联调接口

This commit is contained in:
xuli3099
2025-08-12 13:43:21 +08:00
parent 74596473ab
commit f5717959ae
15 changed files with 293 additions and 114 deletions

30
src/utils/encrypt.js Normal file
View 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
}

View File

@@ -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,

View File

@@ -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
View File

@@ -0,0 +1,11 @@
// 1=Android、2=IOS
export function formatIOS(type){
const result = {
'android':1,
'ios':2,
}
return result[type];
}