update style

This commit is contained in:
Timi
2025-12-17 16:16:10 +08:00
parent 423775c255
commit 369cfe2bf2
40 changed files with 375 additions and 507 deletions

View File

@ -1,7 +1,6 @@
{
"component": true,
"usingComponents": {
"t-tag": "tdesign-miniprogram/tag/tag",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-rate": "tdesign-miniprogram/rate/rate",
"t-icon": "tdesign-miniprogram/icon/icon",

View File

@ -24,12 +24,6 @@
line-height: 64rpx;
}
&.status {
display: flex;
margin-top: 24rpx;
justify-content: center;
}
&.title {
color: var(--theme-text-primary);
padding: 24rpx;
@ -67,6 +61,26 @@
width: 100%;
height: 520rpx;
}
.custom-callout {
width: fit-content;
max-width: 400rpx;
background: var(--theme-bg-card-secondary);
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, .15);
border-radius: 8rpx;
.callout-content {
padding: 12rpx 20rpx;
.callout-text {
color: var(--theme-text-primary);
overflow: hidden;
font-size: 28rpx;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
}
&.media {
@ -112,12 +126,13 @@
&.navigate {
padding: 0 16rpx;
margin-top: 90rpx;
}
&.action {
gap: 24rpx;
display: flex;
padding: 24rpx 16rpx 0 16rpx;
padding: 0 16rpx;
.edit {
flex: 2;

View File

@ -1,18 +1,13 @@
// pages/main/travel-location-detail/index.ts
import Time from "../../../utils/Time";
import config from "../../../config/index";
import { TravelLocationApi } from "../../../api/TravelLocationApi";
import { TravelLocation, TravelLocationTypeIcon, TravelLocationTypeLabel } from "../../../types/Travel";
import { MediaAttachExt, MediaAttachType } from "../../../types/Attachment";
import { MediaItem, MediaItemType } from "../../../types/UI";
import { MapMarker, MediaItem, MediaItemType } from "../../../types/UI";
import Toolkit from "../../../utils/Toolkit";
interface TravelLocationView extends TravelLocation {
/** 首次出行时间 */
firstTravelTime?: string;
/** 最近出行时间 */
lastTravelTime?: string;
/** 媒体列表 */
mediaItems?: MediaItem[];
}
@ -22,7 +17,7 @@ interface TravelLocationDetailData {
location: TravelLocationView | null;
/** 地点 ID */
locationId: string;
/** 行 ID */
/** 行 ID */
travelId: string;
/** 是否正在加载 */
isLoading: boolean;
@ -35,7 +30,7 @@ interface TravelLocationDetailData {
/** 媒体类型枚举 */
mediaItemTypeEnum: typeof MediaItemType;
/** 地图标记 */
mapMarkers: WechatMiniprogram.MapMarker[];
mapMarkers: MapMarker[];
/** 删除对话框可见性 */
deleteDialogVisible: boolean;
/** 删除确认文本 */
@ -100,11 +95,7 @@ Page({
thumbItems.forEach((thumbItem) => {
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

View File

@ -20,12 +20,6 @@
<t-empty icon="location" description="暂无地点信息" />
</view>
<view wx:else class="content">
<!-- 类型标签 -->
<view class="section status">
<t-tag size="large" theme="primary" variant="light" icon="{{locationTypeIcons[location.type]}}">
{{locationTypeLabels[location.type]}}
</t-tag>
</view>
<!-- 标题 -->
<view class="section title">
<text class="title-text">{{location.title || '未命名地点'}}</text>
@ -33,6 +27,11 @@
<!-- 位置信息 -->
<t-cell-group wx:if="{{location.lat !== undefined && location.lng !== undefined}}" class="section location">
<view slot="title" class="title">位置信息</view>
<t-cell
left-icon="{{locationTypeIcons[location.type]}}"
title="类型"
note="{{locationTypeLabels[location.type]}}"
/>
<t-cell class="map">
<map
slot="description"
@ -42,7 +41,15 @@
markers="{{mapMarkers}}"
scale="15"
show-location
></map>
>
<cover-view slot="callout">
<cover-view class="custom-callout" marker-id="0">
<cover-view class="callout-content">
<cover-view class="callout-text">{{location.title || '地点'}}</cover-view>
</cover-view>
</cover-view>
</cover-view>
</map>
</t-cell>
<t-cell
left-icon="location"
@ -57,13 +64,13 @@
<t-cell wx:if="{{location.amount !== undefined && location.amount !== null}}" left-icon="money" title="费用">
<view slot="note">¥{{location.amount}}</view>
</t-cell>
<t-cell left-icon="verify" title="需要身份证">
<t-cell left-icon="verify" title="身份证">
<view slot="note" class="{{location.requireIdCard ? 'red' : ''}}">
{{location.requireIdCard ? '需要' : '无需'}}
</view>
</t-cell>
<t-cell left-icon="calendar" title="需要预约">
<view slot="note" class="{{location.requireAppointment ? 'warning' : ''}}">
<t-cell left-icon="calendar" title="预约">
<view slot="note" class="{{location.requireAppointment ? 'red' : ''}}">
{{location.requireAppointment ? '需要' : '无需'}}
</view>
</t-cell>
@ -78,19 +85,6 @@
</view>
</t-cell>
</t-cell-group>
<!-- 出行记录 -->
<t-cell-group class="section">
<view slot="title" class="title">出行记录</view>
<t-cell left-icon="flag" title="首次出行">
<view slot="note">{{location.firstTravelTime || '未记录'}}</view>
</t-cell>
<t-cell left-icon="calendar-1" title="最近出行">
<view slot="note">{{location.lastTravelTime || '未记录'}}</view>
</t-cell>
<t-cell left-icon="chart" title="累计次数">
<view slot="note">{{location.travelCount || 0}} 次</view>
</t-cell>
</t-cell-group>
<!-- 详细说明 -->
<t-cell-group wx:if="{{location.description}}" class="section">
<view slot="title" class="title">详细说明</view>