登录
This commit is contained in:
parent
8d9f09dd46
commit
0c90654ee5
@ -26,10 +26,10 @@ export const changeTerminalConfigUrl = '/admin/ajax/changeTerminalConfig'
|
|||||||
export const clearCacheUrl = '/admin/ajax/clearCache'
|
export const clearCacheUrl = '/admin/ajax/clearCache'
|
||||||
|
|
||||||
// 公共
|
// 公共
|
||||||
export const captchaUrl = '/api/captcha/captchaImage'
|
export const captchaUrl = '/api/auth/captchaImage'
|
||||||
export const clickCaptchaUrl = '/api/captcha/captchaImage'
|
export const clickCaptchaUrl = '/api/auth/captchaImage'
|
||||||
export const checkClickCaptchaUrl = '/api/common/checkClickCaptcha'
|
export const checkClickCaptchaUrl = '/api/common/checkClickCaptcha'
|
||||||
export const refreshTokenUrl = '/api/common/refreshToken'
|
export const refreshTokenUrl = '/api/auth/refreshToken'
|
||||||
|
|
||||||
// api模块(前台)
|
// api模块(前台)
|
||||||
export const apiUploadUrl = '/api/ajax/upload'
|
export const apiUploadUrl = '/api/ajax/upload'
|
||||||
|
@ -122,35 +122,36 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
|||||||
|
|
||||||
if (response.config.responseType == 'json') {
|
if (response.config.responseType == 'json') {
|
||||||
if (response.data && response.data.code == 401) {
|
if (response.data && response.data.code == 401) {
|
||||||
// if (response.data.code == 409) {
|
if (response.data.code == 409) {
|
||||||
// if (!window.tokenRefreshing) {
|
if (!window.tokenRefreshing) {
|
||||||
// window.tokenRefreshing = true
|
window.tokenRefreshing = true
|
||||||
// return refreshToken()
|
return refreshToken()
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// adminInfo.setToken(res.data.token, 'auth')
|
adminInfo.setToken(res.data.token, 'auth')
|
||||||
// response.headers.token = `${res.data.token}`
|
response.headers.token = `${res.data.accessToken}`
|
||||||
// window.requests.forEach((cb) => cb(res.data.token, 'admin-refresh'))
|
window.requests.forEach((cb) => cb(res.data.accessToken, 'admin-refresh'))
|
||||||
// window.requests = []
|
window.requests = []
|
||||||
// return Axios(response.config)
|
return Axios(response.config)
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// adminInfo.removeToken()
|
adminInfo.removeToken()
|
||||||
// router.push({ name: 'adminLogin' })
|
router.push({ name: 'adminLogin' })
|
||||||
// return Promise.reject(err)
|
return Promise.reject(err)
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// window.tokenRefreshing = false
|
window.tokenRefreshing = false
|
||||||
// })
|
})
|
||||||
// } else {
|
} else {
|
||||||
// return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
// // 用函数形式将 resolve 存入,等待刷新后再执行
|
// 用函数形式将 resolve 存入,等待刷新后再执行
|
||||||
// window.requests.push((token: string, type: string) => {
|
window.requests.push((token: string, type: string) => {
|
||||||
// response.headers.token = `${token}`
|
const v = response.headers.v
|
||||||
// resolve(Axios(response.config))
|
response.headers.token = encrypt_aes(token, v)
|
||||||
// })
|
resolve(Axios(response.config))
|
||||||
// })
|
})
|
||||||
// }
|
})
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
// if (options.showCodeMessage) {
|
// if (options.showCodeMessage) {
|
||||||
// ElNotification({
|
// ElNotification({
|
||||||
// type: 'error',
|
// type: 'error',
|
||||||
|
@ -117,7 +117,7 @@ const form = reactive({
|
|||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
keep: false,
|
keep: false,
|
||||||
uuid: '',
|
key: '',
|
||||||
code: '',
|
code: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ const onSubmitPre = () => {
|
|||||||
|
|
||||||
const load = () => {
|
const load = () => {
|
||||||
getCaptchaData().then((res) => {
|
getCaptchaData().then((res) => {
|
||||||
form.uuid = res.data.key
|
form.key = res.data.key
|
||||||
state.captcha = 'data:image\/png;base64,' + res.data.img
|
state.captcha = 'data:image\/png;base64,' + res.data.img
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user