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