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

330 lines
7.6 KiB
Vue

7 months ago
<template>
<div class="menu">
1 month ago
<div v-for="(i,k) in menuList" :class="`menuItem ${$route.path === i.path ? 'focus':''}`"
@mouseenter="getChildren(i)" @click="toLink((i.children||[]).length===0 ? i.path:'')">
1 month ago
<div :class="`name`">{{ i.name }}</div>
7 months ago
<div class="line"></div>
</div>
1 month ago
<div class="subMenu" v-show="(subMenuList||[]).length>0 && subMenuType === 1" @mouseleave="clearChildren">
1 month ago
<div :class="`topMenuItem${$route.fullPath === ii.path ? ' active':''}`" v-for="(ii,k) in subMenuList"
1 week ago
@click="toLink(subMenuPath,ii.configTypeId)">
7 months ago
<div class="icon">
1 week ago
<img :src="ii.configTypeIcon" alt="" style="width: 1.8vw;height: 1.8vw;object-fit: contain">
7 months ago
</div>
<div class="menuChildrenName">
<span>
1 week ago
{{ ii.configTypeName }}
7 months ago
</span>
</div>
</div>
</div>
1 week ago
<div class="subMenu1" :style="{height:20 + 50 + 40*(Math.max(...subMenuList.map(e=>e.children.length || 0)))+'px'}"
v-show="(subMenuList||[]).length>0 && subMenuType === 2"
@mouseleave="clearChildren">
<div class="subMenuList" :style="{width:100/subMenuList.length+'%'}"
v-for="(ii,k) in subMenuList">
<div class="subMenuListTitle" @click="toLink(subMenuPath,ii.configTypeId)">
<img class="subMenuListTitleIcon" :src="ii.configTypeIcon" alt=""
style="width: 1vw;height: 1vw;object-fit: contain">
<div class="subMenuListTitleSpan">{{ ii.configTypeName }}</div>
<i class="el-icon-arrow-down subMenuListTitleIcon1"></i>
1 month ago
</div>
1 week ago
<div class="subMenuListItem" v-for="(iii,kkk) in ii.children"
@click="toLink(subMenuPath,iii.configTypeId,true)">
1 week ago
<img :src="iii.configTypeIcon" alt=""
style="vertical-align: sub;width: 18px;height: 18px;line-height: 30px;object-fit: contain;margin-right: 6px">
<span>
{{ iii.configTypeName }}
</span>
1 month ago
<el-tag size="small" v-if="kkk <1"></el-tag>
</div>
</div>
</div>
7 months ago
</div>
</template>
<script>
import wlw from "@/assets/icon/wlw.png";
import znzz from "@/assets/icon/znzz.png";
import kdwl from "@/assets/icon/kdwl.png";
import znlt from "@/assets/icon/znlt.png";
6 months ago
import {getPortalConfigTypeList} from "@/api/menu";
7 months ago
export default {
name: 'Index',
data() {
return {
menuList: [
{
name: '首页',
7 months ago
path: '/index'
7 months ago
},
1 month ago
{
name: '关于海威',
1 week ago
path: '/aboutHW',
1 month ago
type: 1,
1 week ago
children: []
1 month ago
},
7 months ago
{
name: '产品中心',
1 week ago
path: '/productCenter',
1 month ago
type: 2,
1 week ago
children: []
7 months ago
},
{
1 month ago
name: '行业方案',
1 week ago
path: '/industryPlan',
1 month ago
type: 2,
1 week ago
children: []
7 months ago
},
{
1 month ago
name: '服务支持',
1 week ago
path: '/serviceSupport',
1 month ago
type: 1,
1 week ago
children: []
7 months ago
},
],
7 months ago
subMenuList: [],
1 week ago
subMenuType: 0,
subMenuPath: '',
7 months ago
}
},
mounted() {
1 week ago
console.log(this.$route)
1 week ago
this.getMenu()
7 months ago
let query = this.$route.path
console.log(this.$route)
7 months ago
},
methods: {
1 week ago
toLink(e, id, isDetail) {
1 week ago
console.log(e)
6 months ago
if (!e) return
1 week ago
let path = e
if (isDetail) {
path = path + '/detail'
}
1 week ago
if (id) {
1 week ago
path = path + '?id=' + id
1 week ago
}
1 week ago
this.$router.push(path)
7 months ago
},
getChildren(e) {
if (e.children) {
this.subMenuList = e.children
1 month ago
this.subMenuType = e.type
1 week ago
this.subMenuPath = e.path
7 months ago
} else {
this.subMenuList = []
1 month ago
this.subMenuType = 0
1 week ago
this.subMenuPath = ''
7 months ago
}
},
clearChildren() {
this.subMenuList = []
1 month ago
this.subMenuType = 0
1 week ago
this.subMenuPath = ''
6 months ago
},
getMenu() {
1 week ago
getPortalConfigTypeList({
configTypeClassfication: 3,
parentId: 0,
}).then(e => {
this.menuList[1].children = e.rows
})
6 months ago
getPortalConfigTypeList({
1 week ago
configTypeClassfication: 4,
6 months ago
parentId: 0,
}).then(e => {
1 week ago
this.menuList[2].children = e.rows
})
getPortalConfigTypeList({
1 week ago
configTypeClassfication: 5,
parentId: 0,
}).then(e => {
this.menuList[3].children = e.rows
})
getPortalConfigTypeList({
configTypeClassfication: 6,
parentId: 0,
}).then(e => {
1 week ago
this.menuList[4].children = e.rows
1 month ago
})
7 months ago
}
}
}
</script>
<style lang="less" scoped>
@import "~@/style.less";
.menu {
position: relative;
.focus, .menuItem:hover {
font-weight: 700;
color: #3076f8;
background-color: #ebf1ff;
.line {
width: 100%;
height: 2px;
position: absolute;
bottom: 0;
left: 0;
background-color: #3076f8;
}
}
.menuItem {
//width: 120px;
padding: 0 2vw;
position: relative;
display: inline-block;
cursor: pointer;
transition: all 0.2s;
.name {
line-height: @top-height;
font-size: 1vw;
letter-spacing: 2px;
}
}
.subMenu {
position: absolute;
width: 100vw;
left: 50%;
transform: translateX(-50%);
height: @menuHeight;
display: flex;
justify-content: center;
background-color: #fff;
z-index: -1;
box-shadow: 0 8px 8px rgba(0, 0, 0, 0.04);
.topMenuItem.active, .topMenuItem:hover {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
.menuChildrenName {
color: @standard-color;
}
}
.topMenuItem {
width: @menuHeight;
height: @menuHeight;
transition: all 0.2s;
.icon {
width: 100%;
height: 36%;
margin-top: 22%;
display: flex;
align-items: center;
justify-content: center;
}
.menuName {
height: 20%;
font-size: 0.9vw;
color: #111;
letter-spacing: 1px;
display: flex;
align-items: center;
justify-content: center;
}
}
1 month ago
.subMenuList {
position: absolute;
width: 80%;
height: @menuHeight;
}
}
.subMenu1 {
position: absolute;
width: 100vw;
left: 50%;
transform: translateX(-50%);
1 week ago
min-height: @menuHeight;
1 month ago
display: flex;
justify-content: center;
background-color: #fff;
z-index: -1;
box-shadow: 0 8px 8px rgba(0, 0, 0, 0.04);
.subMenuList {
1 week ago
max-width: 14vw;
1 month ago
display: inline-block;
text-align: left;
vertical-align: top;
1 week ago
border-right: 1px solid #0001;
&:last-child {
border-right: 0;
}
1 month ago
.subMenuListTitle {
1 week ago
height: 50px;
4 weeks ago
cursor: pointer;
1 week ago
position: relative;
.subMenuListTitleIcon {
position: absolute;
top: 50%;
left: 2vw;
width: 1vw;
height: 1vw;
transform: translateY(-50%);
}
.subMenuListTitleIcon1 {
position: absolute;
top: 50%;
right: 2vw;
width: 1vw;
height: 1vw;
font-size: 1vw;
transform: translateY(-50%);
}
.subMenuListTitleSpan {
position: absolute;
letter-spacing: 0.1vw;
top: 50%;
left: calc(2vw + 1vw + 0.5vw);
transform: translateY(-50%);
font-size: 1vw;
font-weight: 500;
}
1 month ago
}
.subMenuListItem {
1 week ago
padding-left: 2vw;
1 month ago
cursor: pointer;
font-size: 14px;
line-height: 40px;
&:hover {
color: @standard-color;
1 week ago
background-color: #0001;
1 month ago
}
}
}
7 months ago
}
}
@menuHeight: 11vw;
</style>