You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
4.5 KiB

3 months ago
<template>
<div class="home-layout-container">
<!-- 左侧导航栏 -->
4 weeks ago
<div class="left-nav">
3 months ago
<ul class="nav-list">
4 weeks ago
<router-link
:to="'/productList?id=' + item.id"
tag="li"
v-for="item in tagList"
:key="item.id"
class="nav-item"
>
2 months ago
<img :src="util.showImg(item.image)" alt="" />{{ item.name }}
4 weeks ago
</router-link>
3 months ago
</ul>
4 weeks ago
</div>
3 months ago
<!-- 轮播图 -->
<div class="main-content">
<el-carousel style="height: 100%">
2 months ago
<el-carousel-item v-for="item in topBanner" :key="item.id">
<img :src="item.head_img" class="carousel-img" />
3 months ago
</el-carousel-item>
</el-carousel>
</div>
<!-- 右侧用户信息栏 -->
<div class="right-info">
1 month ago
<div class="avatar-container" v-if="$store.getters.isUserLogin">
3 months ago
<img
1 month ago
:src="$store.getters.getUserInfo.avatar"
3 months ago
alt="用户头像"
class="user-avatar"
/>
<div class="welcome-text">Hi-欢迎您</div>
</div>
1 month ago
<div class="btn-group" v-if="false">
2 months ago
<el-button type="danger" size="mini" @click="gotoPath('/Login')"
>登录</el-button
>
<el-button type="warning" size="mini" @click="gotoPath('/Register')"
>注册</el-button
>
3 months ago
<el-button type="primary" size="mini">客服</el-button>
</div>
1 month ago
<div class="func-icons" v-if="$store.getters.isUserLogin">
4 weeks ago
<router-link to="/User/UserCenter" class="icon-item">
3 months ago
<i class="icon el-icon-user"></i>
<span>个人中心</span>
4 weeks ago
</router-link>
<router-link to="/User/OrderList" class="icon-item">
3 months ago
<i class="icon el-icon-goods"></i>
<span>我的订单</span>
4 weeks ago
</router-link>
<router-link to="/User/ViewHistory" class="icon-item">
3 months ago
<i class="icon el-icon-star-off"></i>
<span>我的收藏</span>
4 weeks ago
</router-link>
<router-link to="/User/UserCenter" class="icon-item">
3 months ago
<i class="icon el-icon-pie-chart"></i>
<span>议价单</span>
4 weeks ago
</router-link>
3 months ago
</div>
4 weeks ago
<!-- <div class="announcement">
3 months ago
<el-tag type="danger" size="mini">公告</el-tag>
<span>2099年12月平台重要新规速递</span>
4 weeks ago
</div> -->
3 months ago
</div>
</div>
</template>
<script>
export default {
name: "HomeLayout",
2 months ago
props: {
topBanner: {
type: Array,
default: () => [],
},
tagList: {
type: Array,
default: () => [],
},
},
3 months ago
data() {
2 months ago
return {};
3 months ago
},
};
</script>
<style scoped lang="scss">
.home-layout-container {
display: flex;
width: 100%;
height: auto;
}
/* 左侧导航栏样式 */
.left-nav {
width: 200px;
background-color: #f8f9fa;
padding: 20px 0;
box-sizing: border-box;
}
.nav-list {
list-style: none;
margin: 0;
padding: 0;
}
.nav-item {
padding: 12px 20px;
cursor: pointer;
color: #333;
transition: all 0.3s ease;
2 months ago
display: flex;
3 months ago
2 months ago
img {
width: 20px;
3 months ago
margin-right: 5px;
}
}
.nav-item:hover {
background-color: #e9ecef;
padding-left: 25px;
}
/* 中间主内容样式 */
.main-content {
flex: 1;
height: auto;
overflow: hidden;
}
.carousel-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.main-content ::v-deep .el-carousel__container {
height: 100% !important;
}
/* 右侧用户信息栏样式 */
.right-info {
width: 280px;
background-color: #fff;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
border-left: 1px solid #eee;
}
.avatar-container {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20px;
}
.user-avatar {
width: 60px;
height: 60px;
border-radius: 50%;
margin-bottom: 10px;
border: 2px solid #f0f0f0;
}
.welcome-text {
font-size: 14px;
color: #333;
}
.btn-group {
display: flex;
gap: 10px;
margin-bottom: 30px;
width: 100%;
}
.func-icons {
display: flex;
justify-content: space-around;
width: 100%;
margin-bottom: 30px;
padding: 10px 0;
border-top: 1px dashed #eee;
border-bottom: 1px dashed #eee;
}
.icon-item {
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
color: #666;
transition: color 0.3s ease;
width: 50px;
}
.icon-item:hover {
color: #1890ff;
}
.icon {
font-size: 24px;
margin-bottom: 5px;
}
.icon-item span {
font-size: 12px;
}
.announcement {
display: flex;
align-items: center;
font-size: 12px;
color: #666;
width: 100%;
padding-top: 10px;
span {
margin-left: 10px;
}
}
</style>