scroe and importance allow nullable
This commit is contained in:
@ -23,6 +23,34 @@
|
|||||||
.section {
|
.section {
|
||||||
margin-top: 48rpx;
|
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 {
|
> .title {
|
||||||
color: var(--theme-text-secondary);
|
color: var(--theme-text-secondary);
|
||||||
padding: 0 32rpx;
|
padding: 0 32rpx;
|
||||||
@ -149,11 +177,11 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
padding: 24rpx 16rpx 48rpx 16rpx;
|
padding: 24rpx 16rpx 48rpx 16rpx;
|
||||||
|
|
||||||
.delete-btn {
|
.delete {
|
||||||
flex: .6;
|
flex: .6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submit-btn {
|
.submit {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,12 @@ interface TravelLocationEditorData {
|
|||||||
requireAppointment: boolean;
|
requireAppointment: boolean;
|
||||||
/** 评分 */
|
/** 评分 */
|
||||||
score: number;
|
score: number;
|
||||||
|
/** 评分是否未定 */
|
||||||
|
scoreUndecided: boolean;
|
||||||
/** 重要程度 */
|
/** 重要程度 */
|
||||||
importance: number;
|
importance: number;
|
||||||
|
/** 重要程度是否未定 */
|
||||||
|
importanceUndecided: boolean;
|
||||||
/** 媒体列表(创建和编辑模式使用) */
|
/** 媒体列表(创建和编辑模式使用) */
|
||||||
mediaList: (MediaItem | WechatMediaItem)[];
|
mediaList: (MediaItem | WechatMediaItem)[];
|
||||||
/** 新媒体列表(编辑模式使用) */
|
/** 新媒体列表(编辑模式使用) */
|
||||||
@ -77,7 +81,9 @@ Page({
|
|||||||
requireIdCard: false,
|
requireIdCard: false,
|
||||||
requireAppointment: false,
|
requireAppointment: false,
|
||||||
score: 3,
|
score: 3,
|
||||||
|
scoreUndecided: true,
|
||||||
importance: 1,
|
importance: 1,
|
||||||
|
importanceUndecided: true,
|
||||||
mediaList: [],
|
mediaList: [],
|
||||||
newMediaList: [],
|
newMediaList: [],
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -167,6 +173,14 @@ Page({
|
|||||||
} as MediaItem;
|
} 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({
|
this.setData({
|
||||||
type,
|
type,
|
||||||
locationTypeIndex: locationTypeIndex >= 0 ? locationTypeIndex : 0,
|
locationTypeIndex: locationTypeIndex >= 0 ? locationTypeIndex : 0,
|
||||||
@ -178,8 +192,10 @@ Page({
|
|||||||
amount: location.amount || 0,
|
amount: location.amount || 0,
|
||||||
requireIdCard: location.requireIdCard || false,
|
requireIdCard: location.requireIdCard || false,
|
||||||
requireAppointment: location.requireAppointment || false,
|
requireAppointment: location.requireAppointment || false,
|
||||||
score: location.score !== undefined ? location.score : 3,
|
score,
|
||||||
importance: location.importance !== undefined ? location.importance : 1,
|
scoreUndecided,
|
||||||
|
importance,
|
||||||
|
importanceUndecided,
|
||||||
mediaList,
|
mediaList,
|
||||||
isLoading: false
|
isLoading: false
|
||||||
});
|
});
|
||||||
@ -225,6 +241,32 @@ Page({
|
|||||||
this.setData({ importance: e.detail.value });
|
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() {
|
chooseLocation() {
|
||||||
wx.chooseLocation({
|
wx.chooseLocation({
|
||||||
@ -483,8 +525,8 @@ Page({
|
|||||||
amount: this.data.amount,
|
amount: this.data.amount,
|
||||||
requireIdCard: this.data.requireIdCard,
|
requireIdCard: this.data.requireIdCard,
|
||||||
requireAppointment: this.data.requireAppointment,
|
requireAppointment: this.data.requireAppointment,
|
||||||
score: this.data.score,
|
score: this.data.scoreUndecided ? null : this.data.score,
|
||||||
importance: this.data.importance,
|
importance: this.data.importanceUndecided ? null : this.data.importance,
|
||||||
tempFileIds
|
tempFileIds
|
||||||
});
|
});
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
@ -539,8 +581,8 @@ Page({
|
|||||||
amount: this.data.amount,
|
amount: this.data.amount,
|
||||||
requireIdCard: this.data.requireIdCard,
|
requireIdCard: this.data.requireIdCard,
|
||||||
requireAppointment: this.data.requireAppointment,
|
requireAppointment: this.data.requireAppointment,
|
||||||
score: this.data.score,
|
score: this.data.scoreUndecided ? null : this.data.score,
|
||||||
importance: this.data.importance,
|
importance: this.data.importanceUndecided ? null : this.data.importance,
|
||||||
attachmentIds,
|
attachmentIds,
|
||||||
tempFileIds
|
tempFileIds
|
||||||
});
|
});
|
||||||
|
|||||||
@ -61,24 +61,46 @@
|
|||||||
<switch checked="{{requireAppointment}}" bindchange="onChangeRequireAppointment" />
|
<switch checked="{{requireAppointment}}" bindchange="onChangeRequireAppointment" />
|
||||||
</view>
|
</view>
|
||||||
</t-cell>
|
</t-cell>
|
||||||
<t-cell title="重要程度">
|
<t-cell title="重要程度" class="rate-cell importance {{importanceUndecided ? 'undecided' : 'decided'}}">
|
||||||
<view slot="right-icon">
|
<view slot="note">
|
||||||
<t-rate
|
<view class="rate">
|
||||||
value="{{importance}}"
|
<t-rate
|
||||||
count="{{5}}"
|
value="{{importance}}"
|
||||||
size="24px"
|
count="{{5}}"
|
||||||
bind:change="onChangeImportance"
|
size="20px"
|
||||||
/>
|
bind:change="onChangeImportance"
|
||||||
|
/>
|
||||||
|
<t-icon
|
||||||
|
name="close-circle-filled"
|
||||||
|
size="20px"
|
||||||
|
class="clear-icon"
|
||||||
|
bindtap="clearImportance"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="text" bindtap="selectImportance">
|
||||||
|
未定
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</t-cell>
|
</t-cell>
|
||||||
<t-cell title="评分">
|
<t-cell title="评分" class="rate-cell score {{scoreUndecided ? 'undecided' : 'decided'}}">
|
||||||
<view slot="right-icon">
|
<view slot="note">
|
||||||
<t-rate
|
<view class="rate">
|
||||||
value="{{score}}"
|
<t-rate
|
||||||
count="{{5}}"
|
value="{{score}}"
|
||||||
size="24px"
|
count="{{5}}"
|
||||||
bind:change="onChangeScore"
|
size="20px"
|
||||||
/>
|
bind:change="onChangeScore"
|
||||||
|
/>
|
||||||
|
<t-icon
|
||||||
|
name="close-circle-filled"
|
||||||
|
size="20px"
|
||||||
|
class="clear-icon"
|
||||||
|
bindtap="clearScore"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="text" bindtap="selectScore">
|
||||||
|
未定
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</t-cell>
|
</t-cell>
|
||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
|
|||||||
Reference in New Issue
Block a user