school_website/ruoyi-ui/src/views/officialWebsite/Components/header.vue

169 lines
4.0 KiB
Vue
Raw Normal View History

2024-07-29 11:08:00 +08:00
<template>
2024-08-17 15:19:21 +08:00
<div class="tab-boxs">
2024-07-29 11:08:00 +08:00
<!-- left -->
2024-08-04 17:31:55 +08:00
<div class="d-s" @click="toHome">
2024-07-29 11:08:00 +08:00
<div class="logo-box">
<img :src="baseInfo.webImg" />
</div>
<div class="logo-size">
{{ this.baseInfo.webName }}
</div>
</div>
<!-- tab -->
<div class="d-s">
2024-08-17 15:19:21 +08:00
<div class="x-x" :class="{'active' :tabindex == index }" v-for="(item, index) in tablist " :key="index" @click="tabClick(item.jumpUrl, item.id,index)" >
2024-08-20 10:15:30 +08:00
<div>
2024-08-20 14:24:27 +08:00
<img v-if="item.iconUrl" :src=" imgurl +item.iconUrl " alt="" style="width: 25px;height: 25px">
2024-08-20 10:15:30 +08:00
</div>
2024-08-20 14:24:27 +08:00
<div class="bsize">{{ item.label }}</div>
2024-08-20 10:15:30 +08:00
2024-07-29 11:08:00 +08:00
</div>
</div>
<!-- right -->
<div class="d-s" style="font-size: 20px; color: #fff;cursor: pointer;width: 170px;justify-content: flex-end">
2024-08-01 19:19:11 +08:00
<!-- <i class="el-icon-search" v-if="show_search"></i>-->
<!-- <div style="font-size: 18px; margin-left: 15px; " v-if="show_search" @click="show_search = !show_search">搜索-->
<!-- </div>-->
<!-- <el-input placeholder="输入关键词" v-model="input" style="width: 150px;height: 35px" v-if="!show_search">-->
<!-- <i slot="prefix" class="el-input__icon el-icon-search"></i>-->
<!-- </el-input>-->
<!-- <i class="el-icon-circle-close" v-if="!show_search" style="margin-left: 10px;"-->
<!-- @click="show_search = true"></i>-->
2024-07-29 11:08:00 +08:00
</div>
</div>
</template>
<script>
2024-08-05 17:02:01 +08:00
import { getBaseInfo, getTab } from '@/api/gw/home'
2024-07-29 11:08:00 +08:00
export default {
data() {
return {
baseInfo:"",
2024-08-20 10:15:30 +08:00
imgurl: process.env.VUE_APP_BASE_API,
2024-07-29 11:08:00 +08:00
input:'',
show_search: true,
2024-07-29 16:50:33 +08:00
categoryQuery:{},
2024-08-17 15:19:21 +08:00
tabindex:0,
2024-07-29 11:08:00 +08:00
tablist: [
{name: '首页'},
{name: '中心概括'},
{name: '教学资源'},
{name: '教学平台'},
{name: '教学团队'},
{name: '专业委员会'},
{name: '教学研讨活动'},
{name: '虚仿专业频道'},
{name: '大赛风采'},
{name: '实践平台'},
{name: '合作企业'},
{name: '联系我们'},
],
}
},
2024-08-17 15:19:21 +08:00
props: {
msg: String
},
created() {
this.tabindex = this.msg
},
2024-07-29 11:08:00 +08:00
mounted() {
2024-08-17 15:19:21 +08:00
this.tabindex = this.msg
console.log(this.msg)
2024-07-29 11:08:00 +08:00
// 页面加载完毕调用
this.tabLsit();
this.getWebBaseInfo()
},
methods:{
2024-08-17 15:19:21 +08:00
tabClick(url,id,index){
this.tabindex = index
2024-07-31 18:04:00 +08:00
if (url === 'home') url = "gw";
2024-07-29 14:30:06 +08:00
this.$router.push({
name: url,
2024-07-29 16:15:31 +08:00
query:{ id: id }
2024-07-29 14:30:06 +08:00
});
2024-07-29 11:08:00 +08:00
},
tabLsit() {
getTab().then(response => {
if (response.code == 200) {
this.tablist = response.data;
this.categoryQuery.categoryId = this.tablist[0].id
}
})
},
getWebBaseInfo() {
getBaseInfo().then(res => {
this.baseInfo = res.data
this.baseInfo.webImg = process.env.VUE_APP_BASE_API + this.baseInfo.webImg
})
2024-08-04 17:31:55 +08:00
},
toHome(){
this.$router.push("/virtually")
2024-07-29 11:08:00 +08:00
}
}
}
</script>
<style scoped lang="scss">
2024-08-17 15:19:21 +08:00
.tab-boxs {
2024-07-29 11:08:00 +08:00
width: 100%;
box-sizing: border-box;
2024-08-17 15:19:21 +08:00
padding: 0px 50px;
2024-07-29 11:08:00 +08:00
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);;
font-weight: bold;
font-size: 18px;
color: #FFFFFF;
position: absolute;
z-index: 3;
}
.d-s {
display: flex;
align-items: center;
2024-08-04 17:31:55 +08:00
cursor: pointer;
2024-07-29 11:08:00 +08:00
}
.logo-box {
width: 50px;
height: 50px;
background: #fff;
}
.logo-box img{
width: 50px;
height: 50px;
}
.logo-size {
2024-08-20 14:24:27 +08:00
font-weight: 600;
font-size: 22px;
2024-07-29 11:08:00 +08:00
color: #FFFFFF;
margin-left: 20px;
}
.x-x {
2024-08-20 14:24:27 +08:00
width: 110px;
2024-07-29 11:08:00 +08:00
cursor: pointer;
2024-08-17 15:19:21 +08:00
height: 90px;
2024-08-20 14:24:27 +08:00
text-align: center;
2024-08-20 10:15:30 +08:00
box-sizing: border-box;
2024-08-20 14:24:27 +08:00
padding-top: 25px;
2024-08-17 15:19:21 +08:00
}
.x-x:hover{
background: linear-gradient( 360deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
//border-bottom: 2px solid #fff;
}
.active{
background: linear-gradient( 360deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
border-bottom: 2px solid #fff !important;
2024-07-29 11:08:00 +08:00
}
2024-08-20 14:24:27 +08:00
.bsize{
font-weight: 500;
font-size: 16px;
color: #FFFFFF;
}
2024-07-29 11:08:00 +08:00
</style>