update
This commit is contained in:
@@ -4,10 +4,14 @@ import {Message, Notification} from "@arco-design/web-vue";
|
||||
import Api from "../../api/index.js";
|
||||
|
||||
const verificationCode = defineModel('verificationCode', {type: String});
|
||||
const {mobile} = defineProps({
|
||||
const {mobile, api} = defineProps({
|
||||
mobile: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
api: {
|
||||
type: Function,
|
||||
default: Api.admin.sendSms
|
||||
}
|
||||
});
|
||||
|
||||
@@ -17,7 +21,7 @@ let timer = null;
|
||||
const verifyPhone = async () => {
|
||||
if (/^1[3-9]\d{9}$/.test(mobile)) {
|
||||
if (timer === null) {
|
||||
const {msg, code} = await Api.admin.sendSms(mobile);
|
||||
const {msg, code} = await api(mobile);
|
||||
if (code === 1) Message.success(msg);
|
||||
time.value = 10;
|
||||
timer = setInterval(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import {onMounted, reactive} from "vue";
|
||||
import {reactive} from "vue";
|
||||
|
||||
const {api, fieldName, apiPo} = defineProps({
|
||||
api: {
|
||||
@@ -19,12 +19,14 @@ const {api, fieldName, apiPo} = defineProps({
|
||||
});
|
||||
const list = reactive([]);
|
||||
|
||||
onMounted(() => {
|
||||
api && api(apiPo).then(({data}) => {
|
||||
list.length = 0;
|
||||
list.push(...data);
|
||||
});
|
||||
});
|
||||
const popupChange = async (visible) => {
|
||||
if (visible) {
|
||||
api && api(apiPo).then(({data}) => {
|
||||
list.length = 0;
|
||||
list.push(...data);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -32,6 +34,7 @@ onMounted(() => {
|
||||
v-bind="$attrs"
|
||||
:options="list"
|
||||
:field-names="fieldName"
|
||||
@popup-visible-change="popupChange"
|
||||
placeholder="请选择">
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
26
src/components/XTimePicker/XTimePicker.vue
Normal file
26
src/components/XTimePicker/XTimePicker.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<script setup>
|
||||
import {computed} from 'vue';
|
||||
|
||||
const start = defineModel('start');
|
||||
const end = defineModel('end');
|
||||
|
||||
const value = computed({
|
||||
get: () => [start.value, end.value],
|
||||
set: (val) => {
|
||||
start.value = val[0];
|
||||
end.value = val[1];
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-time-picker
|
||||
v-model:model-value="value"
|
||||
v-bind="$attrs"
|
||||
type="time-range">
|
||||
</a-time-picker>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -1,17 +1,21 @@
|
||||
<script setup>
|
||||
import Api from "../../api/index.js";
|
||||
|
||||
const {size} = defineProps({
|
||||
const {size, api} = defineProps({
|
||||
size: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
api: {
|
||||
type: Function,
|
||||
default: Api.system.uploadFile,
|
||||
}
|
||||
});
|
||||
const emits = defineEmits(['success']);
|
||||
const files = defineModel('file');
|
||||
|
||||
const beforeUpload = (file) => {
|
||||
Api.system.uploadFile(file).then(({data}) => {
|
||||
api(file).then(({data}) => {
|
||||
files.value = data;
|
||||
emits('success', file);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user