196 lines
4.1 KiB
Vue
Raw Normal View History

2025-04-14 10:57:27 +08:00
<template>
<view class="container">
<!-- 用户信息区域 -->
<view class="user-info padding">
<view class="user-avatar">
2025-04-21 17:50:57 +08:00
<image :src="`${imgPath}static/userui/tx.png`" mode="aspectFill"></image><!-- 头像 -->
2025-04-14 10:57:27 +08:00
</view>
<view class="user-details">
<view class="nickname">昵称</view>
<view class="phone-number">182****7183</view>
</view>
</view>
<!-- 账户明细区域 -->
<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<view v-for="(item, index) in menuItems" :key="index" class="cu-item arrow" @click="navigateTo(item.link)">
<view class="content flex">
<view class="icon-container">
<image class="icon-size" :src="item.icon"></image>
</view>
<text class="text-black">{{ item.label }}</text>
</view>
</view>
<view class=" flex flex-direction">
2025-04-21 17:50:57 +08:00
<button @click="logout" style="height: 45px;"
class="cu-btn bg-white margin-tb-sm lg text-red text-bold">退出登录</button>
2025-04-14 10:57:27 +08:00
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
2025-04-15 11:27:28 +08:00
import config from '@/utils/config';
const imgPath = config.imgPath;
2025-04-21 17:50:57 +08:00
2025-04-14 10:57:27 +08:00
const menuItems = ref([{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/zhhanghu.png`,
2025-04-14 10:57:27 +08:00
label: '账户明细',
link: '/pages/user/login/AccountDetails'
},
{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/baoxiujilu.png`,
2025-04-14 10:57:27 +08:00
label: '故障反馈',
2025-04-17 15:08:06 +08:00
link: '/pages/user/login/TroubleReportUser?bikeCode=250306001002&orderCode=12039219893712864'
2025-04-14 10:57:27 +08:00
},
{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/baoxiujilu.png`,
2025-04-14 10:57:27 +08:00
label: '报修记录',
link: '/pages/user/login/RepairReport'
},
{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/shiminrenzheng.png`,
2025-04-14 10:57:27 +08:00
label: '微信登录',
link: '/pages/user/login/wx_login'
},
{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/jilu.png`,
2025-04-14 10:57:27 +08:00
label: '申请换车记录',
2025-04-14 18:51:53 +08:00
link: '/pages/user/login/return-point-records'
2025-04-14 10:57:27 +08:00
},
{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/helpinfo.png`,
2025-04-14 10:57:27 +08:00
label: '帮助中心',
link: '/pages/user/HelpPage/HelpPage'
},
2025-04-17 16:17:42 +08:00
{
icon: `${imgPath}static/userui/icon/helpinfo.png`,
label: '微信支付反馈',
link: '/pages/user/views/PaymentFeedback'
},
2025-04-14 10:57:27 +08:00
{
2025-04-15 11:27:28 +08:00
icon: `${imgPath}static/userui/icon/loginout.png`,
2025-04-14 10:57:27 +08:00
label: '账号注销',
link: '/pages/user/login/userLogout'
}
]);
2025-04-21 17:50:57 +08:00
// 退出登录的方法
const logout = () => {
uni.showModal({
title: '退出登录',
content: '是否确认退出并清除缓存?',
success: function(res) {
if (res.confirm) {
// 清除缓存
uni.clearStorage("wechat_user");
// 弹出成功提示
uni.showToast({
title: '退出成功', // 提示内容
icon: 'success', // 图标类型
duration: 2000 // 持续时间(单位:毫秒)
});
} else if (res.cancel) {
// 用户取消退出,做相应处理(可选)
console.log('用户取消退出');
}
}
});
}
2025-04-14 10:57:27 +08:00
const navigateTo = (link) => {
if (link == "") return;
uni.navigateTo({
url: link
});
}
</script>
<style>
/* 容器 */
.container {
background-color: rgb(248, 248, 248);
height: 100vh;
/* 给容器添加内边距 */
}
/* 用户信息部分 */
.user-info {
display: flex;
margin-bottom: 20px;
/* 用户信息区域底部间距 */
align-items: center;
}
/* 用户头像 */
.user-avatar {
margin-right: 15px;
/* 头像与其他信息之间的间距 */
}
.user-avatar image {
width: 50px;
height: 50px;
border-radius: 50%;
}
/* 用户信息 */
.user-details {
display: flex;
flex-direction: column;
}
.nickname {
font-weight: bold;
font-size: 16px;
}
.phone-number {
color: #888;
font-size: 14px;
}
/* 账户明细部分 */
.account-details {
background-color: #f5f5f5;
padding: 15px;
border-radius: 8px;
}
.account-details .flex {
display: flex;
align-items: center;
}
.icon {
width: 30px;
height: 30px;
background-color: #ddd;
border-radius: 50%;
margin-right: 10px;
}
.account-info {
font-size: 16px;
font-weight: bold;
}
.icon-container {
margin-right: 15px;
}
.icon-size {
width: 15px;
height: 15px;
}
</style>