diff --git a/miniprogram/pages/main/travel-location-editor/index.less b/miniprogram/pages/main/travel-location-editor/index.less
index 53cc88e..2217646 100644
--- a/miniprogram/pages/main/travel-location-editor/index.less
+++ b/miniprogram/pages/main/travel-location-editor/index.less
@@ -23,6 +23,34 @@
.section {
margin-top: 48rpx;
+ .rate-cell {
+
+ &.decided {
+
+ .rate {
+ display: block;
+ gap: 16rpx;
+ display: flex;
+ align-items: center;
+ }
+
+ .text {
+ display: none;
+ }
+ }
+
+ &.undecided {
+
+ .rate {
+ display: none;
+ }
+
+ .text {
+ display: block;
+ }
+ }
+ }
+
> .title {
color: var(--theme-text-secondary);
padding: 0 32rpx;
@@ -149,11 +177,11 @@
display: flex;
padding: 24rpx 16rpx 48rpx 16rpx;
- .delete-btn {
+ .delete {
flex: .6;
}
- .submit-btn {
+ .submit {
flex: 1;
}
}
diff --git a/miniprogram/pages/main/travel-location-editor/index.ts b/miniprogram/pages/main/travel-location-editor/index.ts
index dbfbda5..84b44f5 100644
--- a/miniprogram/pages/main/travel-location-editor/index.ts
+++ b/miniprogram/pages/main/travel-location-editor/index.ts
@@ -34,8 +34,12 @@ interface TravelLocationEditorData {
requireAppointment: boolean;
/** 评分 */
score: number;
+ /** 评分是否未定 */
+ scoreUndecided: boolean;
/** 重要程度 */
importance: number;
+ /** 重要程度是否未定 */
+ importanceUndecided: boolean;
/** 媒体列表(创建和编辑模式使用) */
mediaList: (MediaItem | WechatMediaItem)[];
/** 新媒体列表(编辑模式使用) */
@@ -77,7 +81,9 @@ Page({
requireIdCard: false,
requireAppointment: false,
score: 3,
+ scoreUndecided: true,
importance: 1,
+ importanceUndecided: true,
mediaList: [],
newMediaList: [],
isLoading: false,
@@ -167,6 +173,14 @@ Page({
} as MediaItem;
});
+ // 判断评分是否未定
+ const scoreUndecided = location.score === null || location.score === undefined;
+ const score = location.score !== null && location.score !== undefined ? location.score : 3;
+
+ // 判断重要程度是否未定
+ const importanceUndecided = location.importance === null || location.importance === undefined;
+ const importance = location.importance !== null && location.importance !== undefined ? location.importance : 1;
+
this.setData({
type,
locationTypeIndex: locationTypeIndex >= 0 ? locationTypeIndex : 0,
@@ -178,8 +192,10 @@ Page({
amount: location.amount || 0,
requireIdCard: location.requireIdCard || false,
requireAppointment: location.requireAppointment || false,
- score: location.score !== undefined ? location.score : 3,
- importance: location.importance !== undefined ? location.importance : 1,
+ score,
+ scoreUndecided,
+ importance,
+ importanceUndecided,
mediaList,
isLoading: false
});
@@ -225,6 +241,32 @@ Page({
this.setData({ importance: e.detail.value });
},
+ /** 清除评分 */
+ clearScore() {
+ this.setData({ scoreUndecided: true });
+ },
+
+ /** 清除重要程度 */
+ clearImportance() {
+ this.setData({ importanceUndecided: true });
+ },
+
+ /** 点击未定文字选择评分 */
+ selectScore() {
+ this.setData({
+ scoreUndecided: false,
+ score: 3
+ });
+ },
+
+ /** 点击未定文字选择重要程度 */
+ selectImportance() {
+ this.setData({
+ importanceUndecided: false,
+ importance: 1
+ });
+ },
+
/** 选择位置 */
chooseLocation() {
wx.chooseLocation({
@@ -483,8 +525,8 @@ Page({
amount: this.data.amount,
requireIdCard: this.data.requireIdCard,
requireAppointment: this.data.requireAppointment,
- score: this.data.score,
- importance: this.data.importance,
+ score: this.data.scoreUndecided ? null : this.data.score,
+ importance: this.data.importanceUndecided ? null : this.data.importance,
tempFileIds
});
wx.showToast({
@@ -539,8 +581,8 @@ Page({
amount: this.data.amount,
requireIdCard: this.data.requireIdCard,
requireAppointment: this.data.requireAppointment,
- score: this.data.score,
- importance: this.data.importance,
+ score: this.data.scoreUndecided ? null : this.data.score,
+ importance: this.data.importanceUndecided ? null : this.data.importance,
attachmentIds,
tempFileIds
});
diff --git a/miniprogram/pages/main/travel-location-editor/index.wxml b/miniprogram/pages/main/travel-location-editor/index.wxml
index 753c65e..ac91998 100644
--- a/miniprogram/pages/main/travel-location-editor/index.wxml
+++ b/miniprogram/pages/main/travel-location-editor/index.wxml
@@ -61,24 +61,46 @@
-
-
-
+
+
+
+
+
+
+
+ 未定
+
-
-
-
+
+
+
+
+
+
+
+ 未定
+