🎨 调整条件

This commit is contained in:
目棃
2025-02-25 09:07:39 +08:00
parent d2e6d112d5
commit 7f5ffab2a7
2 changed files with 20 additions and 3 deletions

View File

@@ -157,7 +157,7 @@ import TcGameBadge from "@comp/pageConfig/tc-gameBadge.vue";
import TcInfo from "@comp/pageConfig/tc-info.vue"; import TcInfo from "@comp/pageConfig/tc-info.vue";
import TcUserBadge from "@comp/pageConfig/tc-userBadge.vue"; import TcUserBadge from "@comp/pageConfig/tc-userBadge.vue";
import TGSqlite from "@Sqlite/index.js"; 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 { open } from "@tauri-apps/plugin-dialog";
import { remove } from "@tauri-apps/plugin-fs"; import { remove } from "@tauri-apps/plugin-fs";
import { platform } from "@tauri-apps/plugin-os"; import { platform } from "@tauri-apps/plugin-os";
@@ -513,6 +513,7 @@ function submitResize(): void {
// 开启无痕浏览 // 开启无痕浏览
async function switchIncognito(): Promise<void> { async function switchIncognito(): Promise<void> {
await event.emit("switchIncognito");
if (appStore.incognito) { if (appStore.incognito) {
showSnackbar.success("已关闭无痕浏览!"); showSnackbar.success("已关闭无痕浏览!");
return; return;

View File

@@ -101,9 +101,9 @@ import VpBtnReply from "@comp/viewPost/vp-btn-reply.vue";
import VpOverlayCollection from "@comp/viewPost/vp-overlay-collection.vue"; import VpOverlayCollection from "@comp/viewPost/vp-overlay-collection.vue";
import Mys from "@Mys/index.js"; import Mys from "@Mys/index.js";
import { app, webviewWindow } from "@tauri-apps/api"; 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 { storeToRefs } from "pinia";
import { onMounted, onUnmounted, ref, shallowRef } from "vue"; import { onBeforeMount, onMounted, onUnmounted, ref, shallowRef } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useAppStore } from "@/store/modules/app.js"; 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 // eslint-disable-next-line no-undef
let shareTimer: NodeJS.Timeout | null = null; let shareTimer: NodeJS.Timeout | null = null;
let incognitoListener: UnlistenFn | null = null;
function getGameIcon(gameId: number): string { function getGameIcon(gameId: number): string {
const find = TGBbs.channels.find((item) => item.gid === gameId); const find = TGBbs.channels.find((item) => item.gid === gameId);
@@ -133,6 +134,17 @@ function getGameIcon(gameId: number): string {
return "/platforms/mhy/mys.webp"; return "/platforms/mhy/mys.webp";
} }
onBeforeMount(async () => {
incognitoListener = await listen<void>("switchIncognito", () => window.location.reload());
});
onUnmounted(() => {
if (incognitoListener !== null) {
incognitoListener();
incognitoListener = null;
}
});
onMounted(async () => { onMounted(async () => {
await showLoading.start(`正在加载帖子数据`); await showLoading.start(`正在加载帖子数据`);
appVersion.value = await app.getVersion(); appVersion.value = await app.getVersion();
@@ -268,6 +280,10 @@ async function tryLike(): Promise<void> {
showSnackbar.error("数据未加载"); showSnackbar.error("数据未加载");
return; return;
} }
if (!incognito.value) {
showSnackbar.error("无法在无痕浏览模式下操作");
return;
}
const ck = { ltoken: cookie.value.ltoken, ltuid: cookie.value.ltuid }; const ck = { ltoken: cookie.value.ltoken, ltuid: cookie.value.ltuid };
const resp = await apiHubReq.post.like(postData.value.post.post_id, ck, isLike.value); const resp = await apiHubReq.post.like(postData.value.post.post_id, ck, isLike.value);
if (resp.retcode !== 0) { if (resp.retcode !== 0) {