Blame view

稻城亚丁小程序/uniapp/src/data/userWorks.ts 898 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  import type { GalleryPhoto } from "./gallery";
  import { mockPhotos } from "./gallery";
  
  /** 我的作品(审核状态为前端演示数据) */
  export type MyWorkAuditStatus = "approved" | "pending" | "rejected";
  
  export interface MyWorkItem {
    id: number;
    imageUrl: string;
    title: string;
    likes: number;
    status: MyWorkAuditStatus;
    /** 仅 status=rejected 时有值 */
    rejectReason?: string;
    publishedAt: string;
  }
  
  function withStatus(photo: GalleryPhoto, index: number): MyWorkItem {
    return {
      id: photo.id,
      imageUrl: photo.imageUrl,
      title: photo.title,
      likes: photo.likes,
      status: index % 6 === 2 ? "pending" : "approved",
      publishedAt: "2026-03-18",
    };
  }
  
  /** 当前登录用户「山行者」的作品列表(演示:取相册前 12 条) */
  export const myWorksList: MyWorkItem[] = mockPhotos
    .slice(0, 12)
    .map((p, i) => withStatus(p, i));