diff --git a/collect_information/package.json b/collect_information/package.json
index 9c42ee8..c05bfaa 100644
--- a/collect_information/package.json
+++ b/collect_information/package.json
@@ -59,6 +59,7 @@
"@tarojs/taro": "3.6.25",
"dayjs": "^1.11.10",
"pinia": "^2.1.7",
+ "pinia-plugin-persistedstate": "^4.0.1",
"vue": "^3.0.0"
},
"devDependencies": {
diff --git a/collect_information/src/app.config.ts b/collect_information/src/app.config.ts
index aec9800..df9377c 100644
--- a/collect_information/src/app.config.ts
+++ b/collect_information/src/app.config.ts
@@ -22,6 +22,12 @@ export default defineAppConfig({
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
+ {
+ pagePath: 'pages/policeManager/index/index',
+ text: '首页',
+ iconPath: "assets/mine/punch.png",
+ selectedIconPath: "assets/mine/punch-active.png"
+ },
{
pagePath: 'pages/employeeInfo/employeeInfo',
text: '员工信息',
diff --git a/collect_information/src/app.ts b/collect_information/src/app.ts
index 60b67c5..117c29d 100644
--- a/collect_information/src/app.ts
+++ b/collect_information/src/app.ts
@@ -2,7 +2,10 @@ import {createApp} from 'vue'
import {createPinia} from 'pinia'
import './app.scss'
import './assets/scss/colorui.scss'
+import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
+const pinia = createPinia()
+pinia.use(piniaPluginPersistedstate)
const App = createApp({
onShow(options) {
console.log('App onShow.')
@@ -10,6 +13,6 @@ const App = createApp({
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
})
-App.use(createPinia())
+App.use(pinia)
export default App
diff --git a/collect_information/src/custom-tab-bar/index.vue b/collect_information/src/custom-tab-bar/index.vue
index b6f6e33..f2b91fb 100644
--- a/collect_information/src/custom-tab-bar/index.vue
+++ b/collect_information/src/custom-tab-bar/index.vue
@@ -1,11 +1,14 @@
-
-
-
-
- {{ item.text }}
-
-
+
+
+
+
+
+
+
+ {{ item.text }}
+
+
diff --git a/collect_information/src/store/index.ts b/collect_information/src/store/index.ts
index 7562b84..e29a946 100644
--- a/collect_information/src/store/index.ts
+++ b/collect_information/src/store/index.ts
@@ -1,19 +1,51 @@
import {defineStore} from 'pinia'
+import Taro from '@tarojs/taro'
export const useCounterStore = defineStore('counter', {
state: () => {
return {
userInfo: {},
- selected: 0
+ selected: 0,
+ list: Taro.getStorageSync('list') || [
+ {
+ pagePath: '/pages/projectManager/index/index',
+ text: '首页',
+ iconPath: "/assets/mine/punch.png",
+ selectedIconPath: "/assets/mine/punch-active.png"
+ },
+ {
+ pagePath: '/pages/employeeInfo/employeeInfo',
+ text: '员工信息',
+ iconPath: "/assets/mine/punch.png",
+ selectedIconPath: "/assets/mine/punch-active.png"
+ },
+ {
+ pagePath: '/pages/mine/mine',
+ text: '我的',
+ iconPath: "/assets/mine/my.png",
+ selectedIconPath: "/assets/mine/my-active.png"
+ },
+ ]
}
},
actions: {
setSelected(index: number) {
this.selected = index
+ },
+ updateHomePagePath(newPath: string) {
+ this.list[0].pagePath = newPath
+ // 更新 list 后存储到小程序本地存储
+ Taro.setStorageSync('list', this.list)
}
},
getters: {
- getSelected: (state) => state.selected
+ getSelected: (state) => state.selected,
+ getList: (state) => state.list
+ },
+ persist: {
+ // key: 'my-store', // 存储到 localStorage 的 key
+ // storage: localStorage, // 持久化方式为 localStorage
+ // paths: ['list'] // 持久化 list
}
})