feat: 将版本更新入口移到我的页面

This commit is contained in:
郭鸿轩 2026-09-24 22:09:12 +08:00
parent c8ce45ae38
commit 7c6c7a1b32
2 changed files with 22 additions and 50 deletions

View File

@ -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
}
}

View File

@ -4,7 +4,6 @@
<u-cell-group :border="false">
<u-cell-item title="通用" @click="navTo('/pages/sys/user/currency')" :arrow="true"></u-cell-item>
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
<u-cell-item title="版本更新" @click="upgrade()" :arrow="true"></u-cell-item>
<u-cell-item title="隐私政策" @click="navTo('')" :arrow="true"></u-cell-item>
<u-cell-item title="用户协议" @click="navTo('')" :arrow="true"></u-cell-item>
</u-cell-group>
@ -18,10 +17,6 @@
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
import app_upgrade from '@/uni_modules/app-upgrade/js_sdk/index.js'
import util from '@/common/util.js';
import config from '../../../common/config';
export default {
data() {
return {
@ -34,36 +29,6 @@ export default {
url: url
});
},
upgrade(){
// #ifdef APP-PLUS
app_upgrade(async ()=>{
// 获取应用信息
const appInfo = await new Promise((resolve) => {
plus.runtime.getProperty(plus.runtime.appid, (inf) => {
resolve(inf);
});
});
const res = await this.$u.api.upgradeCheck({
app_name: config.upgradeName,
current_version: appInfo.version
})
console.log('res',res)
if(!res.download_url){
this.$u.toast('当前版本已是最新版');
return
}
return {
changelog: res.message + ',最新版本:' + res.latest_version,
status: res.need_update ? 1 : 0, // 0 无新版本 | 1 有新版本
path: res.download_url // 新apk地址
}
}, 1)
// #endif
// #ifndef APP-PLUS
this.$u.toast('小程序端或H5端已是最新版,无需检查更新!');
// #endif
},
openSettings() {
// #ifdef APP-PLUS
uni.getSystemInfo({