Merge branch 'test' of e.coding.net:g-cphe0354/duanju/new_app into gyq
This commit is contained in:
commit
eac369650a
|
|
@ -1,3 +1,4 @@
|
|||
/node_modules/
|
||||
/unpackage/
|
||||
/unpackage/dist/
|
||||
/unpackage/dist/cache/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"version" : "1.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ export const h5Config = {
|
|||
|
||||
export const AppConfig = {
|
||||
production: 'https://dj-api.hnsiyao.cn',
|
||||
test: 'https://video-h5.hnsiyao.cn',
|
||||
test: 'https://web-api.hnsiyao.cn',
|
||||
local: 'http://192.168.1.41:8100'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@
|
|||
"NSPhotoLibraryUsageDescription" : "获取您的相册读取权限,目的是为了在我的资料页面使用相册读取功能,修改上传头像",
|
||||
"NSCameraUsageDescription" : "获取您的摄像头权限,目的是为了在我的资料页面使用摄像头功能,修改上传头像"
|
||||
},
|
||||
"urltypes" : "com.hnsiyao.duanju"
|
||||
"urltypes" : "com.hnsiyao.duanju",
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
|
|
|
|||
|
|
@ -1,64 +1,3 @@
|
|||
import { SM4 } from 'gm-crypto'
|
||||
import {encryptKey} from '@/commons/config.js'
|
||||
|
||||
let HEX_KEY = null
|
||||
|
||||
// 字符串转16进制
|
||||
function str2hex(str) {
|
||||
var val = ''
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (val == '')
|
||||
val = str.charCodeAt(i).toString(16)
|
||||
else
|
||||
val += str.charCodeAt(i).toString(16)
|
||||
}
|
||||
val += ''
|
||||
return val
|
||||
}
|
||||
|
||||
// 获取hex秘钥
|
||||
function getHexKey(){
|
||||
|
||||
if(!HEX_KEY){
|
||||
|
||||
HEX_KEY = str2hex(encryptKey)
|
||||
|
||||
}
|
||||
return HEX_KEY
|
||||
}
|
||||
|
||||
|
||||
// 解密 (http响应数据, 做通用处理)
|
||||
export function sm4DecryptByResData(data){
|
||||
|
||||
if(!data){
|
||||
return data
|
||||
}
|
||||
|
||||
let res = SM4.decrypt(data, getHexKey(), {
|
||||
inputEncoding: 'base64',
|
||||
outputEncoding: 'utf8'
|
||||
})
|
||||
|
||||
if(!res){
|
||||
return res
|
||||
}
|
||||
|
||||
return JSON.parse(res)['originData']
|
||||
}
|
||||
|
||||
// 加密 (http响应数据, 做通用处理)
|
||||
export function sm4EncryptByReqData(data){
|
||||
if(!data){
|
||||
return data
|
||||
}
|
||||
|
||||
// 加密处理
|
||||
let encryptData = SM4.encrypt(JSON.stringify(data), getHexKey(), {
|
||||
inputEncoding: 'utf8',
|
||||
outputEncoding: 'base64'
|
||||
})
|
||||
|
||||
return {encryptData : encryptData}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue