|
|
|
@ -41,6 +41,9 @@ Page({ |
|
|
|
imagePreview: false, |
|
|
|
imagePreview: false, |
|
|
|
previewImageSrc: '', |
|
|
|
previewImageSrc: '', |
|
|
|
currentPhotoAngle: '', |
|
|
|
currentPhotoAngle: '', |
|
|
|
|
|
|
|
previewImages: [] as string[], |
|
|
|
|
|
|
|
previewAngles: [] as string[], |
|
|
|
|
|
|
|
previewCurrentIndex: 0, |
|
|
|
|
|
|
|
|
|
|
|
recordId: '', |
|
|
|
recordId: '', |
|
|
|
// 表单数据
|
|
|
|
// 表单数据
|
|
|
|
@ -377,10 +380,30 @@ Page({ |
|
|
|
const { angle } = e.currentTarget.dataset |
|
|
|
const { angle } = e.currentTarget.dataset |
|
|
|
const photo = this.data.photoMap[angle] |
|
|
|
const photo = this.data.photoMap[angle] |
|
|
|
if (photo) { |
|
|
|
if (photo) { |
|
|
|
|
|
|
|
// 构建已上传图片列表(按 cameraList 顺序)
|
|
|
|
|
|
|
|
const allAngles = [ |
|
|
|
|
|
|
|
...this.data.cameraList.frontend, |
|
|
|
|
|
|
|
...this.data.cameraList.backend, |
|
|
|
|
|
|
|
...this.data.cameraList.other, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
const previewAngles: string[] = [] |
|
|
|
|
|
|
|
const previewImages: string[] = [] |
|
|
|
|
|
|
|
allAngles.forEach((item) => { |
|
|
|
|
|
|
|
const p = this.data.photoMap[item.angle] |
|
|
|
|
|
|
|
if (p) { |
|
|
|
|
|
|
|
previewAngles.push(item.angle) |
|
|
|
|
|
|
|
previewImages.push(p.photoUrl) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const currentIndex = previewAngles.indexOf(angle) |
|
|
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
imagePreview: true, |
|
|
|
imagePreview: true, |
|
|
|
previewImageSrc: photo.photoUrl, |
|
|
|
previewImageSrc: photo.photoUrl, |
|
|
|
currentPhotoAngle: angle, |
|
|
|
currentPhotoAngle: angle, |
|
|
|
|
|
|
|
previewImages, |
|
|
|
|
|
|
|
previewAngles, |
|
|
|
|
|
|
|
previewCurrentIndex: currentIndex >= 0 ? currentIndex : 0, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -392,6 +415,18 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 预览图片切换
|
|
|
|
|
|
|
|
handleImageChange(e: any) { |
|
|
|
|
|
|
|
const { index } = e.detail |
|
|
|
|
|
|
|
const angle = this.data.previewAngles[index] |
|
|
|
|
|
|
|
if (angle) { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
currentPhotoAngle: angle, |
|
|
|
|
|
|
|
previewCurrentIndex: index, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 重新拍摄
|
|
|
|
// 重新拍摄
|
|
|
|
handleImageRetake() { |
|
|
|
handleImageRetake() { |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
|