|
@@ -15,11 +15,11 @@
|
|
|
apiAdress
|
|
apiAdress
|
|
|
}}</text>
|
|
}}</text>
|
|
|
</u-cell>
|
|
</u-cell>
|
|
|
- <!-- <u-cell :title="'当前版本 ' + currentVersion" :isLink="true" arrow-direction="right">
|
|
|
|
|
|
|
+ <u-cell :title="'当前版本 ' + currentVersion" :isLink="true" arrow-direction="right">
|
|
|
<text slot="value" class="u-slot-value" @click="handlUpdate">{{
|
|
<text slot="value" class="u-slot-value" @click="handlUpdate">{{
|
|
|
- Nversion == currentVersion ? '' : `发现新版本(${this.Nversion})`
|
|
|
|
|
- }}</text>
|
|
|
|
|
- </u-cell> -->
|
|
|
|
|
|
|
+ Nversion == currentVersion ? '' : `发现新版本(${Nversion})`}}
|
|
|
|
|
+ </text>
|
|
|
|
|
+ </u-cell>
|
|
|
</u-cell-group>
|
|
</u-cell-group>
|
|
|
<view class="flex-buttom">
|
|
<view class="flex-buttom">
|
|
|
<view class="btn" @click="loginOut"> 退出登录 </view>
|
|
<view class="btn" @click="loginOut"> 退出登录 </view>
|
|
@@ -46,6 +46,9 @@
|
|
|
removeMemo
|
|
removeMemo
|
|
|
} from '@/utils/passwordMemo.js'
|
|
} from '@/utils/passwordMemo.js'
|
|
|
import ServerSetting from '@/components/ServerSetting/index'
|
|
import ServerSetting from '@/components/ServerSetting/index'
|
|
|
|
|
+ import {
|
|
|
|
|
+ getLatestVersion
|
|
|
|
|
+ } from '@/api/common.js'
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
updatePop,
|
|
updatePop,
|
|
@@ -70,9 +73,15 @@
|
|
|
apiInfo.hostname &&
|
|
apiInfo.hostname &&
|
|
|
`${apiInfo.protocal || ''}${apiInfo.hostname || ''}:${apiInfo.port || ''}`
|
|
`${apiInfo.protocal || ''}${apiInfo.hostname || ''}:${apiInfo.port || ''}`
|
|
|
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ appVersion
|
|
|
|
|
+ } = uni.getAppBaseInfo()
|
|
|
|
|
+ this.currentVersion = appVersion
|
|
|
|
|
+ getLatestVersion().then(res => {
|
|
|
|
|
+ this.Nversion = res.versionCode
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- this.currentVersion = plus?.runtime.version
|
|
|
|
|
|
|
+ // this.currentVersion = plus?.runtime.version
|
|
|
// this.getbb()
|
|
// this.getbb()
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -152,26 +161,91 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
handlUpdate() {
|
|
handlUpdate() {
|
|
|
- get(this.apiUrl + '/versioning/getLatestData').then(res => {
|
|
|
|
|
- console.log(res);
|
|
|
|
|
- if (res.success) {
|
|
|
|
|
- const currentVersion = this.currentVersion
|
|
|
|
|
- const Nversion = res.data.version
|
|
|
|
|
-
|
|
|
|
|
- console.log(currentVersion, Nversion);
|
|
|
|
|
- this.VersionInfo = res.data
|
|
|
|
|
- if (currentVersion !== Nversion) {
|
|
|
|
|
- this.$refs.updatePop.open()
|
|
|
|
|
- this.versionNum = Nversion
|
|
|
|
|
- this.downloadUrl = this.apiUrl + res.data.path
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '暂无新版本',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // get(this.apiUrl + '/versioning/getLatestData').then(res => {
|
|
|
|
|
+ // console.log(res);
|
|
|
|
|
+ // if (res.success) {
|
|
|
|
|
+ // const currentVersion = this.currentVersion
|
|
|
|
|
+ // const Nversion = res.data.version
|
|
|
|
|
+
|
|
|
|
|
+ // console.log(currentVersion, Nversion);
|
|
|
|
|
+ // this.VersionInfo = res.data
|
|
|
|
|
+ // if (currentVersion !== Nversion) {
|
|
|
|
|
+ // this.$refs.updatePop.open()
|
|
|
|
|
+ // this.versionNum = Nversion
|
|
|
|
|
+ // this.downloadUrl = this.apiUrl + res.data.path
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // uni.showToast({
|
|
|
|
|
+ // title: '暂无新版本',
|
|
|
|
|
+ // icon: 'none'
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ getLatestVersion().then(res => {
|
|
|
|
|
+ const {
|
|
|
|
|
+ appVersion
|
|
|
|
|
+ } = uni.getAppBaseInfo()
|
|
|
|
|
+ if (appVersion != res.versionCode) {
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '发现新版本',
|
|
|
|
|
+ content: '更新说明:' + res.releaseNotes,
|
|
|
|
|
+ confirmText: '立即更新',
|
|
|
|
|
+ success: (val) => {
|
|
|
|
|
+ if (val.confirm) {
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: "正在下载安装包...",
|
|
|
|
|
+ mask: true,
|
|
|
|
|
+ });
|
|
|
|
|
+ uni.downloadFile({
|
|
|
|
|
+ url: `${Vue.prototype.webviewUrl}/kd-aiot/${res.fileStorePath}`,
|
|
|
|
|
+ success: (data) => {
|
|
|
|
|
+ if (data.statusCode === 200) {
|
|
|
|
|
+ uni.saveFile({
|
|
|
|
|
+ tempFilePath: data
|
|
|
|
|
+ .tempFilePath,
|
|
|
|
|
+ success: (saveRes) => {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '下载成功',
|
|
|
|
|
+ icon: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: "正在更新...",
|
|
|
|
|
+ mask: true,
|
|
|
|
|
+ });
|
|
|
|
|
+ // 调用安装逻辑
|
|
|
|
|
+ plus.runtime.install(
|
|
|
|
|
+ saveRes
|
|
|
|
|
+ .savedFilePath, {
|
|
|
|
|
+ force: true
|
|
|
|
|
+ },
|
|
|
|
|
+ function() {
|
|
|
|
|
+ uni
|
|
|
|
|
+ .hideLoading();
|
|
|
|
|
+ },
|
|
|
|
|
+ function() {
|
|
|
|
|
+ uni
|
|
|
|
|
+ .hideLoading();
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '更新失败',
|
|
|
|
|
+ icon: 'error'
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
+ // #endif
|
|
|
},
|
|
},
|
|
|
getbb() {
|
|
getbb() {
|
|
|
get(this.apiUrl + '/versioning/getLatestData').then(res => {
|
|
get(this.apiUrl + '/versioning/getLatestData').then(res => {
|