- 将升级检查接口调用改为使用统一的 putJson 方法,简化请求逻辑 - 新增 vm.$u.putJsonFullUrl 方法,支持传入完整URL且带默认JSON请求头 - putJsonFullUrl 方法封装了请求的统一header和响应处理逻辑 - manifest版本号升级至1.1.2 (112) - sys user setting页面增加升级检查返回日志打印,方便调试
125 lines
3.3 KiB
Vue
125 lines
3.3 KiB
Vue
<template>
|
|
<view class="wrap">
|
|
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
|
|
<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>
|
|
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
|
|
<view>
|
|
<u-button class="sign-out" @click="logout" :hair-line="false">退出登录</u-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
/**
|
|
* 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 {
|
|
|
|
};
|
|
},
|
|
methods: {
|
|
navTo(url) {
|
|
uni.navigateTo({
|
|
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({
|
|
success(res) {
|
|
if(res.platform == 'ios'){
|
|
plus.runtime.openURL("app-settings://");
|
|
} else if (res.platform == 'android'){
|
|
var main = plus.android.runtimeMainActivity();
|
|
var Intent = plus.android.importClass("android.content.Intent");
|
|
var mIntent = new Intent('android.settings.SOUND_SETTINGS');
|
|
main.startActivity(mIntent);
|
|
}
|
|
}
|
|
});
|
|
// #endif
|
|
// #ifndef APP-PLUS
|
|
this.$u.toast('小程序端或H5端已是最新版,无需检查更新!');
|
|
// #endif
|
|
},
|
|
logout() {
|
|
this.$u.api.pdaLogout().then(res => {
|
|
console.log('res',res)
|
|
if (res.code != 0) {
|
|
// this.$u.toast('退出登录失败');
|
|
uni.reLaunch({
|
|
url: '/pages/sys/login/index'
|
|
});
|
|
return
|
|
}
|
|
// 清除token和用户信息
|
|
uni.removeStorageSync('token');
|
|
this.$store.dispatch('updateUserInfo', null);
|
|
uni.reLaunch({
|
|
url: '/pages/sys/login/index'
|
|
});
|
|
}).catch(error => {
|
|
console.log('error',error)
|
|
// 即使退出登录失败,也要清除本地token和用户信息
|
|
uni.removeStorageSync('token');
|
|
this.$store.dispatch('updateUserInfo', null);
|
|
// this.$u.toast('退出登录失败');
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss">
|
|
|
|
|
|
page {
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
::v-deep( .u-cell-title) {
|
|
padding: 25rpx 30rpx;
|
|
font-size: 30rpx;
|
|
}
|
|
</style>
|