Compare commits

...

3 Commits

Author SHA1 Message Date
bf5deff045 update 1.6.4 2025-12-23 14:57:37 +08:00
f94cf05f62 preview travel location attach in list 2025-12-23 14:45:15 +08:00
9538a21e42 add MALL travel type 2025-12-23 14:27:51 +08:00
5 changed files with 50 additions and 4 deletions

View File

@ -26,7 +26,7 @@
</view>
<view class="item">
<text class="label">版本:</text>
<text>1.6.3</text>
<text>1.6.4</text>
</view>
<view class="item copyright">
<text>{{copyright}}</text>

View File

@ -66,6 +66,31 @@
}
.location {
.thumb {
width: 96rpx;
height: 96rpx;
border: 1px solid var(--theme-border-light);
overflow: hidden;
background: var(--theme-bg-page);
flex-shrink: 0;
border-radius: 16rpx;
}
.thumb-img {
width: 100%;
height: 100%;
}
.thumb-placeholder {
color: var(--theme-text-secondary);
width: 100%;
height: 100%;
display: flex;
font-size: 24rpx;
background: var(--theme-bg-page);
align-items: center;
justify-content: center;
}
.note {
width: 2em;

View File

@ -3,8 +3,14 @@
import Time from "../../../utils/Time";
import { TravelApi } from "../../../api/TravelApi";
import { TravelLocationApi } from "../../../api/TravelLocationApi";
import config from "../../../config/index";
import { Travel, TravelStatusLabel, TravelStatusIcon, TransportationTypeLabel, TravelLocation, TravelLocationTypeLabel, TravelLocationTypeIcon, TransportationTypeIcon, TravelLocationType } from "../../../types/Travel";
interface TravelLocationView extends TravelLocation {
/** 预览图 */
previewThumb?: string;
}
interface TravelDetailData {
/** 出行详情 */
travel: Travel | null;
@ -13,7 +19,7 @@ interface TravelDetailData {
/** 是否正在加载 */
isLoading: boolean;
/** 地点列表 */
locations: TravelLocation[];
locations: TravelLocationView[];
/** 是否正在加载地点 */
isLoadingLocations: boolean;
/** 状态标签映射 */
@ -140,7 +146,14 @@ Page({
equalsExample
});
this.setData({ locations: result.list });
const locations = result.list.map((location) => {
const previewItem = location.items && 0 < location.items.length ? location.items[0] : undefined;
return {
...location,
previewThumb: previewItem ? `${config.url}/attachment/read/${previewItem.mongoId}` : undefined
};
});
this.setData({ locations });
} catch (error) {
console.error("获取地点列表失败:", error);
} finally {

View File

@ -71,12 +71,17 @@
class="location"
wx:for="{{locations}}"
wx:key="id"
left-icon="{{locationTypeIcons[item.type]}}"
title="{{item.title || '未命名地点'}}"
bind:tap="toLocationDetail"
data-id="{{item.id}}"
arrow
>
<view slot="left-icon" class="thumb">
<image wx:if="{{item.previewThumb}}" class="thumb-img" src="{{item.previewThumb}}" mode="aspectFill" />
<view wx:else class="thumb-placeholder">
<t-icon name="{{locationTypeIcons[item.type]}}" size="28px" color="var(--theme-wx)" />
</view>
</view>
<view slot="note" class="note">{{locationTypeLabels[item.type]}}</view>
<view slot="description" class="description">
<view wx:if="{{item.requireIdCard}}" class="item">

View File

@ -94,6 +94,7 @@ export enum TravelLocationType {
HOTEL = "HOTEL",
TRANSPORT = "TRANSPORT",
ATTRACTION = "ATTRACTION",
MALL = "MALL",
SHOPPING = "SHOPPING",
PLAY = "PLAY",
LIFE = "LIFE"
@ -105,6 +106,7 @@ export const TravelLocationTypeLabel: Record<TravelLocationType, string> = {
[TravelLocationType.HOTEL]: "酒店",
[TravelLocationType.TRANSPORT]: "交通",
[TravelLocationType.ATTRACTION]: "景点",
[TravelLocationType.MALL]: "商场",
[TravelLocationType.SHOPPING]: "购物",
[TravelLocationType.PLAY]: "玩乐",
[TravelLocationType.LIFE]: "生活"
@ -116,6 +118,7 @@ export const TravelLocationTypeIcon: Record<TravelLocationType, string> = {
[TravelLocationType.HOTEL]: "city-8",
[TravelLocationType.TRANSPORT]: "map-route-planning",
[TravelLocationType.ATTRACTION]: "image-1",
[TravelLocationType.MALL]: "chart-3d",
[TravelLocationType.SHOPPING]: "shop",
[TravelLocationType.PLAY]: "ferris-wheel",
[TravelLocationType.LIFE]: "location"