From 8b47a6acff1683df5764c5df1b2460110255f544 Mon Sep 17 00:00:00 2001 From: jt <jt@activesoft.com.cn> Date: 星期一, 29 四月 2024 17:16:33 +0800 Subject: [PATCH] 登录时将获取的mac地址例如:78b8d67511ca 作为client_info传进api/user/ace/VerifyPassword接口里 --- pages/login/index.vue | 136 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 103 insertions(+), 33 deletions(-) diff --git a/pages/login/index.vue b/pages/login/index.vue index 6f6aca7..df5707a 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -283,47 +283,94 @@ }); return; } - var dataInfo = { - server: this.userServer - }; - this.$store.dispatch('GetApkVersionInfo', dataInfo).then(success => { - console.log(success); - if (success.code == '00000') { - let resp = success.data; - if (resp) { - // const obj = resp.data.filter(item => { - // return item.groupName == 'version' - // }) - //鑾峰彇褰撳墠鐗堟湰鍙�- const VersionName = resp.VersionName; //鏇存柊鍖呭悕绉�- const VersionCode = resp.VersionCode; //鐗堟湰缂栫爜 - const versionNum = resp.Version; //鏈嶅姟绔増鏈彿 - // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app涓嬭浇閾炬帴 - this.downloadUrl = "http://" + this.userServer + "/Program/" + VersionName; //app涓嬭浇閾炬帴this. - var isver = this.compare(versionNum,version); - if (isver) { - this.$refs.promotion.open(); + var ser = this.userServer.split('/'); + var $this = this; + if(ser[1] == 'mobox3'){ //鍒ゆ柇褰撳墠缃戝潃鏄惁鏄痬obox3 + var url = 'http://'+this.userServer+'/Program/version.txt'; + // console.log(url); + uni.request({ + url: url, // 鎸囧畾JS鏂囦欢鐨勫畬鏁磋矾寰�+ method: 'GET', + success(res) { + console.log(res); + if (res && res.statusCode === 200) { + //鑾峰彇褰撳墠鐗堟湰鍙�+ var VersionName = res.data; //鏇存柊鍖呭悕绉�+ var versionInfo = res.data.split('_'); + var versionNum = versionInfo[2].replace(".apk", ""); //鐗堟湰缂栫爜 + var VersionCode = versionInfo[2].replace(".apk", "").replace(".", "").replace(".", ""); //鏈嶅姟绔増鏈彿 + // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app涓嬭浇閾炬帴 + $this.downloadUrl = "http://" + $this.userServer + "/Program/" + VersionName; //app涓嬭浇閾炬帴this. + var isver = $this.compare(versionNum,version); + if (isver) { + $this.$refs.promotion.open(); + } else { + console.log('褰撳墠宸叉槸鏈�柊鐗堟湰') + } } else { - console.log('褰撳墠宸叉槸鏈�柊鐗堟湰') + // if(res.statusCode === 404){ + // uni.showModal({ + // title: "鎻愮ず", + // content: '璇锋眰澶辫触锛屾壘涓嶅埌鏇存柊鍖呯増鏈枃妗o細'+url, + // showCancel: false, + // confirmText: "鍙栨秷" + // }); + // } } + }, + fail(err) { + // 閿欒澶勭悊閫昏緫 + uni.showModal({ + title: "閿欒", + content: '鑾峰彇'+url+'鏂囦欢澶辫触锛�+ err, + showCancel: false, + confirmText: "鍙栨秷" + }); } - } else { + }); + }else{ + var dataInfo = { + server: this.userServer + }; + this.$store.dispatch('GetApkVersionInfo', dataInfo).then(success => { + console.log(success); + if (success.code == '00000') { + let resp = success.data; + if (resp) { + // const obj = resp.data.filter(item => { + // return item.groupName == 'version' + // }) + //鑾峰彇褰撳墠鐗堟湰鍙�+ const VersionName = resp.VersionName; //鏇存柊鍖呭悕绉�+ const VersionCode = resp.VersionCode; //鐗堟湰缂栫爜 + const versionNum = resp.Version; //鏈嶅姟绔増鏈彿 + // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app涓嬭浇閾炬帴 + $this.downloadUrl = "http://" + $this.userServer + "/Program/" + VersionName; //app涓嬭浇閾炬帴this. + var isver = $this.compare(versionNum,version); + if (isver) { + $this.$refs.promotion.open(); + } else { + console.log('褰撳墠宸叉槸鏈�柊鐗堟湰') + } + } + } else { + uni.showModal({ + title: "閿欒", + content: success.msg, + showCancel: false, + confirmText: "鍙栨秷" + }); + } + }).catch(ex => { + console.log(ex); uni.showModal({ title: "閿欒", - content: success.msg, + content: ex.errMsg ? ex.errMsg : ex.message, showCancel: false, confirmText: "鍙栨秷" }); - } - }).catch(ex => { - console.log(ex); - uni.showModal({ - title: "閿欒", - content: ex.errMsg ? ex.errMsg : ex.message, - showCancel: false, - confirmText: "鍙栨秷" }); - }); + } }, compare(curV, reqV) { var arr1 = curV.toString().split('.'); @@ -507,7 +554,7 @@ //鐧诲綍 this.$store.dispatch('login', loginInfo).then(success => { console.log(success); - if (success.code == '00000') { + if (success.code == '00000' || success.err_code==0) { //鐧诲綍鎴愬姛鍚庢竻绌虹紦瀛樻暟鎹� this.$store.commit("areaFunc", null); this.$store.commit("classAttrList", null); @@ -553,6 +600,29 @@ } }, onLoad() { + //鑾峰彇mac鍦板潃 + var net = plus.android.importClass("java.net.NetworkInterface"); + var wl0 = net.getByName('wlan0'); + var macByte = wl0.getHardwareAddress(); + var deviceId = '' + //涓嬮潰杩欐浠g爜鏉ヨ嚜缃戠粶 + for (var i = 0; i < macByte.length; i++) { + var tmp = ""; + var num = macByte[i]; + if (num < 0) { + tmp =(255+num+1).toString(16); + } else { + tmp = num.toString(16); + } + if (tmp.length == 1) { + tmp = "0" + tmp; + } + deviceId += tmp; + } + //78b8d67511ca + this.$store.commit("setDeviceId", deviceId); + console.log('Android璁惧鐨刣eviceId:', deviceId); + plus.runtime.getProperty(plus.runtime.appid, (info) => { // console.log(info); this.$data.version = info.version; -- Gitblit v1.9.1