|
|
@@ -63,6 +63,7 @@ export default {
|
|
|
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
|
|
|
localStorage.version = inf.version;
|
|
|
that.curVersion = inf.version;
|
|
|
+ console.log("inf:",inf);
|
|
|
});
|
|
|
|
|
|
//获取手机UUID
|
|
|
@@ -72,45 +73,22 @@ export default {
|
|
|
uuid = uuid.substring(0, uuid.length - 1);
|
|
|
localStorage.eqSn = uuid;
|
|
|
console.log('===== uuid =====:' + uuid + '\ngetDeviceInfo success: ' + JSON.stringify(e.uuid));
|
|
|
- // 正式版打开
|
|
|
+
|
|
|
// 获取转发端口地址
|
|
|
that.getServeIpAddress(e.uuid);
|
|
|
|
|
|
- // 公司测试机用公司版本升级
|
|
|
- // if (uuid == "a1f2d679c1624d3a" || uuid == "8e501b0bde9ce600") {
|
|
|
- if (uuid == "1277fcb4c81e29d2" || uuid == "8e501b0bde9ce600") {
|
|
|
- //首发版本 '1.1.0' 在线版不需要自动升级
|
|
|
- // 内测版自动升级
|
|
|
- let url = 'http://192.168.0.3:19096/v1/Sensors/QueryVueFramework';
|
|
|
- let param = {};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- axios.post(url, postdata).then(function (data) {
|
|
|
- let json = data.data;
|
|
|
- if (json.Code == 0) {
|
|
|
- if (localStorage.version != json.VueFramework.Version) {
|
|
|
- // 测试版本下载
|
|
|
- console.log(332);
|
|
|
- let downUrl = "http://192.168.0.3:19096/v1/Sensors/DownloadVueFramework";
|
|
|
- that.downWgt(downUrl);
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log(json.Memo);
|
|
|
- }
|
|
|
- }, function (response) {
|
|
|
- console.info(response);
|
|
|
- })
|
|
|
+ //公司测试机升级
|
|
|
+ if (uuid == "14cc77e7c2281e20") {
|
|
|
+ that.checkTestUpdate();
|
|
|
} else {
|
|
|
- console.log(223);
|
|
|
- // 正式版
|
|
|
- //开启自动升级
|
|
|
- // 教室版本自动升级,户外版禁用自动升级
|
|
|
+ //户外版禁用升级
|
|
|
if (runVersion == 'outDoor') {
|
|
|
console.log('户外版禁用自动升级');
|
|
|
return false
|
|
|
} else {
|
|
|
- that.checkUpdate();
|
|
|
+ //正式版
|
|
|
+ that.checkReleaseUpdate();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
fail: function (e) {
|
|
|
@@ -119,25 +97,84 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- // 是否有新版本
|
|
|
- checkUpdate() {
|
|
|
+ //获取转发端地址
|
|
|
+ getServeIpAddress(eqSn) {
|
|
|
+ const that = this;
|
|
|
+
|
|
|
+ //演示版固定转发端地址
|
|
|
+ if (runVersion == 'test') {
|
|
|
+ headapi = "http://cal.beswell.com:85/DataTransfer/";
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ //正式版请求转发段地址的url
|
|
|
+ let url = 'http://cal.beswell.com:85/v1/Sensors/GetShopConfigParam'
|
|
|
+ //测试版
|
|
|
+ if (eqSn == '14cc77e7c2281e20') {
|
|
|
+ url = "http://192.168.0.3:19096/v1/Sensors/GetShopConfigParam";
|
|
|
+ }
|
|
|
+ console.log("url:"+url+"\neqSn:"+eqSn);
|
|
|
+ let param = {
|
|
|
+ eqSn: eqSn
|
|
|
+ };
|
|
|
+ let postData = qs.stringify(param);
|
|
|
+ axios.post(url, postData).then(function (data) {
|
|
|
+ let json = data.data;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ //户外版
|
|
|
+ if (runVersion == 'outDoor') {
|
|
|
+ headapi = json.Rs.HotsPotDataServiceIP;
|
|
|
+ if (!json.Rs.HotsPotDataServiceIP) {
|
|
|
+ that.$message.error("未获取到HotsPotDataServiceIP");
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else if (runVersion == 'normal'){
|
|
|
+ headapi = json.Rs.DataServiceIP;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ headapi = 'http://221.214.111.254:9000/';
|
|
|
+ console.log(json.memo);
|
|
|
+ that.$message.error(json.memo);
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ console.info(response);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //检查测试版本升级
|
|
|
+ checkTestUpdate(){
|
|
|
let that = this;
|
|
|
+ let url = 'http://192.168.0.3:19096/v1/Sensors/QueryVueFramework';
|
|
|
+ let param = {};
|
|
|
+ let postData = qs.stringify(param);
|
|
|
+ axios.post(url, postData).then(function (data) {
|
|
|
+ let json = data.data;
|
|
|
+ console.log("checkTestUpdate",json);
|
|
|
+ if (json.Code == 0) {
|
|
|
+ if (localStorage.version != json.VueFramework.Version) {
|
|
|
+ // 测试版本下载
|
|
|
+ let testVersion = "http://192.168.0.3:19096/v1/Sensors/DownloadVueFramework";
|
|
|
+ that.downWgt(testVersion);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log(json.Memo);
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ console.info(response);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //检查正式版本升级
|
|
|
+ checkReleaseUpdate() {
|
|
|
let param = {};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- const h = that.$createElement;
|
|
|
- QueryVueFramework(postdata).then(res => {
|
|
|
+ let postData = qs.stringify(param);
|
|
|
+ QueryVueFramework(postData).then(res => {
|
|
|
let json = res;
|
|
|
+ console.log("checkReleaseUpdate",json);
|
|
|
if (json.Code == 0) {
|
|
|
console.log('localStorage.version' + localStorage.version);
|
|
|
+ //正式
|
|
|
if (localStorage.version != json.VueFramework.Version) {
|
|
|
- // 正式
|
|
|
- let url = "http://cal.beswell.com:85/v1/Sensors/DownloadVueFramework";
|
|
|
- this.downWgt(url);
|
|
|
- // that.downWgt(url, json.Version);
|
|
|
- // that.$notify({
|
|
|
- // title: '升级提醒',
|
|
|
- // message: h('i', {style: 'color: teal'}, '检测到新的版本,正在下载最新版本')
|
|
|
- // });
|
|
|
+ let releaseVersion = "http://cal.beswell.com:85/v1/Sensors/DownloadVueFramework";
|
|
|
+ this.downWgt(releaseVersion);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -145,75 +182,26 @@ export default {
|
|
|
downWgt(url) {
|
|
|
let that = this;
|
|
|
plus.downloader.createDownload(url, {filename: "_doc/update/"}, function (d, status) {
|
|
|
- // plus.downloader.createDownload(url, {}, function (d, status) {
|
|
|
if (status == 200) {
|
|
|
console.log(d);
|
|
|
console.log("下载wgt成功:" + d.filename);
|
|
|
- that.installWgt(d.filename); // 安装wgt包
|
|
|
+ that.installWgt(d.filename);
|
|
|
} else {
|
|
|
console.log("下载wgt失败!");
|
|
|
- // plus.nativeUI.alert("下载wgt失败!");
|
|
|
}
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
}).start();
|
|
|
},
|
|
|
+ //安装wgt包
|
|
|
installWgt(path) {
|
|
|
- // plus.nativeUI.showWaiting("安装wgt文件...");
|
|
|
plus.runtime.install(path, {}, function () {
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
console.log("安装wgt文件成功!");
|
|
|
- // plus.nativeUI.alert("应用资源更新完成!", function () {
|
|
|
plus.runtime.restart();
|
|
|
- // });
|
|
|
}, function (e) {
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
console.log("安装wgt文件失败[" + e.code + "]:" + e.message);
|
|
|
- // plus.nativeUI.alert("安装wgt文件失败[" + e.code + "]:" + e.message);
|
|
|
});
|
|
|
- },
|
|
|
- // 获取转发端口地址
|
|
|
- getServeIpAddress(eqsn) {
|
|
|
- const that = this;
|
|
|
- let url = '';
|
|
|
- if (runVersion == 'test') {
|
|
|
- headapi = "http://cal.beswell.com:85/DataTransfer/";
|
|
|
- return false
|
|
|
- }
|
|
|
- // 测试使用0.3心率系统
|
|
|
- // if (eqsn == 'a1f2d679c1624d3a' || eqsn == '30:9C:23:0C:8B:1E') {
|
|
|
- if (eqsn == '1277fcb4c81e29d2' || eqsn == '30:9C:23:0C:8B:1E') {
|
|
|
- url = "http://192.168.0.3:19096/v1/Sensors/GetShopConfigParam";
|
|
|
- } else {
|
|
|
- url = 'http://cal.beswell.com:85/v1/Sensors/GetShopConfigParam'
|
|
|
- }
|
|
|
- let param = {
|
|
|
- eqSn: eqsn
|
|
|
- };
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- axios.post(url, postdata).then(function (data) {
|
|
|
- let json = data.data;
|
|
|
- if (json.Code == 0) {
|
|
|
- // 户外版使用HotsPotDataServiceIP
|
|
|
- if (runVersion == 'outDoor') {
|
|
|
- headapi = json.Rs.HotsPotDataServiceIP;
|
|
|
- // 内网测试版
|
|
|
- // headapi = 'http://192.168.0.3:19096/v1/Sensors/';
|
|
|
- if (!json.Rs.HotsPotDataServiceIP) {
|
|
|
- that.$message.error("未获取到HotsPotDataServiceIP");
|
|
|
- return false
|
|
|
- }
|
|
|
- } else {
|
|
|
- headapi = json.Rs.DataServiceIP;
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- headapi = 'http://192.168.0.10:8080/';
|
|
|
- console.log(json.memo);
|
|
|
- that.$message.error(json.memo);
|
|
|
- }
|
|
|
- }, function (response) {
|
|
|
- console.info(response);
|
|
|
- })
|
|
|
}
|
|
|
},
|
|
|
components: {}
|