|
@@ -5,11 +5,13 @@
|
|
import uniAsync from "@/utils/uni-async.js"; // uni api async 化
|
|
import uniAsync from "@/utils/uni-async.js"; // uni api async 化
|
|
import {baseApiUrl} from './config.js'
|
|
import {baseApiUrl} from './config.js'
|
|
import store from '@/store/index.js'
|
|
import store from '@/store/index.js'
|
|
|
|
+import CryptoJS from './crypto.js'
|
|
|
|
|
|
/**
|
|
/**
|
|
* 上传文件到服务器
|
|
* 上传文件到服务器
|
|
*/
|
|
*/
|
|
export const uploadToServer = async (tempFilePath) => {
|
|
export const uploadToServer = async (tempFilePath) => {
|
|
|
|
+ const { envVersion } = uni.getAccountInfoSync().miniProgram
|
|
const temres = await uniAsync.uploadFile({
|
|
const temres = await uniAsync.uploadFile({
|
|
url: baseApiUrl + "/public/upload",
|
|
url: baseApiUrl + "/public/upload",
|
|
filePath: tempFilePath,
|
|
filePath: tempFilePath,
|
|
@@ -18,7 +20,7 @@ export const uploadToServer = async (tempFilePath) => {
|
|
Authorization: store.state.user.token,
|
|
Authorization: store.state.user.token,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
- const res = JSON.parse(temres.data);
|
|
|
|
|
|
+ const res = envVersion === 'release' ? JSON.parse(CryptoJS.Des3Decrypt(temres.data)) : JSON.parse(temres.data);
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
return res.data;
|
|
return res.data;
|
|
}
|
|
}
|