Browse Source

Improve diff baseline display and camera UX

- Show baseline date separately with icon badge in diff
  date selection
- Sort photos with baseline first in diff edit
- Add left/right orientation labels on camera guide
- Add tips for eye movement camera angles
- Stop sequential shooting when opening single angle
- Change note list title to patient-specific diary name
dev
kola-web 6 days ago
parent
commit
f2ad084a8f
  1. 9
      src/pages/d_noteDiff/index.scss
  2. 65
      src/pages/d_noteDiff/index.ts
  3. 4
      src/pages/d_noteDiff/index.wxml
  4. 24
      src/pages/d_noteDiffEdit/index.ts
  5. 2
      src/pages/d_noteList/index.wxml
  6. 14
      src/patient/components/camera/index.scss
  7. 18
      src/patient/components/camera/index.ts
  8. 2
      src/patient/components/camera/index.wxml
  9. 74
      src/patient/pages/noteAdd/index.ts
  10. 10
      src/patient/pages/noteDiff/index.scss
  11. 69
      src/patient/pages/noteDiff/index.ts
  12. 17
      src/patient/pages/noteDiff/index.wxml
  13. 26
      src/patient/pages/noteDiffEdit/index.ts

9
src/pages/d_noteDiff/index.scss

@ -80,6 +80,7 @@ page { @@ -80,6 +80,7 @@ page {
gap: 24rpx 22rpx;
.item {
position: relative;
padding: 16rpx;
font-size: 32rpx;
color: #211d2e;
@ -93,6 +94,14 @@ page { @@ -93,6 +94,14 @@ page {
color: #fff;
background: linear-gradient(180deg, #e98ff8 0%, #b073ff 100%);
}
.icon {
position: absolute;
top: -18rpx;
right: 0;
width: 90rpx;
height: 52rpx;
}
}
}
}

65
src/pages/d_noteDiff/index.ts

@ -27,7 +27,7 @@ Page({ @@ -27,7 +27,7 @@ Page({
// 对比角度
photoAngle: '',
photoAngleName: '',
angleList: [] as { key: string, name: string }[],
angleList: [] as { key: string; name: string }[],
angleMap: {} as Record<string, string>,
// 日期选择
@ -48,8 +48,7 @@ Page({ @@ -48,8 +48,7 @@ Page({
})
},
onShow() {
},
onShow() {},
// 获取对比角度列表
getCompareAngle() {
@ -58,9 +57,10 @@ Page({ @@ -58,9 +57,10 @@ Page({
url: '?r=xd/doctor/proptosis/get-compare-angle',
// 兼容后端实际需要 patientId(文档可能漏写)
data: this.data.patientId ? { patientId: this.data.patientId } : {},
}).then((res: any) => {
})
.then((res: any) => {
const angleMap = res.photoAngle || {}
const angleList = Object.keys(angleMap).map(key => ({
const angleList = Object.keys(angleMap).map((key) => ({
key,
name: angleMap[key],
}))
@ -75,7 +75,8 @@ Page({ @@ -75,7 +75,8 @@ Page({
if (this.data.photoAngle) {
this.getCompareDates()
}
}).catch((err) => {
})
.catch((err) => {
console.error('获取对比角度失败:', err)
wx.showToast({ title: '获取对比角度失败', icon: 'none' })
})
@ -83,8 +84,7 @@ Page({ @@ -83,8 +84,7 @@ Page({
// 获取对比可用日期
getCompareDates() {
if (!this.data.photoAngle)
return
if (!this.data.photoAngle) return
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/proptosis/compare-dates',
@ -92,12 +92,31 @@ Page({ @@ -92,12 +92,31 @@ Page({
patientId: this.data.patientId,
photoAngle: this.data.photoAngle,
},
}).then((res: any) => {
})
.then((res: any) => {
const newBaseline = res.baseline || null
const newList = res.nonBaselineList || []
const newRecordIds = newList.map((item: CompareDate) => item.recordId)
if (newBaseline) {
newRecordIds.push(newBaseline.recordId)
}
const selectedDates = this.data.selectedDates.filter((id: string) => newRecordIds.includes(id))
const nonBaselineList = newList.map((item: CompareDate & { isSelected?: boolean }) => ({
...item,
isSelected: selectedDates.includes(item.recordId),
}))
this.setData({
baseline: res.baseline || null,
nonBaselineList: res.nonBaselineList || [],
baseline: newBaseline,
nonBaselineList,
selectedDates,
})
}).catch((err) => {
if (selectedDates.length > 0 || newBaseline) {
this.getComparePhotos()
} else {
this.setData({ comparePhotos: [] })
}
})
.catch((err) => {
console.error('获取对比日期失败:', err)
wx.showToast({ title: '获取对比日期失败', icon: 'none' })
})
@ -110,7 +129,6 @@ Page({ @@ -110,7 +129,6 @@ Page({
this.setData({
photoAngle: angle.key,
photoAngleName: angle.name,
selectedDates: [],
comparePhotos: [],
})
this.getCompareDates()
@ -123,8 +141,12 @@ Page({ @@ -123,8 +141,12 @@ Page({
const index = selectedDates.indexOf(recordId)
if (index > -1) {
selectedDates.splice(index, 1)
} else {
const maxSelect = this.data.baseline ? 5 : 6
if (selectedDates.length >= maxSelect) {
wx.showToast({ title: '最多选择6张对比图', icon: 'none' })
return
}
else {
selectedDates.push(recordId)
}
// 更新列表中的选中状态
@ -140,12 +162,15 @@ Page({ @@ -140,12 +162,15 @@ Page({
// 获取对比照片
getComparePhotos() {
const { photoAngle, selectedDates, baseline } = this.data
if (!photoAngle || selectedDates.length === 0) {
if (!photoAngle) {
this.setData({ comparePhotos: [] })
return
}
// 包含基准照ID
const recordIds = baseline ? [baseline.recordId, ...selectedDates] : selectedDates
if (recordIds.length === 0) {
this.setData({ comparePhotos: [] })
return
}
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/proptosis/compare',
@ -154,7 +179,8 @@ Page({ @@ -154,7 +179,8 @@ Page({
photoAngle,
recordIds: recordIds.join(','),
},
}).then((res: any) => {
})
.then((res: any) => {
const baselineRes = res.baseline
const compareList = res.compareList || []
const merged: ComparePhoto[] = []
@ -183,9 +209,10 @@ Page({ @@ -183,9 +209,10 @@ Page({
})
})
this.setData({
comparePhotos: merged.filter(item => item.photoUrl),
comparePhotos: merged.filter((item) => item.photoUrl).sort((a, b) => b.isBaseline - a.isBaseline),
})
})
}).catch((err) => {
.catch((err) => {
console.error('获取对比照片失败:', err)
wx.showToast({ title: '获取对比照片失败', icon: 'none' })
})

4
src/pages/d_noteDiff/index.wxml

@ -22,6 +22,10 @@ @@ -22,6 +22,10 @@
<view class="form-item">
<view class="title">选择对比日期(可多选)</view>
<view class="multiple">
<view class="item active baseline" wx:if="{{baseline}}">
{{baseline.recordDate}}
<image class="icon" src="{{imageUrl}}icon169.png?t={{Timestamp}}"></image>
</view>
<view
class="item {{item.isSelected ? 'active' : ''}}"
wx:for="{{nonBaselineList}}"

24
src/pages/d_noteDiffEdit/index.ts

@ -50,12 +50,14 @@ Page({ @@ -50,12 +50,14 @@ Page({
data: {
patientId: this.data.patientId,
},
}).then((res: any) => {
})
.then((res: any) => {
const angleMap = res.photoAngle || {}
this.setData({
photoAngleName: angleMap[this.data.photoAngle] || '',
})
}).catch((err) => {
})
.catch((err) => {
console.error('获取角度名称失败:', err)
})
},
@ -77,7 +79,8 @@ Page({ @@ -77,7 +79,8 @@ Page({
photoAngle,
recordIds: recordIds.join(','),
},
}).then((res: any) => {
})
.then((res: any) => {
const baselineRes = res.baseline
const compareList = res.compareList || []
const photos: PhotoItem[] = []
@ -106,10 +109,11 @@ Page({ @@ -106,10 +109,11 @@ Page({
})
})
this.setData({
photos: photos.filter(item => item.photoUrl),
photos: photos.filter((item) => item.photoUrl).sort((a, b) => b.isBaseline - a.isBaseline),
loading: false,
})
}).catch((err) => {
})
.catch((err) => {
console.error('获取对比照片失败:', err)
this.setData({ loading: false })
wx.showToast({ title: '获取照片失败', icon: 'none' })
@ -173,8 +177,9 @@ Page({ @@ -173,8 +177,9 @@ Page({
const mergeComponent = this.selectComponent('#merge')
if (mergeComponent) {
const imageList = photos.map((item) => {
const label = item.isBaseline === 1
? `基准照片 ${item.recordDate}`
const label =
item.isBaseline === 1
? `基准照片 ${item.recordDate} 替妥尤单抗:${item.treatmentCount >= 9 ? '>8' : item.treatmentCount}`
: `对比照片 ${item.recordDate} 替妥尤单抗:${item.treatmentCount >= 9 ? '>8' : item.treatmentCount}`
return {
src: item.croppedUrl || item.photoUrl,
@ -220,15 +225,14 @@ Page({ @@ -220,15 +225,14 @@ Page({
// 是否有裁剪过的照片
hasCroppedPhoto(): boolean {
return this.data.photos.some(item => item.isCropped)
return this.data.photos.some((item) => item.isCropped)
},
// 返回上一页
handleBack() {
if (this.hasCroppedPhoto()) {
this.setData({ popupShow: true })
}
else {
} else {
wx.navigateBack()
}
},

2
src/pages/d_noteList/index.wxml

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<navbar fixed title="记" custom-style="background:{{background}}">
<navbar fixed title="{{patientName}}的突眼日记" custom-style="background:{{background}}">
<van-icon name="arrow-left" slot="left" size="18px" color="#000" bind:tap="handleBack" />
</navbar>

14
src/patient/components/camera/index.scss

@ -70,6 +70,20 @@ @@ -70,6 +70,20 @@
width: 606rpx;
max-height: 304rpx;
}
.left {
position: absolute;
top: 156rpx;
left: 28rpx;
font-size: 32rpx;
color: #ffffff;
}
.right {
position: absolute;
top: 156rpx;
right: 28rpx;
font-size: 32rpx;
color: #ffffff;
}
}
&::before {
content: '';

18
src/patient/components/camera/index.ts

@ -44,14 +44,14 @@ Component({ @@ -44,14 +44,14 @@ Component({
5: { name: '右侧-90°', group: '侧面', index: 2, total: 4, tip: '身体与头部完全转向左侧,呈标准90°侧面,仅可见右侧眼睛。' },
6: { name: '左侧-45°', group: '侧面', index: 3, total: 4, tip: '身体与头部转向右前方45°。' },
7: { name: '右侧-45°', group: '侧面', index: 4, total: 4, tip: '身体与头部转向左前方45°' },
8: { name: '左上', group: '眼球运动', index: 1, total: 8 },
9: { name: '向上', group: '眼球运动', index: 2, total: 8 },
10: { name: '右上', group: '眼球运动', index: 3, total: 8 },
11: { name: '向左', group: '眼球运动', index: 4, total: 8 },
12: { name: '向右', group: '眼球运动', index: 5, total: 8 },
13: { name: '左下', group: '眼球运动', index: 6, total: 8 },
14: { name: '向下', group: '眼球运动', index: 7, total: 8 },
15: { name: '右下', group: '眼球运动', index: 8, total: 8 },
8: { name: '左上', group: '眼球运动', index: 1, total: 8, tip: '正对镜头,双眼向左上方看。' },
9: { name: '向上', group: '眼球运动', index: 2, total: 8, tip: '正对镜头,双眼向上方看。' },
10: { name: '右上', group: '眼球运动', index: 3, total: 8, tip: '正对镜头,双眼向右上方看。' },
11: { name: '向左', group: '眼球运动', index: 4, total: 8, tip: '正对镜头,双眼向左方看。' },
12: { name: '向右', group: '眼球运动', index: 5, total: 8, tip: '正对镜头,双眼向右方看。' },
13: { name: '左下', group: '眼球运动', index: 6, total: 8, tip: '正对镜头,双眼向左下方看。' },
14: { name: '向下', group: '眼球运动', index: 7, total: 8, tip: '正对镜头,双眼向下方看。' },
15: { name: '右下', group: '眼球运动', index: 8, total: 8, tip: '正对镜头,双眼向右下方看。' },
},
frame: {
1: {
@ -155,6 +155,7 @@ Component({ @@ -155,6 +155,7 @@ Component({
})
},
handleHideCamera() {
this.triggerEvent('close')
if (this.properties.onlyCamera) {
this.setData({
visible: false,
@ -410,6 +411,7 @@ Component({ @@ -410,6 +411,7 @@ Component({
// 关闭相机
this.setData({
visible: false,
selectShow: false,
})
// 如果机审不通过且不允许继续,提示用户

2
src/patient/components/camera/index.wxml

@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@
<view class="photo-wrap">
<image class="photo" src="{{imageUrl}}{{frame[type].exampleSrc}}.png?t={{Timestamp}}"></image>
<image class="label" src="{{imageUrl}}icon162.png?t={{Timestamp}}"></image>
<view class="right">左</view>
<view class="left">右</view>
</view>
</view>
</view>

74
src/patient/pages/noteAdd/index.ts

@ -231,9 +231,11 @@ Page({ @@ -231,9 +231,11 @@ Page({
// 打开相机选择照片
handleCamera(e: any) {
const { angle } = e.currentTarget.dataset
this._stopSequentialShoot()
this.setData({
currentPhotoAngle: angle,
isCapturing: true,
sequentialShootMode: false,
})
const cameraComponent = this.selectComponent('#camera-component')
if (cameraComponent) {
@ -243,6 +245,18 @@ Page({ @@ -243,6 +245,18 @@ Page({
}
},
_stopSequentialShoot() {
if (this._sequentialTimer) {
clearTimeout(this._sequentialTimer)
this._sequentialTimer = null
}
this.setData({
sequentialShootMode: false,
sequentialShootList: [],
sequentialShootIndex: 0,
})
},
// 一键顺序拍摄
handleSequentialShoot() {
// 定义拍摄顺序:正面 -> 侧面 -> 眼球运动
@ -290,39 +304,6 @@ Page({ @@ -290,39 +304,6 @@ Page({
}
},
// 顺序拍摄模式下的上传成功回调
onSequentialUploadSuccess(e: any) {
const { photoId, photoAngle, photoUrl, checkStatus, isContinue, message } = e.detail
// 保存照片信息到页面数据
const photoMap = this.data.photoMap
photoMap[photoAngle] = {
photoId,
photoAngle,
photoUrl,
checkStatus,
isContinue,
message,
}
// 检查是否是顺序拍摄模式
if (this.data.sequentialShootMode) {
// 继续下一个拍摄
const nextIndex = this.data.sequentialShootIndex + 1
this.setData({
photoMap,
sequentialShootIndex: nextIndex,
})
// 延迟一下再打开下一个相机,给用户反馈时间
setTimeout(() => {
this.startSequentialShoot()
}, 500)
}
else {
this.setData({ photoMap })
}
},
// 将 angle 映射到 camera 组件的 type
getCameraType(angle: string): number {
const typeMap: Record<string, number> = {
@ -349,14 +330,9 @@ Page({ @@ -349,14 +330,9 @@ Page({
onUploadSuccess(e: any) {
const { photoId, photoAngle, photoUrl, checkStatus, isContinue, message } = e.detail
// 不允许继续的情况:不写入 photoMap,提示重新上传;顺序拍摄不推进 index
// 不允许继续的情况:不写入 photoMap,提示重新上传
if (checkStatus === 2 && !isContinue) {
wx.showToast({ title: message || '图片不合规,请重新上传', icon: 'none' })
if (this.data.sequentialShootMode) {
setTimeout(() => {
this.startSequentialShoot()
}, 500)
}
return
}
@ -370,24 +346,16 @@ Page({ @@ -370,24 +346,16 @@ Page({
isContinue,
message,
}
this.setData({ photoMap, hasUnsavedData: true })
// 检查是否是顺序拍摄模式
// 顺序拍摄模式:继续下一个
if (this.data.sequentialShootMode) {
// 继续下一个拍摄
const nextIndex = this.data.sequentialShootIndex + 1
this.setData({
photoMap,
sequentialShootIndex: nextIndex,
hasUnsavedData: true,
})
// 延迟一下再打开下一个相机,给用户反馈时间
setTimeout(() => {
this.setData({ sequentialShootIndex: nextIndex })
this._sequentialTimer = setTimeout(() => {
this.startSequentialShoot()
}, 500)
}
else {
this.setData({ photoMap, hasUnsavedData: true })
}
},
// camera 组件上传失败回调
@ -398,7 +366,9 @@ Page({ @@ -398,7 +366,9 @@ Page({
// 关闭相机
onCloseCamera() {
// camera 组件内部处理关闭逻辑
if (this.data.sequentialShootMode) {
this._stopSequentialShoot()
}
},
// 预览图片

10
src/patient/pages/noteDiff/index.scss

@ -101,6 +101,7 @@ page { @@ -101,6 +101,7 @@ page {
grid-template-columns: repeat(2, 1fr);
gap: 24rpx 22rpx;
.item {
position: relative;
padding: 16rpx;
font-size: 32rpx;
color: #211d2e;
@ -113,6 +114,13 @@ page { @@ -113,6 +114,13 @@ page {
color: #fff;
background: linear-gradient(180deg, #e98ff8 0%, #b073ff 100%);
}
.icon {
position: absolute;
top: -18rpx;
right: 0;
width: 90rpx;
height: 52rpx;
}
}
}
}
@ -252,7 +260,7 @@ page { @@ -252,7 +260,7 @@ page {
align-items: baseline;
gap: 8rpx;
.num {
font-size: 56rpx;
font-size: 32rpx;
color: #b073ff;
font-weight: bold;
}

69
src/patient/pages/noteDiff/index.ts

@ -22,7 +22,7 @@ Page({ @@ -22,7 +22,7 @@ Page({
// 对比角度
photoAngle: '',
photoAngleName: '',
angleList: [] as { key: string, name: string }[],
angleList: [] as { key: string; name: string }[],
angleMap: {} as Record<string, string>,
// 日期选择
@ -53,9 +53,10 @@ Page({ @@ -53,9 +53,10 @@ Page({
method: 'GET',
url: '?r=xd/proptosis/get-compare-angle',
data: {},
}).then((res: any) => {
})
.then((res: any) => {
const angleMap = res.photoAngle || {}
const angleList = Object.keys(angleMap).map(key => ({
const angleList = Object.keys(angleMap).map((key) => ({
key,
name: angleMap[key],
}))
@ -70,7 +71,8 @@ Page({ @@ -70,7 +71,8 @@ Page({
if (this.data.photoAngle) {
this.getCompareDates()
}
}).catch((err) => {
})
.catch((err) => {
console.error('获取对比角度失败:', err)
})
},
@ -81,36 +83,51 @@ Page({ @@ -81,36 +83,51 @@ Page({
method: 'GET',
url: '?r=xd/proptosis/baseline-status',
data: {},
}).then((res: any) => {
})
.then((res: any) => {
this.setData({
hasBaseline: res.hasBaseline,
})
}).catch((err) => {
})
.catch((err) => {
console.error('获取基准照状态失败:', err)
})
},
// 获取对比可用日期
getCompareDates() {
if (!this.data.photoAngle)
return
if (!this.data.photoAngle) return
wx.ajax({
method: 'GET',
url: '?r=xd/proptosis/compare-dates',
data: {
photoAngle: this.data.photoAngle,
},
}).then((res: any) => {
const selectedDates = this.data.selectedDates
const nonBaselineList = (res.nonBaselineList || []).map((item: CompareDate) => ({
})
.then((res: any) => {
const newBaseline = res.baseline || null
const newList = res.nonBaselineList || []
const newRecordIds = newList.map((item: CompareDate) => item.recordId)
if (newBaseline) {
newRecordIds.push(newBaseline.recordId)
}
const selectedDates = this.data.selectedDates.filter((id: string) => newRecordIds.includes(id))
const nonBaselineList = newList.map((item: CompareDate) => ({
...item,
isSelected: selectedDates.includes(item.recordId),
}))
this.setData({
baseline: res.baseline || null,
baseline: newBaseline,
nonBaselineList,
selectedDates,
})
if (selectedDates.length > 0 || newBaseline) {
this.getComparePhotos()
} else {
this.setData({ comparePhotos: [] })
}
})
}).catch((err) => {
.catch((err) => {
console.error('获取对比日期失败:', err)
})
},
@ -122,7 +139,6 @@ Page({ @@ -122,7 +139,6 @@ Page({
this.setData({
photoAngle: angle.key,
photoAngleName: angle.name,
selectedDates: [],
comparePhotos: [],
})
this.getCompareDates()
@ -135,8 +151,12 @@ Page({ @@ -135,8 +151,12 @@ Page({
const index = selectedDates.indexOf(recordId)
if (index > -1) {
selectedDates.splice(index, 1)
} else {
const maxSelect = this.data.baseline ? 5 : 6
if (selectedDates.length >= maxSelect) {
wx.showToast({ title: '最多选择6张对比图', icon: 'none' })
return
}
else {
selectedDates.push(recordId)
}
// 更新列表中的选中状态
@ -152,12 +172,15 @@ Page({ @@ -152,12 +172,15 @@ Page({
// 获取对比照片
getComparePhotos() {
const { photoAngle, selectedDates, baseline } = this.data
if (!photoAngle || selectedDates.length === 0) {
if (!photoAngle) {
this.setData({ comparePhotos: [] })
return
}
// 包含基准照ID
const recordIds = baseline ? [baseline.recordId, ...selectedDates] : selectedDates
if (recordIds.length === 0) {
this.setData({ comparePhotos: [] })
return
}
wx.ajax({
method: 'GET',
url: '?r=xd/proptosis/compare-photos',
@ -165,13 +188,17 @@ Page({ @@ -165,13 +188,17 @@ Page({
photoAngle,
recordIds: recordIds.join(','),
},
}).then((res: any) => {
// 过滤掉 photoUrl 为空的数据
const photos = (res.photos || []).filter((item: any) => item.photoUrl)
})
.then((res: any) => {
// 过滤掉 photoUrl 为空的数据,确保基准照片排在第一位
const photos = (res.photos || [])
.filter((item: any) => item.photoUrl)
.sort((a: any, b: any) => b.isBaseline - a.isBaseline)
this.setData({
comparePhotos: photos,
})
}).catch((err) => {
})
.catch((err) => {
console.error('获取对比照片失败:', err)
})
},

17
src/patient/pages/noteDiff/index.wxml

@ -32,13 +32,19 @@ @@ -32,13 +32,19 @@
<view class="form-item">
<view class="title">选择对比日期(可多选)</view>
<view class="multiple">
<view class="item active baseline" wx:if="{{baseline}}">
{{baseline.recordDate}}
<image class="icon" src="{{imageUrl}}icon169.png?t={{Timestamp}}"></image>
</view>
<view
class="item {{item.isSelected ? 'active' : ''}}"
wx:for="{{nonBaselineList}}"
wx:key="recordId"
data-record-id="{{item.recordId}}"
bind:tap="onDateSelect"
>{{item.recordDate}}</view>
>
{{item.recordDate}}
</view>
</view>
</view>
</view>
@ -58,11 +64,16 @@ @@ -58,11 +64,16 @@
</view>
<view class="tags">
<view wx:if="{{item.isBaseline === 1}}" class="tag tag1">基准照片</view>
<view class="tag tag2" wx:if="{{item.treatmentCount > 0}}">替妥尤单抗:{{item.treatmentCount >= 9 ? '>8' : item.treatmentCount}}</view>
<view class="tag tag2" wx:if="{{item.treatmentCount > 0}}">
替妥尤单抗:{{item.treatmentCount >= 9 ? '>8' : item.treatmentCount}}
</view>
</view>
<view class="photo-card">
<image class="photo" src="{{item.photoUrl}}" mode="aspectFill"></image>
<view class="row" wx:if="{{item.leftEye != null || item.rightEye != null || item.interorbitalDistance != null}}">
<view
class="row"
wx:if="{{item.leftEye != null || item.rightEye != null || item.interorbitalDistance != null}}"
>
<view class="col">
<view class="name">右眼</view>
<view class="content">

26
src/patient/pages/noteDiffEdit/index.ts

@ -48,12 +48,14 @@ Page({ @@ -48,12 +48,14 @@ Page({
method: 'GET',
url: '?r=xd/proptosis/get-compare-angle',
data: {},
}).then((res: any) => {
})
.then((res: any) => {
const angleMap = res.photoAngle || {}
this.setData({
photoAngleName: angleMap[this.data.photoAngle] || '',
})
}).catch((err) => {
})
.catch((err) => {
console.error('获取角度名称失败:', err)
})
},
@ -74,8 +76,10 @@ Page({ @@ -74,8 +76,10 @@ Page({
photoAngle,
recordIds: recordIds.join(','),
},
}).then((res: any) => {
const photos = (res.photos || []).map((item: any) => ({
})
.then((res: any) => {
const photos = (res.photos || [])
.map((item: any) => ({
photoId: item.photoId || item.recordId,
photoUrl: item.photoUrl,
recordDate: item.recordDate,
@ -87,11 +91,13 @@ Page({ @@ -87,11 +91,13 @@ Page({
isCropped: false,
croppedUrl: '',
}))
.sort((a: PhotoItem, b: PhotoItem) => b.isBaseline - a.isBaseline)
this.setData({
photos,
loading: false,
})
}).catch((err) => {
})
.catch((err) => {
console.error('获取对比照片失败:', err)
this.setData({ loading: false })
wx.showToast({ title: '获取照片失败', icon: 'none' })
@ -155,8 +161,9 @@ Page({ @@ -155,8 +161,9 @@ Page({
const mergeComponent = this.selectComponent('#merge')
if (mergeComponent) {
const imageList = photos.map((item) => {
const label = item.isBaseline === 1
? `基准照片 ${item.recordDate}`
const label =
item.isBaseline === 1
? `基准照片 ${item.recordDate} 替妥尤单抗:${item.treatmentCount >= 9 ? '>8' : item.treatmentCount}`
: `对比照片 ${item.recordDate} 替妥尤单抗:${item.treatmentCount >= 9 ? '>8' : item.treatmentCount}`
return {
src: item.croppedUrl || item.photoUrl,
@ -207,15 +214,14 @@ Page({ @@ -207,15 +214,14 @@ Page({
// 是否有裁剪过的照片
hasCroppedPhoto(): boolean {
return this.data.photos.some(item => item.isCropped)
return this.data.photos.some((item) => item.isCropped)
},
// 返回上一页
handleBack() {
if (this.hasCroppedPhoto()) {
this.setData({ popupShow: true })
}
else {
} else {
wx.navigateBack()
}
},

Loading…
Cancel
Save