人脸识别与大模型问答
This commit is contained in:
parent
21dbc43674
commit
2dded72955
|
|
@ -1,16 +1,16 @@
|
|||
import axios from 'axios'
|
||||
import { Loading, Message, MessageBox, Notification } from 'element-ui'
|
||||
import {Loading, Message, MessageBox, Notification} from 'element-ui'
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import {getToken} from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { blobValidate, tansParams } from '@/utils/bonus'
|
||||
import {blobValidate, tansParams} from '@/utils/bonus'
|
||||
import cache from '@/plugins/cache'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { decryptCBC, encryptCBC } from '@/utils/aescbc'
|
||||
import { hashWithSM3AndSalt } from '@/utils/sm' // 导入SM3哈希函数
|
||||
import {saveAs} from 'file-saver'
|
||||
import {decryptCBC, encryptCBC} from '@/utils/aescbc'
|
||||
import {hashWithSM3AndSalt} from '@/utils/sm' // 导入SM3哈希函数
|
||||
|
||||
let downloadLoadingInstance
|
||||
export let isRelogin = { show: false }
|
||||
export let isRelogin = {show: false}
|
||||
|
||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ service.interceptors.request.use(
|
|||
if (!sessionObj) {
|
||||
cache.session.setJSON('sessionObj', requestObj)
|
||||
} else {
|
||||
const { url, data, time } = sessionObj
|
||||
const {url, data, time} = sessionObj
|
||||
const interval = 0 // 间隔时间(ms),小于此时间视为重复提交
|
||||
|
||||
if (data === requestObj.data && requestObj.time - time < interval && url === requestObj.url) {
|
||||
|
|
@ -90,7 +90,7 @@ service.interceptors.request.use(
|
|||
if (formData) {
|
||||
formData = formData.slice(0, -1)
|
||||
const encryptedData = encryptCBC(formData)
|
||||
config.data = { formData: encryptedData }
|
||||
config.data = {formData: encryptedData}
|
||||
config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头
|
||||
}
|
||||
} else {
|
||||
|
|
@ -143,7 +143,7 @@ service.interceptors.response.use(
|
|||
}).then(() => {
|
||||
isRelogin.show = false
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index'
|
||||
location.href = '/login'
|
||||
})
|
||||
}).catch(() => {
|
||||
isRelogin.show = false
|
||||
|
|
@ -151,13 +151,13 @@ service.interceptors.response.use(
|
|||
}
|
||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
} else if (code === 500) {
|
||||
Message({ message: msg, type: 'error' })
|
||||
Message({message: msg, type: 'error'})
|
||||
return Promise.reject(new Error(msg))
|
||||
} else if (code === 601) {
|
||||
Message({ message: msg, type: 'warning' })
|
||||
Message({message: msg, type: 'warning'})
|
||||
return Promise.reject('error')
|
||||
} else if (code !== 200) {
|
||||
Notification.error({ title: msg })
|
||||
Notification.error({title: msg})
|
||||
return Promise.reject('error')
|
||||
} else {
|
||||
return res.data
|
||||
|
|
@ -165,7 +165,7 @@ service.interceptors.response.use(
|
|||
},
|
||||
(error) => {
|
||||
console.log('err' + error)
|
||||
let { message } = error
|
||||
let {message} = error
|
||||
|
||||
if (message === 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
|
|
@ -175,7 +175,7 @@ service.interceptors.response.use(
|
|||
message = `系统接口${message.substr(message.length - 3)}异常`
|
||||
}
|
||||
|
||||
Message({ message, type: 'error', duration: 5 * 1000 })
|
||||
Message({message, type: 'error', duration: 5 * 1000})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
|
@ -190,10 +190,10 @@ export function download(url, params, filename, config) {
|
|||
|
||||
return service.post(url, params, {
|
||||
transformRequest: [(params) => tansParams(params)],
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', encryption: 'encryption' },
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded', encryption: 'encryption'},
|
||||
responseType: 'blob',
|
||||
...config
|
||||
}).then(async(data) => {
|
||||
}).then(async (data) => {
|
||||
const isBlob = blobValidate(data)
|
||||
if (isBlob) {
|
||||
const blob = new Blob([data])
|
||||
|
|
|
|||
Loading…
Reference in New Issue