Zlpt_Portal/src/views/home/index.vue

532 lines
17 KiB
Vue
Raw Normal View History

2023-12-01 11:22:09 +08:00
<script setup lang="ts">
2023-12-04 17:42:11 +08:00
import EquipCard from 'components/equipCard.vue'
2023-12-05 17:05:54 +08:00
import NavMenu from 'components/Navmenu/index.vue'
import { getGoodsClassListApi } from 'http/api/home'
2023-12-04 17:42:11 +08:00
import { useStore } from 'store/main'
2023-12-08 13:13:00 +08:00
import { getHotList } from 'http/api/equip'
2023-12-04 13:10:38 +08:00
const userStore = useStore()
2023-12-05 17:05:54 +08:00
// 获取商品分类
const getGoodsClassList = async () => {
const res = await getGoodsClassListApi()
console.log(res, '商品分类列表')
}
getGoodsClassList()
2023-12-03 10:41:32 +08:00
const leftNavList = [
{
name: '全部商品',
children: [
{
title: '挖掘机',
children: [
{ goodsName: '履带挖掘机' },
{ goodsName: '履带挖掘机' },
{ goodsName: '履带挖掘机' },
{ goodsName: '履带挖掘机' },
{ goodsName: '履带挖掘机' },
{ goodsName: '履带挖掘机' }
]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '挖掘机',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '土方机械',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '工程起重机械',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '动力设备',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '压实机械',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '路桥机械',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '混凝土机械',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
},
{
name: '桩工机械',
children: [
{
title: '挖掘机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '开沟机',
children: [{ goodsName: '履带挖掘机' }]
},
{
title: '斗轮挖掘机',
children: [{ goodsName: '履带挖掘机' }]
}
]
}
]
2023-12-01 11:22:09 +08:00
2023-12-03 10:41:32 +08:00
const handlerGoodsDetails = () => {
console.log('去往商品详情页')
}
2023-12-04 09:12:38 +08:00
const detailsList = ref([
{
v_title: '实锤了,确实挖掘技术强!山东用挖掘机在海外市场“挖呀挖”',
v_content_info:
'天眼查数据显示截至今年4月中旬全国存天眼查数据显示截至今年4月中旬全国存天眼查数据显示截至今年4月中旬全国存',
v_time: '[2023/11/28]'
},
{
v_title: '实锤了,确实挖掘技术强!山东用挖掘机在海外市场“挖呀挖”',
v_content_info:
'天眼查数据显示截至今年4月中旬全国存天眼查数据显示截至今年4月中旬全国存天眼查数据显示截至今年4月中旬全国存',
v_time: '[2023/11/28]'
},
{
v_title: '实锤了,确实挖掘技术强!山东用挖掘机在海外市场“挖呀挖”',
v_content_info:
'天眼查数据显示截至今年4月中旬全国存天眼查数据显示截至今年4月中旬全国存天眼查数据显示截至今年4月中旬全国存',
v_time: '[2023/11/28]'
}
])
2023-12-08 13:13:00 +08:00
/* 获取热搜装备 */
const getHotDeviceList = async () => {
const res = await getHotList({ pageSize: 3 })
console.log(res, '热搜装备111')
}
getHotDeviceList()
2023-12-01 11:22:09 +08:00
</script>
<template>
2023-12-01 15:00:37 +08:00
<div class="home-index-banner">
2023-12-03 10:41:32 +08:00
<div class="home-index">
2023-12-01 14:03:26 +08:00
<!-- 商品菜单导航以及轮播图区域 -->
<div class="home-goods">
<ul class="left-nav">
2023-12-02 14:18:00 +08:00
<!-- 左侧机械名称菜单按钮 -->
2023-12-03 10:41:32 +08:00
<li class="item-nav" v-for="item in leftNavList" :key="item.name">
{{ item.name }}
2023-12-02 14:18:00 +08:00
<ul class="sub-goods">
<!-- 级联框内 类别名称 -->
<li v-for="child in item.children" :key="child.title">
<span>{{ child.title }}</span>
<span>
<!-- 小类名称 -->
2023-12-03 10:41:32 +08:00
<a
v-for="son in child.children"
:key="son.goodsName"
@click="handlerGoodsDetails">
{{ son.goodsName }}
</a>
2023-12-02 14:18:00 +08:00
</span>
</li>
</ul>
</li>
2023-12-01 13:00:16 +08:00
</ul>
2023-12-01 14:03:26 +08:00
<div class="right-content">
2023-12-02 14:18:00 +08:00
<!-- 轮播图上方导航按钮 -->
2023-12-05 17:05:54 +08:00
<NavMenu />
2023-12-02 14:18:00 +08:00
<!-- 轮播图 -->
2023-12-01 14:03:26 +08:00
<div class="swpier-img">
2023-12-01 14:48:58 +08:00
<el-carousel :interval="5000" arrow="always" height="437px">
2023-12-01 14:03:26 +08:00
<el-carousel-item v-for="item in 4" :key="item">
2023-12-04 17:42:11 +08:00
<!-- <h3 text="2xl" justify="center">{{ item }}</h3> -->
<el-image
style="width: 100%"
src="https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/488bab245180ebf9f1f3d7db5301be4.png"
fit="cover" />
2023-12-01 14:03:26 +08:00
</el-carousel-item>
</el-carousel>
</div>
</div>
</div>
<!-- 热搜装备 -->
<div class="hot-equip">
<span>热搜装备</span>
<a>查看更多</a>
</div>
<ul class="equip-pic">
2023-12-05 09:43:57 +08:00
<li @click="$router.push('equipDetail/5')" style="cursor: pointer">
2023-12-01 17:02:05 +08:00
<EquipCard />
</li>
2023-12-05 09:43:57 +08:00
<li @click="$router.push('equipDetail/5')" style="cursor: pointer">
2023-12-01 17:02:05 +08:00
<EquipCard />
</li>
2023-12-05 09:43:57 +08:00
<li @click="$router.push('equipDetail/5')" style="cursor: pointer">
2023-12-01 17:02:05 +08:00
<EquipCard />
</li>
2023-12-01 14:03:26 +08:00
</ul>
<!-- 专题咨询 -->
<div class="hot-equip">
<span>专题资讯</span>
<a></a>
</div>
<ul class="consult-nav">
<li>
<a>资讯</a>
</li>
<li>
<a>专题</a>
</li>
<li>
<a>检验</a>
</li>
<li>
<a>保险</a>
</li>
</ul>
<div class="consult-content">
<!-- 左侧背景图片 -->
<div class="left-bg"></div>
<!-- 右侧信息 -->
<div class="right-consult">
2023-12-04 09:12:38 +08:00
<div
class="consult-box"
@click="$router.push('/consultationDetails')"
v-for="item in detailsList"
:key="item.v_time">
2023-12-01 14:03:26 +08:00
<div class="consult-title">
2023-12-04 09:12:38 +08:00
<h2>{{ item.v_title }}</h2>
<span>{{ item.v_time }}</span>
2023-12-01 14:03:26 +08:00
</div>
<div class="consult-info">
2023-12-04 09:12:38 +08:00
{{ item.v_content_info }}
2023-12-01 14:03:26 +08:00
</div>
</div>
2023-12-01 13:00:16 +08:00
</div>
</div>
</div>
</div>
2023-12-01 11:22:09 +08:00
</template>
<style lang="scss">
2023-12-03 10:41:32 +08:00
.home-index-banner {
background-color: #fff;
padding: 20px 15px;
border-radius: 10px;
box-sizing: border-box;
}
2023-12-02 14:18:00 +08:00
2023-12-03 10:41:32 +08:00
.home-index {
.home-goods {
height: 500px;
2023-12-01 13:00:16 +08:00
display: flex;
2023-12-03 10:41:32 +08:00
.left-nav {
position: relative;
width: 200px;
height: 100%;
display: flex;
background-color: #f7f9fa;
flex-direction: column;
justify-content: space-around;
.item-nav {
2023-12-05 17:05:54 +08:00
// text-align: left;
// padding-left: 50px;
2023-12-03 10:41:32 +08:00
color: #8b8b8b;
height: 36px;
line-height: 36px;
2023-12-05 17:05:54 +08:00
text-align: center;
2023-12-03 10:41:32 +08:00
&:hover {
cursor: pointer;
color: #2282ff;
font-weight: bold;
background-color: #1abc9c;
2023-12-01 13:00:16 +08:00
2023-12-03 10:41:32 +08:00
.sub-goods {
display: block;
}
2023-12-02 14:18:00 +08:00
}
}
2023-12-01 13:00:16 +08:00
2023-12-03 10:41:32 +08:00
.sub-goods {
position: absolute;
display: none;
top: 0;
left: 200px;
width: 500px;
height: 100%;
background-color: #f5f4f4;
z-index: 999;
opacity: 0.9;
li {
margin: 15px 0;
color: #333;
font-weight: bold;
display: flex;
span:first-child {
width: 160px;
margin-left: 10px;
}
span a {
margin: 0 15px;
font-size: 14px;
font-weight: normal;
}
2023-12-01 13:00:16 +08:00
}
}
}
2023-12-03 10:41:32 +08:00
.right-content {
flex: 1;
height: 100%;
margin-left: 20px;
2023-12-01 13:00:16 +08:00
2023-12-03 10:41:32 +08:00
.swpier-img {
width: 100%;
2023-12-01 14:48:58 +08:00
height: 437px;
2023-12-03 10:41:32 +08:00
margin-top: 10px;
border-radius: 8px;
2023-12-01 14:48:58 +08:00
2023-12-03 10:41:32 +08:00
.el-carousel {
height: 437px;
}
2023-12-01 14:48:58 +08:00
2023-12-03 10:41:32 +08:00
.el-carousel__item h3 {
color: #475669;
opacity: 0.75;
line-height: 300px;
margin: 0;
text-align: center;
}
2023-12-01 14:48:58 +08:00
2023-12-03 10:41:32 +08:00
.el-carousel__item:nth-child(2n) {
background-color: #99a9bf;
}
2023-12-01 14:48:58 +08:00
2023-12-03 10:41:32 +08:00
.el-carousel__item:nth-child(2n + 1) {
background-color: #d3dce6;
}
}
2023-12-01 13:00:16 +08:00
}
}
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
.hot-equip {
margin-top: 30px;
height: 37px;
display: flex;
align-items: center;
justify-content: space-between;
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
span {
font-size: 18px;
font-weight: bold;
color: #333333;
}
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
a {
color: #9d9d9d;
font-size: 14px;
cursor: pointer;
}
2023-12-01 14:03:26 +08:00
}
2023-12-03 10:41:32 +08:00
.equip-pic {
height: 160px;
display: flex;
justify-content: space-between;
align-items: center;
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
li {
width: 340px;
}
2023-12-01 14:03:26 +08:00
}
2023-12-03 10:41:32 +08:00
.consult-nav {
width: 100%;
2023-12-01 14:03:26 +08:00
height: 40px;
2023-12-03 10:41:32 +08:00
border-bottom: 1px solid #e0e0e0;
display: flex;
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
li {
height: 40px;
line-height: 40px;
margin: 0 15px;
&:hover {
border-bottom: 1px solid #2282ff;
cursor: pointer;
}
2023-12-01 14:03:26 +08:00
}
}
2023-12-03 10:41:32 +08:00
.consult-content {
margin-top: 20px;
2023-12-01 14:03:26 +08:00
height: 210px;
2023-12-03 10:41:32 +08:00
display: flex;
align-items: center;
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
.left-bg {
background: url(../../assets/img/home/2023_12_01_beijing2/left_bg.png) no-repeat;
background-size: cover;
width: 340px;
height: 210px;
}
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
.right-consult {
height: 210px;
flex: 1;
2023-12-04 09:12:38 +08:00
width: calc(100% - 340px);
// padding-left: 35px;
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
.consult-box {
height: 70px;
2023-12-04 09:12:38 +08:00
padding-left: 15px;
cursor: pointer;
2023-12-03 10:41:32 +08:00
.consult-title {
height: 30px;
display: flex;
justify-content: space-between;
align-items: center;
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
h2 {
font-weight: bold;
}
2023-12-01 14:03:26 +08:00
2023-12-03 10:41:32 +08:00
span {
color: #827d7d;
font-size: 14px;
}
2023-12-01 14:03:26 +08:00
}
2023-12-03 10:41:32 +08:00
.consult-info {
width: calc(100% - 100px);
height: 40px;
line-height: 40px;
border-bottom: 1px dashed #979797;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
2023-12-01 14:03:26 +08:00
}
}
}
}
2023-12-01 15:00:37 +08:00
</style>