第一个版本
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<image class="avatar" src="/static/logo.png" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<text class="nickname">{{ userStore.userInfo?.nickname || '未登录' }}</text>
|
||||
<text class="nickname">{{ userStore.isLogin ? formatPhone(userStore.userInfo?.phone) : '未登录' }}</text>
|
||||
<text class="user-desc" v-if="userStore.isLogin">欢迎使用爱上萍乡</text>
|
||||
<text class="user-desc user-desc--link" v-else @click="goLogin">点击登录 →</text>
|
||||
</view>
|
||||
@@ -85,7 +85,6 @@ function handleLogout() {
|
||||
if (res.confirm) {
|
||||
userStore.logout()
|
||||
uni.showToast({ title: '已退出', icon: 'success' })
|
||||
setTimeout(() => { uni.navigateTo({ url: '/pages/login/login' }) }, 1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -105,6 +104,12 @@ function goOrders() { uni.navigateTo({ url: '/packages/user/pages/order/list' })
|
||||
|
||||
/** 拨打客服热线 */
|
||||
function callService() { uni.makePhoneCall({ phoneNumber: '400-123-0101' }) }
|
||||
|
||||
/** 手机号脱敏显示(138****5678) */
|
||||
function formatPhone(phone?: string) {
|
||||
if (!phone) return '已登录'
|
||||
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user