联调接口
This commit is contained in:
@@ -3,7 +3,7 @@ import request from "@/utils/request"
|
||||
// 获取客户端版本
|
||||
export function versionCheck(data) {
|
||||
return request.post({
|
||||
url: '/api/versionCheck',
|
||||
url: '/acc/auth/version',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -11,18 +11,28 @@ export function versionCheck(data) {
|
||||
// 获取设备绑定状态
|
||||
export function getBindStatus(data) {
|
||||
return request.post({
|
||||
url: '/api/getBindStatus',
|
||||
url: '/acc/auth/status',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取图片
|
||||
export function getCaptchaImage() {
|
||||
return request.get({
|
||||
url: '/api/captchaImage',
|
||||
// 申请设备授权
|
||||
export function authDeviceApply(data) {
|
||||
return request.post({
|
||||
url: '/acc/auth/apply',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// App绑定设备授权码
|
||||
export function authInputCode(data) {
|
||||
return request.post({
|
||||
url: '/acc/auth/inputCode',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 获取验证码
|
||||
export function getVerifyCode(data) {
|
||||
return request.post({
|
||||
@@ -34,11 +44,18 @@ export function getVerifyCode(data) {
|
||||
// 登录
|
||||
export function login(data) {
|
||||
return request.post({
|
||||
url: '/api/user/login',
|
||||
url: '/acc/auth/login',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 登出
|
||||
export function logout(data) {
|
||||
return request.post({
|
||||
url: '/acc/auth/logout',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
export function getUserInfo(data) {
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
export const TOKEN_KEY = 'token';
|
||||
export const AGREEWELCOME_KEY="agreewelcome"
|
||||
export const AGREEWELCOME_KEY="agreewelcome";
|
||||
|
||||
// clientId 默认写2
|
||||
export const CLIENT_ID=2;
|
||||
// #区分内外网 //1-内网,2-外网
|
||||
export const NETWORK_ENV=1;
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ export const RequestMethodsEnum = {
|
||||
};
|
||||
|
||||
export const RequestCodeEnum = {
|
||||
SUCCESS: 0, //成功
|
||||
SUCCESS: 0 || 200, //成功
|
||||
FAILED: -1, // 失败
|
||||
TOKEN_INVALID: 10003 // TOKEN失效未登录
|
||||
TOKEN_INVALID: 401 // TOKEN失效未登录
|
||||
};
|
||||
|
||||
export const RequestErrMsgEnum = {
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="bottom-pic">
|
||||
<image src="@/static/images/PicLogo@2x.png" class="pic-logo" />
|
||||
@@ -85,8 +84,10 @@ import { ref,nextTick,onMounted,onUnmounted,getCurrentInstance } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { getNavBarPaddingTop} from '@/utils/system.js';
|
||||
import { getBindStatus } from '@/api/auth.js';
|
||||
import { getBindStatus,authDeviceApply,authInputCode } from '@/api/auth.js';
|
||||
import {showToast} from '@/utils/message.js'
|
||||
import { CLIENT_ID,NETWORK_ENV } from '@/enums/cacheEnums';
|
||||
import encryptObj from '@/utils/encrypt.js'
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
import { useUserStore } from '@/stores/user';
|
||||
@@ -112,7 +113,9 @@ onMounted(async () => {
|
||||
console.log("333bindStatus=>",bindStatus.value)
|
||||
if(bindStatus.value==2){
|
||||
// bindStatus=2-----到等待页面(定时任务查询 10秒查询一次)
|
||||
timer = setInterval(()=>{ refreshBindStatus() },1000*10)//10秒刷新一次
|
||||
timer = setInterval(()=>{
|
||||
refreshBindStatus()
|
||||
},1000*10)//10秒刷新一次
|
||||
}
|
||||
})
|
||||
|
||||
@@ -124,7 +127,7 @@ onUnmounted(() => {
|
||||
// 根据设备ID查询设备状态
|
||||
let selectBindStatus = async ()=>{
|
||||
if(deviceId.value){
|
||||
let res = await getBindStatus({deviceId:deviceId.value})
|
||||
let res = await getBindStatus({uniqCode:deviceId.value})
|
||||
bindStatus.value = res.bindStatus;
|
||||
console.log("111bindStatus=>",bindStatus.value)
|
||||
|
||||
@@ -145,10 +148,12 @@ let selectBindStatus = async ()=>{
|
||||
|
||||
// 刷新定时任务
|
||||
let refreshBindStatus = async ()=>{
|
||||
let res = await getBindStatus({deviceId:deviceId.value})
|
||||
let res = await getBindStatus({uniqCode:deviceId.value})
|
||||
bindStatus.value = res.bindStatus;
|
||||
console.log("222bindStatus=>",bindStatus.value)
|
||||
if(bindStatus.value==2){}else{
|
||||
if(bindStatus.value==2){
|
||||
|
||||
}else{
|
||||
if(bindStatus.value==4){
|
||||
if (userStore.isLogin) {
|
||||
uni.reLaunch({
|
||||
@@ -167,50 +172,84 @@ let refreshBindStatus = async ()=>{
|
||||
// 账号登录
|
||||
const form2 = ref(null);
|
||||
const formData2 = ref({
|
||||
username: 'admin',
|
||||
password: '123456'
|
||||
username: '',
|
||||
password: ''
|
||||
});
|
||||
|
||||
const rules2 = {
|
||||
username: {
|
||||
rules: [
|
||||
{ required: true, errorMessage: '请输入用户名' },
|
||||
{ minLength: 3, maxLength: 10, errorMessage: '用户名长度在3到10个字符之间' }
|
||||
// { minLength: 3, maxLength: 10, errorMessage: '用户名长度在3到10个字符之间' }
|
||||
]
|
||||
},
|
||||
password: {
|
||||
rules: [
|
||||
{ required: true, errorMessage: '请输入密码' },
|
||||
{ pattern: /^[a-zA-Z0-9]{6,12}$/, errorMessage: '密码必须是6-12位字母或数字' }
|
||||
// { pattern: /^[a-zA-Z0-9]{6,12}$/, errorMessage: '密码必须是6-12位字母或数字' }
|
||||
]
|
||||
}
|
||||
};
|
||||
const btnLoading=ref(false)
|
||||
// 登录提交
|
||||
const submitForm = () => {
|
||||
// 用户名和密码登录
|
||||
form2.value.validate().then(async param => {
|
||||
const submitForm = async() => {
|
||||
// 用户名和密码登录
|
||||
form2.value.validate().then(async param => {
|
||||
btnLoading.value = true;
|
||||
setTimeout(()=>{
|
||||
console.log('表单数据11:', formData2.value);
|
||||
// let res = await login(param);
|
||||
deviceId.value = uuidv4();
|
||||
let cilentId = `${CLIENT_ID || 2}`;
|
||||
let password = encryptObj.Encrypt(param.username + cilentId + "," + param.password);
|
||||
console.log("password=>",password)
|
||||
|
||||
btnLoading.value = false;
|
||||
|
||||
deviceId.value = uuidv4();console.log("新生成=>",deviceId.value);
|
||||
uni.setStorageSync('app_device_id', deviceId.value)
|
||||
|
||||
bindStatus.value = 2;//默认为 等待审核
|
||||
|
||||
timer = setInterval(()=>{ refreshBindStatus() },1000*10)//10秒刷新一次
|
||||
},500)
|
||||
|
||||
let systemInfo = uni.getSystemInfoSync()
|
||||
let params = {
|
||||
username:param.username,
|
||||
password,
|
||||
networkEnv:NETWORK_ENV,//1-内网,2-外网
|
||||
uniqCode:deviceId.value,//生成的设备唯一标识
|
||||
...systemInfo,//设备信息
|
||||
// #ifdef APP-PLUS
|
||||
verId:systemInfo.appWgtVersion,//当前版本号
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
verId : systemInfo.appVersion,
|
||||
// #endif
|
||||
osAndroidApiLevel:systemInfo.osAndroidAPILevel
|
||||
}
|
||||
console.log("params=>",params)
|
||||
let res = await authDeviceApply(params);
|
||||
console.log("authDeviceApply=>",res)
|
||||
btnLoading.value = false;
|
||||
uni.setStorageSync('app_device_id', deviceId.value)
|
||||
bindStatus.value = res.bindStatus;//默认为 2-等待审核
|
||||
// 刷新状态
|
||||
refreshBindStatus();
|
||||
timer = setInterval(()=>{
|
||||
refreshBindStatus()
|
||||
},1000*10)//10秒刷新一次
|
||||
}).catch(err => {
|
||||
console.log('表单错误11:', err);
|
||||
btnLoading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 在UniApp的APP端使用plus.netinfo
|
||||
let getLocalIPInUniApp=()=>{
|
||||
return new Promise((resolve) => {
|
||||
plus.netinfo.getCurrentInfo((info) => {
|
||||
const ips = [];
|
||||
if (info.wifi && info.wifi.ipAddress) {
|
||||
ips.push(info.wifi.ipAddress);
|
||||
}
|
||||
if (info.cellular && info.cellular.ipAddress) {
|
||||
ips.push(info.cellular.ipAddress);
|
||||
}
|
||||
console.log(1111,ips)
|
||||
resolve(ips.length ? ips : ['无法获取本地IP']);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新
|
||||
const handleRefresh = ()=>{
|
||||
selectBindStatus();
|
||||
@@ -276,7 +315,6 @@ const handleInput=(e,type)=>{
|
||||
num6.value = obj6.num;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let authCode = ref('')
|
||||
@@ -290,6 +328,7 @@ const handleBlur = ()=>{
|
||||
authCode.value = pass1+pass2+pass3+pass4+pass5+pass6;
|
||||
}
|
||||
|
||||
// 执行设备绑定
|
||||
let subLoading = ref(false)
|
||||
const handleSubmit=()=>{
|
||||
console.log("authCode=>",authCode.value)
|
||||
@@ -297,10 +336,22 @@ const handleSubmit=()=>{
|
||||
showToast("请输入验证码")
|
||||
return;
|
||||
}
|
||||
if(authCode.value.length!=6){
|
||||
showToast("请正确输入验证码")
|
||||
return;
|
||||
}
|
||||
|
||||
let uniqCode = uni.getStorageSync('app_device_id');
|
||||
let param={
|
||||
uniqCode,
|
||||
authCode:authCode.value
|
||||
}
|
||||
subLoading.value=true;
|
||||
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
subLoading.value = false;
|
||||
authInputCode(param).then(res=>{
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}).finally(()=>{
|
||||
subLoading.value = false;
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { versionCheck,getBindStatus } from '@/api/auth.js';
|
||||
import { formatIOS } from '@/utils/status.js'
|
||||
import { useUserStore } from '@/stores/user';
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -43,51 +44,82 @@ onLoad(async(opt) => {
|
||||
// #ifdef APP-PLUS
|
||||
// 查询版本接口
|
||||
await getOSVesion();
|
||||
// #endif
|
||||
|
||||
// 不更新版本 执行设备ID查询和绑定操作
|
||||
if(!versionVisible.value){
|
||||
selectDeviceId()
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
setTimeout(()=>{
|
||||
if(userStore.isLogin){
|
||||
uni.reLaunch({
|
||||
url: '/pages/home/home',
|
||||
});
|
||||
}else{
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
},2000)
|
||||
// #endif
|
||||
|
||||
});
|
||||
|
||||
// 检查版本是否是最新的
|
||||
let getOSVesion = async()=>{
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
let systemInfo = uni.getSystemInfoSync(); console.log(systemInfo.osName)
|
||||
let param = {
|
||||
// #ifdef APP-PLUS
|
||||
appVersion:systemInfo.appWgtVersion,//当前版本号
|
||||
verNumber:systemInfo.appWgtVersion,//当前版本号
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
appVersion : systemInfo.appVersion,
|
||||
verNumber : systemInfo.appVersion,
|
||||
// #endif
|
||||
deviceType:systemInfo.model,//型号
|
||||
os: systemInfo.osName,//操作系统 Android IOS
|
||||
osVersion:systemInfo.osVersion,//操作系统版本
|
||||
resolution:systemInfo.windowWidth+"*"+systemInfo.windowHeight,//分辨率
|
||||
trademark:systemInfo.deviceBrand,//设备品牌
|
||||
uniqueCode:systemInfo.deviceId//设备ID
|
||||
// deviceType:systemInfo.model,//型号
|
||||
os: formatIOS(systemInfo.osName),//操作系统 Android IOS
|
||||
// osVersion:systemInfo.osVersion,//操作系统版本
|
||||
// resolution:systemInfo.windowWidth+"*"+systemInfo.windowHeight,//分辨率
|
||||
// trademark:systemInfo.deviceBrand,//设备品牌
|
||||
// uniqueCode:systemInfo.deviceId//设备ID
|
||||
}
|
||||
// 当前手机版本
|
||||
appVersion.value = param.appVersion;
|
||||
appVersion.value = param.verNumber;
|
||||
// console.log("appVersion=>",appVersion)
|
||||
versionData.value = param;
|
||||
|
||||
let data = await versionCheck(param);
|
||||
newVersion.value = data.latestVersion;
|
||||
newVersion.value = data.verNumber;
|
||||
|
||||
// isForceUpdate 是否强制更新 1-是 2-否
|
||||
let isForceUpdate = data.isForceUpdate;
|
||||
if(isForceUpdate==1){
|
||||
btnVisible.value = false;
|
||||
}else{
|
||||
btnVisible.value = true;
|
||||
}
|
||||
// 是否为当前最新版本(是=1,否=2)
|
||||
let isCurrent = data.isCurrent;
|
||||
if(isCurrent == 1){
|
||||
versionVisible.value=false;
|
||||
}else{
|
||||
versionVisible.value=true;
|
||||
}
|
||||
|
||||
// 版本状态 0-最新版本 1-有新版本,但现有版本可用 2-现有版本不可用,需要下载新版本
|
||||
if(data.status == 1 || data.status == 2){
|
||||
versionVisible.value = true;
|
||||
downloadURL.value = data.downloadURL;
|
||||
// 可用版本列表
|
||||
let availableVersionsList = data.availableVersionsList;
|
||||
// let versionList = availableVersionsList.split(",");
|
||||
if(availableVersionsList.indexOf(appVersion.value)>-1){
|
||||
btnVisible.value = true;
|
||||
}else{
|
||||
btnVisible.value = false;
|
||||
}
|
||||
// }else{
|
||||
// if(data.status == 1 || data.status == 2){
|
||||
// versionVisible.value = true;
|
||||
// downloadURL.value = data.downloadURL;
|
||||
// // 可用版本列表
|
||||
// let availableVersionsList = data.availableVersionsList;
|
||||
// // let versionList = availableVersionsList.split(",");
|
||||
// if(availableVersionsList.indexOf(appVersion.value)>-1){
|
||||
|
||||
// }else{
|
||||
// btnVisible.value = false;
|
||||
// }
|
||||
// // }else{
|
||||
// if(userStore.isLogin){
|
||||
// // _this.getUserInfo();
|
||||
// }else{
|
||||
@@ -95,18 +127,53 @@ let getOSVesion = async()=>{
|
||||
// url: '/pages/home/home',
|
||||
// });
|
||||
// }
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// 查询设备ID
|
||||
const selectDeviceId = async()=>{
|
||||
// 查询本地缓存的设备状态是否绑定过
|
||||
let deviceId = uni.getStorageSync('app_device_id');// 本地设备ID
|
||||
console.log("uniqCode=>",deviceId)
|
||||
if(!deviceId){
|
||||
setTimeout(()=>{
|
||||
uni.reLaunch({
|
||||
url: '/pages/deviceAuth/deviceAuth',
|
||||
});
|
||||
},2000)
|
||||
}else{
|
||||
let res = await getBindStatus({uniqCode:deviceId});
|
||||
console.log("getBindStatus=>",res)
|
||||
setTimeout(()=>{
|
||||
// 检查是否已登录 并 获取用户信息
|
||||
// if (userStore.isLogin) {
|
||||
// 绑定状态(1=已提交、2=等待审核、3=审核通过、4=绑定成功、5=审核拒绝)
|
||||
if(res.bindStatus == 4){
|
||||
uni.reLaunch({
|
||||
url: '/pages/home/home',
|
||||
});
|
||||
}else{
|
||||
uni.reLaunch({
|
||||
url: '/pages/deviceAuth/deviceAuth',
|
||||
});
|
||||
}
|
||||
// }else{
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/login/login',
|
||||
// });
|
||||
// }
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
// 下载最新版本
|
||||
const handleDown = ()=>{
|
||||
// 跳转到应用商店或下载最新版本的页面
|
||||
plus.runtime.openURL(downloadURL.value);
|
||||
// if (versionData.value.os == 'ios'){
|
||||
// plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
|
||||
// } else if (versionData.value.os == 'android'){
|
||||
if (versionData.value.os == 'ios'){
|
||||
plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
|
||||
} else if (versionData.value.os == 'android'){
|
||||
plus.runtime.quit();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
//版本更新关闭
|
||||
@@ -117,34 +184,6 @@ const handleClose=()=>{
|
||||
selectDeviceId()
|
||||
}
|
||||
}
|
||||
|
||||
// 查询设备ID
|
||||
const selectDeviceId = async()=>{
|
||||
// 查询本地缓存的设备状态是否绑定过
|
||||
let deviceId = ref(undefined);
|
||||
deviceId.value = uni.getStorageSync('app_device_id');// 本地设备ID
|
||||
let res = await getBindStatus({deviceId:deviceId.value});
|
||||
setTimeout(()=>{
|
||||
// 检查是否已登录 并 获取用户信息
|
||||
if (userStore.isLogin) {
|
||||
// 绑定状态(1=已提交、2=等待审核、3=审核通过、4=绑定成功、5=审核拒绝)
|
||||
if(res.bindStatus == 4){
|
||||
uni.reLaunch({
|
||||
url: '/pages/home/home',
|
||||
});
|
||||
}else{
|
||||
uni.reLaunch({
|
||||
url: '/pages/deviceAuth/deviceAuth',
|
||||
});
|
||||
}
|
||||
}else{
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -81,10 +81,11 @@ import {showAlert} from '@/utils/message';
|
||||
import { getVerifyCode,login } from '@/api/auth';
|
||||
import cache from '@/utils/cache';
|
||||
import { AGREEWELCOME_KEY } from '@/enums/cacheEnums';
|
||||
|
||||
import { getNavBarPaddingTop} from '@/utils/system.js'
|
||||
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import encryptObj from '@/utils/encrypt.js'
|
||||
import { CLIENT_ID } from '@/enums/cacheEnums';
|
||||
|
||||
const userStore = useUserStore()
|
||||
onLoad(async(opt) => {
|
||||
uni.setStorageSync('page_cache',true);
|
||||
@@ -187,7 +188,7 @@ let resetCountdown =()=>{
|
||||
// 账号登录
|
||||
const form2 = ref(null);
|
||||
const formData2 = ref({
|
||||
username: 'admin',
|
||||
username: '445',
|
||||
password: '123456',
|
||||
loginType:1
|
||||
});
|
||||
@@ -196,13 +197,13 @@ const rules2 = {
|
||||
username: {
|
||||
rules: [
|
||||
{ required: true, errorMessage: '请输入用户名' },
|
||||
{ minLength: 3, maxLength: 10, errorMessage: '用户名长度在3到10个字符之间' }
|
||||
// { minLength: 3, maxLength: 10, errorMessage: '用户名长度在3到10个字符之间' }
|
||||
]
|
||||
},
|
||||
password: {
|
||||
rules: [
|
||||
{ required: true, errorMessage: '请输入密码' },
|
||||
{ pattern: /^[a-zA-Z0-9]{6,12}$/, errorMessage: '密码必须是6-12位字母或数字' }
|
||||
// { pattern: /^[a-zA-Z0-9]{6,12}$/, errorMessage: '密码必须是6-12位字母或数字' }
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -242,7 +243,13 @@ const submitForm = () => {
|
||||
}else if(activeTab.value===1){
|
||||
// 用户名和密码登录
|
||||
form2.value.validate().then(async param => {
|
||||
param.loginType = activeTab.value; console.log('表单数据11:', formData2.value);
|
||||
param.loginType = activeTab.value;
|
||||
let cilentId = `${CLIENT_ID || 2}`;
|
||||
let password = encryptObj.Encrypt(param.username + cilentId + "," + param.password);
|
||||
param.password = password;
|
||||
param.uniqCode = uni.getStorageSync('app_device_id');//先从缓存取之后处理
|
||||
|
||||
console.log("login->param->",param)
|
||||
let res = await login(param);
|
||||
userStore.login(res);
|
||||
uni.switchTab({ url: '/pages/home/home' })
|
||||
|
||||
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