Commit c6e41920ecb95f72668cd4e50ba0a19c562a796e
1 parent
b0015d21
Exists in
master
feat:相册修改
Showing
1 changed file
with
0 additions
and
80 deletions
Show diff stats
src/views/GrowUp/MyAlbum.vue
| ... | ... | @@ -18,24 +18,6 @@ |
| 18 | 18 | </div> |
| 19 | 19 | </van-list> |
| 20 | 20 | </div> |
| 21 | - <!-- <div class="control_panel"> | |
| 22 | - <p class="control_btn" @click="controlStatus = 'control'" v-if="controlStatus == 'default'">管理相册({{ spaceSize }}/2G)</p> | |
| 23 | - <div class="control_box" v-if="controlStatus == 'control'"> | |
| 24 | - <van-uploader multiple :after-read="afterRead"> | |
| 25 | - <div class="btn add"> | |
| 26 | - <van-icon class="icon" name="add-o" /> | |
| 27 | - <p class="text">添加</p> | |
| 28 | - </div> | |
| 29 | - </van-uploader> | |
| 30 | - <div class="btn del" @click="controlStatus = 'del'"> | |
| 31 | - <van-icon class="icon" name="delete-o" /> | |
| 32 | - <p class="text">删除</p> | |
| 33 | - </div> | |
| 34 | - <van-button class="blue_btn" type="info" round color="#3074FF" @click="controlStatus = 'default'">完成</van-button> | |
| 35 | - </div> | |
| 36 | - <p class="cancel_btn" @click="controlStatus = 'control'" v-if="controlStatus == 'del'">取消</p> | |
| 37 | - <p class="del_btn" @click="handleDel" v-if="controlStatus == 'del'">删除相片</p> | |
| 38 | - </div> --> | |
| 39 | 21 | <van-image-preview v-model="showPreview" :images="previewArr" :start-position="startPosition" @change="previewChange"> |
| 40 | 22 | </van-image-preview> |
| 41 | 23 | </div> |
| ... | ... | @@ -221,68 +203,6 @@ export default { |
| 221 | 203 | this.getUserAlbum() |
| 222 | 204 | this.getUserSpaceSize() |
| 223 | 205 | }, |
| 224 | - // 读取到文件后 | |
| 225 | - afterRead(file) { | |
| 226 | - if (Array.isArray(file)) { | |
| 227 | - this.fileUpload(file, 0) | |
| 228 | - } else { | |
| 229 | - this.fileUpload([file], 0) | |
| 230 | - } | |
| 231 | - }, | |
| 232 | - // 上传照片到文件服务器 | |
| 233 | - fileUpload(files, index) { | |
| 234 | - this.$toast.loading({ | |
| 235 | - message: `上传中 ${index + 1}/${files.length}...`, | |
| 236 | - duration: 0, | |
| 237 | - forbidClick: true, | |
| 238 | - }) | |
| 239 | - let size = files[index].file.size | |
| 240 | - let params = new FormData() | |
| 241 | - params.append('file', files[index].file, files[index].file.name) | |
| 242 | - let config = { | |
| 243 | - headers: { | |
| 244 | - //添加请求头 | |
| 245 | - 'Content-Type': 'multipart/form-data', | |
| 246 | - }, | |
| 247 | - } | |
| 248 | - Axios.post('https://market.myjxt.com:51311/file/fileUpload', params, config).then((res) => { | |
| 249 | - this.$toast.clear() | |
| 250 | - if (res?.status == 200) { | |
| 251 | - this.uploadImgList.push({ path: res.data, imgSize: size }) | |
| 252 | - } else { | |
| 253 | - this.$toast(`照片${index + 1}上传失败,自动忽略`) | |
| 254 | - } | |
| 255 | - if (index + 1 < files.length) { | |
| 256 | - this.fileUpload(files, index + 1) | |
| 257 | - } else { | |
| 258 | - // 照片全部上传完成,统一上传到服务器 | |
| 259 | - this.uploadUserAlbum() | |
| 260 | - } | |
| 261 | - }) | |
| 262 | - }, | |
| 263 | - // 上传照片 | |
| 264 | - uploadUserAlbum() { | |
| 265 | - this.$toast.loading({ | |
| 266 | - message: `同步照片到我的相册...`, | |
| 267 | - duration: 0, | |
| 268 | - forbidClick: true, | |
| 269 | - }) | |
| 270 | - this.http | |
| 271 | - .uploadUserAlbum({ | |
| 272 | - centerNo: this.userInfo.centerNo, | |
| 273 | - imgList: this.uploadImgList, | |
| 274 | - }) | |
| 275 | - .then((res) => { | |
| 276 | - this.$toast.clear() | |
| 277 | - if (res.code == 200) { | |
| 278 | - this.$toast('同步完成') | |
| 279 | - this.uploadImgList = [] | |
| 280 | - this.pageReload() //上传完成后页面重新加载 | |
| 281 | - } else { | |
| 282 | - this.$toast(res.message) | |
| 283 | - } | |
| 284 | - }) | |
| 285 | - }, | |
| 286 | 206 | }, |
| 287 | 207 | } |
| 288 | 208 | </script> | ... | ... |