mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-30 06:19:45 +08:00
♻️ 类型迁移&重构
This commit is contained in:
@@ -75,7 +75,7 @@ import { computed, onMounted, shallowRef, watch } from "vue";
|
||||
import { generateShareImg } from "@/utils/TGShare.js";
|
||||
import { createPost } from "@/utils/TGWindow.js";
|
||||
|
||||
type TPostCardProps = { modelValue: TGApp.Plugins.Mys.Post.FullData; selectMode?: boolean };
|
||||
type TPostCardProps = { modelValue: TGApp.BBS.Post.FullData; selectMode?: boolean };
|
||||
type TPostCardEmits = (e: "onSelected", v: string) => void;
|
||||
type TPostStatus = RenderStatus & { stat: ActStat };
|
||||
type RenderForum = { name: string; icon: string; id: number };
|
||||
@@ -86,7 +86,7 @@ export type RenderCard = {
|
||||
cover: string;
|
||||
postId: number;
|
||||
subtitle: string;
|
||||
user: TGApp.Plugins.Mys.User.Post | null;
|
||||
user: TGApp.BBS.Post.User | null;
|
||||
forum: RenderForum | null;
|
||||
data: RenderData | null;
|
||||
status?: RenderStatus;
|
||||
@@ -130,7 +130,7 @@ function getActivityStatus(status: number): RenderStatus {
|
||||
return stats[ActStat.UNKNOWN];
|
||||
}
|
||||
|
||||
function getPostCover(item: TGApp.Plugins.Mys.Post.FullData): string {
|
||||
function getPostCover(item: TGApp.BBS.Post.FullData): string {
|
||||
let cover;
|
||||
if (item.cover) cover = item.cover.url;
|
||||
else if (item.post.cover) cover = item.post.cover;
|
||||
@@ -140,7 +140,7 @@ function getPostCover(item: TGApp.Plugins.Mys.Post.FullData): string {
|
||||
return `${cover}?x-oss-process=image/resize,m_fill,w_360,h_130,limit_0/format,png`;
|
||||
}
|
||||
|
||||
function getCommonCard(item: TGApp.Plugins.Mys.Post.FullData): RenderCard {
|
||||
function getCommonCard(item: TGApp.BBS.Post.FullData): RenderCard {
|
||||
let forumData: RenderForum | null = null;
|
||||
let statData: RenderData | null = null;
|
||||
if (item.forum !== null) {
|
||||
@@ -167,7 +167,7 @@ function getCommonCard(item: TGApp.Plugins.Mys.Post.FullData): RenderCard {
|
||||
};
|
||||
}
|
||||
|
||||
function getPostCard(item: TGApp.Plugins.Mys.Post.FullData): RenderCard {
|
||||
function getPostCard(item: TGApp.BBS.Post.FullData): RenderCard {
|
||||
const commonCard = getCommonCard(item);
|
||||
if (
|
||||
item.news_meta !== undefined &&
|
||||
|
||||
@@ -21,7 +21,7 @@ import parseAnnoContent from "@/web/utils/annoParser.js";
|
||||
type TaParserProps = { data: TGApp.BBS.Announcement.ContentItem };
|
||||
const props = defineProps<TaParserProps>();
|
||||
|
||||
function getTaName(ta: TGApp.Plugins.Mys.SctPost.Base): Component {
|
||||
function getTaName(ta: TGApp.BBS.SctPost.Base): Component {
|
||||
if (ta.children) return TpTexts;
|
||||
if (typeof ta.insert === "string") return TpText;
|
||||
if ("image" in ta.insert) return TpImage;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
import TMiImg from "@comp/app/t-mi-img.vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
type TpAvatarProps = { data: TGApp.Plugins.Mys.User.Post; position: "left" | "right" };
|
||||
type TpAvatarProps = { data: TGApp.BBS.Post.User; position: "left" | "right" };
|
||||
|
||||
const props = defineProps<TpAvatarProps>();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<TpParser :data="JSON.parse(props.data.insert.fold.content)" />
|
||||
</div>
|
||||
</details>
|
||||
<TpUnknown v-else :data="<TGApp.Plugins.Mys.SctPost.Empty>props.data" />
|
||||
<TpUnknown v-else :data="<TGApp.BBS.SctPost.Empty>props.data" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, toRaw } from "vue";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:title="props.data.insert.divider"
|
||||
/>
|
||||
</div>
|
||||
<TpUnknown v-else :data="<TGApp.Plugins.Mys.SctPost.Empty>props.data" />
|
||||
<TpUnknown v-else :data="<TGApp.BBS.SctPost.Empty>props.data" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
|
||||
@@ -24,7 +24,7 @@ import TpVillaCard from "./tp-villaCard.vue";
|
||||
import TpVod from "./tp-vod.vue";
|
||||
import TpVote from "./tp-vote.vue";
|
||||
|
||||
type SctPostDataArr = Array<TGApp.Plugins.Mys.SctPost.Base>;
|
||||
type SctPostDataArr = Array<TGApp.BBS.SctPost.Base>;
|
||||
type TpParserProps = { data: SctPostDataArr };
|
||||
|
||||
const props = defineProps<TpParserProps>();
|
||||
@@ -32,7 +32,7 @@ const props = defineProps<TpParserProps>();
|
||||
function getParsedData(data: SctPostDataArr): SctPostDataArr {
|
||||
const res: SctPostDataArr = [];
|
||||
let child: SctPostDataArr = [];
|
||||
let cur: TGApp.Plugins.Mys.SctPost.Base | undefined;
|
||||
let cur: TGApp.BBS.SctPost.Base | undefined;
|
||||
for (const tp of data) {
|
||||
const tpName = getTpName(tp);
|
||||
// 单独处理 TpMention
|
||||
@@ -90,7 +90,7 @@ function getParsedText(data: TpTextType): Array<TpTextType> {
|
||||
return [data];
|
||||
}
|
||||
|
||||
function getTpName(tp: TGApp.Plugins.Mys.SctPost.Base): Component {
|
||||
function getTpName(tp: TGApp.BBS.SctPost.Base): Component {
|
||||
if (tp.children) return TpTexts;
|
||||
if (typeof tp.insert === "string") return TpText;
|
||||
if ("backup_text" in tp.insert) return TpBackupText;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { onMounted, toRaw } from "vue";
|
||||
|
||||
import TGLogger from "@/utils/TGLogger.js";
|
||||
|
||||
type TpUnknownProps = { data: TGApp.Plugins.Mys.SctPost.Empty };
|
||||
type TpUnknownProps = { data: TGApp.BBS.SctPost.Empty };
|
||||
|
||||
const props = defineProps<TpUnknownProps>();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import VpOverlayCollect from "./vp-overlay-collect.vue";
|
||||
|
||||
import TGLogger from "@/utils/TGLogger.js";
|
||||
|
||||
type TbCollectProps = { modelValue: number; data?: TGApp.Plugins.Mys.Post.FullData };
|
||||
type TbCollectProps = { modelValue: number; data?: TGApp.BBS.Post.FullData };
|
||||
|
||||
const props = defineProps<TbCollectProps>();
|
||||
const isCollected = ref<boolean>(false);
|
||||
|
||||
@@ -39,7 +39,7 @@ import showSnackbar from "@comp/func/snackbar.js";
|
||||
import TSUserCollection from "@Sqlite/modules/userCollect.js";
|
||||
import { ref, shallowRef, watch } from "vue";
|
||||
|
||||
type ToPostCollectProps = { post?: TGApp.Plugins.Mys.Post.FullData };
|
||||
type ToPostCollectProps = { post?: TGApp.BBS.Post.FullData };
|
||||
type ToPostCollectEmits = (e: "submit") => void;
|
||||
|
||||
const props = defineProps<ToPostCollectProps>();
|
||||
|
||||
@@ -54,7 +54,7 @@ import { useRouter } from "vue-router";
|
||||
import { timestampToDate } from "@/utils/toolFunc.js";
|
||||
import postReq from "@/web/request/postReq.js";
|
||||
|
||||
type TpoCollectionProps = { collection: TGApp.Plugins.Mys.Post.Collection };
|
||||
type TpoCollectionProps = { collection: TGApp.BBS.Post.Collection };
|
||||
type TpoCollectionItem = {
|
||||
postId: string;
|
||||
title: string;
|
||||
|
||||
@@ -53,7 +53,7 @@ type RenderCard = {
|
||||
id: string;
|
||||
upWay: string;
|
||||
status: string;
|
||||
creator: TGApp.Plugins.Mys.User.Post;
|
||||
creator: TGApp.BBS.Post.User;
|
||||
drawTime: string;
|
||||
rewards: Array<RenderReward>;
|
||||
};
|
||||
@@ -61,7 +61,7 @@ type RenderReward = {
|
||||
name: string;
|
||||
win: number;
|
||||
goal: number;
|
||||
users: TGApp.Plugins.Mys.User.Post[];
|
||||
users: Array<TGApp.BBS.Post.User>;
|
||||
};
|
||||
|
||||
const props = defineProps<TpoLotteryProps>();
|
||||
|
||||
@@ -38,7 +38,7 @@ const lastId = ref<string>("");
|
||||
const game = ref<string>("2");
|
||||
const isLast = ref<boolean>(false);
|
||||
const load = ref<boolean>(false);
|
||||
const results = shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]);
|
||||
const results = shallowRef<Array<TGApp.BBS.Post.FullData>>([]);
|
||||
const gameName = computed<string>(
|
||||
() => TGBbs.channels.find((v) => v.gid.toString() === game.value)?.title || "未知分区",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user