添加回正开关,默认开启

This commit is contained in:
目棃
2024-08-11 17:36:29 +08:00
parent 1f814bc8b5
commit fc43dd9820
7 changed files with 549 additions and 526 deletions

View File

@@ -67,15 +67,15 @@
"dependencies": {
"@mdi/font": "7.4.47",
"@tauri-apps/api": "2.0.0-rc.0",
"@tauri-apps/plugin-deep-link": "2.0.0-beta.10",
"@tauri-apps/plugin-dialog": "2.0.0-beta.8",
"@tauri-apps/plugin-fs": "2.0.0-beta.8",
"@tauri-apps/plugin-http": "2.0.0-beta.9",
"@tauri-apps/plugin-log": "2.0.0-beta.9",
"@tauri-apps/plugin-os": "2.0.0-beta.8",
"@tauri-apps/plugin-process": "2.0.0-beta.8",
"@tauri-apps/plugin-shell": "2.0.0-beta.9",
"@tauri-apps/plugin-sql": "2.0.0-beta.7",
"@tauri-apps/plugin-deep-link": "2.0.0-rc.0",
"@tauri-apps/plugin-dialog": "2.0.0-rc.0",
"@tauri-apps/plugin-fs": "2.0.0-rc.0",
"@tauri-apps/plugin-http": "2.0.0-rc.0",
"@tauri-apps/plugin-log": "2.0.0-rc.0",
"@tauri-apps/plugin-os": "2.0.0-rc.0",
"@tauri-apps/plugin-process": "2.0.0-rc.0",
"@tauri-apps/plugin-shell": "2.0.0-rc.0",
"@tauri-apps/plugin-sql": "2.0.0-rc.0",
"ajv": "^8.17.1",
"artplayer": "^5.1.6",
"clipboard": "^2.0.11",
@@ -84,44 +84,44 @@
"html2canvas": "^1.4.1",
"js-md5": "^0.8.3",
"jsencrypt": "^3.3.2",
"pinia": "^2.2.0",
"pinia": "^2.2.1",
"pinia-plugin-persistedstate": "^3.2.1",
"qrcode.vue": "^3.4.1",
"uuid": "^10.0.0",
"vue": "^3.4.35",
"vue-echarts": "^6.7.3",
"vue": "^3.4.37",
"vue-echarts": "^7.0.1",
"vue-json-viewer": "^3.0.4",
"vue-router": "^4.4.2",
"vue-router": "^4.4.3",
"vuetify": "^3.6.14",
"wcag-color": "^1.1.1",
"xml-js": "^1.6.11"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@eslint/js": "^9.9.0",
"@tauri-apps/cli": "2.0.0-beta.21",
"@types/color-convert": "^2.0.3",
"@types/js-md5": "^0.7.2",
"@types/node": "^22.1.0",
"@types/node": "^22.2.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/parser": "^8.0.1",
"@vitejs/plugin-vue": "^5.1.2",
"concurrently": "^8.2.2",
"eslint": "^9.8.0",
"eslint": "^9.9.0",
"eslint-config-love": "^62.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-n": "^17.10.1",
"eslint-plugin-n": "^17.10.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.0.0",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-vue": "^9.27.0",
"eslint-plugin-yml": "^1.14.0",
"globals": "^15.9.0",
"husky": "^9.1.4",
"jsonc-eslint-parser": "^2.4.0",
"lint-staged": "^15.2.7",
"oxlint": "^0.6.1",
"lint-staged": "^15.2.8",
"oxlint": "^0.7.0",
"prettier": "3.3.3",
"stylelint": "^16.8.1",
"stylelint-config-idiomatic-order": "^10.0.0",
@@ -131,11 +131,11 @@
"stylelint-order": "^6.0.4",
"stylelint-prettier": "^5.0.2",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0",
"vite": "^5.3.5",
"typescript-eslint": "^8.0.1",
"vite": "^5.4.0",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-vue-devtools": "^7.3.7",
"vite-plugin-vuetify": "^2.0.3",
"vite-plugin-vuetify": "^2.0.4",
"vue-eslint-parser": "^9.4.3",
"yaml-eslint-parser": "^1.2.3"
}

941
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

36
src-tauri/Cargo.lock generated
View File

