update style
This commit is contained in:
@ -10,9 +10,9 @@ import { MediaItem, MediaItemType } from "../../../types/UI";
|
||||
interface TravelLocationEditorData {
|
||||
/** 模式:create 或 edit */
|
||||
mode: "create" | "edit";
|
||||
/** 旅行地点 ID(编辑模式) */
|
||||
/** 出行地点 ID(编辑模式) */
|
||||
id?: number;
|
||||
/** 关联的旅行计划 ID */
|
||||
/** 关联的出行计划 ID */
|
||||
travelId: number;
|
||||
/** 地点类型 */
|
||||
type: TravelLocationType;
|
||||
@ -32,12 +32,6 @@ interface TravelLocationEditorData {
|
||||
requireIdCard: boolean;
|
||||
/** 是否需要预约 */
|
||||
requireAppointment: boolean;
|
||||
/** 首次出行时间戳 */
|
||||
firstTraveledAt: number;
|
||||
/** 上次出行时间戳 */
|
||||
lastTraveledAt: number;
|
||||
/** 出行次数 */
|
||||
travelCount: number;
|
||||
/** 评分 */
|
||||
score: number;
|
||||
/** 重要程度 */
|
||||
@ -55,11 +49,11 @@ interface TravelLocationEditorData {
|
||||
/** 上传进度信息 */
|
||||
uploadInfo: string;
|
||||
/** 地点类型选项 */
|
||||
locationTypes: { label: string; value: TravelLocationType }[];
|
||||
locationTypes: string[];
|
||||
/** 地点类型值数组 */
|
||||
locationTypeValues: TravelLocationType[];
|
||||
/** 地点类型选中索引 */
|
||||
locationTypeIndex: number;
|
||||
/** 地点类型选择器可见性 */
|
||||
locationTypePickerVisible: boolean;
|
||||
/** 删除对话框可见性 */
|
||||
deleteDialogVisible: boolean;
|
||||
/** 删除确认文本 */
|
||||
@ -82,9 +76,6 @@ Page({
|
||||
amount: 0,
|
||||
requireIdCard: false,
|
||||
requireAppointment: false,
|
||||
firstTraveledAt: 0,
|
||||
lastTraveledAt: 0,
|
||||
travelCount: 0,
|
||||
score: 3,
|
||||
importance: 1,
|
||||
mediaList: [],
|
||||
@ -96,16 +87,17 @@ Page({
|
||||
mediaItemTypeEnum: {
|
||||
...MediaItemType
|
||||
},
|
||||
locationTypes: [
|
||||
{ label: "景点", value: TravelLocationType.ATTRACTION },
|
||||
{ label: "酒店", value: TravelLocationType.HOTEL },
|
||||
{ label: "餐厅", value: TravelLocationType.RESTAURANT },
|
||||
{ label: "交通站点", value: TravelLocationType.TRANSPORT },
|
||||
{ label: "购物", value: TravelLocationType.SHOPPING },
|
||||
{ label: "其他", value: TravelLocationType.OTHER }
|
||||
locationTypes: ["美食", "酒店", "交通", "景点", "购物", "玩乐", "生活"],
|
||||
locationTypeValues: [
|
||||
TravelLocationType.FOOD,
|
||||
TravelLocationType.HOTEL,
|
||||
TravelLocationType.TRANSPORT,
|
||||
TravelLocationType.ATTRACTION,
|
||||
TravelLocationType.SHOPPING,
|
||||
TravelLocationType.PLAY,
|
||||
TravelLocationType.LIFE
|
||||
],
|
||||
locationTypeIndex: 0,
|
||||
locationTypePickerVisible: false,
|
||||
deleteDialogVisible: false,
|
||||
deleteConfirmText: ""
|
||||
},
|
||||
@ -115,7 +107,7 @@ Page({
|
||||
const travelId = options.travelId ? parseInt(options.travelId) : 0;
|
||||
if (!travelId) {
|
||||
wx.showToast({
|
||||
title: "缺少旅行计划 ID",
|
||||
title: "缺少出行计划 ID",
|
||||
icon: "error"
|
||||
});
|
||||
setTimeout(() => {
|
||||
@ -155,8 +147,8 @@ Page({
|
||||
|
||||
// 计算地点类型索引
|
||||
const type = location.type || TravelLocationType.ATTRACTION;
|
||||
const locationTypeIndex = this.data.locationTypes.findIndex(
|
||||
item => item.value === type
|
||||
const locationTypeIndex = this.data.locationTypeValues.findIndex(
|
||||
item => item === type
|
||||
);
|
||||
|
||||
const items = location.items || [];
|
||||
@ -186,9 +178,6 @@ Page({
|
||||
amount: location.amount || 0,
|
||||
requireIdCard: location.requireIdCard || false,
|
||||
requireAppointment: location.requireAppointment || false,
|
||||
firstTraveledAt: location.firstTraveledAt || 0,
|
||||
lastTraveledAt: location.lastTraveledAt || 0,
|
||||
travelCount: location.travelCount || 0,
|
||||
score: location.score !== undefined ? location.score : 3,
|
||||
importance: location.importance !== undefined ? location.importance : 1,
|
||||
mediaList,
|
||||
@ -212,30 +201,10 @@ Page({
|
||||
const index = e.detail.value;
|
||||
this.setData({
|
||||
locationTypeIndex: index,
|
||||
type: this.data.locationTypes[index].value
|
||||
type: this.data.locationTypeValues[index]
|
||||
});
|
||||
},
|
||||
|
||||
/** 显示地点类型选择器 */
|
||||
showLocationTypePicker() {
|
||||
this.setData({ locationTypePickerVisible: true });
|
||||
},
|
||||
|
||||
/** Picker 确认 */
|
||||
onPickerConfirm(e: any) {
|
||||
const index = e.detail.value;
|
||||
this.setData({
|
||||
locationTypeIndex: index,
|
||||
type: this.data.locationTypes[index].value,
|
||||
locationTypePickerVisible: false
|
||||
});
|
||||
},
|
||||
|
||||
/** Picker 取消 */
|
||||
onPickerCancel() {
|
||||
this.setData({ locationTypePickerVisible: false });
|
||||
},
|
||||
|
||||
/** 改变是否需要身份证 */
|
||||
onChangeRequireIdCard(e: any) {
|
||||
this.setData({ requireIdCard: e.detail.value });
|
||||
@ -355,7 +324,7 @@ Page({
|
||||
// 创建模式:只有 mediaList
|
||||
const sources = (this.data.mediaList as WechatMediaItem[]).map(item => ({
|
||||
url: item.path,
|
||||
type: MediaItemType[item.type].toLowerCase()
|
||||
type: item.type!.toLowerCase()
|
||||
}));
|
||||
|
||||
const total = sources.length;
|
||||
@ -371,11 +340,11 @@ Page({
|
||||
// 编辑模式:mediaList + newMediaList
|
||||
const sources = (this.data.mediaList as MediaItem[]).map(item => ({
|
||||
url: item.sourceURL,
|
||||
type: MediaItemType[item.type].toLowerCase()
|
||||
type: item.type.toLowerCase()
|
||||
}));
|
||||
const newSources = this.data.newMediaList.map(item => ({
|
||||
url: item.path,
|
||||
type: MediaItemType[item.type].toLowerCase()
|
||||
type: item.type!.toLowerCase()
|
||||
}));
|
||||
const allSources = [...sources, ...newSources];
|
||||
const itemIndex = isNewMedia ? this.data.mediaList.length + index : index;
|
||||
@ -514,9 +483,6 @@ Page({
|
||||
amount: this.data.amount,
|
||||
requireIdCard: this.data.requireIdCard,
|
||||
requireAppointment: this.data.requireAppointment,
|
||||
firstTraveledAt: this.data.firstTraveledAt,
|
||||
lastTraveledAt: this.data.lastTraveledAt,
|
||||
travelCount: this.data.travelCount,
|
||||
score: this.data.score,
|
||||
importance: this.data.importance,
|
||||
tempFileIds
|
||||
@ -573,9 +539,6 @@ Page({
|
||||
amount: this.data.amount,
|
||||
requireIdCard: this.data.requireIdCard,
|
||||
requireAppointment: this.data.requireAppointment,
|
||||
firstTraveledAt: this.data.firstTraveledAt,
|
||||
lastTraveledAt: this.data.lastTraveledAt,
|
||||
travelCount: this.data.travelCount,
|
||||
score: this.data.score,
|
||||
importance: this.data.importance,
|
||||
attachmentIds,
|
||||
|
||||
Reference in New Issue
Block a user