diff --git a/pages/index/writeReview.vue b/pages/index/writeReview.vue
index c9dc2e8..71f76a2 100644
--- a/pages/index/writeReview.vue
+++ b/pages/index/writeReview.vue
@@ -798,10 +798,17 @@
},
async submitForm() {
if (!this.isFormValid) {
- uni.showToast({
- title: '请填写评价内容',
- icon: 'none'
- });
+ if (!this.form.reviewImg) {
+ uni.showToast({
+ title: '请上传至少一张图片',
+ icon: 'none'
+ });
+ } else if (this.form.reviewContent.trim().length < 15) {
+ uni.showToast({
+ title: '评价内容至少15个字',
+ icon: 'none'
+ });
+ }
return;
}
@@ -817,7 +824,10 @@
icon: 'success'
});
setTimeout(() => {
- uni.navigateBack();
+ // 跳转回酒款详情页
+ uni.redirectTo({
+ url: `/pages/index/review?beerId=${this.form.beerId}`
+ });
}, 1500);
}
} catch (error) {
diff --git a/pagesActivity/activityDetail.vue b/pagesActivity/activityDetail.vue
index ffe9e3b..ba41663 100644
--- a/pagesActivity/activityDetail.vue
+++ b/pagesActivity/activityDetail.vue
@@ -34,7 +34,7 @@
0天
- {{activityInfo.duration}}天
+ {{totalDays}}天
@@ -49,7 +49,7 @@
- 首次扫码开始累计 {{activityInfo.activityDuration || '-'}} 天内
+ 首次扫码开始累计 {{activityInfo.duration || '-'}} 天内
{{ activityInfo.beer_scope === 0 ? '全系列酒款' : '以下酒款' }}累计扫码 ≥ {{activityInfo.activityTarget || '-'}} 桶
@@ -148,6 +148,14 @@
this.checkLoginStatus();
},
computed: {
+ totalDays() {
+ if(this.activityInfo.endDate && this.activityInfo.startDate) {
+ const endDate = new Date(this.activityInfo.endDate);
+ const startDate = new Date(this.activityInfo.startDate);
+ return Math.ceil((endDate - startDate) / (1000 * 3600 * 24));
+ }
+ return 0;
+ },
processNum() {
if(this.activityInfo.endDate) {
const endDate = new Date(this.activityInfo.endDate);
@@ -177,8 +185,8 @@
this.activityInfo = res.data;
// 检查关键数据是否存在
- if (!this.activityInfo.activityDuration) {
- console.warn('缺少活动累计天数:activityDuration');
+ if (!this.activityInfo.duration) {
+ console.warn('缺少活动累计天数:duration');
}
if (!this.activityInfo.activityTarget) {
console.warn('缺少活动目标数量:activityTarget');
@@ -190,22 +198,15 @@
// 计算剩余天数
this.activityInfo.remainingDays = this.getRemainingDays(res.data.endDate);
- // 计算活动总持续时间(用于进度条显示)
- if(res.data.endDate && res.data.startDate) {
- const endDate = new Date(res.data.endDate);
- const startDate = new Date(res.data.startDate);
- this.activityInfo.duration = Math.ceil((endDate - startDate) / (1000 * 3600 * 24));
- }
-
// 启动倒计时
this.startCountdown();
}).catch(err => {
console.error('获取活动详情失败:', err);
uni.showToast({
- title: '获取活动信息失败',
+ title: '获取活动详情失败',
icon: 'none'
});
- })
+ });
},
startCountdown() {
if(this.timer) {