diff --git a/miniprogram/api/TravelApi.ts b/miniprogram/api/TravelApi.ts index 614387b..1ec4d1d 100644 --- a/miniprogram/api/TravelApi.ts +++ b/miniprogram/api/TravelApi.ts @@ -3,22 +3,22 @@ import { Travel } from "../types/Travel"; import { QueryPage, QueryPageResult } from "../types/Model"; /** - * Travel 旅行计划 API + * Travel 出行计划 API * * 按业务模块封装网络请求,使代码更清晰、可维护 */ export class TravelApi { /** - * 获取旅行详情 + * 获取出行详情 * - * @param id - 旅行 ID + * @param id - 出行 ID */ static getDetail(id: number | string): Promise { return Network.get(`/journal/travel/${id}`); } /** - * 旅行分页列表 + * 出行分页列表 * * @param pageParams - 分页参数 */ @@ -27,9 +27,9 @@ export class TravelApi { } /** - * 创建旅行 + * 创建出行 * - * @param data - 旅行数据 + * @param data - 出行数据 */ static create(data: Partial): Promise { return Network.post("/journal/travel/create", data, { @@ -39,9 +39,9 @@ export class TravelApi { } /** - * 更新旅行 + * 更新出行 * - * @param data - 旅行数据(必须包含 id) + * @param data - 出行数据(必须包含 id) */ static update(data: Partial & { id: number }): Promise { return Network.post("/journal/travel/update", data, { @@ -51,9 +51,9 @@ export class TravelApi { } /** - * 删除旅行 + * 删除出行 * - * @param id - 旅行 ID + * @param id - 出行 ID */ static delete(id: number): Promise { return Network.post("/journal/travel/delete", { id }); diff --git a/miniprogram/api/TravelLocationApi.ts b/miniprogram/api/TravelLocationApi.ts index 49719c7..680c342 100644 --- a/miniprogram/api/TravelLocationApi.ts +++ b/miniprogram/api/TravelLocationApi.ts @@ -3,13 +3,13 @@ import { TravelLocation } from "../types/Travel"; import { QueryPage, QueryPageResult } from "../types/Model"; /** - * TravelLocation 旅行地点 API + * TravelLocation 出行地点 API * * 按业务模块封装网络请求,使代码更清晰、可维护 */ export class TravelLocationApi { /** - * 获取旅行地点详情 + * 获取出行地点详情 * * @param id - 地点 ID */ @@ -18,7 +18,7 @@ export class TravelLocationApi { } /** - * 获取旅行地点分页列表 + * 获取出行地点分页列表 * * @param pageParams - 分页参数(通常包含 travelId 筛选) */ @@ -27,7 +27,7 @@ export class TravelLocationApi { } /** - * 创建旅行地点 + * 创建出行地点 * * @param data - 地点数据 */ @@ -39,7 +39,7 @@ export class TravelLocationApi { } /** - * 更新旅行地点 + * 更新出行地点 * * @param data - 地点数据(必须包含 id) */ @@ -51,7 +51,7 @@ export class TravelLocationApi { } /** - * 删除旅行地点 + * 删除出行地点 * * @param id - 地点 ID */ @@ -60,7 +60,7 @@ export class TravelLocationApi { } /** - * 批量获取旅行地点 + * 批量获取出行地点 * * @param ids - 地点 ID 数组 */ diff --git a/miniprogram/app.json b/miniprogram/app.json index 4294f01..818c863 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -49,7 +49,7 @@ "selectedIconPath": "@tabBarIconMomentActive" }, { - "text": "旅行", + "text": "出行", "pagePath": "pages/main/travel/index", "iconPath": "@tabBarIconTravel", "selectedIconPath": "@tabBarIconTravelActive" diff --git a/miniprogram/components/background/snowflake/index.json b/miniprogram/components/background/snowflake/index.json index 7efff18..e5dd770 100644 --- a/miniprogram/components/background/snowflake/index.json +++ b/miniprogram/components/background/snowflake/index.json @@ -1,4 +1,6 @@ { "component": true, - "usingComponents": {} + "usingComponents": { + "t-icon": "tdesign-miniprogram/icon/icon" + } } \ No newline at end of file diff --git a/miniprogram/components/background/snowflake/index.less b/miniprogram/components/background/snowflake/index.less index a314274..434e9ec 100644 --- a/miniprogram/components/background/snowflake/index.less +++ b/miniprogram/components/background/snowflake/index.less @@ -23,31 +23,9 @@ page { } .snowflake { - width: 10px; - height: 10px; + color: var(--theme-brand-gao); display: block; position: absolute; animation: snowflakeFall linear infinite; - - &::before, - &::after { - content: ''; - position: absolute; - background: var(--theme-brand-gao); - opacity: .8; - } - - &::before { - top: 45%; - left: 0; - width: 100%; - height: 10%; - } - - &::after { - left: 45%; - width: 10%; - height: 100%; - } } } diff --git a/miniprogram/components/background/snowflake/index.ts b/miniprogram/components/background/snowflake/index.ts index 0c47e33..deb8927 100644 --- a/miniprogram/components/background/snowflake/index.ts +++ b/miniprogram/components/background/snowflake/index.ts @@ -20,7 +20,7 @@ Component({ createSnowflake() { const snowflake = { x: Toolkit.random(0, this.data.docWidth), - s: Toolkit.random(6, 20), + s: Toolkit.random(16, 64), speed: Toolkit.random(14, 26) }; this.setData({ diff --git a/miniprogram/components/background/snowflake/index.wxml b/miniprogram/components/background/snowflake/index.wxml index 96ba115..a4f71cd 100644 --- a/miniprogram/components/background/snowflake/index.wxml +++ b/miniprogram/components/background/snowflake/index.wxml @@ -1,9 +1,10 @@ - + style="left: {{item.x}}px; font-size: {{item.s}}rpx; animation-duration: {{item.speed}}s;" + name="snowflake" + /> diff --git a/miniprogram/components/journal-detail-popup/index.less b/miniprogram/components/journal-detail-popup/index.less index 6b2206b..517853d 100644 --- a/miniprogram/components/journal-detail-popup/index.less +++ b/miniprogram/components/journal-detail-popup/index.less @@ -57,7 +57,7 @@ padding: 4rpx 12rpx; font-size: 24rpx; font-weight: bold; - background: var(--theme-bg-journal); + background: var(--theme-bg-card); border-radius: 12rpx; } } diff --git a/miniprogram/components/travel-location-popup/index.less b/miniprogram/components/travel-location-popup/index.less index 35b6c09..0db5f13 100644 --- a/miniprogram/components/travel-location-popup/index.less +++ b/miniprogram/components/travel-location-popup/index.less @@ -81,7 +81,7 @@ padding: 4rpx 12rpx; font-size: 24rpx; font-weight: bold; - background: var(--theme-bg-journal); + background: var(--theme-bg-card); border-radius: 12rpx; } } diff --git a/miniprogram/components/travel-location-popup/index.wxml b/miniprogram/components/travel-location-popup/index.wxml index f179775..433e38a 100644 --- a/miniprogram/components/travel-location-popup/index.wxml +++ b/miniprogram/components/travel-location-popup/index.wxml @@ -43,9 +43,6 @@ 重要性 {{item.importance}} - - 已出行 {{item.travelCount}} 次 - 需要身份证 diff --git a/miniprogram/pages/main/journal-editor/index.less b/miniprogram/pages/main/journal-editor/index.less index 8c1d9c8..e814c77 100644 --- a/miniprogram/pages/main/journal-editor/index.less +++ b/miniprogram/pages/main/journal-editor/index.less @@ -26,6 +26,7 @@ display: flex; .radio { + background: transparent; margin-right: 1em; } } diff --git a/miniprogram/pages/main/journal-editor/index.ts b/miniprogram/pages/main/journal-editor/index.ts index 19ea5a4..e91c764 100644 --- a/miniprogram/pages/main/journal-editor/index.ts +++ b/miniprogram/pages/main/journal-editor/index.ts @@ -77,7 +77,7 @@ Page({ async onLoad(options: any) { // 授权定位 const setting = await wx.getSetting(); - wx.setStorageSync("isAuthLocation", setting.authSetting["scope.userLocation"]); + wx.setStorageSync("isAuthLocation", setting.authSetting["scope.userLocation"] || false); let isAuthLocation = JSON.parse(wx.getStorageSync("isAuthLocation")); this.setData({ isAuthLocation }); if (!isAuthLocation) { @@ -293,7 +293,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; diff --git a/miniprogram/pages/main/journal-map/index.less b/miniprogram/pages/main/journal-map/index.less index 2601296..5671ea3 100644 --- a/miniprogram/pages/main/journal-map/index.less +++ b/miniprogram/pages/main/journal-map/index.less @@ -14,7 +14,7 @@ width: fit-content; min-width: 350rpx; max-width: 450rpx; - background: #fff; + background: var(--theme-bg-card-secondary); box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, .15); border-radius: 6rpx; @@ -56,7 +56,7 @@ flex-direction: column; .location { - color: #333; + color: var(--theme-text-primary); overflow: hidden; font-size: 30rpx; white-space: nowrap; @@ -68,7 +68,7 @@ display: flex; .date { - color: #999; + color: var(--theme-text-secondary); font-size: 24rpx; margin-right: 16rpx; } diff --git a/miniprogram/pages/main/journal-map/index.ts b/miniprogram/pages/main/journal-map/index.ts index 3d130c8..a038295 100644 --- a/miniprogram/pages/main/journal-map/index.ts +++ b/miniprogram/pages/main/journal-map/index.ts @@ -3,19 +3,7 @@ import config from "../../../config/index"; import Time from "../../../utils/Time"; import { Journal, JournalPageType } from "../../../types/Journal"; import Toolkit from "../../../utils/Toolkit"; - -interface MapMarker { - id: number; - latitude: number; - longitude: number; - width: number; - height: number; - customCallout: { - anchorY: number; - anchorX: number; - display: string; - }; -} +import { MapMarker } from "../../../types/UI"; interface LocationMarker { locationKey: string; // 位置键 "lat,lng" diff --git a/miniprogram/pages/main/journal/index.wxml b/miniprogram/pages/main/journal/index.wxml index cad41e9..b3450a6 100644 --- a/miniprogram/pages/main/journal/index.wxml +++ b/miniprogram/pages/main/journal/index.wxml @@ -41,7 +41,7 @@ { - const extData = JSON.parse(item.ext); + const ext = JSON.parse(item.ext) as MediaAttachExt; + const thumbURL = `${config.url}/attachment/read/${item.mongoId}`; + const sourceURL = `${config.url}/attachment/read/${ext.sourceMongoId}`; return { id: item.id, - type: extData.isImage ? ItemType.IMAGE : ItemType.VIDEO, - mongoId: item.mongoId, - thumbUrl: `${config.url}/attachment/read/${item.mongoId}`, - sourceMongoId: extData.sourceMongoId, + type: ext.isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO, + thumbURL, + sourceURL, checked: false } as Item; }) @@ -176,8 +172,8 @@ Page({ const sources = this.data.list.slice(startIndex, endIndex).map((item: Item) => { return { - url: `${config.url}/attachment/read/${item.sourceMongoId}`, - type: item.type === 0 ? "image" : "video" + url: item.sourceURL, + type: item.type.toLowerCase() } }) as any; wx.previewMedia({ @@ -347,13 +343,14 @@ Page({ wx.showToast({ title: "上传成功", icon: "success" }); const list = resp.data.data; const added = list.map((item: any) => { - const extData = JSON.parse(item.ext); + const ext = JSON.parse(item.ext) as MediaAttachExt; + const thumbURL = `${config.url}/attachment/read/${item.mongoId}`; + const sourceURL = `${config.url}/attachment/read/${ext.sourceMongoId}`; return { id: item.id, - type: extData.isImage ? ItemType.IMAGE : ItemType.VIDEO, - mongoId: item.mongoId, - thumbUrl: `${config.url}/attachment/read/${item.mongoId}`, - sourceMongoId: extData.sourceMongoId, + type: ext.isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO, + thumbURL, + sourceURL, checked: false } as Item; }); diff --git a/miniprogram/pages/main/moment/index.wxml b/miniprogram/pages/main/moment/index.wxml index 8e79c9f..95ce4da 100644 --- a/miniprogram/pages/main/moment/index.wxml +++ b/miniprogram/pages/main/moment/index.wxml @@ -63,8 +63,8 @@ - + @@ -24,7 +24,7 @@ - {{travel.title || '未命名旅行'}} + {{travel.title || '未命名出行'}} 基本信息 @@ -34,7 +34,7 @@ 未定 - + {{travel.days}} 天 未定 @@ -44,18 +44,16 @@ {{transportLabels[travel.transportationType]}} - - + + 详细说明 - + 地点列表 - - - - - + + 地图浏览 + @@ -73,14 +71,18 @@ > {{locationTypeLabels[item.type]}} - - - ¥{{item.amount}} - 需要身份证 + + + 需要预约 + + + + ¥{{item.amount}} + 重要程度 @@ -97,8 +99,7 @@ - - + @@ -119,7 +120,7 @@ t-class="edit" bind:tap="toEdit" > - 编辑旅行计划 + 编辑出行计划 @@ -128,7 +129,7 @@ .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; + } + } } } diff --git a/miniprogram/pages/main/travel-editor/index.ts b/miniprogram/pages/main/travel-editor/index.ts index 557df1a..1214f89 100644 --- a/miniprogram/pages/main/travel-editor/index.ts +++ b/miniprogram/pages/main/travel-editor/index.ts @@ -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, diff --git a/miniprogram/pages/main/travel-editor/index.wxml b/miniprogram/pages/main/travel-editor/index.wxml index 9378cae..27f7192 100644 --- a/miniprogram/pages/main/travel-editor/index.wxml +++ b/miniprogram/pages/main/travel-editor/index.wxml @@ -1,5 +1,5 @@ - + 取消 @@ -11,12 +11,12 @@ + 基本信息 标题 @@ -31,6 +31,7 @@ + 详细信息 @@ -51,13 +52,13 @@ /> - + - - - - - {{transportationTypes[transportationTypeIndex].label}} - - - - - - - - - - {{statuses[statusIndex].label}} - - - - - + + + {{transportationTypes[transportationTypeIndex].label}} + + + + + {{statuses[statusIndex].label}} + + - 创建旅行 + 创建出行 @@ -148,7 +137,7 @@ { try { - const extStr = thumbItem.ext ? thumbItem.ext.toString() : ""; - if (!extStr) { - return; - } - const ext = JSON.parse(extStr) as MediaAttachExt; + const ext = JSON.parse(thumbItem.ext!.toString()) as MediaAttachExt; const thumbURL = `${config.url}/attachment/read/${thumbItem.mongoId}`; const sourceURL = `${config.url}/attachment/read/${ext.sourceMongoId}`; mediaItems.push({ @@ -120,35 +111,28 @@ Page({ }); // 构建地图标记 - const mapMarkers: WechatMiniprogram.MapMarker[] = []; + const mapMarkers: MapMarker[] = []; if (location.lat !== undefined && location.lng !== undefined) { mapMarkers.push({ id: 0, latitude: location.lat, longitude: location.lng, - width: 30, + width: 24, height: 30, - callout: { - content: location.title || "地点", - display: "ALWAYS", - padding: 10, - borderRadius: 5, - bgColor: "#FFFFFF", - color: "#333333", - fontSize: 12, - textAlign: "center" + customCallout: { + anchorY: 0, + anchorX: 0, + display: "ALWAYS" } }); } console.log(mediaItems); - + this.setData({ location: { ...location, - mediaItems, - firstTravelTime: location.firstTraveledAt ? Time.toDateTime(location.firstTraveledAt) : "", - lastTravelTime: location.lastTraveledAt ? Time.toDateTime(location.lastTraveledAt) : "" + mediaItems }, travelId: location.travelId ? String(location.travelId) : this.data.travelId, mapMarkers diff --git a/miniprogram/pages/main/travel-location-detail/index.wxml b/miniprogram/pages/main/travel-location-detail/index.wxml index d6eb721..371ba5b 100644 --- a/miniprogram/pages/main/travel-location-detail/index.wxml +++ b/miniprogram/pages/main/travel-location-detail/index.wxml @@ -20,12 +20,6 @@ - - - - {{locationTypeLabels[location.type]}} - - {{location.title || '未命名地点'}} @@ -33,6 +27,11 @@ 位置信息 + + > + + + + {{location.title || '地点'}} + + + + ¥{{location.amount}} - + {{location.requireIdCard ? '需要' : '无需'}} - - + + {{location.requireAppointment ? '需要' : '无需'}} @@ -78,19 +85,6 @@ - - - 出行记录 - - {{location.firstTravelTime || '未记录'}} - - - {{location.lastTravelTime || '未记录'}} - - - {{location.travelCount || 0}} 次 - - 详细说明 diff --git a/miniprogram/pages/main/travel-location-editor/index.less b/miniprogram/pages/main/travel-location-editor/index.less index f230200..53cc88e 100644 --- a/miniprogram/pages/main/travel-location-editor/index.less +++ b/miniprogram/pages/main/travel-location-editor/index.less @@ -30,17 +30,18 @@ line-height: 64rpx; } - .location { + &.location { - .title { - width: 2em; + .note { + color: var(--theme-text-primary); } - } - .picker .slot { - gap: 16rpx; - display: flex; - align-items: center; + .value { + + .title { + width: 2em; + } + } } &.media { @@ -127,103 +128,36 @@ } } } - } - .media-section { - margin-top: 48rpx; - padding: 32rpx; - background: var(--theme-bg-card); + &.upload { + gap: 16rpx; + display: flex; + padding: 24rpx 32rpx; + margin-top: 24rpx; + align-items: center; + border-radius: 12rpx; + background: var(--theme-bg-card); - .section-title { - color: var(--theme-text-primary); - margin-bottom: 24rpx; - font-size: 32rpx; - font-weight: bold; + .text { + color: var(--theme-text-secondary); + font-size: 28rpx; + } } - .media-grid { + &.action { gap: 24rpx; - display: grid; - grid-template-columns: repeat(3, 1fr); - - .media-item { - width: 100%; - height: 200rpx; - overflow: hidden; - position: relative; - border-radius: 12rpx; - - .media-img { - width: 100%; - height: 100%; - } - - .video-badge { - top: 50%; - left: 50%; - display: flex; - position: absolute; - transform: translate(-50%, -50%); - align-items: center; - justify-content: center; - } - - .media-delete { - top: 8rpx; - right: 8rpx; - width: 48rpx; - height: 48rpx; - display: flex; - position: absolute; - background: rgba(0, 0, 0, .5); - align-items: center; - border-radius: 50%; - justify-content: center; - } + display: flex; + padding: 24rpx 16rpx 48rpx 16rpx; + + .delete-btn { + flex: .6; } - - .media-add { - width: 100%; - height: 200rpx; - display: flex; - align-items: center; - border-radius: 12rpx; - justify-content: center; - background: var(--theme-bg-page); - border: 2rpx dashed var(--theme-border); + + .submit-btn { + flex: 1; } } } - - .upload-info { - gap: 16rpx; - display: flex; - padding: 24rpx 32rpx; - margin-top: 24rpx; - align-items: center; - border-radius: 12rpx; - background: var(--theme-bg-card); - - .upload-text { - color: var(--theme-text-secondary); - font-size: 28rpx; - } - } - - .submit-section { - gap: 24rpx; - display: flex; - padding: 24rpx 16rpx 48rpx 16rpx; - margin-top: 64rpx; - - .delete-btn { - flex: .6; - } - - .submit-btn { - flex: 1; - } - } } } diff --git a/miniprogram/pages/main/travel-location-editor/index.ts b/miniprogram/pages/main/travel-location-editor/index.ts index e5a304b..dbfbda5 100644 --- a/miniprogram/pages/main/travel-location-editor/index.ts +++ b/miniprogram/pages/main/travel-location-editor/index.ts @@ -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, diff --git a/miniprogram/pages/main/travel-location-editor/index.wxml b/miniprogram/pages/main/travel-location-editor/index.wxml index 136ab3c..753c65e 100644 --- a/miniprogram/pages/main/travel-location-editor/index.wxml +++ b/miniprogram/pages/main/travel-location-editor/index.wxml @@ -10,14 +10,16 @@ 加载中... - + 位置信息 - - {{locationTypes[locationTypeIndex].label}} - - + + + {{locationTypes[locationTypeIndex]}} + + + 位置 - {{location}} + {{location}} @@ -46,6 +48,7 @@ placeholder="0" label="费用" suffix="元" + type="digit" align="right" /> @@ -207,16 +210,16 @@ - + - {{uploadInfo}} + {{uploadInfo}} - + - - - - - - + @@ -46,13 +46,13 @@ - + - {{travel.title || '未命名旅行'}} + {{travel.title || '未命名出行'}} {{travel.content}} - + - {{travel.travelDate}} {{travel.travelTime}} + {{travel.travelDate}} {{travel.days}} 天 - + {{transportLabels[travel.transportationType]}} diff --git a/miniprogram/tdesign.less b/miniprogram/tdesign.less index 60137be..25371ac 100644 --- a/miniprogram/tdesign.less +++ b/miniprogram/tdesign.less @@ -256,10 +256,10 @@ page { --td-font-size-l: var(--td-font-size-title-large); --td-font-size-xl: var(--td-font-size-title-extra-large); --td-font-size-xxl: var(--td-font-size-headline-large); - --td-radius-small: 2px; - --td-radius-default: 4px; - --td-radius-large: 6px; - --td-radius-extraLarge: 7px; - --td-radius-round: 999px; + --td-radius-small: 8rpx; + --td-radius-default: 16rpx; + --td-radius-large: 24px; + --td-radius-extraLarge: 32rpx; + --td-radius-round: 9999rpx; --td-radius-circle: 50%; } \ No newline at end of file diff --git a/miniprogram/theme.less b/miniprogram/theme.less index 39bb5ba..7db672b 100644 --- a/miniprogram/theme.less +++ b/miniprogram/theme.less @@ -13,6 +13,7 @@ page { --theme-bg-primary: #FFF; --theme-bg-secondary: #F5F5F5; --theme-bg-card: #FFF; + --theme-bg-card-secondary: #F4F4F4; --theme-bg-journal: #FFF2C8; --theme-bg-overlay: rgba(0, 0, 0, .1); --theme-bg-menu: rgba(255, 255, 255, .95); @@ -68,7 +69,8 @@ page { --theme-bg-primary: #1A1A1A; --theme-bg-secondary: #2A2A2A; --theme-bg-card: #2C2C2C; - --theme-bg-journal: #3A3A2E; + --theme-bg-card-secondary: #404040; + --theme-bg-journal: #404040; --theme-bg-overlay: rgba(0, 0, 0, .3); --theme-bg-menu: rgba(40, 40, 40, .95); diff --git a/miniprogram/types/Travel.ts b/miniprogram/types/Travel.ts index b57bb03..b062739 100644 --- a/miniprogram/types/Travel.ts +++ b/miniprogram/types/Travel.ts @@ -22,28 +22,38 @@ export const TransportationTypeLabel: Record = { [TransportationType.OTHER]: "其他" }; -/** 旅行状态 */ +/** 交通类型图标映射 */ +export const TransportationTypeIcon: Record = { + [TransportationType.PLANE]: "flight-takeoff", + [TransportationType.TRAIN]: "map-route", + [TransportationType.CAR]: "vehicle", + [TransportationType.SHIP]: "anchor", + [TransportationType.SELF_DRIVING]: "vehicle", + [TransportationType.OTHER]: "compass" +}; + +/** 出行状态 */ export enum TravelStatus { PLANNING = "PLANNING", ONGOING = "ONGOING", COMPLETED = "COMPLETED" } -/** 旅行状态中文映射 */ +/** 出行状态中文映射 */ export const TravelStatusLabel: Record = { [TravelStatus.PLANNING]: "计划中", [TravelStatus.ONGOING]: "进行中", [TravelStatus.COMPLETED]: "已完成" }; -/** 旅行状态图标映射 */ +/** 出行状态图标映射 */ export const TravelStatusIcon: Record = { [TravelStatus.PLANNING]: "calendar", [TravelStatus.ONGOING]: "play-circle", [TravelStatus.COMPLETED]: "check-circle" }; -/** 旅行计划实体 */ +/** 出行计划实体 */ export interface Travel extends Model { /** 交通类型 */ transportationType?: TransportationType; @@ -55,10 +65,10 @@ export interface Travel extends Model { content?: string; /** 出行时间戳 */ - travelAt?: number; + travelAt?: number | null; /** 天数 */ - days?: number; + days?: number | null; /** 状态 */ status?: TravelStatus; @@ -70,7 +80,7 @@ export interface Travel extends Model { travelTime?: string; } -/** 旅行分页查询 */ +/** 出行分页查询 */ export interface TravelPage extends QueryPage { /** 条件过滤 */ equalsExample?: { @@ -80,37 +90,40 @@ export interface TravelPage extends QueryPage { /** 地点类型 */ export enum TravelLocationType { - ATTRACTION = "ATTRACTION", + FOOD = "FOOD", HOTEL = "HOTEL", - RESTAURANT = "RESTAURANT", TRANSPORT = "TRANSPORT", + ATTRACTION = "ATTRACTION", SHOPPING = "SHOPPING", - OTHER = "OTHER" + PLAY = "PLAY", + LIFE = "LEFE" } /** 地点类型中文映射 */ export const TravelLocationTypeLabel: Record = { - [TravelLocationType.ATTRACTION]: "景点", + [TravelLocationType.FOOD]: "美食", [TravelLocationType.HOTEL]: "酒店", - [TravelLocationType.RESTAURANT]: "餐厅", - [TravelLocationType.TRANSPORT]: "交通站点", + [TravelLocationType.TRANSPORT]: "交通", + [TravelLocationType.ATTRACTION]: "景点", [TravelLocationType.SHOPPING]: "购物", - [TravelLocationType.OTHER]: "其他" + [TravelLocationType.PLAY]: "玩乐", + [TravelLocationType.LIFE]: "生活" }; /** 地点类型图标映射 */ export const TravelLocationTypeIcon: Record = { - [TravelLocationType.ATTRACTION]: "location", - [TravelLocationType.HOTEL]: "home", - [TravelLocationType.RESTAURANT]: "shop", - [TravelLocationType.TRANSPORT]: "map-route", - [TravelLocationType.SHOPPING]: "cart", - [TravelLocationType.OTHER]: "ellipsis" + [TravelLocationType.FOOD]: "chicken", + [TravelLocationType.HOTEL]: "city-8", + [TravelLocationType.TRANSPORT]: "map-route-planning", + [TravelLocationType.ATTRACTION]: "image-1", + [TravelLocationType.SHOPPING]: "shop", + [TravelLocationType.PLAY]: "ferris-wheel", + [TravelLocationType.LIFE]: "cart" }; -/** 旅行地点实体 */ +/** 出行地点实体 */ export interface TravelLocation extends Model { - /** 关联的旅行计划 ID */ + /** 关联的出行计划 ID */ travelId?: number; /** 地点类型 */ @@ -140,15 +153,6 @@ export interface TravelLocation extends Model { /** 是否需要预约 */ requireAppointment?: boolean; - /** 首次出行时间戳 */ - firstTraveledAt?: number; - - /** 上次出行时间戳 */ - lastTraveledAt?: number; - - /** 出行次数 */ - travelCount?: number; - /** 评分 */ score?: number; diff --git a/miniprogram/types/UI.ts b/miniprogram/types/UI.ts index 072907b..43a71b6 100644 --- a/miniprogram/types/UI.ts +++ b/miniprogram/types/UI.ts @@ -55,10 +55,10 @@ export type WechatMediaItem = { export enum MediaItemType { /** 图片 */ - IMAGE, + IMAGE = "image", /** 视频 */ - VIDEO + VIDEO = "video" } /** 位置 */ @@ -79,4 +79,17 @@ export enum JournalDetailType { DATE = "DATE", LOCATION = "LOCATION" -} \ No newline at end of file +} + +export interface MapMarker { + id: number; + latitude: number; + longitude: number; + width: number; + height: number; + customCallout: { + anchorY: number; + anchorX: number; + display: string; + }; +} diff --git a/miniprogram/utils/Network.ts b/miniprogram/utils/Network.ts index 756767a..b0ba8d9 100644 --- a/miniprogram/utils/Network.ts +++ b/miniprogram/utils/Network.ts @@ -1,5 +1,6 @@ import config from "../config/index"; import { Response, QueryPage, QueryPageResult, TempFileResponse } from "../types/Model"; +import { MediaItemType } from "../types/UI"; /** 微信媒体项(用于上传) */ export interface WechatMediaItem { @@ -13,7 +14,7 @@ export interface WechatMediaItem { size?: number; /** 媒体类型 */ - type?: string; + type?: MediaItemType; } /** 请求选项 */