@@ -3873,9 +3873,9 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.204"
version = "1.0.206"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
checksum = "5b3e4cd94123dd520a128bcd11e34d9e9e423e7e3e50425cb1b4b1e3549d0284"
dependencies = [
"serde_derive",
]
@@ -3893,9 +3893,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.204"
version = "1.0.206"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
checksum = "fabfb6138d2383ea8208cf98ccf69cdfb1aff4088460681d84189aa259762f97"
dependencies = [
"proc-macro2",
"quote",
@@ -4629,9 +4629,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tauri"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "255e746089a370802ec4eb896dccc6f27c1dd2a203c1dc484fd996db954e2300"
checksum = "19ee93e545e49458813d4ed16179c67ee6141dba140ec3d4f078dda3b8d4e0d1"
dependencies = [
"anyhow",
"bytes",
@@ -4678,9 +4678,9 @@ dependencies = [
[[package]]
name = "tauri-build"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85ceb8d082c3b17b4b2eb134a39363a22c696ddba473d6e5c0ab1caadad4cfca"
checksum = "96a58b3a716b51d7f671f729bb8c0a53cd2551eec8450c64e828ef4e6c9f948e"
dependencies = [
"anyhow",
"cargo_toml",
@@ -4700,9 +4700,9 @@ dependencies = [
[[package]]
name = "tauri-codegen"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2407c7d37a491b16e530445c9611d91091cae198eea2ed424913b740215605f2"
checksum = "90a9e63ecd827d57228864764e0234935c9aac230099cf145197c8c08e754ced"
dependencies = [
"base64 0.22.1",
"brotli",
@@ -4727,9 +4727,9 @@ dependencies = [
[[package]]
name = "tauri-macros"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d210893b693be00f569b4f54456803debe104b7675f368205f2b6e94bac09b34"
checksum = "a54f5d5b289aa6215ffcfed7d4ff9960a04b7a854436d04519a9fcf911050cba"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -4932,9 +4932,9 @@ dependencies = [
[[package]]
name = "tauri-runtime"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6624fdf383ccafc9e8ad9205fe6e5c976b318efcd6b3662dde658c74e4254792"
checksum = "8f01b129b1ebdf09563c354760dbe7c0e96a166b4e33362d9c8d207f527c7ea5"
dependencies = [
"dpi",
"gtk",
@@ -4951,9 +4951,9 @@ dependencies = [
[[package]]
name = "tauri-runtime-wry"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fd1a785c4281f8231b091593393b40cb3a800810c407b1ffed52de27ff1640a"
checksum = "fcda27639094ace2bf25f00bc10e35ea4e3af2f92753b1bdd2a174d1fa5a6292"
dependencies = [
"cocoa",
"gtk",
@@ -4975,9 +4975,9 @@ dependencies = [
[[package]]
name = "tauri-utils"
version = "2.0.0-rc.0"
version = "2.0.0-rc.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f435eeaae1e69cf93cf19da0f727989eed2e5eb6fc63a8d21432f59dd3ac4ac"
checksum = "28bb83cffa26e9cb7a2b3d0c31ab87bf277f44aaaa90f17159aef4d37aabd051"
dependencies = [
"brotli",
"cargo_metadata",

View File

@@ -15,10 +15,10 @@ tauri-build = { version = "2.0.0-beta.19", features = [] }
[dependencies]
chrono = "0.4.38"
log = "0.4.22"
serde = { version = "1.0.204", features = ["derive"] }
serde = { version = "1.0.206", features = ["derive"] }
serde_json = "1.0.122"
tauri = { version = "2.0.0-rc.0", features = [] }
tauri-utils = "2.0.0-rc.0"
tauri = { version = "2.0.0-rc.2", features = [] }
tauri-utils = "2.0.0-rc.2"
url = "2.5.2"
walkdir = "2.5.0"

View File

@@ -52,7 +52,8 @@ onBeforeMount(async () => {
await core.invoke("init_app");
urlListener = await getDeepLink();
}
await checkResize();
if (appStore.needResize === undefined) appStore.needResize = true;
if (appStore.needResize) await checkResize();
await win.show();
});

View File

@@ -45,6 +45,22 @@
/>
</template>
</v-list-item>
<v-list-item title="窗口回正" subtitle="根据分辨率动态调整窗体大小">
<template #prepend>
<div class="config-icon">
<v-icon>mdi-window-restore</v-icon>
</div>
</template>
<template #append>
<v-switch
v-model="appStore.needResize"
:label="appStore.needResize ? '开启' : '关闭'"
:inset="true"
color="#FAC51E"
@click="submitResize"
/>
</template>
</v-list-item>
<v-list-item>
<template #prepend>
<div class="config-icon">
@@ -442,9 +458,20 @@ async function confirmResetDB(title?: string): Promise<void> {
// 开启 dev 模式
function submitDevMode(): void {
appStore.devMode
? showSnackbar({ text: "已关闭 dev 模式!" })
: showSnackbar({ text: "已开启 dev 模式!" });
if (appStore.devMode) {
showSnackbar({ text: "已关闭 dev 模式!" });
return;
}
showSnackbar({ text: "已开启 dev 模式!" });
}
// 开启窗口回正
function submitResize(): void {
if (appStore.needResize) {
showSnackbar({ text: "已开启窗口回正!" });
return;
}
showSnackbar({ text: "已关闭窗口回正!" });
}
// 通过子组件的事件来控制 loading

View File

@@ -1,7 +1,7 @@
/**
* @file store/modules/app.ts
* @description App store module
* @since Beta v0.5.2
* @since Beta v0.5.3
*/
import { path } from "@tauri-apps/api";
@@ -50,6 +50,8 @@ export const useAppStore = defineStore(
const lang = ref<AnnoLang>("zh-cn");
// 最近的咨讯类型
const recentNewsType = ref("notice");
// 是否开启分辨率回正
const needResize = ref<boolean | undefined>(true);
// 初始化
function init(): void {
@@ -61,6 +63,7 @@ export const useAppStore = defineStore(
server.value = AnnoServer.CN_ISLAND;
lang.value = "zh-cn";
recentNewsType.value = "notice";
needResize.value = true;
initDevice();
}
@@ -87,6 +90,7 @@ export const useAppStore = defineStore(
server,
lang,
recentNewsType,
needResize,
init,
changeTheme,
};
@@ -101,7 +105,7 @@ export const useAppStore = defineStore(
{
key: "app",
storage: window.localStorage,
paths: ["devMode", "loading", "buildTime", "isLogin"],
paths: ["devMode", "loading", "buildTime", "isLogin", "needResize"],
},
{
key: "sidebar",