add editor

This commit is contained in:
Timi
2025-12-09 18:02:23 +08:00
parent 6dc4d71718
commit 19b6206695
13 changed files with 898 additions and 22 deletions

View File

@ -0,0 +1,55 @@
import { Model } from "./Model";
/** 附件 */
export type Attachment = {
/** 业务类型 */
bizType: string;
/** 业务 ID */
bizId: number;
/** 附件类型 */
attachType?: MediaAttachType;
/** 文件名 */
name: string;
/** 文件 MD5 */
md5: string;
/** 访问 mongoId */
mongoId: string;
/** 大小 */
size: number;
/** 扩展数据 */
ext?: string | MediaAttachExt;
} & Model;
/** 媒体附件类型 */
export enum MediaAttachType {
/** 原图 */
SOURCE = "SOURCE",
/** 缩略图 */
THUMB = "THUMB"
}
/** 媒体附件扩展数据 */
export type MediaAttachExt = {
/** 原文件附件 ID */
sourceId: number;
/** 原文件访问 mongoId */
sourceMongoId: string;
/** true 为图片 */
isImage: boolean;
/** true 为视频 */
isVideo: boolean;
}

View File

@ -1,11 +1,54 @@
import { QueryPage } from "./Model";
import { Attachment } from "./Attachment";
import { Model, QueryPage } from "./Model";
/** 日记 */
export type Journal = {
/** 类型 */
type: JournalType;
/** 想法、说明 */
idea?: string;
/** 维度 */
lat?: number;
/** 经度 */
lng?: number;
/** 位置 */
location?: string;
/** 天气 */
weatcher?: string;
/** 附件(照片、视频等) */
items?: Attachment[];
} & Model;
/** 日记类型 */
export enum JournalType {
/** 正常 */
NORMAL = "NORMAL",
/** 专业拍摄 */
PORTFOLIO = "PORTFOLIO"
}
/** 日记页面查询对象 */
export type JournalPage = {
/** 查询类型 */
type: JournalPageType;
} & QueryPage;
/** 日记页面查询类型 */
export enum JournalPageType {
/** 正常查询所有附件 */
NORMAL = "NORMAL",
/** 仅查询第一个附件用于预览 */
PREVIEW = "PREVIEW"
}
}

View File

@ -1,4 +1,4 @@
// 基本实体模型
/** 基本实体模型 */
export type Model = {
id?: number;
@ -7,37 +7,45 @@ export type Model = {
deletedAt?: number;
}
/** 基本返回对象 */
export type Response = {
code: number;
msg?: string;
data: object;
}
/** 基本页面查询对象 */
export type QueryPage = {
/** 页面下标,从 0 开始 */
index: number;
/** 单页数据量 */
size: number;
/** 排序 */
orderMap?: { [key: string]: OrderType };
/** 全等比较条件AND 连接) */
equalsExample?: { [key: string]: string | undefined | null };
/** 模糊查询条件OR 连接) */
likeExample?: { [key: string]: string | undefined | null };
}
/** 排序方式 */
export enum OrderType {
ASC = "ASC",
DESC = "DESC"
}
/** 页面查询返回 */
export type QueryPageResult<T> = {
total: number;
list: T[];
}
// 携带验证码的请求体
export type CaptchaData<T> = {
from: string;
captcha: string;
data: T;
}
/** 键值对对象 */
export type KeyValue<T> = {
key: string;
value: T;

64
miniprogram/types/UI.ts Normal file
View File

@ -0,0 +1,64 @@
/** 系统媒体项目 */
export type MediaItem = {
/** 类型 */
type: MediaItemType;
/** 缩略图访问 URL */
thumbURL: string;
/** 原图访问 URL */
sourceURL: string;
/** 文件大小 */
size: number;
/** 附件 ID */
attachmentId: number;
}
/** 微信媒体项目 */
export type WechatMediaItem = {
/** 类型 */
type: MediaItemType;
/** 本地路径 */
path: string;
/** 缩略图路径 */
thumbPath: string;
/** 文件大小 */
size: number;
/** 时长(视频) */
duration: number | undefined;
/** 微信原始媒体对象 */
raw?: any;
}
/** 媒体项目类型 */
export enum MediaItemType {
/** 图片 */
IMAGE,
/** 视频 */
VIDEO
}
/** 位置 */
export type Location = {
/** 维度 */
lat?: number;
/** 经度 */
lng?: number;
/** 描述 */
text?: string;
}