Files
gaoYuJournal/miniprogram/types/Travel.ts
2025-12-16 16:57:49 +08:00

181 lines
3.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Attachment } from "./Attachment";
import { Model, QueryPage } from "./Model";
import { MediaItem } from "./UI";
/** 交通类型 */
export enum TransportationType {
PLANE = "PLANE",
TRAIN = "TRAIN",
CAR = "CAR",
SHIP = "SHIP",
SELF_DRIVING = "SELF_DRIVING",
OTHER = "OTHER"
}
/** 交通类型中文映射 */
export const TransportationTypeLabel: Record<TransportationType, string> = {
[TransportationType.PLANE]: "飞机",
[TransportationType.TRAIN]: "火车",
[TransportationType.CAR]: "汽车",
[TransportationType.SHIP]: "轮船",
[TransportationType.SELF_DRIVING]: "自驾",
[TransportationType.OTHER]: "其他"
};
/** 旅行状态 */
export enum TravelStatus {
PLANNING = "PLANNING",
ONGOING = "ONGOING",
COMPLETED = "COMPLETED"
}
/** 旅行状态中文映射 */
export const TravelStatusLabel: Record<TravelStatus, string> = {
[TravelStatus.PLANNING]: "计划中",
[TravelStatus.ONGOING]: "进行中",
[TravelStatus.COMPLETED]: "已完成"
};
/** 旅行状态图标映射 */
export const TravelStatusIcon: Record<TravelStatus, string> = {
[TravelStatus.PLANNING]: "calendar",
[TravelStatus.ONGOING]: "play-circle",
[TravelStatus.COMPLETED]: "check-circle"
};
/** 旅行计划实体 */
export interface Travel extends Model {
/** 交通类型 */
transportationType?: TransportationType;
/** 标题 */
title?: string;
/** 内容 */
content?: string;
/** 出行时间戳 */
travelAt?: number;
/** 天数 */
days?: number;
/** 状态 */
status?: TravelStatus;
/** 格式化的出行日期 */
travelDate?: string;
/** 格式化的出行时间 */
travelTime?: string;
}
/** 旅行分页查询 */
export interface TravelPage extends QueryPage {
/** 条件过滤 */
equalsExample?: {
status?: TravelStatus;
};
}
/** 地点类型 */
export enum TravelLocationType {
ATTRACTION = "ATTRACTION",
HOTEL = "HOTEL",
RESTAURANT = "RESTAURANT",
TRANSPORT = "TRANSPORT",
SHOPPING = "SHOPPING",
OTHER = "OTHER"
}
/** 地点类型中文映射 */
export const TravelLocationTypeLabel: Record<TravelLocationType, string> = {
[TravelLocationType.ATTRACTION]: "景点",
[TravelLocationType.HOTEL]: "酒店",
[TravelLocationType.RESTAURANT]: "餐厅",
[TravelLocationType.TRANSPORT]: "交通站点",
[TravelLocationType.SHOPPING]: "购物",
[TravelLocationType.OTHER]: "其他"
};
/** 地点类型图标映射 */
export const TravelLocationTypeIcon: Record<TravelLocationType, string> = {
[TravelLocationType.ATTRACTION]: "location",
[TravelLocationType.HOTEL]: "home",
[TravelLocationType.RESTAURANT]: "shop",
[TravelLocationType.TRANSPORT]: "map-route",
[TravelLocationType.SHOPPING]: "cart",
[TravelLocationType.OTHER]: "ellipsis"
};
/** 旅行地点实体 */
export interface TravelLocation extends Model {
/** 关联的旅行计划 ID */
travelId?: number;
/** 地点类型 */
type?: TravelLocationType;
/** 标题 */
title?: string;
/** 说明 */
description?: string;
/** 纬度 */
lat?: number;
/** 经度 */
lng?: number;
/** 位置描述 */
location?: string;
/** 费用 */
amount?: number;
/** 是否需要身份证 */
requireIdCard?: boolean;
/** 是否需要预约 */
requireAppointment?: boolean;
/** 首次出行时间戳 */
firstTraveledAt?: number;
/** 上次出行时间戳 */
lastTraveledAt?: number;
/** 出行次数 */
travelCount?: number;
/** 评分 */
score?: number;
/** 重要程度 */
importance?: number;
/** 附件 */
items?: Attachment[];
/** 保留的附件 ID 列表(更新时使用) */
attachmentIds?: number[];
/** 临时文件 ID 列表(创建/更新时上传附件用) */
tempFileIds?: string[];
// ---------- 视图属性 ----------
/** 类型标签 */
typeLabel?: string;
/** 类型图标 */
typeIcon?: string;
/** 分列后的 items用于瀑布流展示 */
columnedItems?: MediaItem[][];
/** 媒体项(由附件转) */
mediaItems?: MediaItem[];
}