名称修改
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填,最多三张)</text></view>
|
||||
<u-upload
|
||||
:fileList="selectedImages"
|
||||
@on-list-change="onListChange"
|
||||
@delete="deletePic"
|
||||
name="upload"
|
||||
multiple
|
||||
@@ -84,18 +85,31 @@ export default {
|
||||
deletePic(event) {
|
||||
this.selectedImages.splice(event.index, 1);
|
||||
},
|
||||
|
||||
// 图片列表变化处理
|
||||
onListChange(list) {
|
||||
this.selectedImages = list;
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if(!this.repairInfo.location) {
|
||||
toast('请先填写地址')
|
||||
return
|
||||
}
|
||||
|
||||
if(this.selectedImages.length<=0){
|
||||
this.realSubmit()
|
||||
return
|
||||
}
|
||||
console.log("t1",this.selectedImages)
|
||||
const images = this.selectedImages
|
||||
.map(item => item?.path?.replace('file://', '') || item?.url || null)
|
||||
.filter(path => path !== null);
|
||||
if (images.length === 0) {
|
||||
this.realSubmit();
|
||||
return;
|
||||
}
|
||||
// 遍历selectedImages数组并处理图片路径
|
||||
const images = this.selectedImages.map(item => item.path.replace('file://', ''));
|
||||
|
||||
const result = await uploadFiles({
|
||||
files: images,
|
||||
url: this.vuex_config.baseUrl + '/resource/oss/upload',
|
||||
@@ -103,12 +117,12 @@ export default {
|
||||
vm: this // 关键:用于注入 token 等
|
||||
});
|
||||
|
||||
if (result.code == '200') {
|
||||
|
||||
// 遍历result获取data.url加上,分割
|
||||
const urls = result.map(item => item.data?.url || '').filter(url => url !== '');
|
||||
this.repairInfo.orderImgUrl = urls.join(',');
|
||||
this.realSubmit()
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
async realSubmit(){
|
||||
|
Reference in New Issue
Block a user