mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
@@ -146,7 +146,7 @@ function getLastPoolTime(time: number) {
|
|||||||
return `${hour}:${minute.toFixed(0).padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`;
|
return `${hour}:${minute.toFixed(0).padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toPost(pool: GachaCard) {
|
function toPost(pool: GachaCard) {
|
||||||
const path = router.resolve({
|
const path = router.resolve({
|
||||||
name: "帖子详情",
|
name: "帖子详情",
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
* @file utils TGWindow.ts
|
* @file utils TGWindow.ts
|
||||||
* @description 用于创建TG窗口的工具
|
* @description 用于创建TG窗口的工具
|
||||||
* @author BTMuli<bt-muli@outlook.com>
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
* @since Alpha
|
* @since Alpha v0.1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { window as TauriWindow } from "@tauri-apps/api";
|
import { window as TauriWindow } from "@tauri-apps/api";
|
||||||
/**
|
/**
|
||||||
* @description 创建TG窗口
|
* @description 创建TG窗口
|
||||||
|
* @since Alpha v0.1.2
|
||||||
* @param {string} url 窗口地址
|
* @param {string} url 窗口地址
|
||||||
* @param {string} label 窗口标签
|
* @param {string} label 窗口标签
|
||||||
* @param {string} title 窗口标题
|
* @param {string} title 窗口标题
|
||||||
@@ -27,8 +28,17 @@ export function createTGWindow(
|
|||||||
// 计算窗口位置
|
// 计算窗口位置
|
||||||
const left = (window.screen.width - width) / 2;
|
const left = (window.screen.width - width) / 2;
|
||||||
const top = (window.screen.height - height) / 2;
|
const top = (window.screen.height - height) / 2;
|
||||||
// 判断窗口是否存在
|
// https://github.com/tauri-apps/tauri/issues/5380
|
||||||
if (TauriWindow.WebviewWindow.getByLabel(label)) {
|
new TauriWindow.WebviewWindow(label, {
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
x: left,
|
||||||
|
y: top,
|
||||||
|
resizable: resizable,
|
||||||
|
url: url,
|
||||||
|
title: title,
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
new TauriWindow.WindowManager(label).close().then(() => {
|
new TauriWindow.WindowManager(label).close().then(() => {
|
||||||
new TauriWindow.WebviewWindow(label, {
|
new TauriWindow.WebviewWindow(label, {
|
||||||
height: height,
|
height: height,
|
||||||
@@ -38,17 +48,7 @@ export function createTGWindow(
|
|||||||
resizable: resizable,
|
resizable: resizable,
|
||||||
url: url,
|
url: url,
|
||||||
title: title,
|
title: title,
|
||||||
|
visible: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
new TauriWindow.WebviewWindow(label, {
|
|
||||||
height: height,
|
|
||||||
width: width,
|
|
||||||
x: left,
|
|
||||||
y: top,
|
|
||||||
resizable: resizable,
|
|
||||||
url: url,
|
|
||||||
title: title,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import { ref, onMounted, reactive } from "vue";
|
|||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import JsonViewer from "vue-json-viewer";
|
import JsonViewer from "vue-json-viewer";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
|
// tauri
|
||||||
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
// plugins
|
// plugins
|
||||||
import GenshinOper from "../plugins/Genshin";
|
import GenshinOper from "../plugins/Genshin";
|
||||||
// interface
|
// interface
|
||||||
@@ -31,6 +33,7 @@ let jsonList = reactive({});
|
|||||||
let jsonContent = reactive({});
|
let jsonContent = reactive({});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await appWindow.show();
|
||||||
// 检查数据
|
// 检查数据
|
||||||
if (!anno_id) {
|
if (!anno_id) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
|
// tauri
|
||||||
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
// plugins
|
// plugins
|
||||||
import GenshinOper from "../plugins/Genshin";
|
import GenshinOper from "../plugins/Genshin";
|
||||||
// interface
|
// interface
|
||||||
@@ -30,6 +32,7 @@ const annoData = ref({} as AnnoContentItem);
|
|||||||
const annoHtml = ref("");
|
const annoHtml = ref("");
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await appWindow.show();
|
||||||
// 检查数据
|
// 检查数据
|
||||||
if (!anno_id) {
|
if (!anno_id) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
|
|||||||
@@ -51,6 +51,8 @@
|
|||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
|
// tauri
|
||||||
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
// plugins
|
// plugins
|
||||||
import MysOper from "../plugins/Mys";
|
import MysOper from "../plugins/Mys";
|
||||||
// interface
|
// interface
|
||||||
@@ -70,6 +72,7 @@ function backPost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await appWindow.show();
|
||||||
// 检查数据
|
// 检查数据
|
||||||
if (!lottery_id) {
|
if (!lottery_id) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
|
|||||||
@@ -205,10 +205,9 @@ onMounted(async () => {
|
|||||||
const activityData = await MysOper.News.get.activity(gid);
|
const activityData = await MysOper.News.get.activity(gid);
|
||||||
rawData.value.activity.is_last = activityData.is_last;
|
rawData.value.activity.is_last = activityData.is_last;
|
||||||
rawData.value.activity.last_id = activityData.list.length;
|
rawData.value.activity.last_id = activityData.list.length;
|
||||||
if (showNews) {
|
if (showNews.value) {
|
||||||
loadingTitle.value = "正在获取新闻数据...";
|
loadingTitle.value = "正在获取新闻数据...";
|
||||||
const newsData = await MysOper.News.get.news(gid);
|
const newsData = await MysOper.News.get.news(gid);
|
||||||
console.log(newsData);
|
|
||||||
rawData.value.news!.is_last = newsData.is_last;
|
rawData.value.news!.is_last = newsData.is_last;
|
||||||
rawData.value.news!.last_id = newsData.list.length;
|
rawData.value.news!.last_id = newsData.list.length;
|
||||||
postData.value = {
|
postData.value = {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import { ref, onMounted, reactive } from "vue";
|
|||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import JsonViewer from "vue-json-viewer";
|
import JsonViewer from "vue-json-viewer";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
|
// tauri
|
||||||
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
// plugins
|
// plugins
|
||||||
import MysOper from "../plugins/Mys";
|
import MysOper from "../plugins/Mys";
|
||||||
|
|
||||||
@@ -25,6 +27,7 @@ const post_id = Number(useRoute().params.post_id);
|
|||||||
let jsonData = reactive({});
|
let jsonData = reactive({});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await appWindow.show();
|
||||||
// 检查数据
|
// 检查数据
|
||||||
if (!post_id) {
|
if (!post_id) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const post_id = Number(useRoute().params.post_id);
|
|||||||
const postHtml = ref("");
|
const postHtml = ref("");
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await appWindow.show();
|
||||||
// 检查数据
|
// 检查数据
|
||||||
if (!post_id) {
|
if (!post_id) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
@@ -39,6 +40,7 @@ onMounted(async () => {
|
|||||||
postHtml.value = MysOper.Post.parser(postData);
|
postHtml.value = MysOper.Post.parser(postData);
|
||||||
await appWindow.setTitle(postData.post.subject);
|
await appWindow.setTitle(postData.post.subject);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
loadingTitle.value = "帖子不存在或解析失败";
|
loadingTitle.value = "帖子不存在或解析失败";
|
||||||
await appWindow.setTitle("帖子不存在或解析失败");
|
await appWindow.setTitle("帖子不存在或解析失败");
|
||||||
|
|||||||
Reference in New Issue
Block a user