refactor(components): 重构饮酒卡片组件的多照片布局和样式结构
- 将多照片布局从拼贴模式改为网格系统,支持2-9张照片的不同排列 - 优化卡片宽度为650rpx并调整整体布局结构 - 更新品牌底栏为左右分栏布局并添加二维码区域 - 简化模板数量计算逻辑,合并少照片情况的处理 - 为单照片模式添加object-fit: cover确保图片填充效果 - 移除多余的换行和注释,精简代码结构 - 调整CSS样式以适应新的网格布局系统
This commit is contained in:
@@ -420,6 +420,23 @@ export default {
|
||||
this.backfillDate = options.date
|
||||
}
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.currentStep > 1 || this.hasFormData()) {
|
||||
uni.showModal({
|
||||
title: '放弃记录?',
|
||||
content: '当前填写的内容将不会保存',
|
||||
confirmText: '继续填写',
|
||||
cancelText: '放弃',
|
||||
success: (res) => {
|
||||
if (res.cancel) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
})
|
||||
return true // 阻止默认返回
|
||||
}
|
||||
return false
|
||||
},
|
||||
methods: {
|
||||
selectCategory(cat) {
|
||||
this.currentDrink.category = cat.id
|
||||
@@ -484,10 +501,30 @@ export default {
|
||||
handleBack() {
|
||||
if (this.currentStep > 1) {
|
||||
this.prevStep()
|
||||
} else if (this.hasFormData()) {
|
||||
uni.showModal({
|
||||
title: '放弃记录?',
|
||||
content: '当前填写的内容将不会保存',
|
||||
confirmText: '继续填写',
|
||||
cancelText: '放弃',
|
||||
success: (res) => {
|
||||
if (res.cancel) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
hasFormData() {
|
||||
return this.drinks.length > 0 ||
|
||||
this.currentDrink.brand ||
|
||||
this.currentDrink.category ||
|
||||
this.selectedFood ||
|
||||
this.selectedFeeling ||
|
||||
this.photos.length > 0
|
||||
},
|
||||
prevStep() {
|
||||
if (this.currentStep > 1) this.currentStep--
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user