mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🎨 调整条件
This commit is contained in:
@@ -157,7 +157,7 @@ import TcGameBadge from "@comp/pageConfig/tc-gameBadge.vue";
|
||||
import TcInfo from "@comp/pageConfig/tc-info.vue";
|
||||
import TcUserBadge from "@comp/pageConfig/tc-userBadge.vue";
|
||||
import TGSqlite from "@Sqlite/index.js";
|
||||
import { core } from "@tauri-apps/api";
|
||||
import { core, event } from "@tauri-apps/api";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { remove } from "@tauri-apps/plugin-fs";
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
@@ -513,6 +513,7 @@ function submitResize(): void {
|
||||
|
||||
// 开启无痕浏览
|
||||
async function switchIncognito(): Promise<void> {
|
||||
await event.emit("switchIncognito");
|
||||
if (appStore.incognito) {
|
||||
showSnackbar.success("已关闭无痕浏览!");
|
||||
return;
|
||||
|
||||
@@ -101,9 +101,9 @@ import VpBtnReply from "@comp/viewPost/vp-btn-reply.vue";
|
||||
import VpOverlayCollection from "@comp/viewPost/vp-overlay-collection.vue";
|
||||
import Mys from "@Mys/index.js";
|
||||
import { app, webviewWindow } from "@tauri-apps/api";
|
||||
import { emit } from "@tauri-apps/api/event";
|
||||
import { emit, listen, UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onMounted, onUnmounted, ref, shallowRef } from "vue";
|
||||
import { onBeforeMount, onMounted, onUnmounted, ref, shallowRef } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { useAppStore } from "@/store/modules/app.js";
|
||||
@@ -126,6 +126,7 @@ const postData = shallowRef<TGApp.Plugins.Mys.Post.FullData>();
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
let shareTimer: NodeJS.Timeout | null = null;
|
||||
let incognitoListener: UnlistenFn | null = null;
|
||||
|
||||
function getGameIcon(gameId: number): string {
|
||||
const find = TGBbs.channels.find((item) => item.gid === gameId);
|
||||
@@ -133,6 +134,17 @@ function getGameIcon(gameId: number): string {
|
||||
return "/platforms/mhy/mys.webp";
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
incognitoListener = await listen<void>("switchIncognito", () => window.location.reload());
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (incognitoListener !== null) {
|
||||
incognitoListener();
|
||||
incognitoListener = null;
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await showLoading.start(`正在加载帖子数据`);
|
||||
appVersion.value = await app.getVersion();
|
||||
@@ -268,6 +280,10 @@ async function tryLike(): Promise<void> {
|
||||
showSnackbar.error("数据未加载");
|
||||
return;
|
||||
}
|
||||
if (!incognito.value) {
|
||||
showSnackbar.error("无法在无痕浏览模式下操作");
|
||||
return;
|
||||
}
|
||||
const ck = { ltoken: cookie.value.ltoken, ltuid: cookie.value.ltuid };
|
||||
const resp = await apiHubReq.post.like(postData.value.post.post_id, ck, isLike.value);
|
||||
if (resp.retcode !== 0) {
|
||||
|
||||
Reference in New Issue
Block a user