Merge branch 'main' of http://192.168.1.13:3000/zcy/canneng-admin
This commit is contained in:
@@ -68,7 +68,11 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
// 自动携带token
|
// 自动携带token
|
||||||
if (config.headers) {
|
if (config.headers) {
|
||||||
const token = adminInfo.getToken()
|
const token = adminInfo.getToken()
|
||||||
if (token) (config.headers as anyObj).Authorization = token
|
if (token) {
|
||||||
|
;(config.headers as anyObj).Authorization = token
|
||||||
|
} else {
|
||||||
|
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|||||||
@@ -130,22 +130,23 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
|||||||
grant_type: 'captcha',
|
grant_type: 'captcha',
|
||||||
imageCode: '',
|
imageCode: '',
|
||||||
verifyCode: 0
|
verifyCode: 0
|
||||||
}).then(res => {
|
})
|
||||||
if (res.code == 'A0000') {
|
.then(res => {
|
||||||
// window.localStorage.setItem('token', '123')
|
console.log('🚀 ~ file: login.vue:134 ~ gongkey ~ res:', res)
|
||||||
|
|
||||||
useInfo.setToken(res.data.token_type + ' ' + res.data.access_token, 'auth')
|
useInfo.setToken(res.data.token_type + ' ' + res.data.access_token, 'auth')
|
||||||
state.submitLoading = false
|
// state.submitLoading = false
|
||||||
router.push({
|
router.push({
|
||||||
path: 'admin/dashboard'
|
path: 'admin/dashboard'
|
||||||
})
|
})
|
||||||
} else {
|
})
|
||||||
ElMessage({
|
// .catch(res => {
|
||||||
message: res.message,
|
// ElMessage({
|
||||||
type: 'warning'
|
// message: res.message,
|
||||||
})
|
// type: 'warning'
|
||||||
state.submitLoading = false
|
// })
|
||||||
}
|
// })
|
||||||
})
|
// state.submitLoading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user