update style
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user