|
@@ -99,7 +99,7 @@
|
|
url: '',
|
|
url: '',
|
|
show: true
|
|
show: true
|
|
}, ],
|
|
}, ],
|
|
- version:"1.1.0"
|
|
|
|
|
|
+ version: "1.1.0"
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -108,9 +108,17 @@
|
|
onShow() {
|
|
onShow() {
|
|
this.getList()
|
|
this.getList()
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
- this.version = plus.runtime.version
|
|
|
|
- console.log("当前版本为:",plus.runtime.version)
|
|
|
|
- this.checkVersion()
|
|
|
|
|
|
+ plus.runtime.getProperty(plus.runtime.appid, (info) => {
|
|
|
|
+ //版本号
|
|
|
|
+ this.version = info.version;
|
|
|
|
+ console.log("当前版本为:", this.version)
|
|
|
|
+ this.checkVersion()
|
|
|
|
+ //appid
|
|
|
|
+ // this.appID = info.appid;
|
|
|
|
+ })
|
|
|
|
+ // this.version = plus.runtime.version
|
|
|
|
+ // console.log("当前版本为:", plus.runtime)
|
|
|
|
+ // this.checkVersion()
|
|
// #endif
|
|
// #endif
|
|
},
|
|
},
|
|
onLoad() {},
|
|
onLoad() {},
|
|
@@ -135,8 +143,7 @@
|
|
},
|
|
},
|
|
method: 'GET',
|
|
method: 'GET',
|
|
success: (res) => {
|
|
success: (res) => {
|
|
- var versionNo = plus.runtime.version
|
|
|
|
- if (versionNo == res.data.data.version) {
|
|
|
|
|
|
+ if (this.version == res.data.data.version) {
|
|
this.version = "当前为最新版" + res.data.data.version
|
|
this.version = "当前为最新版" + res.data.data.version
|
|
} else {
|
|
} else {
|
|
this.version = "发现新版本,立即更新"
|
|
this.version = "发现新版本,立即更新"
|
|
@@ -162,7 +169,7 @@
|
|
plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
|
|
plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
|
|
let client_version = wgtinfo.version
|
|
let client_version = wgtinfo.version
|
|
var flag_update = client_version.split(".").splice(0, 2).join(
|
|
var flag_update = client_version.split(".").splice(0, 2).join(
|
|
- ".") != res.data.data.version.split(".").splice(0, 2)
|
|
|
|
|
|
+ ".") != res.data.data.version.split(".").splice(0, 2)
|
|
.join(".")
|
|
.join(".")
|
|
var flag_hot = (Number(client_version.split(".")[2]) < Number(res
|
|
var flag_hot = (Number(client_version.split(".")[2]) < Number(res
|
|
.data.data.version.split(".")[2])) & !flag_update
|
|
.data.data.version.split(".")[2])) & !flag_update
|
|
@@ -182,21 +189,22 @@
|
|
console.log(res.data.data.url, )
|
|
console.log(res.data.data.url, )
|
|
var dtask = plus.downloader
|
|
var dtask = plus.downloader
|
|
.createDownload(res.data.data
|
|
.createDownload(res.data.data
|
|
- .url, {
|
|
|
|
- method: 'GET',
|
|
|
|
- filename: '_doc/update/'
|
|
|
|
- }, function(d, status) {
|
|
|
|
- if (status == 200) {
|
|
|
|
- var path = d
|
|
|
|
- .filename; //下载apk
|
|
|
|
- plus.runtime.install(
|
|
|
|
- path); // 自动安装apk文件
|
|
|
|
- } else {
|
|
|
|
- plus.nativeUI.alert(
|
|
|
|
- '版本更新失败:' +
|
|
|
|
- status);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ .url, {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ filename: '_doc/update/'
|
|
|
|
+ },
|
|
|
|
+ function(d, status) {
|
|
|
|
+ if (status == 200) {
|
|
|
|
+ var path = d
|
|
|
|
+ .filename; //下载apk
|
|
|
|
+ plus.runtime.install(
|
|
|
|
+ path); // 自动安装apk文件
|
|
|
|
+ } else {
|
|
|
|
+ plus.nativeUI.alert(
|
|
|
|
+ '版本更新失败:' +
|
|
|
|
+ status);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
dtask.start();
|
|
dtask.start();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -204,7 +212,7 @@
|
|
} else if (flag_hot) {
|
|
} else if (flag_hot) {
|
|
console.log("热更新")
|
|
console.log("热更新")
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
- title:'正在热更新'
|
|
|
|
|
|
+ title: '正在热更新'
|
|
})
|
|
})
|
|
uni.downloadFile({
|
|
uni.downloadFile({
|
|
url: res.data.data.wgtUrl,
|
|
url: res.data.data.wgtUrl,
|
|
@@ -213,7 +221,7 @@
|
|
if (downloadResult.statusCode === 200) {
|
|
if (downloadResult.statusCode === 200) {
|
|
plus.nativeUI.toast(
|
|
plus.nativeUI.toast(
|
|
`正在热更新!${res.data.data.versionCode}`
|
|
`正在热更新!${res.data.data.versionCode}`
|
|
- );
|
|
|
|
|
|
+ );
|
|
plus.runtime.install(downloadResult
|
|
plus.runtime.install(downloadResult
|
|
.tempFilePath, {
|
|
.tempFilePath, {
|
|
force: false
|
|
force: false
|
|
@@ -233,19 +241,19 @@
|
|
that.$store
|
|
that.$store
|
|
.commit(
|
|
.commit(
|
|
'logout'
|
|
'logout'
|
|
- )
|
|
|
|
|
|
+ )
|
|
that.$api
|
|
that.$api
|
|
.logout()
|
|
.logout()
|
|
plus.nativeUI
|
|
plus.nativeUI
|
|
.toast(
|
|
.toast(
|
|
"登出成功"
|
|
"登出成功"
|
|
- );
|
|
|
|
|
|
+ );
|
|
plus.runtime
|
|
plus.runtime
|
|
.restart();
|
|
.restart();
|
|
plus.nativeUI
|
|
plus.nativeUI
|
|
.toast(
|
|
.toast(
|
|
"重启成功"
|
|
"重启成功"
|
|
- );
|
|
|
|
|
|
+ );
|
|
}
|
|
}
|
|
})
|
|
})
|
|
plus.runtime.restart();
|
|
plus.runtime.restart();
|
|
@@ -255,7 +263,7 @@
|
|
console.log(e)
|
|
console.log(e)
|
|
plus.nativeUI.toast(
|
|
plus.nativeUI.toast(
|
|
`热更新失败:${e.message}`
|
|
`热更新失败:${e.message}`
|
|
- );
|
|
|
|
|
|
+ );
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -337,8 +345,8 @@
|
|
url: `/pages/user/fankui`
|
|
url: `/pages/user/fankui`
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- unsubscribe(){
|
|
|
|
- var that=this
|
|
|
|
|
|
+ unsubscribe() {
|
|
|
|
+ var that = this
|
|
uni.clearStorage({
|
|
uni.clearStorage({
|
|
success: function(res) {
|
|
success: function(res) {
|
|
console.log('success');
|
|
console.log('success');
|
|
@@ -347,7 +355,7 @@
|
|
})
|
|
})
|
|
that.$api.doRequest('post', '/auth/api/logout').then(res => {
|
|
that.$api.doRequest('post', '/auth/api/logout').then(res => {
|
|
if (res.data.data) {
|
|
if (res.data.data) {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
})
|
|
})
|
|
that.$store.commit('logout')
|
|
that.$store.commit('logout')
|
|
@@ -468,6 +476,7 @@
|
|
.exitlogin:after {
|
|
.exitlogin:after {
|
|
border: none;
|
|
border: none;
|
|
}
|
|
}
|
|
|
|
+
|
|
.version_css {
|
|
.version_css {
|
|
// margin-right: 10rpx;
|
|
// margin-right: 10rpx;
|
|
color: #9D9D9D;
|
|
color: #9D9D9D;
|