This commit is contained in:
parent
ea522a9c9f
commit
b8ca5dfed5
|
|
@ -344,12 +344,12 @@ const afterRead = (e) => {
|
|||
if (data.code === 200) {
|
||||
keyInfoForm.value.faceImg = [e.file[0]]
|
||||
} else {
|
||||
// uni.$u.toast('人脸识别失败:' + data.msg)
|
||||
uni.$u.toast('人脸识别失败:' + data.msg)
|
||||
keyInfoForm.value.faceImg = [e.file[0]]
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.$u.toast('人脸识别失败:' + err.msg)
|
||||
uni.$u.toast('人脸识别失败')
|
||||
},
|
||||
})
|
||||
//
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ const onAttendanceHandle = () => {
|
|||
},
|
||||
})
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败,请重新识别')
|
||||
uni.$u.toast('人脸识别失败,请重新识别' + data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ const onFaceRecognition = () => {
|
|||
})
|
||||
}, 500)
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败,请重新识别')
|
||||
uni.$u.toast('人脸识别失败,请重新识别' + data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('人脸识别失败:' + err.msg)
|
||||
uni.$u.toast('人脸识别失败')
|
||||
},
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -96,13 +96,13 @@ const handleTapPersonEntry = (item) => {
|
|||
})
|
||||
}, 500)
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败,请重新识别')
|
||||
uni.$u.toast('人脸识别失败,请重新识别' + data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
showLoading.value = false
|
||||
console.log(err, 'err人脸识别失败')
|
||||
uni.$u.toast('人脸识别失败:' + err.msg)
|
||||
uni.$u.toast('人脸识别失败')
|
||||
},
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
export const getCurrentEnv = () => {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
const { platform } = systemInfo
|
||||
|
||||
// 平台判断
|
||||
switch (platform) {
|
||||
case 'android':
|
||||
return 'Android'
|
||||
case 'ios':
|
||||
return 'iOS'
|
||||
case 'devtools':
|
||||
return 'H5' // 注意:H5 环境下 platform 为 'devtools'
|
||||
case 'mp-weixin':
|
||||
return '微信小程序'
|
||||
case 'mp-alipay':
|
||||
return '支付宝小程序'
|
||||
// 其他平台可以继续补充
|
||||
default:
|
||||
return platform
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import { useMemberStore, useCommonStore } from '@/stores'
|
|||
import { encrypt, decrypt } from './encrypt' // 引入加解密方法
|
||||
import { cloneDeep } from 'lodash-es' // 引入深拷贝函数
|
||||
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt, tansParams } from '@/utils/sm'
|
||||
import { getCurrentEnv } from '@/utils/getConfig'
|
||||
|
||||
/**
|
||||
* 添加拦截器
|
||||
|
|
@ -113,8 +114,17 @@ export const http = (options) => {
|
|||
|
||||
success(res) {
|
||||
console.log(res, '请求拦截器处解密后的返回值')
|
||||
const currentEnv = getCurrentEnv()
|
||||
console.log(currentEnv, 'currentEnv')
|
||||
// 判断是H5 还是App环境
|
||||
let isEncryptResponse = ''
|
||||
if (currentEnv === 'windows') {
|
||||
isEncryptResponse = 'encryptresponse'
|
||||
} else {
|
||||
isEncryptResponse = 'encryptResponse'
|
||||
}
|
||||
|
||||
if (res.header.encryptResponse) {
|
||||
if (res.header[isEncryptResponse]) {
|
||||
console.log(JSON.parse(decryptWithSM4(res.data)), '解密后')
|
||||
|
||||
res.data = JSON.parse(decryptWithSM4(res.data))
|
||||
|
|
|
|||
Loading…
Reference in New Issue