|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
clmurl: '/',
|
|
|
}],
|
|
|
editableTabsValue: '1',
|
|
|
- curVersion: '2.0',
|
|
|
+ localVersion: '2.5',
|
|
|
isPad: true,// pad 展示版本
|
|
|
ClentHeight: document.documentElement.clientHeight + 'px',
|
|
|
testEqsnArr: [
|
|
|
@@ -55,103 +55,119 @@ export default {
|
|
|
intervTime_checkUpdate: 600000, //检测升级信息的轮询时间 毫秒
|
|
|
appRuntime: 0, //APP运行时长 分钟
|
|
|
}
|
|
|
- },
|
|
|
+ },
|
|
|
mounted() {
|
|
|
- this.getCurVersion();
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ this.sysInit();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
// 获取当前版本号
|
|
|
- getCurVersion() {
|
|
|
+ sysInit() {
|
|
|
let that = this;
|
|
|
//浏览器默认的
|
|
|
localStorage.eqSn = '30:9C:23:0C:8B:1E';
|
|
|
// localStorage.eqSn = 'd104bd6ffec3d5ba';
|
|
|
that.$store.commit('setEqSn', localStorage.eqSn);
|
|
|
- localStorage.version = '2.3.1';
|
|
|
+ that.$store.commit('setLocalVersion', that.localVersion);
|
|
|
+
|
|
|
+ that.getSysDateTime();
|
|
|
|
|
|
if (window.plus) {
|
|
|
- plusReady();
|
|
|
+ that.plusReady();
|
|
|
} else {
|
|
|
console.log('>>> plus is not ready');
|
|
|
// 调试时候关闭
|
|
|
this.getConfigParam(localStorage.eqSn);
|
|
|
- // plusReady();
|
|
|
- document.addEventListener('plusready', plusReady, false);
|
|
|
- }
|
|
|
+ document.addEventListener('plusready', that.plusReady, false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSysDateTime() {
|
|
|
+ let that = this;
|
|
|
+ console.log('[sysInit] getSysDateTime() run!');
|
|
|
+
|
|
|
+ setInterval(() => {
|
|
|
+ let date = new Date();
|
|
|
+ let curTime = globalGetCurrentTime(date);
|
|
|
+ let curDay = globalcurrentByCN(date);
|
|
|
+ let curWeek = numberToWeekdays(date.getDay());
|
|
|
+ that.$store.commit('setCurTime', curTime);
|
|
|
+ that.$store.commit('setCurDay', curDay);
|
|
|
+ that.$store.commit('setCurWeek', curWeek);
|
|
|
+ // console.log(curTime);
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ plusReady() {
|
|
|
+ let that = this;
|
|
|
+ console.log('>>> plus is ready');
|
|
|
+
|
|
|
+ if (typeof plus == 'undefined') return false;
|
|
|
+ // 获取本地应用资源版本号
|
|
|
+ plus.runtime.getProperty(plus.runtime.appid, function (inf) {
|
|
|
+ that.localVersion = inf.version;
|
|
|
+ that.$store.commit('setLocalVersion', that.localVersion);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 获取手机UUID
|
|
|
+ plus.device.getInfo({
|
|
|
+ success: function (e) {
|
|
|
+ let uuid = JSON.stringify(e.uuid).toString().substr(1);
|
|
|
+ uuid = uuid.substring(0, uuid.length - 1);
|
|
|
+ localStorage.eqSn = uuid;
|
|
|
+ that.$store.commit('setEqSn', uuid);
|
|
|
+
|
|
|
+ console.log('>>> [uuid]: ' + uuid);
|
|
|
+ console.log('getDeviceInfo success: ' + JSON.stringify(e.uuid));
|
|
|
+ // 正式版打开
|
|
|
+ // 获取配置参数
|
|
|
+ that.getConfigParam(e.uuid);
|
|
|
+
|
|
|
+ // 公司测试机用公司版本升级
|
|
|
+ if (that.testEqsnArr.includes(uuid)) {
|
|
|
+ that.testMode = true;
|
|
|
+ } else { // 正式版
|
|
|
+ that.testMode = false;
|
|
|
+ }
|
|
|
|
|
|
- function plusReady() {
|
|
|
- console.log('>>> plus is ready');
|
|
|
-
|
|
|
- if (typeof plus == 'undefined') return false;
|
|
|
- // 获取本地应用资源版本号
|
|
|
- plus.runtime.getProperty(plus.runtime.appid, function (inf) {
|
|
|
- localStorage.version = inf.version;
|
|
|
- that.curVersion = inf.version;
|
|
|
- });
|
|
|
-
|
|
|
- // 获取手机UUID
|
|
|
- plus.device.getInfo({
|
|
|
- success: function (e) {
|
|
|
- let uuid = JSON.stringify(e.uuid).toString().substr(1);
|
|
|
- uuid = uuid.substring(0, uuid.length - 1);
|
|
|
- localStorage.eqSn = uuid;
|
|
|
- that.$store.commit('setEqSn', uuid);
|
|
|
+ // 教室版本自动升级,户外版禁用自动升级
|
|
|
+ if (runVersion == 'outDoor') {
|
|
|
+ console.log('户外版禁用自动升级');
|
|
|
|
|
|
- console.log('>>> [uuid]: ' + uuid);
|
|
|
- console.log('getDeviceInfo success: ' + JSON.stringify(e.uuid));
|
|
|
- // 正式版打开
|
|
|
- // 获取配置参数
|
|
|
- that.getConfigParam(e.uuid);
|
|
|
-
|
|
|
- // 公司测试机用公司版本升级
|
|
|
- if (that.testEqsnArr.includes(uuid)) {
|
|
|
- that.testMode = true;
|
|
|
- } else { // 正式版
|
|
|
- that.testMode = false;
|
|
|
- }
|
|
|
+ setInterval(() => {
|
|
|
+ that.checkAppRuntime();
|
|
|
+ }, that.intervTime_checkUpdate);
|
|
|
+
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ else if (runVersion == 'localtest') {
|
|
|
+ console.log('本机测试禁用自动升级');
|
|
|
+ plus.nativeUI.toast("本机测试 禁用自动升级 UUID: " + uuid);
|
|
|
+
|
|
|
+ setInterval(() => {
|
|
|
+ that.checkAppRuntime();
|
|
|
+ }, that.intervTime_checkUpdate);
|
|
|
+
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ that.checkUpdate();
|
|
|
|
|
|
- // 教室版本自动升级,户外版禁用自动升级
|
|
|
- if (runVersion == 'outDoor') {
|
|
|
- console.log('户外版禁用自动升级');
|
|
|
-
|
|
|
- setInterval(() => {
|
|
|
- that.checkAppRuntime();
|
|
|
- }, that.intervTime_checkUpdate);
|
|
|
+ // 每10分钟检测一下升级信息
|
|
|
+ setInterval(() => {
|
|
|
+ // console.log("$route.path: " + that.$route.path);
|
|
|
+ // console.log("$route.name: " + that.$route.name);
|
|
|
|
|
|
- return false
|
|
|
- }
|
|
|
- else if (runVersion == 'localtest') {
|
|
|
- console.log('本机测试禁用自动升级');
|
|
|
- plus.nativeUI.toast("本机测试 禁用自动升级 UUID: " + uuid);
|
|
|
-
|
|
|
- setInterval(() => {
|
|
|
- that.checkAppRuntime();
|
|
|
- }, that.intervTime_checkUpdate);
|
|
|
-
|
|
|
- return false
|
|
|
- }
|
|
|
- else {
|
|
|
- that.checkUpdate();
|
|
|
-
|
|
|
- // 每10分钟检测一下升级信息
|
|
|
- setInterval(() => {
|
|
|
- // console.log("$route.path: " + that.$route.path);
|
|
|
- // console.log("$route.name: " + that.$route.name);
|
|
|
-
|
|
|
- that.checkAppRuntime();
|
|
|
-
|
|
|
- if (that.$route.name == "Wait") {
|
|
|
- console.log(">>> checkUpdate");
|
|
|
- that.checkUpdate();
|
|
|
- }
|
|
|
- }, that.intervTime_checkUpdate);
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function (e) {
|
|
|
- console.log('getDeviceInfo failed: ' + JSON.stringify(e));
|
|
|
+ that.checkAppRuntime();
|
|
|
+
|
|
|
+ if (that.$route.name == "Wait") {
|
|
|
+ console.log(">>> checkUpdate");
|
|
|
+ that.checkUpdate();
|
|
|
+ }
|
|
|
+ }, that.intervTime_checkUpdate);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ },
|
|
|
+ fail: function (e) {
|
|
|
+ console.log('getDeviceInfo failed: ' + JSON.stringify(e));
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
checkAppRuntime() {
|
|
|
let that = this;
|
|
|
@@ -176,12 +192,14 @@ export default {
|
|
|
QueryVueFramework(postdata, that.testMode).then(res => {
|
|
|
let json = res;
|
|
|
if (json.Code == 0) {
|
|
|
- console.log('localStorage.version: ' + localStorage.version);
|
|
|
- console.log('json.VueFramework.Version: ' + json.VueFramework.Version);
|
|
|
- // plus.nativeUI.toast("当前安装版本: " + localStorage.version);
|
|
|
- if (localStorage.version != json.VueFramework.Version) {
|
|
|
+ let remoteVersion = json.VueFramework.Version;
|
|
|
+ that.$store.commit('setRemoteVersion', remoteVersion);
|
|
|
+
|
|
|
+ console.log('localVersion: ' + that.$store.state.localVersion);
|
|
|
+ console.log('remoteVersion: ' + that.$store.state.remoteVersion);
|
|
|
+ if (that.$store.state.localVersion != that.$store.state.remoteVersion) {
|
|
|
// 正式
|
|
|
- plus.nativeUI.toast("发现新版本 " + json.VueFramework.Version + ",准备升级...");
|
|
|
+ plus.nativeUI.toast("发现新版本 " + that.$store.state.remoteVersion + ",准备升级...");
|
|
|
let url = DownloadVueFramework(that.testMode);
|
|
|
that.downWgt(url);
|
|
|
}
|