feat: 添加应用版本检查功能,优化用户体验
This commit is contained in:
@@ -350,7 +350,7 @@
|
||||
<view class="right-box">
|
||||
<text>{{ friendInfo.nick || '未知名称' }}</text>
|
||||
<text v-if="friendInfo?.cbType !== 'group'">
|
||||
手机号: {{ friendInfo.userID }}
|
||||
ID: {{ friendInfo.userID }}
|
||||
</text>
|
||||
<text v-if="friendInfo?.cbType !== 'group'">
|
||||
个性签名: {{ friendInfo.selfSignature || '暂无个性签名' }}
|
||||
@@ -513,7 +513,9 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.title {
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC,
|
||||
PingFang SC;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
|
||||
@@ -97,7 +97,9 @@
|
||||
<uni-icons v-else type="contact-filled" size="70"></uni-icons>
|
||||
<view class="nickname">
|
||||
<text class="name">{{ userInfo?.userName || '' }}</text>
|
||||
<text class="name">ID:{{ userInfo?.invitationCode || '' }}</text>
|
||||
<text class="name">
|
||||
ID: {{ userInfo?.invitationCode || '' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<image
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<uni-icons v-else type="contact-filled" size="60"></uni-icons>
|
||||
<view class="right-box">
|
||||
<text>{{ userInfo.userName }}</text>
|
||||
<text>ID: {{ userInfo.userId }}</text>
|
||||
<text>ID: {{ userInfo.invitationCode }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="code-img">
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { navigateTo } from '../../../utils/router'
|
||||
import { useUI } from '../../../utils/use-ui'
|
||||
import { getAppVersion } from '@/api'
|
||||
import { compareVersion } from '@/utils/util.js'
|
||||
|
||||
const { showDialog, showToast } = useUI()
|
||||
|
||||
@@ -14,7 +16,11 @@
|
||||
},
|
||||
// { name: '聊天背景', value: '', url: '' },
|
||||
// { name: '朋友圈设置', value: '', url: '' },
|
||||
{ name: '消息通知', value: '', url: '/pages/my-index/set-up/message/index' }
|
||||
{
|
||||
name: '消息通知',
|
||||
value: '',
|
||||
url: '/pages/my-index/set-up/message/index'
|
||||
}
|
||||
// { name: '安全设置', value: '', url: '' },
|
||||
// { name: '群发消息', value: '', url: '' },
|
||||
// { name: '登录设备', value: '', url: '' }
|
||||
@@ -29,6 +35,9 @@
|
||||
value: '',
|
||||
url: '/pages/my-index/set-up/feedback'
|
||||
},
|
||||
// #ifdef APP-PLUS
|
||||
{ name: '检查更新', value: '3', url: '' },
|
||||
// #endif
|
||||
{ name: '关于我们', value: '', url: '/pages/discover/company' }
|
||||
]
|
||||
|
||||
@@ -45,6 +54,35 @@
|
||||
}
|
||||
})
|
||||
return
|
||||
} else if (item.value === '3') {
|
||||
plus.runtime.getProperty(plus.runtime.appid, function (widgetInfo) {
|
||||
getAppVersion().then(res => {
|
||||
console.log('应用版本信息', res.data)
|
||||
const lastVersion = res.data.version
|
||||
const currentVersion = widgetInfo.version
|
||||
if (compareVersion(currentVersion, lastVersion) < 0) {
|
||||
// 当前版本低于最新版本,提示用户更新
|
||||
console.log('当前版本低于最新版本,请更新应用')
|
||||
const url = res.data.updateUrl
|
||||
const isForceUpdate = res.data.forceUpdate
|
||||
uni.showModal({
|
||||
title: '更新提示',
|
||||
content: res.data.updateMessage,
|
||||
confirmText: '立即更新',
|
||||
cancelText: '稍后再说',
|
||||
showCancel: !isForceUpdate,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
plus.runtime.openURL(url)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
showToast('当前已是最新版本', 'info')
|
||||
}
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
item.url && navigateTo(item.url)
|
||||
}
|
||||
@@ -104,7 +142,9 @@
|
||||
padding: 0 32rpx;
|
||||
.item {
|
||||
padding: 20rpx 0;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC,
|
||||
PingFang SC;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
@@ -135,7 +175,9 @@
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: #fff;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC,
|
||||
PingFang SC;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #eb1c26;
|
||||
|
||||
Reference in New Issue
Block a user