184 lines
3.5 KiB
Vue
184 lines
3.5 KiB
Vue
<template>
|
|
<view class="page">
|
|
<!-- 用户信息卡片 -->
|
|
<view class="user-card" @click="goToChanginfo">
|
|
<view class="user-info">
|
|
<image
|
|
class="avatar"
|
|
:src="userInfo.avatar_pull || '/static/image/user.png'"
|
|
mode="aspectFill"
|
|
/>
|
|
<view class="user-details">
|
|
<text class="nickname">{{ userInfo.name}}</text>
|
|
<text class="phone">{{ userInfo.name_en}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 功能入口 -->
|
|
<view class="menu-section">
|
|
<view class="menu-item" @tap="goToMyPublish" v-if="this.userInfo.role==2">
|
|
<view class="menu-icon">
|
|
<u-icon name="list-dot" size="24" color="#3F435B"></u-icon>
|
|
</view>
|
|
<text class="menu-text">我的发布</text>
|
|
<view class="menu-arrow">
|
|
<u-icon name="arrow-right" size="18" color="#999"></u-icon>
|
|
</view>
|
|
</view>
|
|
<view class="menu-item" @tap="goToMyPublish" v-if="this.userInfo.role==1">
|
|
<view class="menu-icon">
|
|
<u-icon name="list-dot" size="24" color="#3F435B"></u-icon>
|
|
</view>
|
|
<text class="menu-text">我的车库</text>
|
|
<view class="menu-arrow">
|
|
<u-icon name="arrow-right" size="18" color="#999"></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<CustomTabBar class="h5-custom-tabbar" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { request } from '@/api/apiT.js'
|
|
import CustomTabBar from '@/custom-tab-bar/index.vue'
|
|
export default {
|
|
components: {
|
|
CustomTabBar
|
|
},
|
|
data() {
|
|
return {
|
|
userInfo: {}
|
|
}
|
|
},
|
|
onLoad() {
|
|
},
|
|
onShow() {
|
|
// 页面显示时刷新用户信息
|
|
this.getUserInfo()
|
|
},
|
|
methods: {
|
|
// 获取用户信息
|
|
getUserInfo() {
|
|
request({
|
|
url: 'common/user/info',
|
|
method: 'get'
|
|
}).then(res => {
|
|
if (res.data.code == 0 || res.data.code == 200) {
|
|
this.userInfo = res.data.data
|
|
}
|
|
}).catch(() => {
|
|
// 获取失败时使用默认值
|
|
})
|
|
},
|
|
// 跳转到我的发布列表
|
|
goToMyPublish() {
|
|
uni.navigateTo({
|
|
url: '/pages/index/myPublish'
|
|
})
|
|
},
|
|
// 跳转到个人信息
|
|
goToChanginfo() {
|
|
uni.navigateTo({
|
|
url: '/pages/index/changinfo'
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.page {
|
|
min-height: 100vh;
|
|
background: #f4f6f8;
|
|
padding: 20rpx;
|
|
}
|
|
|
|
.user-card {
|
|
background: rgba(255, 255, 255, 0.95);
|
|
border-radius: 18rpx;
|
|
padding: 40rpx 30rpx;
|
|
margin-bottom: 20rpx;
|
|
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.user-info {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.avatar {
|
|
width: 120rpx;
|
|
height: 120rpx;
|
|
border-radius: 50%;
|
|
background: #eef2f7;
|
|
margin-right: 30rpx;
|
|
}
|
|
|
|
.user-details {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12rpx;
|
|
}
|
|
|
|
.nickname {
|
|
font-size: 32rpx;
|
|
font-weight: 700;
|
|
color: #111827;
|
|
}
|
|
|
|
.phone {
|
|
font-size: 26rpx;
|
|
color: #6b7280;
|
|
}
|
|
|
|
.menu-section {
|
|
background: rgba(255, 255, 255, 0.95);
|
|
border-radius: 18rpx;
|
|
overflow: hidden;
|
|
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.menu-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 30rpx;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
transition: background-color 0.2s;
|
|
}
|
|
|
|
.menu-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.menu-item:active {
|
|
background-color: #f9fafb;
|
|
}
|
|
|
|
.menu-icon {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-right: 24rpx;
|
|
// background: #f3f4f6;
|
|
border-radius: 12rpx;
|
|
}
|
|
|
|
.menu-text {
|
|
flex: 1;
|
|
font-size: 30rpx;
|
|
color: #111827;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.menu-arrow {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
</style>
|