联调接口

This commit is contained in:
xuli3099
2025-08-12 16:19:19 +08:00
parent 7c5233f8f5
commit 107cc64a81
9 changed files with 70 additions and 73 deletions

View File

@@ -128,8 +128,6 @@ let selectBindStatus = async ()=>{
if(deviceId.value){
let res = await getBindStatus({uniqCode:deviceId.value})
bindStatus.value = res.bindStatus;
console.log("111bindStatus=>",bindStatus.value)
//bindStatus=4-----已绑定成功,跳转用户登录页面
if(bindStatus.value==4){
if (userStore.isLogin) {
@@ -149,7 +147,6 @@ let selectBindStatus = async ()=>{
let refreshBindStatus = async ()=>{
let res = await getBindStatus({uniqCode:deviceId.value})
bindStatus.value = res.bindStatus;
console.log("222bindStatus=>",bindStatus.value)
if(bindStatus.value==2){
}else{
@@ -196,9 +193,8 @@ const submitForm = async() => {
form2.value.validate().then(async param => {
btnLoading.value = true;
deviceId.value = uuidv4();
let cilentId = `${CLIENT_ID || 2}`;
let password = encryptObj.Encrypt(param.username + cilentId + "," + param.password);
console.log("password=>",password)
let clientId = `${CLIENT_ID || 2}`;
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
let systemInfo = uni.getSystemInfoSync()
let params = {
@@ -215,9 +211,7 @@ const submitForm = async() => {
// #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-等待审核
@@ -243,7 +237,6 @@ let getLocalIPInUniApp=()=>{
if (info.cellular && info.cellular.ipAddress) {
ips.push(info.cellular.ipAddress);
}
console.log(1111,ips)
resolve(ips.length ? ips : ['无法获取本地IP']);
});
});
@@ -346,7 +339,9 @@ const handleSubmit=()=>{
authCode:authCode.value
}
subLoading.value=true;
console.log("param=>",param)
authInputCode(param).then(res=>{
console.log("authInputCode=>",res)
uni.reLaunch({ url: '/pages/login/login' })
}).finally(()=>{
subLoading.value = false;

View File

@@ -69,7 +69,7 @@ onLoad(async(opt) => {
// 检查版本是否是最新的
let getOSVesion = async()=>{
let systemInfo = uni.getSystemInfoSync(); console.log(systemInfo.osName)
let systemInfo = uni.getSystemInfoSync();
let param = {
// #ifdef APP-PLUS
verNumber:systemInfo.appWgtVersion,//当前版本号
@@ -88,9 +88,7 @@ let getOSVesion = async()=>{
appVersion.value = param.verNumber;
// console.log("appVersion=>",appVersion)
versionData.value = param;
console.log("versionCheck=>param=>",param)
let data = await versionCheck(param);
console.log("versionCheck=>",data)
newVersion.value = data.verNumber;
downloadURL.value = data.downloadUrl;
@@ -123,25 +121,25 @@ const selectDeviceId = async()=>{
},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){
// 绑定状态1=已提交、2=等待审核、3=审核通过、4=绑定成功、5=审核拒绝)
if(res.bindStatus == 4){
// 检查是否已登录 并 获取用户信息
if (userStore.isLogin) {
uni.reLaunch({
url: '/pages/home/home',
});
}else{
uni.reLaunch({
url: '/pages/deviceAuth/deviceAuth',
url: '/pages/login/login',
});
}
// }else{
// uni.reLaunch({
// url: '/pages/login/login',
// });
// }
}else{
uni.reLaunch({
url: '/pages/deviceAuth/deviceAuth',
});
}
},2000)
}
}

View File

@@ -77,7 +77,6 @@ import { ref,onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import customTabs from '@/components/customTabs.vue';
import {isPhoneNumber} from '@/utils/validate';
import {showAlert} from '@/utils/message';
import { getVerifyCode,login } from '@/api/auth';
import cache from '@/utils/cache';
import { AGREEWELCOME_KEY } from '@/enums/cacheEnums';
@@ -103,8 +102,8 @@ const tabList = ['验证码登录', '账号登录'];
// 验证码登录
const form = ref(null);
const formData = ref({
phone: '15112345600',
verifyCode: '123456',
phone: '',
verifyCode: '',
loginType:0
});
@@ -188,8 +187,8 @@ let resetCountdown =()=>{
// 账号登录
const form2 = ref(null);
const formData2 = ref({
username: '445',
password: '123456',
username: '',
password: '',
loginType:1
});
@@ -230,7 +229,7 @@ const submitForm = () => {
if(activeTab.value===0){
form.value.validate().then(async param => {
// 2.调用登录接口
param.loginType = activeTab.value; console.log('表单数据00:', param);
param.loginType = activeTab.value;
let res = await login(param)
// 3.登录后存储token
userStore.login(res);
@@ -244,12 +243,11 @@ const submitForm = () => {
// 用户名和密码登录
form2.value.validate().then(async param => {
param.loginType = activeTab.value;
let cilentId = `${CLIENT_ID || 2}`;
let password = encryptObj.Encrypt(param.username + cilentId + "," + param.password);
let clientId = `${CLIENT_ID || "2"}`;
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
param.password = password;
param.uniqCode = uni.getStorageSync('app_device_id');//先从缓存取之后处理
console.log("login->param->",param)
param.uniqCode = 'bf52f71a-a951-43c3-a63d-0927d7854955'// uni.getStorageSync('app_device_id');//先从缓存取之后处理
param.clientId = clientId;
let res = await login(param);
userStore.login(res);
uni.switchTab({ url: '/pages/home/home' })

View File

@@ -113,17 +113,7 @@ onLoad(async(opt) => {
// 1.头部导航栏
const navBarPaddingTop = ref(0);
let appVersion = ref("1.0.0");//当前版本号
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
let systemInfo = uni.getSystemInfoSync();
// #ifdef APP-PLUS
appVersion.value=systemInfo.appWgtVersion; //当前版本号
// #endif
// #ifdef H5
appVersion.value=systemInfo.appVersion;
// #endif
})
// 下拉刷新
const mescrollRef = ref(null);
@@ -158,7 +148,6 @@ const selectUserInfo = async ()=>{
let data = await getUserInfo({});
userObj.value = data;
}
selectUserInfo()
// 3.退出登录
const handleLoginOut = async ()=>{
@@ -168,14 +157,25 @@ const handleLoginOut = async ()=>{
});
}
// 4.跳转到版本
const handleVersion=()=>{
uni.navigateTo({url:'/pages/userinfo/version'})
}
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
let systemInfo = uni.getSystemInfoSync();
// #ifdef APP-PLUS
appVersion.value=systemInfo.appWgtVersion; //当前版本号
// #endif
// #ifdef H5
appVersion.value=systemInfo.appVersion;
// #endif
selectUserInfo()
})
</script>
<style scoped>

View File

@@ -26,10 +26,17 @@
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { ref, onMounted } from 'vue'
import customHeader from '@/components/customHeader.vue'
import { versionCheck } from '@/api/auth.js';
import { getNavBarPaddingTop } from '@/utils/system.js'
import { formatIOS } from '@/utils/status.js'
// 初始load页面
onLoad(async(opt) => {
getOSVesion();
});
// 1.头部导航栏
let navBarPaddingTop = ref(0);
@@ -38,29 +45,24 @@ let newVersion = ref('1.0.0');//最新版本号
let remark = ref('');//更新内容
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
getOSVesion();
})
let getOSVesion = async()=>{
let systemInfo = uni.getSystemInfoSync();
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
os: formatIOS(systemInfo.osName),//操作系统 Android IOS
}
// 当前手机版本
appVersion.value = param.appVersion;
// console.log("appVersion=>",appVersion)
console.log("appVersion=>",appVersion)
let data = await versionCheck(param);
newVersion.value = data.latestVersion;
newVersion.value = data.verNumber;
downloadURL.value = data.downloadUrl;
remark.value = data.remark //|| '全新的UI界面 优化了签到/打卡功能,整体流程更加简洁清晰 搜索功能全面升级 修复了已知BUG'
}
@@ -69,11 +71,11 @@ const handleDown = ()=>{
// #ifdef APP-PLUS
// 跳转到应用商店或下载最新版本的页面
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();
// }
}
// #endif
}
</script>