This commit is contained in:
刘玉霞 2024-06-21 09:27:02 +08:00
parent e43f9594cc
commit f4dfe60c7e
2 changed files with 10 additions and 9 deletions

View File

@ -2,7 +2,6 @@ import createAxios from '/@/utils/axios'
import { isAdminApp, checkFileMimetype } from '/@/utils/common'
import { getUrl } from '/@/utils/axios'
import { useAdminInfo } from '/@/stores/adminInfo'
import { useUserInfo } from '/@/stores/userInfo'
import { ElNotification, type UploadRawFile } from 'element-plus'
import { useSiteConfig } from '/@/stores/siteConfig'
import { state as uploadExpandState, fileUpload as uploadExpand } from '/@/components/mixins/baUpload'
@ -27,8 +26,8 @@ export const changeTerminalConfigUrl = '/admin/ajax/changeTerminalConfig'
export const clearCacheUrl = '/admin/ajax/clearCache'
// 公共
export const captchaUrl = '/api/captchaImage'
export const clickCaptchaUrl = '/api/captchaImage'
export const captchaUrl = '/api/captcha/captchaImage'
export const clickCaptchaUrl = '/api/captcha/captchaImage'
export const checkClickCaptchaUrl = '/api/common/checkClickCaptcha'
export const refreshTokenUrl = '/api/common/refreshToken'

View File

@ -8,6 +8,7 @@ import adminBaseRoute from '/@/router/static/adminBase'
import { useAdminInfo } from '/@/stores/adminInfo'
import { useConfig } from '/@/stores/config'
import { encrypt_aes, decrypt_aes, generateRandomNumber } from './crypto'
import { json } from 'stream/consumers'
window.requests = []
window.tokenRefreshing = false
@ -48,6 +49,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
headers: {
'think-lang': config.lang.defaultLang,
server: true,
'Content-Type': 'application/json',
},
responseType: 'json',
})
@ -88,14 +90,14 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
if (config.method === 'post' && config.data) {
// 对data进行加密
const formData = new FormData()
formData.append('param', encrypt_aes(config.data, v))
config.data = formData
// const formData = new FormData()
// formData.append('param')
config.data = encrypt_aes(config.data, v)
} else if (config.method === 'get' && config.params) {
// 对params进行加密
const formData = new FormData()
formData.append('param', encrypt_aes(config.params, v))
config.params = formData
// const formData = new FormData()
// formData.append('param')
config.params = encrypt_aes(config.params, v)
}
// 自动携带token