完善cookie模式

This commit is contained in:
piexlMax
2024-01-04 22:15:54 +08:00
parent 8aefb5db8e
commit 08617f2fd4
7 changed files with 40 additions and 31 deletions
+1
View File
@@ -21,6 +21,7 @@
"echarts": "5.4.3",
"element-plus": "^2.3.8",
"highlight.js": "^11.8.0",
"js-cookie": "^3.0.5",
"marked": "4.3.0",
"mitt": "^3.0.1",
"nprogress": "^0.2.0",
+2 -1
View File
@@ -5,6 +5,7 @@ import { ElLoading, ElMessage } from 'element-plus'
import { defineStore } from 'pinia'
import { ref, computed, watch } from 'vue'
import { useRouterStore } from './router'
import cookie from 'js-cookie'
export const useUserStore = defineStore('user', () => {
const loadingInstance = ref(null)
@@ -18,7 +19,7 @@ export const useUserStore = defineStore('user', () => {
activeColor: 'var(--el-color-primary)',
baseColor: '#fff'
})
const token = ref(window.localStorage.getItem('token') || '')
const token = ref(window.localStorage.getItem('token') || cookie.get('x-token') || '')
const setUserInfo = (val) => {
userInfo.value = val
}
@@ -151,7 +151,7 @@ import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import sysDictionaryDetail from './sysDictionaryDetail.vue'
import { Edit, Plus } from '@element-plus/icons-vue'
import { Edit } from '@element-plus/icons-vue'
defineOptions({
name: 'SysDictionary',