token修改

This commit is contained in:
仲么了
2024-01-03 14:04:56 +08:00
parent 8e2569010f
commit 25a8c99088
5 changed files with 20 additions and 22 deletions

View File

@@ -73,13 +73,19 @@ import { gongkey, login } from '@/api/user'
import { useAdminInfo } from '@/stores/adminInfo'
import type { FormInstance, InputInstance, FormRules } from 'element-plus'
import { useRouter } from 'vue-router'
import { ADMIN_INFO } from '@/stores/constant/cacheKey'
import { Local } from '@/utils/storage'
const router = useRouter()
let timer: number
const formRef = ref<FormInstance>()
const usernameRef = ref<InputInstance>()
const passwordRef = ref<InputInstance>()
const useInfo = useAdminInfo()
const userInfo = useAdminInfo()
Local.remove(ADMIN_INFO)
Local.remove(ADMIN_INFO)
userInfo.removeToken()
interface RuleForm {
username: string
password: string
@@ -107,6 +113,7 @@ const focusInput = () => {
}
onMounted(() => {
timer = window.setTimeout(() => {
pageBubble.init()
}, 0)
@@ -134,7 +141,7 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
}).then(res => {
console.log('🚀 ~ file: login.vue:134 ~ gongkey ~ res:', res)
useInfo.setToken(res.data.token_type + ' ' + res.data.access_token, 'auth')
userInfo.setToken(res.data.token_type + ' ' + res.data.access_token, 'auth')
state.submitLoading = false
router.push({
path: 'admin/dashboard'