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