Files
Code-Create/src/pages/my-account/account-info.vue

116 lines
2.2 KiB
Vue
Raw Normal View History

2026-05-18 15:22:08 +08:00
<template>
<div class="account-info">
<div class="left">
2026-05-18 16:46:55 +08:00
<div class="info">
<img alt="" src="" class="avatar" />
<div class="name">12312</div>
<div class="email">12312@example.com</div>
</div>
<router-link
class="link"
v-for="(v, i) in navs"
:key="i"
:to="v.path"
@click="typeof v.onClick === 'function' && v.onClick()"
>
<span class="iconfont" :class="v.icon"></span>
<span class="label">{{ v.label }}</span>
</router-link>
</div>
<div class="content">
<router-view></router-view>
2026-05-18 15:22:08 +08:00
</div>
</div>
</template>
<script setup lang="ts">
2026-05-18 16:46:55 +08:00
import { computed, ref } from 'vue'
import { useUserInfoStore } from '@/stores/userInfo'
const userInfoStore = useUserInfoStore()
const navs = ref([
{
path: '/my-account',
label: 'Dashboard',
icon: 'icon-dashboard'
},
{
path: '/my-account/orders',
label: 'Orders',
icon: 'icon-orders'
},
{
path: '/my-account/subscriptions',
label: 'Subscriptions',
icon: 'icon-subscriptions'
},
{
path: '/my-account/address',
label: 'Address',
icon: 'icon-address'
},
{
2026-05-19 15:55:49 +08:00
path: '/my-account/payment-methods',
2026-05-18 16:46:55 +08:00
label: 'Payment methods',
icon: 'icon-duidiaojiaohuanduihuan'
},
{
path: '/my-account/details',
label: 'Account details',
icon: 'icon-tubiao-'
},
{
path: '/my-account',
label: 'Log out',
icon: 'icon-tuichu',
onClick: () => {
console.log('logout')
userInfoStore.setToken('')
}
}
])
2026-05-18 15:22:08 +08:00
</script>
<style scoped lang="less">
.account-info {
display: flex;
2026-05-18 16:46:55 +08:00
> .left {
2026-05-18 15:22:08 +08:00
width: 270px;
border-right: 1px solid #e1e1e1;
margin-right: 30px;
2026-05-18 16:46:55 +08:00
> .info {
margin-bottom: 30px;
> .avatar {
width: 86px;
height: 86px;
margin-bottom: 15px;
border-radius: 50%;
}
> .name {
color: #222;
font-size: 16px;
}
> .email {
color: #333;
font-size: 14px;
}
}
> .link {
display: flex;
align-items: center;
width: 100%;
color: #222;
font-size: 16px;
text-decoration: none;
padding: 7px 0;
line-height: 1.6;
> .iconfont {
font-size: 20px;
margin-right: 5px;
}
}
2026-05-18 15:22:08 +08:00
}
2026-05-18 16:46:55 +08:00
> .content {
2026-05-18 15:22:08 +08:00
flex: 1;
}
}
</style>