|
@@ -41,6 +41,12 @@
|
|
|
</view>
|
|
|
<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
|
|
|
</view>
|
|
|
+ <view class='cu-item' style='margin-bottom:10px;' @click='updataEdition'>
|
|
|
+ <view>
|
|
|
+ <text>检查新版本</text>
|
|
|
+ </view>
|
|
|
+ <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class='exitloginwrap'>
|
|
|
<button @click='logout()' class='exitlogin'>退出登录</button>
|
|
@@ -52,6 +58,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import appUpdate from 'common/appUpdate.js'
|
|
|
import {
|
|
|
mapState
|
|
|
} from 'vuex';
|
|
@@ -81,39 +88,172 @@
|
|
|
},
|
|
|
onLoad() {},
|
|
|
methods: {
|
|
|
- UpdataPassword(){
|
|
|
+ updataEdition() {
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ let type = uni.getSystemInfoSync().platform
|
|
|
+ if (type == "android") {
|
|
|
+ uni.request({
|
|
|
+ url: 'http://api1.eliangeyun.com/appVersion/selectInfo',
|
|
|
+ data: {
|
|
|
+ appid: plus.runtime.appid,
|
|
|
+ version: plus.runtime.version,
|
|
|
+ imei: "1"
|
|
|
+ },
|
|
|
+ method: 'GET',
|
|
|
+ success: (res) => {
|
|
|
+ if (res.statusCode === 200) {
|
|
|
+ console.log("uni.request update success", res)
|
|
|
+ plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
|
|
|
+ let client_version = wgtinfo.version
|
|
|
+ var flag_update = client_version.split(".").splice(0, 2).join(
|
|
|
+ ".") != res.data.data.version.split(".").splice(0, 2)
|
|
|
+ .join(".")
|
|
|
+ var flag_hot = (Number(client_version.split(".")[2]) < Number(res
|
|
|
+ .data.data.version.split(".")[2])) & !flag_update
|
|
|
+ console.log("client_version", client_version)
|
|
|
+ console.log("flag_update", flag_update)
|
|
|
+ console.log("flag_hot", flag_hot)
|
|
|
+
|
|
|
+ if (flag_update) {
|
|
|
+ console.log("更新弹窗")
|
|
|
+ // 提醒用户更新
|
|
|
+ uni.showModal({
|
|
|
+ title: '更新提示',
|
|
|
+ content: res.data.data.note,
|
|
|
+ success: (showResult) => {
|
|
|
+ if (showResult.confirm) {
|
|
|
+ plus.nativeUI.toast("正在准备环境,请稍后!");
|
|
|
+ console.log(res.data.data.url, )
|
|
|
+ var dtask = plus.downloader
|
|
|
+ .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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dtask.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (flag_hot) {
|
|
|
+ console.log("热更新")
|
|
|
+ uni.showLoading({
|
|
|
+ title:'正在热更新'
|
|
|
+ })
|
|
|
+ uni.downloadFile({
|
|
|
+ url: res.data.data.wgtUrl,
|
|
|
+ success: (downloadResult) => {
|
|
|
+ console.log(downloadResult.tempFilePath)
|
|
|
+ if (downloadResult.statusCode === 200) {
|
|
|
+ plus.nativeUI.toast(
|
|
|
+ `正在热更新!${res.data.data.versionCode}`
|
|
|
+ );
|
|
|
+ plus.runtime.install(downloadResult
|
|
|
+ .tempFilePath, {
|
|
|
+ force: false
|
|
|
+ },
|
|
|
+ function() {
|
|
|
+ uni.hideLoading()
|
|
|
+ plus.nativeUI.toast(
|
|
|
+ "热更新成功");
|
|
|
+ uni.clearStorageSync();
|
|
|
+ plus.nativeUI.toast(
|
|
|
+ "缓存清除成功");
|
|
|
+ that.$api.doRequest('post',
|
|
|
+ '/auth/api/logout')
|
|
|
+ .then(res => {
|
|
|
+ if (res.data
|
|
|
+ .data) {
|
|
|
+ that.$store
|
|
|
+ .commit(
|
|
|
+ 'logout'
|
|
|
+ )
|
|
|
+ that.$api
|
|
|
+ .logout()
|
|
|
+ plus.nativeUI
|
|
|
+ .toast(
|
|
|
+ "登出成功"
|
|
|
+ );
|
|
|
+ plus.runtime
|
|
|
+ .restart();
|
|
|
+ plus.nativeUI
|
|
|
+ .toast(
|
|
|
+ "重启成功"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ })
|
|
|
+ plus.runtime.restart();
|
|
|
+ },
|
|
|
+ function(e) {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.log(e)
|
|
|
+ plus.nativeUI.toast(
|
|
|
+ `热更新失败:${e.message}`
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.content = '您当前版本为最新版本'
|
|
|
+ this.isShowAlert = true
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ UpdataPassword() {
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/public/reset?phone=${this.userInfo.phone}`
|
|
|
})
|
|
|
},
|
|
|
- clearStorage(){
|
|
|
- let that = this
|
|
|
+ clearStorage() {
|
|
|
+ let that = this
|
|
|
uni.clearStorage({
|
|
|
- success: function (res) {
|
|
|
- console.log('success');
|
|
|
+ success: function(res) {
|
|
|
+ console.log('success');
|
|
|
that.goOpenService()
|
|
|
- }
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
cancelClick() {
|
|
|
this.isShowAlert = false
|
|
|
},
|
|
|
goOpenService() {
|
|
|
+ if (this.content == '您当前版本为最新版本') {
|
|
|
+ this.isShowAlert = false
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.hideTabBarRedDot({
|
|
|
index: 3
|
|
|
})
|
|
|
uni.clearStorageSync();
|
|
|
- var that=this
|
|
|
+ var that = this
|
|
|
this.$api.doRequest('post', '/auth/api/logout').then(res => {
|
|
|
if (res.data.data) {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
this.$store.commit('logout')
|
|
|
this.$api.logout()
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/public/login`
|
|
|
- })
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/public/login`
|
|
|
+ })
|
|
|
},
|
|
|
getList() {
|
|
|
this.userInfo = uni.getStorageSync('userInfo')
|