From b7aeb1865574584d70e61a4b72bb00b87f12f479 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期二, 11 六月 2024 20:08:52 +0800
Subject: [PATCH] 5600 run custonevent
---
pages/login/index.vue | 134 ++++++++++++++++++++++++++++++++++----------
1 files changed, 102 insertions(+), 32 deletions(-)
diff --git a/pages/login/index.vue b/pages/login/index.vue
index 3a1f07c..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('.');
@@ -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