mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
✨ feat(check): 更新完后自动更新资源
This commit is contained in:
@@ -35,6 +35,7 @@ import { fs, window, app, event } from "@tauri-apps/api";
|
|||||||
import { useAppStore } from "./store/modules/app";
|
import { useAppStore } from "./store/modules/app";
|
||||||
// utils
|
// utils
|
||||||
import { InitTGData, DeleteTGData, WriteTGData } from "./utils/TGIndex";
|
import { InitTGData, DeleteTGData, WriteTGData } from "./utils/TGIndex";
|
||||||
|
import { getBuildTime } from "./utils/TGBuild";
|
||||||
// data
|
// data
|
||||||
import { TGAppDataList, TGGetDataList } from "./data";
|
import { TGAppDataList, TGGetDataList } from "./data";
|
||||||
|
|
||||||
@@ -68,6 +69,13 @@ async function listenOnTheme () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkLoad () {
|
async function checkLoad () {
|
||||||
|
const localBuildTime = appStore.buildTime;
|
||||||
|
const buildTime = getBuildTime();
|
||||||
|
if (localBuildTime !== buildTime) {
|
||||||
|
appStore.buildTime = buildTime;
|
||||||
|
console.info("数据已过期,开始加载数据...");
|
||||||
|
appStore.loading = false;
|
||||||
|
}
|
||||||
if (appStore.loading) {
|
if (appStore.loading) {
|
||||||
console.info("数据已加载!");
|
console.info("数据已加载!");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @file store modules app.ts
|
* @file store modules app.ts
|
||||||
* @description App store module
|
* @description App store module
|
||||||
* @author BTMuli<bt-muli@outlook.com>
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
* @since Alpha v0.1.3
|
* @since Alpha v0.1.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// vue
|
// vue
|
||||||
@@ -24,6 +24,8 @@ export const useAppStore = defineStore(
|
|||||||
() => {
|
() => {
|
||||||
// 应用加载状态
|
// 应用加载状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
// 应用打包时间
|
||||||
|
const buildTime = ref("");
|
||||||
// 侧边栏设置
|
// 侧边栏设置
|
||||||
const sidebar = reactive({
|
const sidebar = reactive({
|
||||||
// 是否折叠
|
// 是否折叠
|
||||||
@@ -82,6 +84,7 @@ export const useAppStore = defineStore(
|
|||||||
return {
|
return {
|
||||||
theme,
|
theme,
|
||||||
loading,
|
loading,
|
||||||
|
buildTime,
|
||||||
sidebar,
|
sidebar,
|
||||||
devMode,
|
devMode,
|
||||||
dataPath,
|
dataPath,
|
||||||
@@ -102,7 +105,7 @@ export const useAppStore = defineStore(
|
|||||||
{
|
{
|
||||||
key: "app",
|
key: "app",
|
||||||
storage: window.localStorage,
|
storage: window.localStorage,
|
||||||
paths: ["devMode", "loading"],
|
paths: ["devMode", "loading", "buildTime"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "sidebar",
|
key: "sidebar",
|
||||||
|
|||||||
Reference in New Issue
Block a user