diff --git a/src/enums/cacheEnums.js b/src/enums/cacheEnums.js index 2258607..264ff92 100644 --- a/src/enums/cacheEnums.js +++ b/src/enums/cacheEnums.js @@ -2,7 +2,7 @@ export const TOKEN_KEY = 'token'; export const AGREEWELCOME_KEY="agreewelcome"; // clientId 默认写2 -export const CLIENT_ID=2; +export const CLIENT_ID="2"; // #区分内外网 //1-内网,2-外网 export const NETWORK_ENV=1; diff --git a/src/pages/deviceAuth/deviceAuth.vue b/src/pages/deviceAuth/deviceAuth.vue index f9cde53..a4aef7e 100644 --- a/src/pages/deviceAuth/deviceAuth.vue +++ b/src/pages/deviceAuth/deviceAuth.vue @@ -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; diff --git a/src/pages/loading/loading.vue b/src/pages/loading/loading.vue index 86b71d2..1cc6644 100644 --- a/src/pages/loading/loading.vue +++ b/src/pages/loading/loading.vue @@ -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) } } diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 1303c27..b3a9c44 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -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' }) diff --git a/src/pages/userinfo/userinfo.vue b/src/pages/userinfo/userinfo.vue index 2e644c4..acae6ae 100644 --- a/src/pages/userinfo/userinfo.vue +++ b/src/pages/userinfo/userinfo.vue @@ -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() +}) +