Commit 3143dafabf7a7775ef58be62b86ec09789c88c80

Authored by fengtao
1 parent 620c62bb

pref:优化个人资料上传头像显示加载状态

... ... @@ -42,8 +42,9 @@
42 42 alt="avatar"
43 43 />
44 44 <div v-else>
45   - <div style="">
46   - <PlusOutlined style="font-size: 30px" />
  45 + <div>
  46 + <LoadingOutlined style="font-size: 30px" v-if="loading" />
  47 + <PlusOutlined v-else style="font-size: 30px" />
47 48 </div>
48 49 </div>
49 50 </Upload>
... ... @@ -92,6 +93,7 @@
92 93 import { PlusOutlined } from '@ant-design/icons-vue';
93 94 import { useUserStore } from '/@/store/modules/user';
94 95 import type { FileItem } from '/@/components/Upload/src/typing';
  96 + import { LoadingOutlined } from '@ant-design/icons-vue';
95 97
96 98 const schema: DescItem[] = [
97 99 {
... ... @@ -121,9 +123,10 @@
121 123 ];
122 124 export default defineComponent({
123 125 name: 'Index',
124   - components: { BasicModal, BasicForm, Description, Upload, PlusOutlined },
  126 + components: { BasicModal, BasicForm, Description, Upload, PlusOutlined, LoadingOutlined },
125 127 emits: ['refreshPersonl', 'register'],
126 128 setup(_, { emit }) {
  129 + const loading = ref(false);
127 130 const userInfo = getAuthCache(USER_INFO_KEY);
128 131 const { createMessage } = useMessage();
129 132 const getPersonalValue: any = ref({});
... ... @@ -143,11 +146,14 @@
143 146
144 147 const customUploadqrcodePic = async ({ file }) => {
145 148 if (beforeUploadqrcodePic(file)) {
  149 + peresonalPic.value = '';
  150 + loading.value = true;
146 151 const formData = new FormData();
147 152 formData.append('file', file);
148 153 const response = await uploadApi(formData);
149 154 if (response.fileStaticUri) {
150 155 peresonalPic.value = response.fileStaticUri;
  156 + loading.value = false;
151 157 }
152 158 }
153 159 };
... ... @@ -240,6 +246,7 @@
240 246 schema,
241 247 registerModal,
242 248 registerForm,
  249 + loading,
243 250 };
244 251 },
245 252 });
... ...