mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-13 14:13:47 +08:00
smart-app alpha 版本
This commit is contained in:
55
smart-app/src/components/dict-select/index.vue
Normal file
55
smart-app/src/components/dict-select/index.vue
Normal file
@@ -0,0 +1,55 @@
|
||||
<!---
|
||||
* 字段 下拉选择框
|
||||
*
|
||||
* @Author: 1024创新实验室:罗伊
|
||||
* @Date: 2022-09-12 22:06:45
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<uni-data-select :localdata="dictValueList" v-model="selectValue" :placeholder="props.placeholder" :clear="true" @change="onChange" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { dictApi } from '/@/api/support/dict-api';
|
||||
|
||||
const props = defineProps({
|
||||
keyCode: String,
|
||||
modelValue: [String],
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择',
|
||||
},
|
||||
});
|
||||
|
||||
// -------------------------- 查询 字典数据 --------------------------
|
||||
|
||||
const dictValueList = ref([]);
|
||||
async function queryDict() {
|
||||
let res = await dictApi.valueList(props.keyCode);
|
||||
dictValueList.value = res.data.map((e) => Object.assign({}, { text: e.valueName, value: e.valueCode }));
|
||||
}
|
||||
onMounted(queryDict);
|
||||
|
||||
// -------------------------- 选中 相关、事件 --------------------------
|
||||
|
||||
const selectValue = ref(props.modelValue);
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(value) => {
|
||||
selectValue.value = value;
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
function onChange(selectValue) {
|
||||
let find = dictValueList.value.filter((e) => e.value === selectValue)[0];
|
||||
emit('update:modelValue', find.value);
|
||||
emit('change', find.value, find.text);
|
||||
}
|
||||
</script>
|
||||
70
smart-app/src/components/smart-card/index.vue
Normal file
70
smart-app/src/components/smart-card/index.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<view class="card">
|
||||
<view class="card-header">
|
||||
<slot name="title">
|
||||
<view class="card-title">
|
||||
{{ title }}
|
||||
</view>
|
||||
</slot>
|
||||
<slot v-if="isExtra" name="extra" @click="extra">
|
||||
<view class="card-extra">
|
||||
查看更多>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view class="card-content">
|
||||
<slot name="content"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
//标题
|
||||
title:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
//是否展示Extra
|
||||
isExtra:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['extra'])
|
||||
const extra = ()=>{
|
||||
emits('extra')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card{
|
||||
width: 700rpx;
|
||||
margin: 0 auto 20rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
.card-header{
|
||||
height: 76rpx;
|
||||
background: linear-gradient(180deg,#e8f4ff, #f8fcff);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
align-items: center;
|
||||
.card-title{
|
||||
font-size: 32rpx;
|
||||
font-family: PingFang SC, PingFang SC-Semibold;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
color: #323333;
|
||||
}
|
||||
.card-extra{
|
||||
cursor: pointer;
|
||||
font-size: 24rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #1a9aff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
42
smart-app/src/components/smart-enum-radio/index.vue
Normal file
42
smart-app/src/components/smart-enum-radio/index.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<!--
|
||||
* 枚举 radio
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-08 20:32:30
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*
|
||||
-->
|
||||
<template>
|
||||
<radio-group @change="handleChange">
|
||||
<label v-for="item in $smartEnumPlugin.getValueDescList(props.enumName)" :key="item.value" class="smart-margin-right10">
|
||||
<radio :value="item.value + ''" :checked="item.value === modelValue">{{ item.desc }}</radio>
|
||||
</label>
|
||||
</radio-group>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
enumName: String,
|
||||
modelValue: [Number, String],
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
const selectValue = ref(props.modelValue);
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newValue) => {
|
||||
selectValue.value = newValue;
|
||||
}
|
||||
);
|
||||
|
||||
function handleChange(e) {
|
||||
emit('update:modelValue', e.detail.value);
|
||||
emit('change', e.detail.value);
|
||||
}
|
||||
</script>
|
||||
49
smart-app/src/components/smart-enum-select/index.vue
Normal file
49
smart-app/src/components/smart-enum-select/index.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<!---
|
||||
* 字段 下拉选择框
|
||||
*
|
||||
* @Author: 1024创新实验室:罗伊
|
||||
* @Date: 2022-09-12 22:06:45
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<uni-data-select :localdata="dataList" v-model="selectValue" :clear="true" @change="onChange" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject, onMounted, ref, watch } from 'vue';
|
||||
|
||||
const smartEnumPlugin = inject('smartEnumPlugin');
|
||||
|
||||
const props = defineProps({
|
||||
enumName: String,
|
||||
modelValue: [Number, String],
|
||||
});
|
||||
|
||||
// -------------------------- 枚举数据列表 --------------------------
|
||||
const dataList = ref([]);
|
||||
function getEnumData() {
|
||||
dataList.value = smartEnumPlugin.getValueDescList(props.enumName).map((e) => Object.assign({}, { text: e.desc, value: e.value }));
|
||||
}
|
||||
onMounted(getEnumData);
|
||||
|
||||
// -------------------------- 选中 相关、事件 --------------------------
|
||||
|
||||
const selectValue = ref(props.modelValue);
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(value) => {
|
||||
selectValue.value = value;
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
function onChange(value) {
|
||||
emit('update:modelValue', value);
|
||||
emit('change', value, smartEnumPlugin.getDescByValue(props.enumName, value));
|
||||
}
|
||||
</script>
|
||||
73
smart-app/src/components/smart-tabs/index.vue
Normal file
73
smart-app/src/components/smart-tabs/index.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<scroll-view class="scroll-view" scroll-x="true" :show-scrollbar="false">
|
||||
<view class="item" :class="active === item.value ? 'active' : ''" v-for="item in tabsList" :key="item.value" @click="change(item.value)">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
default: 'fixed',
|
||||
},
|
||||
tabsList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
});
|
||||
|
||||
const position = ref(props.position);
|
||||
const active = ref(props.modelValue);
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newValue) => {
|
||||
active.value = newValue;
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
const change = (value) => {
|
||||
active.value = value;
|
||||
emit('update:modelValue', value);
|
||||
emit('change', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll-view {
|
||||
position: v-bind(position);
|
||||
background-color: #f4f4f4;
|
||||
z-index: 998;
|
||||
|
||||
:deep(::-webkit-scrollbar) {
|
||||
height: 0 !important;
|
||||
width: 0 !important;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 0 24rpx;
|
||||
height: 72rpx;
|
||||
font-size: 30rpx;
|
||||
color: #777;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
border-radius: 8rpx;
|
||||
line-height: 72rpx;
|
||||
margin: 24rpx 0 24rpx 24rpx;
|
||||
}
|
||||
.active {
|
||||
color: #ffffff;
|
||||
background: #1a9aff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user