Skip to content

Commit

Permalink
♻️ 全面整理重构
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Dec 13, 2024
1 parent 86bfc80 commit 3ed6d50
Show file tree
Hide file tree
Showing 229 changed files with 3,092 additions and 4,114 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Install frontend dependencies
run: pnpm install
- name: Build app
run: pnpm build -- ${{ matrix.settings.args }}
run: pnpm build ${{ matrix.settings.args }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 0 additions & 10 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,52 @@ walkdir = "2.5.0"
# deep link 插件
[dependencies.tauri-plugin-deep-link]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# dialog 插件
[dependencies.tauri-plugin-dialog]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# fs 插件
[dependencies.tauri-plugin-fs]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# http 插件
[dependencies.tauri-plugin-http]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"
features = ["unsafe-headers"]

# log 插件
[dependencies.tauri-plugin-log]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# os 插件
[dependencies.tauri-plugin-os]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# process 插件
[dependencies.tauri-plugin-process]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# shell 插件
[dependencies.tauri-plugin-shell]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# single-instance 插件
[dependencies.tauri-plugin-single-instance]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"

# sqlite 插件
[dependencies.tauri-plugin-sql]
git = "ssh://[email protected]/tauri-apps/plugins-workspace.git"
#git = "https://github.com/tauri-apps/plugins-workspace.git"
branch = "v2"
features = ["sqlite"]

Expand Down
26 changes: 13 additions & 13 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
</template>

<script lang="ts" setup>
import TBackTop from "@comp/app/t-backTop.vue";
import TSidebar from "@comp/app/t-sidebar.vue";
import showDialog from "@comp/func/dialog.js";
import showSnackbar from "@comp/func/snackbar.js";
import TGSqlite from "@Sqlite/index.js";
import TSUserAccount from "@Sqlite/modules/userAccount.js";
import { app, core, event, webviewWindow } from "@tauri-apps/api";
import { PhysicalSize } from "@tauri-apps/api/dpi";
import { Event, UnlistenFn } from "@tauri-apps/api/event";
import type { Event, UnlistenFn } from "@tauri-apps/api/event";
import { currentMonitor, getCurrentWindow } from "@tauri-apps/api/window";
import { mkdir } from "@tauri-apps/plugin-fs";
import { storeToRefs } from "pinia";
import { computed, onMounted, onUnmounted, ref } from "vue";
import { useRouter } from "vue-router";
import TBackTop from "./components/app/t-backTop.vue";
import TSidebar from "./components/app/t-sidebar.vue";
import showDialog from "./components/func/dialog.js";
import showSnackbar from "./components/func/snackbar.js";
import TGSqlite from "./plugins/Sqlite/index.js";
import TSUserAccount from "./plugins/Sqlite/modules/userAccount.js";
import { useAppStore } from "./store/modules/app.js";
import { useUserStore } from "./store/modules/user.js";
import { getBuildTime } from "./utils/TGBuild.js";
import TGLogger from "./utils/TGLogger.js";
import OtherApi from "./web/request/otherReq.js";
import { useAppStore } from "@/store/modules/app.js";
import { useUserStore } from "@/store/modules/user.js";
import { getBuildTime } from "@/utils/TGBuild.js";
import TGLogger from "@/utils/TGLogger.js";
import OtherApi from "@/web/request/otherReq.js";
const router = useRouter();
const { theme, needResize, deviceInfo, isLogin, userDir, buildTime } = storeToRefs(useAppStore());
Expand Down Expand Up @@ -173,7 +173,7 @@ async function checkUserLoad(): Promise<void> {
}
async function getDeepLink(): Promise<UnlistenFn> {
return await event.listen("active_deep_link", async (e: Event<string>) => {
return await event.listen<string>("active_deep_link", async (e: Event<string>) => {
const windowGet = new webviewWindow.WebviewWindow("TeyvatGuide");
if (await windowGet.isMinimized()) await windowGet.unminimize();
await windowGet.setFocus();
Expand Down
13 changes: 4 additions & 9 deletions src/components/app/t-backTop.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
<template>
<transition name="fade">
<div v-show="canTop" class="back-top" @click="handleScrollTop">
<img src="../../assets/icons/back-top.svg" alt="back-icon" />
<img src="@/assets/icons/back-top.svg" alt="back-icon" />
</div>
</transition>
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted, ref } from "vue";
const scrollTop = ref<number>(0); // 滚动条距离顶部的距离
const canTop = ref<boolean>(false); // 默认不显示
const scrollTop = ref<number>(0);
const canTop = ref<boolean>(false);
// 监听滚动事件
function handleScroll(): void {
scrollTop.value = document.documentElement.scrollTop || document.body.scrollTop;
// 超过500px显示回到顶部按钮
canTop.value = scrollTop.value > 500;
// 没超过500,但是到底部了,也显示回到顶部按钮
if (!canTop.value) {
const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
const clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
canTop.value = scrollHeight - clientHeight - scrollTop.value <= 0;
}
}
// 点击回到顶部
function handleScrollTop(): void {
let timer = 0;
cancelAnimationFrame(timer);
Expand All @@ -43,8 +39,7 @@ function handleScrollTop(): void {
onMounted(() => window.addEventListener("scroll", handleScroll));
onUnmounted(() => window.removeEventListener("scroll", handleScroll));
</script>

<style scoped>
<style lang="css" scoped>
.back-top {
position: fixed;
right: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,25 @@
</div>
</template>
<script lang="ts" setup>
import showDialog from "@comp/func/dialog.js";
import showSnackbar from "@comp/func/snackbar.js";
import Mys from "@Mys/index.js";
import { emit } from "@tauri-apps/api/event";
import { storeToRefs } from "pinia";
import { computed, onMounted, ref, shallowRef, watch } from "vue";
import Mys from "../../plugins/Mys/index.js";
import { useAppStore } from "../../store/modules/app.js";
import TGClient from "../../utils/TGClient.js";
import TGLogger from "../../utils/TGLogger.js";
import { createPost } from "../../utils/TGWindow.js";
import OtherApi from "../../web/request/otherReq.js";
import showDialog from "../func/dialog.js";
import showSnackbar from "../func/snackbar.js";
import ToLivecode from "./to-livecode.vue";
import { useAppStore } from "@/store/modules/app.js";
import TGClient from "@/utils/TGClient.js";
import TGLogger from "@/utils/TGLogger.js";
import { createPost } from "@/utils/TGWindow.js";
import OtherApi from "@/web/request/otherReq.js";
type TGameNavProps = { modelValue: number };
const props = withDefaults(defineProps<TGameNavProps>(), { modelValue: 2 });
const appStore = useAppStore();
const { isLogin } = storeToRefs(useAppStore());
const nav = shallowRef<TGApp.BBS.Navigator.Navigator[]>([]);
const codeData = shallowRef<TGApp.BBS.Navigator.CodeData[]>([]);
const showOverlay = ref<boolean>(false);
Expand Down Expand Up @@ -72,7 +73,7 @@ async function tryGetCode(): Promise<void> {
}
async function toNav(item: TGApp.BBS.Navigator.Navigator): Promise<void> {
if (!appStore.isLogin) {
if (!isLogin.value) {
showSnackbar.warn("请先登录");
return;
}
Expand Down Expand Up @@ -133,8 +134,8 @@ async function toBBS(link: URL): Promise<void> {
function getLocalPath(forum?: string): string {
if (!forum) return "";
const forumLocalMap: Record<string, string> = {
"31": "/news/3", // 崩坏2官方
"6": "/news/1", // 崩坏3官方
"31": "/news/3", // 崩坏2 官方
"6": "/news/1", // 崩坏3 官方
"28": "/news/2", // 原神官方
"33": "/news/4", // 未定官方
"58": "/news/8", // 绝区零官方
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ export type TItemBoxData = {
type TItemBoxProps = { modelValue: TItemBoxData };
const props = defineProps<TItemBoxProps>();
const sizeInner = `${props.modelValue.innerHeight ?? 0}px`;
const fontSizeInner = props.modelValue.innerHeight ? `${props.modelValue.innerHeight / 2}px` : "0";
const sizeOuter = `${props.modelValue.outerHeight ?? 0}px`;
const fontSizeOuter = props.modelValue.outerHeight ? `${props.modelValue.outerHeight / 2}px` : "0";
const innerBlur = props.modelValue.innerBlur ?? "0";
</script>
<style lang="css" scoped>
.tib-box {
Expand All @@ -71,8 +66,8 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
left: 0;
overflow: hidden;
width: v-bind("props.modelValue.size");
height: v-bind("props.modelValue.size");
border-radius: 5px;
aspect-ratio: 1;
}
.tib-bg img {
Expand All @@ -85,8 +80,8 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
position: relative;
overflow: hidden;
width: v-bind("props.modelValue.size");
height: v-bind("props.modelValue.size");
border-radius: 5px;
aspect-ratio: 1;
}
.tib-icon img {
Expand All @@ -101,11 +96,11 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
left: 0;
display: flex;
width: v-bind("props.modelValue.size");
height: v-bind("props.modelValue.size");
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 5px;
aspect-ratio: 1;
}
.tib-lt {
Expand All @@ -114,9 +109,9 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
left: 3%;
display: flex;
width: v-bind("props.modelValue.ltSize");
height: v-bind("props.modelValue.ltSize");
align-items: center;
justify-content: center;
aspect-ratio: 1;
}
.tib-lt img {
Expand All @@ -131,9 +126,9 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
right: 0;
display: flex;
width: v-bind("props.modelValue.rtSize");
height: v-bind("props.modelValue.rtSize");
align-items: center;
justify-content: center;
aspect-ratio: 1;
background: rgb(0 0 0 / 40%);
border-bottom-left-radius: 5px;
border-top-right-radius: 5px;
Expand All @@ -150,20 +145,20 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
height: v-bind("props.modelValue.innerHeight ?? 0") px;
align-items: center;
justify-content: center;
-webkit-backdrop-filter: blur(v-bind(innerBlur));
backdrop-filter: blur(v-bind(innerBlur));
-webkit-backdrop-filter: blur(v-bind("props.modelValue.innerBlur ?? 0"));
backdrop-filter: blur(v-bind("props.modelValue.innerBlur ?? 0"));
background: rgb(20 20 20 / 40%);
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
color: var(--tgc-white-1);
font-family: var(--font-title);
font-size: v-bind(fontSizeInner);
font-size: v-bind("((props.modelValue.innerHeight ?? 0) / 2).toString() + 'px'");
}
.tib-inner img {
width: v-bind(sizeInner);
height: v-bind(sizeInner);
width: v-bind("(props.modelValue.innerHeight ?? 0).toString() + 'px'");
padding: 1px;
aspect-ratio: 1;
}
.tib-inner span {
Expand All @@ -178,11 +173,11 @@ const innerBlur = props.modelValue.innerBlur ?? "0";
bottom: 0;
display: flex;
width: 100%;
height: v-bind(sizeOuter);
height: v-bind("(props.modelValue.outerHeight ?? 0).toString() + 'px'");
align-items: center;
justify-content: center;
color: var(--common-text-title);
font-size: v-bind(fontSizeOuter);
font-size: v-bind("((props.modelValue.outerHeight ?? 0)/2).toString() + 'px'");
text-align: center;
}
</style>
9 changes: 2 additions & 7 deletions src/components/app/t-overlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@
<script lang="ts" setup>
import { ref, watch } from "vue";
type TolProps = { modelValue: boolean; blurVal?: string; dismissible?: boolean };
type TolProps = { modelValue: boolean; blurVal?: string };
type TolEmits = (e: "update:modelValue", v: boolean) => void;
const emit = defineEmits<TolEmits>();
const props = withDefaults(defineProps<TolProps>(), {
modelValue: false,
blurVal: "20px",
dismissible: true,
});
const props = withDefaults(defineProps<TolProps>(), { modelValue: false, blurVal: "20px" });
const showTolo = ref<boolean>(false);
const showToli = ref<boolean>(false);
Expand All @@ -35,7 +31,6 @@ watch(
);
function toClick(): void {
if (!props.dismissible) return;
emit("update:modelValue", false);
}
</script>
Expand Down
3 changes: 1 addition & 2 deletions src/components/app/t-pinWin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
</div>
</template>
<script lang="ts" setup>
import showSnackbar from "@comp/func/snackbar.js";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { onMounted, ref } from "vue";
import showSnackbar from "../func/snackbar.js";
const isPined = ref<boolean>(false);
onMounted(async () => {
Expand Down
Loading

0 comments on commit 3ed6d50

Please sign in to comment.