Showing
1 changed file
with
10 additions
and
2 deletions
@@ -19,7 +19,8 @@ | @@ -19,7 +19,8 @@ | ||
19 | > | 19 | > |
20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> | 20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> |
21 | <div v-else> | 21 | <div v-else> |
22 | - <plus-outlined /> | 22 | + <loading-outlined v-if="loading"></loading-outlined> |
23 | + <plus-outlined v-else /> | ||
23 | <div class="ant-upload-text">上传</div> | 24 | <div class="ant-upload-text">上传</div> |
24 | </div> | 25 | </div> |
25 | </Upload> | 26 | </Upload> |
@@ -31,7 +32,7 @@ | @@ -31,7 +32,7 @@ | ||
31 | import { defineComponent, ref, computed, unref } from 'vue'; | 32 | import { defineComponent, ref, computed, unref } from 'vue'; |
32 | import { BasicForm, useForm } from '/@/components/Form/index'; | 33 | import { BasicForm, useForm } from '/@/components/Form/index'; |
33 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 34 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
34 | - import { PlusOutlined } from '@ant-design/icons-vue'; | 35 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
35 | import { message, Upload } from 'ant-design-vue'; | 36 | import { message, Upload } from 'ant-design-vue'; |
36 | 37 | ||
37 | import { useI18n } from '/@/hooks/web/useI18n'; | 38 | import { useI18n } from '/@/hooks/web/useI18n'; |
@@ -47,19 +48,25 @@ | @@ -47,19 +48,25 @@ | ||
47 | BasicForm, | 48 | BasicForm, |
48 | Upload, | 49 | Upload, |
49 | PlusOutlined, | 50 | PlusOutlined, |
51 | + LoadingOutlined, | ||
50 | }, | 52 | }, |
51 | emits: ['success', 'register'], | 53 | emits: ['success', 'register'], |
52 | setup(_, { emit }) { | 54 | setup(_, { emit }) { |
55 | + const loading = ref(false); | ||
56 | + | ||
53 | const isUpdate = ref(true); | 57 | const isUpdate = ref(true); |
54 | const tenantLogo = ref(''); | 58 | const tenantLogo = ref(''); |
55 | 59 | ||
56 | async function customUpload({ file }) { | 60 | async function customUpload({ file }) { |
57 | if (beforeUpload(file)) { | 61 | if (beforeUpload(file)) { |
62 | + loading.value = true; | ||
63 | + | ||
58 | const formData = new FormData(); | 64 | const formData = new FormData(); |
59 | formData.append('file', file); | 65 | formData.append('file', file); |
60 | const response = await upload(formData); | 66 | const response = await upload(formData); |
61 | if (response.fileStaticUri) { | 67 | if (response.fileStaticUri) { |
62 | tenantLogo.value = response.fileStaticUri; | 68 | tenantLogo.value = response.fileStaticUri; |
69 | + loading.value = false; | ||
63 | } | 70 | } |
64 | } | 71 | } |
65 | } | 72 | } |
@@ -158,6 +165,7 @@ | @@ -158,6 +165,7 @@ | ||
158 | tenantLogo, | 165 | tenantLogo, |
159 | beforeUpload, | 166 | beforeUpload, |
160 | customUpload, | 167 | customUpload, |
168 | + loading, | ||
161 | }; | 169 | }; |
162 | }, | 170 | }, |
163 | }); | 171 | }); |