Browse Source

add some code

刘洋 1 year ago
parent
commit
a44fd90711
6 changed files with 14 additions and 9 deletions
  1. 2 2
      .env.production
  2. 2 2
      .env.test
  3. 0 1
      components.d.ts
  4. 4 3
      package.json
  5. 2 1
      src/store/index.js
  6. 4 0
      src/store/modules/user.js

+ 2 - 2
.env.production

@@ -1,7 +1,7 @@
 VITE_ENV_TYPE=production
 
-VITE_VISUALIZER=N
-VITE_COMPRESS=N
+VITE_VISUALIZER=Y
+VITE_COMPRESS=Y
 
 # gzip | brotliCompress | deflate | deflateRaw
 VITE_COMPRESS_TYPE=gzip

+ 2 - 2
.env.test

@@ -1,6 +1,6 @@
 VITE_ENV_TYPE=test
-VITE_VISUALIZER=N
-VITE_COMPRESS=N
+VITE_VISUALIZER=Y
+VITE_COMPRESS=Y
 
 # gzip | brotliCompress | deflate | deflateRaw
 VITE_COMPRESS_TYPE=gzip

+ 0 - 1
components.d.ts

@@ -32,7 +32,6 @@ declare module 'vue' {
     TIcon: typeof import('tdesign-vue-next')['Icon']
     TInput: typeof import('tdesign-vue-next')['Input']
     TInputNumber: typeof import('tdesign-vue-next')['InputNumber']
-    TInputNunber: typeof import('tdesign-vue-next')['InputNunber']
     TLayout: typeof import('tdesign-vue-next')['Layout']
     TLink: typeof import('tdesign-vue-next')['Link']
     TMenu: typeof import('tdesign-vue-next')['Menu']

+ 4 - 3
package.json

@@ -19,7 +19,7 @@
     "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/"
   },
   "dependencies": {
-    "@vueuse/core": "^9.6.0",
+    "@vueuse/core": "^9.13.0",
     "autoprefixer": "^10.4.14",
     "axios": "^1.2.1",
     "dayjs": "^1.11.7",
@@ -29,7 +29,8 @@
     "mockjs": "^1.1.0",
     "nprogress": "^0.2.0",
     "pinia": "^2.0.27",
-    "tdesign-vue-next": "^1.4.1",
+    "pinia-plugin-persistedstate": "^3.2.0",
+    "tdesign-vue-next": "^1.4.2",
     "tvision-color": "^1.5.0",
     "unplugin-vue-setup-extend-plus": "^1.0.0",
     "vue": "^3.3.4",
@@ -58,7 +59,7 @@
     "less": "^4.1.3",
     "prettier": "^2.8.1",
     "rollup-plugin-node-polyfills": "^0.2.1",
-    "rollup-plugin-visualizer": "^5.9.0",
+    "rollup-plugin-visualizer": "^5.9.2",
     "typescript": "^4.8.3",
     "unocss": "^0.52.0",
     "unplugin-auto-import": "^0.16.6",

+ 2 - 1
src/store/index.js

@@ -1,8 +1,9 @@
 import { createPinia } from 'pinia';
 import useAppStore from './modules/app';
 import useUserStore from './modules/user';
+import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
 
 const pinia = createPinia();
-
+pinia.use(piniaPluginPersistedstate);
 export { useAppStore, useUserStore };
 export default pinia;

+ 4 - 0
src/store/modules/user.js

@@ -72,6 +72,9 @@ const filterAsyncRouter = (routerMap) => {
 };
 
 const useUserStore = defineStore('user', {
+  persist: true,
+  storage: localStorage,
+  paths: ['user'],
   state: () => ({
     routers: undefined,
     user: undefined,
@@ -153,6 +156,7 @@ const useUserStore = defineStore('user', {
       return login(form)
         .then((r) => {
           this.setToken(r.token);
+          this.setInfo(r);
           return true;
         })
         .catch((e) => {