联调接口
This commit is contained in:
30
src/utils/encrypt.js
Normal file
30
src/utils/encrypt.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
const key = "DOkldC48$@#(&siI";
|
||||
const iv = "4dad87133de5f2de"
|
||||
|
||||
// 加密
|
||||
function Encrypt(text) {
|
||||
// 解密模式为CBC,补码方式为PKCS5Padding(也就是PKCS7)
|
||||
return CryptoJS.AES.encrypt(text, CryptoJS.enc.Utf8.parse(key), {
|
||||
iv: CryptoJS.enc.Utf8.parse(iv),
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString()
|
||||
}
|
||||
|
||||
// 解密
|
||||
function Decrypt(text) {
|
||||
// 解密模式为CBC,补码方式为PKCS5Padding(也就是PKCS7)
|
||||
let decrypted = CryptoJS.AES.decrypt(text, CryptoJS.enc.Utf8.parse(key), {
|
||||
iv: CryptoJS.enc.Utf8.parse(iv),
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
})
|
||||
return decrypted.toString(CryptoJS.enc.Utf8)
|
||||
}
|
||||
|
||||
export default {
|
||||
Encrypt,
|
||||
Decrypt
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export const showToast = (msg, icon = 'none', mask = false) => {
|
||||
* @param title
|
||||
* @returns
|
||||
*/
|
||||
export const showAlert = (content, title = '提示',showCancel=true,succFun) => {
|
||||
export const showAlert = (content, title = '提示',showCancel=false,succFun) => {
|
||||
return uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import HttpRequest from './http';
|
||||
import { merge } from 'lodash-es';
|
||||
import { getToken } from '../auth';
|
||||
import { CLIENT_ID } from '@/enums/cacheEnums';
|
||||
import { RequestCodeEnum, RequestMethodsEnum } from '@/enums/requestEnums';
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useMessage } from '../message';
|
||||
@@ -54,7 +55,7 @@ const requestHooks = {
|
||||
return Promise.reject();
|
||||
|
||||
default:
|
||||
message.toast(msg)
|
||||
message.alert(msg)
|
||||
// return data;
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
@@ -72,7 +73,10 @@ const requestHooks = {
|
||||
const defaultOptions = {
|
||||
requestOptions: {// 请求配置
|
||||
timeout: 10 * 1000,
|
||||
header: { version: '1.0.0' }
|
||||
header: {
|
||||
version: '1.0.0',
|
||||
clientId:`${CLIENT_ID || 2}`, // clientId传2
|
||||
}
|
||||
},
|
||||
baseUrl: `${import.meta.env.VITE_APP_BASE_URL || ''}`,// 基础 URL
|
||||
isReturnDefaultResponse: false,// 是否返回默认响应
|
||||
|
||||
11
src/utils/status.js
Normal file
11
src/utils/status.js
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
// 1=Android、2=IOS
|
||||
export function formatIOS(type){
|
||||
const result = {
|
||||
'android':1,
|
||||
'ios':2,
|
||||
}
|
||||
return result[type];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user