diff --git a/src/pages/Config.vue b/src/pages/Config.vue
index 9e11a99f..5386146a 100644
--- a/src/pages/Config.vue
+++ b/src/pages/Config.vue
@@ -60,6 +60,25 @@
/>
+
+
+ mdi-view-dashboard
+
+
+
+
+
+
提交
+
+
+
+
@@ -82,6 +101,7 @@ import TLoading from "../components/t-loading.vue";
import { dialog, fs, app } from "@tauri-apps/api";
// store
import useAppStore from "../store/modules/app";
+import useHomeStore from "../store/modules/home";
import useAchievementsStore from "../store/modules/achievements";
// utils
import { WriteTGData } from "../utils/TGIndex";
@@ -90,6 +110,7 @@ import { getDataList } from "../data/init";
// Store
const appStore = useAppStore();
+const homeStore = useHomeStore();
const achievementsStore = useAchievementsStore();
// About
@@ -97,6 +118,9 @@ const loading = ref(true);
const versionApp = ref("");
const versionTauri = ref("");
+// data
+const showHome = ref(homeStore.getShowValue());
+
// load version
onMounted(async () => {
versionApp.value = await app.getVersion();
@@ -151,11 +175,26 @@ async function deleteTemp() {
await dialog.message("临时数据已删除!");
}
}
+
+// 修改首页显示
+async function submitHome() {
+ // 获取已选
+ const show = showHome.value;
+ if (show.length < 1) {
+ await dialog.message("请至少选择一个!");
+ return;
+ }
+ // 设置
+ await homeStore.setShowValue(show);
+ await dialog.message("已修改!");
+}
+
// 恢复默认配置
async function setDefaultConfig() {
const res = await dialog.confirm("确定要初始化数据吗?");
if (res) {
await appStore.init();
+ await homeStore.init();
await achievementsStore.init();
dialog.message("已恢复默认配置!").then(() => {
window.location.reload();
diff --git a/src/pages/Home.vue b/src/pages/Home.vue
index c9805486..31cf4390 100644
--- a/src/pages/Home.vue
+++ b/src/pages/Home.vue
@@ -1,7 +1,7 @@
-
-
-
+
+
+
diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts
index 83ac559b..bb94f48a 100644
--- a/src/store/modules/app.ts
+++ b/src/store/modules/app.ts
@@ -24,7 +24,7 @@ const useAppStore = defineStore({
// 侧边栏设置
sidebar: {
// 是否折叠
- collapse: false,
+ collapse: true,
// 是否显示
submenu: {
database: false,
@@ -55,7 +55,7 @@ const useAppStore = defineStore({
async check() {
if (this.sidebar === undefined) {
this.sidebar = {
- collapse: false,
+ collapse: true,
submenu: {
database: false,
},
diff --git a/src/store/modules/home.ts b/src/store/modules/home.ts
new file mode 100644
index 00000000..b45e0280
--- /dev/null
+++ b/src/store/modules/home.ts
@@ -0,0 +1,56 @@
+/**
+ * @file store modules home.ts
+ * @description Home store module
+ * @author BTMuli
+ * @since Alpha v0.1.1
+ */
+
+import { defineStore } from "pinia";
+
+const useHomeStore = defineStore({
+ id: "home",
+ state: () => {
+ return {
+ calendar: {
+ show: true,
+ order: 3,
+ },
+ pool: {
+ show: true,
+ order: 1,
+ },
+ position: {
+ show: true,
+ order: 2,
+ },
+ };
+ },
+ actions: {
+ async init() {
+ this.calendar.show = true;
+ this.calendar.order = 3;
+ this.pool.show = true;
+ this.pool.order = 1;
+ this.position.show = true;
+ this.position.order = 2;
+ },
+ getShowItem() {
+ return ["素材日历", "限时祈愿", "近期活动"];
+ },
+ getShowValue() {
+ let showValue = [];
+ if (this.calendar.show) showValue.push("素材日历");
+ if (this.pool.show) showValue.push("限时祈愿");
+ if (this.position.show) showValue.push("近期活动");
+ return showValue;
+ },
+ setShowValue(value: string[]) {
+ this.calendar.show = value.includes("素材日历");
+ this.pool.show = value.includes("限时祈愿");
+ this.position.show = value.includes("近期活动");
+ },
+ },
+ persist: true,
+});
+
+export default useHomeStore;