feat: 将版本更新入口移到我的页面
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
<!--<u-cell-item icon="account" :iconStyle="{ color: '#27c0dc' }" title="关于我们" @click="navTo('about')"></u-cell-item>
|
||||
<u-cell-item icon="kefu-ermai" :iconStyle="{ color: '#ff8a00' }" title="联系客服" @click="navTo('service')"></u-cell-item>!-->
|
||||
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
|
||||
<u-cell-item icon="reload" :iconStyle="{ color: '#19be6b' }" title="版本更新" @click="upgrade"></u-cell-item>
|
||||
<u-cell-item icon="setting" :iconStyle="{ color: '#2767dc' }" title="系统设置" @click="navTo('setting')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
@@ -55,6 +56,8 @@
|
||||
</template>
|
||||
<script>
|
||||
import CommonNavbar from "@/components/common-navbar/index";
|
||||
import app_upgrade from '@/uni_modules/app-upgrade/js_sdk/index.js';
|
||||
import config from '@/common/config.js';
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
|
||||
*/
|
||||
@@ -102,25 +105,29 @@ export default {
|
||||
},
|
||||
upgrade(){
|
||||
// #ifdef APP-PLUS
|
||||
this.$u.api.upgradeCheck().then(res => {
|
||||
if (res.result == 'true'){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.message + '是否下载更新?',
|
||||
showCancel: true,
|
||||
success: function (res2) {
|
||||
if (res2.confirm) {
|
||||
plus.runtime.openURL(res.data.apkUrl);
|
||||
}
|
||||
}
|
||||
app_upgrade(async () => {
|
||||
const appInfo = await new Promise((resolve) => {
|
||||
plus.runtime.getProperty(plus.runtime.appid, (inf) => {
|
||||
resolve(inf);
|
||||
});
|
||||
}else{
|
||||
this.$u.toast(res.message);
|
||||
});
|
||||
const res = await this.$u.api.upgradeCheck({
|
||||
app_name: config.upgradeName,
|
||||
current_version: appInfo.version
|
||||
});
|
||||
if (!res.download_url) {
|
||||
this.$u.toast('当前版本已是最新版');
|
||||
return;
|
||||
}
|
||||
});
|
||||
return {
|
||||
changelog: res.message + ',最新版本:' + res.latest_version,
|
||||
status: res.need_update ? 1 : 0,
|
||||
path: res.download_url
|
||||
};
|
||||
}, 1);
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.$u.toast('小程序端或H5端无需检查更新')
|
||||
this.$u.toast('小程序端或H5端已是最新版,无需检查更新!');
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user