update style
This commit is contained in:
@ -23,12 +23,23 @@
|
||||
.section {
|
||||
margin-top: 48rpx;
|
||||
|
||||
> .title {
|
||||
color: var(--theme-text-secondary);
|
||||
padding: 0 32rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 64rpx;
|
||||
}
|
||||
|
||||
.picker .slot {
|
||||
gap: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.note {
|
||||
color: var(--theme-text-primary);
|
||||
}
|
||||
|
||||
.travel-at-content,
|
||||
.days-content {
|
||||
gap: 16rpx;
|
||||
@ -54,9 +65,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.days-stepper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.days {
|
||||
|
||||
&.decided {
|
||||
--td-cell-vertical-padding: 24rpx;
|
||||
|
||||
.t-cell__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import { TravelStatus, TransportationType } from "../../../types/Travel";
|
||||
interface TravelEditorData {
|
||||
/** 模式:create 或 edit */
|
||||
mode: "create" | "edit";
|
||||
/** 旅行 ID(编辑模式) */
|
||||
/** 出行 ID(编辑模式) */
|
||||
id?: number;
|
||||
/** 标题 */
|
||||
title: string;
|
||||
@ -105,7 +105,7 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 加载旅行详情(编辑模式) */
|
||||
/** 加载出行详情(编辑模式) */
|
||||
async loadTravelDetail(id: number) {
|
||||
wx.showLoading({ title: "加载中...", mask: true });
|
||||
try {
|
||||
@ -230,7 +230,7 @@ Page({
|
||||
this.updateTravel();
|
||||
}
|
||||
},
|
||||
/** 创建旅行 */
|
||||
/** 创建出行 */
|
||||
async createTravel() {
|
||||
this.setData({ isSaving: true });
|
||||
|
||||
@ -238,9 +238,7 @@ Page({
|
||||
await TravelApi.create({
|
||||
title: this.data.title.trim(),
|
||||
content: this.data.content.trim(),
|
||||
travelAt: this.data.travelAtUndecided
|
||||
? null
|
||||
: new Date(`${this.data.date}T${this.data.time}:00`).getTime(),
|
||||
travelAt: this.data.travelAtUndecided ? null : Time.now(),
|
||||
days: this.data.daysUndecided ? null : this.data.days,
|
||||
transportationType: this.data.transportationType,
|
||||
status: this.data.status
|
||||
@ -256,7 +254,7 @@ Page({
|
||||
this.setData({ isSaving: false });
|
||||
}
|
||||
},
|
||||
/** 更新旅行 */
|
||||
/** 更新出行 */
|
||||
async updateTravel() {
|
||||
this.setData({ isSaving: true });
|
||||
try {
|
||||
@ -283,7 +281,7 @@ Page({
|
||||
this.setData({ isSaving: false });
|
||||
}
|
||||
},
|
||||
/** 删除旅行 */
|
||||
/** 删除出行 */
|
||||
deleteTravel() {
|
||||
this.setData({
|
||||
deleteDialogVisible: true,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!--pages/main/travel-editor/index.wxml-->
|
||||
<t-navbar title="{{mode === 'create' ? '新建旅行' : '编辑旅行'}}">
|
||||
<t-navbar title="{{mode === 'create' ? '新建出行' : '编辑出行'}}">
|
||||
<text slot="left" bindtap="cancel">取消</text>
|
||||
</t-navbar>
|
||||
|
||||
@ -11,12 +11,12 @@
|
||||
</view>
|
||||
<block wx:else>
|
||||
<t-cell-group class="section">
|
||||
<view slot="title" class="title">基本信息</view>
|
||||
<t-input
|
||||
class="input"
|
||||
placeholder="请输入旅行标题"
|
||||
placeholder="请输入出行标题"
|
||||
model:value="{{title}}"
|
||||
maxlength="50"
|
||||
borderless
|
||||
>
|
||||
<text slot="label">标题</text>
|
||||
</t-input>
|
||||
@ -31,6 +31,7 @@
|
||||
</t-textarea>
|
||||
</t-cell-group>
|
||||
<t-cell-group class="section">
|
||||
<view slot="title" class="title">详细信息</view>
|
||||
<t-cell class="travel-at" title="出行时间">
|
||||
<view slot="right-icon" class="travel-at-content">
|
||||
<picker wx:if="{{!travelAtUndecided}}" class="picker" mode="date" model:value="{{date}}">
|
||||
@ -51,13 +52,13 @@
|
||||
/>
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell title="旅行天数" t-class="days-cell">
|
||||
<t-cell title="出行天数" class="days {{daysUndecided ? 'undecided' : 'decided'}}">
|
||||
<view slot="right-icon" class="days-content">
|
||||
<t-stepper
|
||||
wx:if="{{!daysUndecided}}"
|
||||
theme="filled"
|
||||
model:value="{{days}}"
|
||||
size="medium"
|
||||
size="large"
|
||||
min="{{1}}"
|
||||
max="{{999}}"
|
||||
t-class="stepper"
|
||||
@ -74,40 +75,28 @@
|
||||
/>
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell title="交通方式">
|
||||
<view slot="right-icon">
|
||||
<picker
|
||||
class="picker"
|
||||
mode="selector"
|
||||
range="{{transportationTypes}}"
|
||||
range-key="label"
|
||||
value="{{transportationTypeIndex}}"
|
||||
bindchange="onChangeTransportationType"
|
||||
>
|
||||
<view class="slot">
|
||||
<text>{{transportationTypes[transportationTypeIndex].label}}</text>
|
||||
<t-icon name="chevron-right" size="20px" class="icon" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell title="状态">
|
||||
<view slot="right-icon">
|
||||
<picker
|
||||
class="picker"
|
||||
mode="selector"
|
||||
range="{{statuses}}"
|
||||
range-key="label"
|
||||
value="{{statusIndex}}"
|
||||
bindchange="onChangeStatus"
|
||||
>
|
||||
<view class="slot">
|
||||
<text>{{statuses[statusIndex].label}}</text>
|
||||
<t-icon name="chevron-right" size="20px" class="icon" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</t-cell>
|
||||
<picker
|
||||
mode="selector"
|
||||
range="{{transportationTypes}}"
|
||||
range-key="label"
|
||||
value="{{transportationTypeIndex}}"
|
||||
bindchange="onChangeTransportationType"
|
||||
>
|
||||
<t-cell title="交通方式" arrow>
|
||||
<view slot="note" class="note">{{transportationTypes[transportationTypeIndex].label}}</view>
|
||||
</t-cell>
|
||||
</picker>
|
||||
<picker
|
||||
mode="selector"
|
||||
range="{{statuses}}"
|
||||
range-key="label"
|
||||
value="{{statusIndex}}"
|
||||
bindchange="onChangeStatus"
|
||||
>
|
||||
<t-cell title="状态" arrow>
|
||||
<view slot="note" class="note">{{statuses[statusIndex].label}}</view>
|
||||
</t-cell>
|
||||
</picker>
|
||||
</t-cell-group>
|
||||
<view wx:if="{{mode === 'create'}}" class="submit-section">
|
||||
<t-button
|
||||
@ -117,7 +106,7 @@
|
||||
bind:tap="submit"
|
||||
disabled="{{isSaving}}"
|
||||
>
|
||||
创建旅行
|
||||
创建出行
|
||||
</t-button>
|
||||
</view>
|
||||
<view wx:else class="submit-section horizontal">
|
||||
@ -148,7 +137,7 @@
|
||||
<!-- 删除确认对话框 -->
|
||||
<t-dialog
|
||||
visible="{{deleteDialogVisible}}"
|
||||
title="删除旅行计划"
|
||||
title="删除出行计划"
|
||||
confirm-btn="{{ {content: '删除', variant: 'text', theme: 'danger'} }}"
|
||||
cancel-btn="取消"
|
||||
bind:confirm="confirmDelete"
|
||||
|
||||
Reference in New Issue
Block a user