diff --git a/src/views/system/config/components/BasicSetting.vue b/src/views/system/config/components/BasicSetting.vue index 98efd72..395025f 100644 --- a/src/views/system/config/components/BasicSetting.vue +++ b/src/views/system/config/components/BasicSetting.vue @@ -1,100 +1,94 @@ @@ -114,6 +108,7 @@ import { useForm } from '@/hooks' defineOptions({ name: 'BasicSetting' }) +const loading = ref(false) const formRef = ref() const { form } = useForm({ SITE_FAVICON: '', @@ -162,12 +157,14 @@ const queryForm = reactive({ }) // 查询列表数据 const getDataList = async () => { + loading.value = true const { data } = await listOption(queryForm) siteConfig.value = data.reduce((obj: SiteConfig, option: OptionResp) => { obj[option.code] = { ...option } return obj }, {}) handleCancel() + loading.value = false } const appStore = useAppStore() @@ -206,20 +203,20 @@ const onResetValue = () => { const handleUploadFavicon = (options: RequestOption) => { const controller = new AbortController() ; (async function requestWrap() { - const { onProgress, onError, onSuccess, fileItem, name = 'file' } = options - onProgress(20) - const formData = new FormData() - formData.append(name as string, fileItem.file as Blob) - uploadFile(formData) - .then((res) => { - onSuccess(res) - form.SITE_FAVICON = res.data.url - Message.success('上传成功') - }) - .catch((error) => { - onError(error) - }) - })() + const { onProgress, onError, onSuccess, fileItem, name = 'file' } = options + onProgress(20) + const formData = new FormData() + formData.append(name as string, fileItem.file as Blob) + uploadFile(formData) + .then((res) => { + onSuccess(res) + form.SITE_FAVICON = res.data.url + Message.success('上传成功') + }) + .catch((error) => { + onError(error) + }) + })() return { abort() { controller.abort() @@ -236,20 +233,20 @@ const handleChangeFavicon = (_: any, currentFile: any) => { const handleUploadLogo = (options: RequestOption) => { const controller = new AbortController() ; (async function requestWrap() { - const { onProgress, onError, onSuccess, fileItem, name = 'file' } = options - onProgress(20) - const formData = new FormData() - formData.append(name as string, fileItem.file as Blob) - uploadFile(formData) - .then((res) => { - onSuccess(res) - form.SITE_LOGO = res.data.url - Message.success('上传成功') - }) - .catch((error) => { - onError(error) - }) - })() + const { onProgress, onError, onSuccess, fileItem, name = 'file' } = options + onProgress(20) + const formData = new FormData() + formData.append(name as string, fileItem.file as Blob) + uploadFile(formData) + .then((res) => { + onSuccess(res) + form.SITE_LOGO = res.data.url + Message.success('上传成功') + }) + .catch((error) => { + onError(error) + }) + })() return { abort() { controller.abort() @@ -268,6 +265,10 @@ onMounted(() => {