12312
This commit is contained in:
+47
-51
@@ -1,19 +1,19 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 自定义导航栏 -->
|
||||
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
||||
<view class="nav-header">
|
||||
<text class="nav-title">我的</text>
|
||||
<!-- 未登录 -->
|
||||
<view class="user-section" v-if="!isLogin" @click="goLogin">
|
||||
<view class="user-info">
|
||||
<image class="user-avatar" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_tx.png" mode="aspectFill" />
|
||||
<text class="login-hint">点击登录</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-section">
|
||||
<!-- 已登录 -->
|
||||
<view class="user-section" v-else>
|
||||
<view class="user-info">
|
||||
<image class="user-avatar" src="https://aliyunoss.hn12301.net/hhrs/hhrs_avatar.png" mode="aspectFill" />
|
||||
<image class="user-avatar" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_tx.png" mode="aspectFill" />
|
||||
<view class="user-detail">
|
||||
<text class="user-name">王东林</text>
|
||||
<text class="user-phone">186****9010</text>
|
||||
<text class="user-phone">{{ maskPhone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout-btn" @click="onLogout">退出登录</view>
|
||||
@@ -22,24 +22,24 @@
|
||||
<!-- 菜单列表 -->
|
||||
<view class="menu-list">
|
||||
<view class="menu-item" @click="goWinners">
|
||||
<text class="menu-icon icon-ticket"></text>
|
||||
<image class="menu-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_zjcx.png" mode="aspectFit" />
|
||||
<text class="menu-label">用户中奖查询</text>
|
||||
<text class="menu-arrow"></text>
|
||||
<u-icon name="arrow-right" color="#cccccc" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="menu-item" @click="goGuide">
|
||||
<text class="menu-icon icon-book"></text>
|
||||
<image class="menu-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_syzn.png" mode="aspectFit" />
|
||||
<text class="menu-label">使用指南</text>
|
||||
<text class="menu-arrow"></text>
|
||||
<u-icon name="arrow-right" color="#cccccc" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="menu-item" @click="goService">
|
||||
<text class="menu-icon icon-headset"></text>
|
||||
<image class="menu-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_lxkf.png" mode="aspectFit" />
|
||||
<text class="menu-label">联系客服</text>
|
||||
<text class="menu-arrow"></text>
|
||||
<u-icon name="arrow-right" color="#cccccc" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部 TabBar -->
|
||||
<tab-bar :current="1" />
|
||||
<!-- <tab-bar :current="1" /> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -50,14 +50,24 @@ export default {
|
||||
components: { tabBar },
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 44
|
||||
isLogin: false,
|
||||
phone: ''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
this.statusBarHeight = sysInfo.statusBarHeight || 44
|
||||
computed: {
|
||||
maskPhone() {
|
||||
if (!this.phone || this.phone.length < 7) return this.phone
|
||||
return this.phone.substring(0, 3) + '****' + this.phone.substring(7)
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.phone = uni.getStorageSync('phone') || ''
|
||||
this.isLogin = !!this.phone
|
||||
},
|
||||
methods: {
|
||||
goLogin() {
|
||||
uni.navigateTo({ url: '/pages/index/login' })
|
||||
},
|
||||
onLogout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
@@ -65,6 +75,9 @@ export default {
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.removeStorageSync('token')
|
||||
uni.removeStorageSync('phone')
|
||||
this.isLogin = false
|
||||
this.phone = ''
|
||||
uni.showToast({ title: '已退出登录', icon: 'success' })
|
||||
}
|
||||
}
|
||||
@@ -82,32 +95,13 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
page {
|
||||
background-color: #f2f2f7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.nav-bar {
|
||||
background-color: #ffffff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.nav-header {
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #1a1818;
|
||||
}
|
||||
|
||||
/* 用户信息 */
|
||||
.user-section {
|
||||
@@ -118,6 +112,13 @@ export default {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
|
||||
.login-hint {
|
||||
font-size: 16px;
|
||||
color: #1a1818;
|
||||
font-weight: 500;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -173,10 +174,8 @@ export default {
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
font-size: 18px;
|
||||
color: #0088ff;
|
||||
width: 24px;
|
||||
text-align: center;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.menu-label {
|
||||
@@ -186,8 +185,5 @@ export default {
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
font-size: 14px;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user