♻️ 动态获取版块

This commit is contained in:
目棃
2025-01-16 15:51:03 +08:00
parent e8a79fb409
commit 8ecaed05ea
10 changed files with 297 additions and 135 deletions

View File

@@ -14,7 +14,6 @@
import TMiImg from "@comp/app/t-mi-img.vue";
import showDialog from "@comp/func/dialog.js";
import showSnackbar from "@comp/func/snackbar.js";
import Mys from "@Mys/index.js";
import { emit } from "@tauri-apps/api/event";
import { storeToRefs } from "pinia";
import { computed, onMounted, ref, shallowRef, watch } from "vue";
@@ -25,6 +24,7 @@ import { useAppStore } from "@/store/modules/app.js";
import TGClient from "@/utils/TGClient.js";
import TGLogger from "@/utils/TGLogger.js";
import { createPost } from "@/utils/TGWindow.js";
import ApiHubReq from "@/web/request/apiHubReq.js";
import OtherApi from "@/web/request/otherReq.js";
type TGameNavProps = { modelValue: number };
@@ -49,7 +49,7 @@ watch(
);
async function loadNav(): Promise<void> {
nav.value = await Mys.ApiHub.homeNew(props.modelValue);
nav.value = await ApiHubReq.home(props.modelValue);
}
async function tryGetCode(): Promise<void> {
@@ -79,7 +79,7 @@ async function toNav(item: TGApp.BBS.Navigator.Navigator): Promise<void> {
return;
}
await TGLogger.Info(`[TGameNav][toNav] 打开网页活动 ${item.name}`);
await TGLogger.Info(`[TGameNav}][toNav] ${item.app_path}`);
await TGLogger.Info(`[TGameNav][toNav] ${item.app_path}`);
const link = new URL(item.app_path);
const mysList = [
"https://act.mihoyo.com",
@@ -132,6 +132,7 @@ async function toBBS(link: URL): Promise<void> {
showSnackbar.warn(`不支持的链接:${link.href}`);
}
// todo 动态获取版块列表
function getLocalPath(forum?: string): string {
if (!forum) return "";
const forumLocalMap: Record<string, string> = {

View File

@@ -10,7 +10,7 @@
<v-progress-circular v-else indeterminate color="primary" size="25" />
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted, ref } from "vue";
import { onMounted, onUnmounted, ref, watch } from "vue";
import { useAppStore } from "@/store/modules/app.js";
import { saveImgLocal } from "@/utils/TGShare.js";
@@ -32,10 +32,21 @@ const appStore = useAppStore();
const localUrl = ref<string>();
onMounted(async () => {
if (!props.src) return;
const link = props.ori ? props.src : appStore.getImageUrl(props.src);
localUrl.value = await saveImgLocal(link);
});
watch(
() => props.src,
async () => {
if (!props.src) return;
if (localUrl.value) URL.revokeObjectURL(localUrl.value);
const link = props.ori ? props.src : appStore.getImageUrl(props.src);
localUrl.value = await saveImgLocal(link);
},
);
onUnmounted(() => {
if (localUrl.value) URL.revokeObjectURL(localUrl.value);
});

View File

@@ -1 +0,0 @@
<!-- todo 角色云图 -->

View File

@@ -1,4 +1,4 @@
<!-- todo 优化增加筛选功能调整 typo -->
<!-- todo 优化增加筛选功能 -->
<template>
<div class="ua-gt-box">
<v-data-table

View File

@@ -21,9 +21,10 @@
</div>
</template>
<script lang="ts" setup>
import Mys from "@Mys/index.js";
import { onMounted, shallowRef } from "vue";
import ApiHubReq from "@/web/request/apiHubReq.js";
type TpVote = { insert: { vote: { id: string; uid: string } } };
type TpVoteProps = { data: TpVote };
type TpVoteData = { title: string; count: number; percent: number };
@@ -34,8 +35,8 @@ const votes = shallowRef<TpVoteInfo>();
onMounted(async () => {
const vote = props.data.insert.vote;
const voteInfo = await Mys.ApiHub.getVotes(vote.id, vote.uid);
const voteResult = await Mys.ApiHub.getVoteResult(vote.id, vote.uid);
const voteInfo = await ApiHubReq.vote.info(vote.id, vote.uid);
const voteResult = await ApiHubReq.vote.result(vote.id, vote.uid);
votes.value = {
title: voteInfo.title,
count: voteResult.user_cnt,