Showing
3 changed files
with
50 additions
and
10 deletions
| ... | ... | @@ -15,7 +15,8 @@ |
| 15 | 15 | <img v-if="logoPic" :src="logoPic" /> |
| 16 | 16 | <div v-else> |
| 17 | 17 | <div style="margin-top: 1.875rem"> |
| 18 | - <PlusOutlined style="font-size: 2.5rem" /> | |
| 18 | + <LoadingOutlined v-if="loading" /> | |
| 19 | + <PlusOutlined v-else style="font-size: 2.5rem" /> | |
| 19 | 20 | </div> |
| 20 | 21 | <div |
| 21 | 22 | class="ant-upload-text flex" |
| ... | ... | @@ -38,7 +39,8 @@ |
| 38 | 39 | <img v-if="bgPic" :src="bgPic" alt="avatar" /> |
| 39 | 40 | <div v-else> |
| 40 | 41 | <div style="margin-top: 1.875rem"> |
| 41 | - <PlusOutlined style="font-size: 2.5rem" /> | |
| 42 | + <LoadingOutlined v-if="loading1" /> | |
| 43 | + <PlusOutlined v-else style="font-size: 2.5rem" /> | |
| 42 | 44 | </div> |
| 43 | 45 | <div |
| 44 | 46 | class="ant-upload-text flex" |
| ... | ... | @@ -93,7 +95,7 @@ |
| 93 | 95 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 94 | 96 | import { Loading } from '/@/components/Loading/index'; |
| 95 | 97 | import { Card, Upload, Input, Modal } from 'ant-design-vue'; |
| 96 | - import { PlusOutlined } from '@ant-design/icons-vue'; | |
| 98 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; | |
| 97 | 99 | import { schemas } from '../config/AppDraw.config'; |
| 98 | 100 | import { FileItem, FileInfo } from '../types/index'; |
| 99 | 101 | import { logoUpload, bgUpload } from '/@/api/oem/index'; |
| ... | ... | @@ -111,8 +113,11 @@ |
| 111 | 113 | Input, |
| 112 | 114 | Modal, |
| 113 | 115 | Authority, |
| 116 | + LoadingOutlined, | |
| 114 | 117 | }, |
| 115 | 118 | setup() { |
| 119 | + const loading = ref(false); | |
| 120 | + const loading1 = ref(false); | |
| 116 | 121 | const compState = ref({ |
| 117 | 122 | absolute: false, |
| 118 | 123 | loading: false, |
| ... | ... | @@ -153,11 +158,14 @@ |
| 153 | 158 | const logoPic = ref(); |
| 154 | 159 | async function customUploadLogoPic({ file }) { |
| 155 | 160 | if (beforeUploadLogoPic(file)) { |
| 161 | + logoPic.value = ''; | |
| 162 | + loading.value = true; | |
| 156 | 163 | const formData = new FormData(); |
| 157 | 164 | formData.append('file', file); |
| 158 | 165 | const response = await logoUpload(formData); |
| 159 | 166 | if (response.fileStaticUri) { |
| 160 | 167 | logoPic.value = response.fileStaticUri; |
| 168 | + loading.value = false; | |
| 161 | 169 | } |
| 162 | 170 | } |
| 163 | 171 | } |
| ... | ... | @@ -177,11 +185,14 @@ |
| 177 | 185 | const bgPic = ref(); |
| 178 | 186 | async function customUploadBgPic({ file }) { |
| 179 | 187 | if (beforeUploadBgPic(file)) { |
| 188 | + bgPic.value = ''; | |
| 189 | + loading1.value = true; | |
| 180 | 190 | const formData = new FormData(); |
| 181 | 191 | formData.append('file', file); |
| 182 | 192 | const response = await bgUpload(formData); |
| 183 | 193 | if (response.fileStaticUri) { |
| 184 | 194 | bgPic.value = response.fileStaticUri; |
| 195 | + loading1.value = false; | |
| 185 | 196 | } |
| 186 | 197 | } |
| 187 | 198 | } |
| ... | ... | @@ -202,7 +213,6 @@ |
| 202 | 213 | if (beforeUploadHomeSwiper(file)) { |
| 203 | 214 | const formData = new FormData(); |
| 204 | 215 | formData.append('file', file); |
| 205 | - | |
| 206 | 216 | const response = await bgUpload(formData); |
| 207 | 217 | if (response.fileStaticUri) { |
| 208 | 218 | fileList.value.push({ |
| ... | ... | @@ -294,6 +304,8 @@ |
| 294 | 304 | bgPic, |
| 295 | 305 | previewVisible, |
| 296 | 306 | previewImage, |
| 307 | + loading, | |
| 308 | + loading1, | |
| 297 | 309 | }; |
| 298 | 310 | }, |
| 299 | 311 | }); | ... | ... |
| ... | ... | @@ -14,7 +14,8 @@ |
| 14 | 14 | <img v-if="logoPic" :src="logoPic" /> |
| 15 | 15 | <div v-else> |
| 16 | 16 | <div style="margin-top: 1.875rem"> |
| 17 | - <PlusOutlined style="font-size: 2.5rem" /> | |
| 17 | + <LoadingOutlined v-if="loading" /> | |
| 18 | + <PlusOutlined v-else style="font-size: 2.5rem" /> | |
| 18 | 19 | </div> |
| 19 | 20 | <div |
| 20 | 21 | class="ant-upload-text flex" |
| ... | ... | @@ -40,7 +41,8 @@ |
| 40 | 41 | </div> |
| 41 | 42 | <div v-else> |
| 42 | 43 | <div style="margin-top: 20px"> |
| 43 | - <PlusOutlined style="font-size: 30px" /> | |
| 44 | + <LoadingOutlined v-if="loading1" /> | |
| 45 | + <PlusOutlined v-else style="font-size: 30px" /> | |
| 44 | 46 | </div> |
| 45 | 47 | <div |
| 46 | 48 | class="ant-upload-text flex" |
| ... | ... | @@ -63,7 +65,8 @@ |
| 63 | 65 | <img v-if="bgPic" :src="bgPic" alt="avatar" /> |
| 64 | 66 | <div v-else> |
| 65 | 67 | <div style="margin-top: 1.875rem"> |
| 66 | - <PlusOutlined style="font-size: 2.5rem" /> | |
| 68 | + <LoadingOutlined v-if="loading2" /> | |
| 69 | + <PlusOutlined v-else style="font-size: 2.5rem" /> | |
| 67 | 70 | </div> |
| 68 | 71 | <div |
| 69 | 72 | class="ant-upload-text flex" |
| ... | ... | @@ -98,7 +101,7 @@ |
| 98 | 101 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 99 | 102 | import type { FileItem } from '/@/components/Upload/src/typing'; |
| 100 | 103 | import { logoUpload, iconUpload, bgUpload, getPlatForm, updatePlatForm } from '/@/api/oem/index'; |
| 101 | - import { PlusOutlined } from '@ant-design/icons-vue'; | |
| 104 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; | |
| 102 | 105 | import { useUserStore } from '/@/store/modules/user'; |
| 103 | 106 | import { createLocalStorage } from '/@/utils/cache/index'; |
| 104 | 107 | import { Authority } from '/@/components/Authority'; |
| ... | ... | @@ -112,8 +115,12 @@ |
| 112 | 115 | Input, |
| 113 | 116 | PlusOutlined, |
| 114 | 117 | Authority, |
| 118 | + LoadingOutlined, | |
| 115 | 119 | }, |
| 116 | 120 | setup() { |
| 121 | + const loading = ref(false); | |
| 122 | + const loading1 = ref(false); | |
| 123 | + const loading2= ref(false); | |
| 117 | 124 | const compState = ref({ |
| 118 | 125 | absolute: false, |
| 119 | 126 | loading: false, |
| ... | ... | @@ -138,11 +145,14 @@ |
| 138 | 145 | // logo图片上传 |
| 139 | 146 | async function customUploadLogoPic({ file }) { |
| 140 | 147 | if (beforeUploadLogoPic(file)) { |
| 148 | + logoPic.value = ''; | |
| 149 | + loading.value = true; | |
| 141 | 150 | const formData = new FormData(); |
| 142 | 151 | formData.append('file', file); |
| 143 | 152 | const response = await logoUpload(formData); |
| 144 | 153 | if (response.fileStaticUri) { |
| 145 | 154 | logoPic.value = response.fileStaticUri; |
| 155 | + loading.value = false; | |
| 146 | 156 | } |
| 147 | 157 | } |
| 148 | 158 | } |
| ... | ... | @@ -160,11 +170,14 @@ |
| 160 | 170 | // Icon上传 |
| 161 | 171 | async function customUploadIconPic({ file }) { |
| 162 | 172 | if (beforeUploadIconPic(file)) { |
| 173 | + iconPic.value = ''; | |
| 174 | + loading1.value = true; | |
| 163 | 175 | const formData = new FormData(); |
| 164 | 176 | formData.append('file', file); |
| 165 | 177 | const response = await iconUpload(formData); |
| 166 | 178 | if (response.fileStaticUri) { |
| 167 | 179 | iconPic.value = response.fileStaticUri; |
| 180 | + loading1.value = false; | |
| 168 | 181 | } |
| 169 | 182 | } |
| 170 | 183 | } |
| ... | ... | @@ -182,11 +195,14 @@ |
| 182 | 195 | // 登录页背景上传 |
| 183 | 196 | async function customUploadBgPic({ file }) { |
| 184 | 197 | if (beforeUploadBgPic(file)) { |
| 198 | + bgPic.value = ''; | |
| 199 | + loading2.value = true; | |
| 185 | 200 | const formData = new FormData(); |
| 186 | 201 | formData.append('file', file); |
| 187 | 202 | const response = await bgUpload(formData); |
| 188 | 203 | if (response.fileStaticUri) { |
| 189 | 204 | bgPic.value = response.fileStaticUri; |
| 205 | + loading2.value = false; | |
| 190 | 206 | } |
| 191 | 207 | } |
| 192 | 208 | } |
| ... | ... | @@ -250,6 +266,9 @@ |
| 250 | 266 | beforeUploadBgPic, |
| 251 | 267 | compState, |
| 252 | 268 | handleUpdateInfo, |
| 269 | + loading, | |
| 270 | + loading1, | |
| 271 | + loading2, | |
| 253 | 272 | }; |
| 254 | 273 | }, |
| 255 | 274 | }); | ... | ... |
| ... | ... | @@ -14,7 +14,8 @@ |
| 14 | 14 | <img v-if="qrcodePic" :src="qrcodePic" alt="avatar" /> |
| 15 | 15 | <div v-else> |
| 16 | 16 | <div style="margin-top: 1.875rem"> |
| 17 | - <PlusOutlined style="font-size: 2.5rem" /> | |
| 17 | + <LoadingOutlined v-if="loading" /> | |
| 18 | + <PlusOutlined v-else style="font-size: 2.5rem" /> | |
| 18 | 19 | </div> |
| 19 | 20 | <div |
| 20 | 21 | class="ant-upload-text flex" |
| ... | ... | @@ -47,7 +48,7 @@ |
| 47 | 48 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 48 | 49 | import { useUserStore } from '/@/store/modules/user'; |
| 49 | 50 | import { createLocalStorage } from '/@/utils/cache'; |
| 50 | - import { PlusOutlined } from '@ant-design/icons-vue'; | |
| 51 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; | |
| 51 | 52 | import { qrcodeUpload } from '/@/api/oem/index'; |
| 52 | 53 | import type { FileItem } from '/@/components/Upload/src/typing'; |
| 53 | 54 | import type { CityItem, Code } from '../types'; |
| ... | ... | @@ -61,8 +62,10 @@ |
| 61 | 62 | Upload, |
| 62 | 63 | PlusOutlined, |
| 63 | 64 | Authority, |
| 65 | + LoadingOutlined, | |
| 64 | 66 | }, |
| 65 | 67 | setup() { |
| 68 | + const loading = ref(false); | |
| 66 | 69 | const compState = ref({ |
| 67 | 70 | absolute: false, |
| 68 | 71 | loading: false, |
| ... | ... | @@ -98,11 +101,14 @@ |
| 98 | 101 | const customUploadqrcodePic = async ({ file }) => { |
| 99 | 102 | clearValidate('qrcode'); |
| 100 | 103 | if (beforeUploadqrcodePic(file)) { |
| 104 | + qrcodePic.value = ''; | |
| 105 | + loading.value = true; | |
| 101 | 106 | const formData = new FormData(); |
| 102 | 107 | formData.append('file', file); |
| 103 | 108 | const response = await qrcodeUpload(formData); |
| 104 | 109 | if (response.fileStaticUri) { |
| 105 | 110 | qrcodePic.value = response.fileStaticUri; |
| 111 | + loading.value = false; | |
| 106 | 112 | } |
| 107 | 113 | } |
| 108 | 114 | }; |
| ... | ... | @@ -132,6 +138,8 @@ |
| 132 | 138 | delete newFieldValue.nameCoun; |
| 133 | 139 | delete newFieldValue.nameTown; |
| 134 | 140 | |
| 141 | + console.log(newFieldValue.qrCode); | |
| 142 | + console.log(newFieldValue.codeTown); | |
| 135 | 143 | // 表单校验 |
| 136 | 144 | const values = await validate([ |
| 137 | 145 | 'name', |
| ... | ... | @@ -332,6 +340,7 @@ |
| 332 | 340 | customUploadqrcodePic, |
| 333 | 341 | beforeUploadqrcodePic, |
| 334 | 342 | registerCustomForm, |
| 343 | + loading, | |
| 335 | 344 | }; |
| 336 | 345 | }, |
| 337 | 346 | }); | ... | ... |