123/src/views/index.vue
2024-04-09 18:20:47 +08:00

230 lines
4.4 KiB
Vue

<template>
<div class="home">
<div class="navigationBar">
<div class="navTitle">
<router-link to="/">
<img class="img-logo" src="../assets/logo.png" alt="" />
</router-link>
</div>
<div class="navUser">
<div v-if="login" class="block">
<el-avatar
shape="square"
:size="50"
fit="cover"
:src="squareUrl"
></el-avatar>
</div>
<span v-if="login">{{ userName }}</span>
<el-button v-else type="primary" icon="el-icon-user-solid"
>登陆</el-button
>
</div>
</div>
<div class="content">
<img src="../assets/11.jpg" alt="" />
</div>
<div class="particulars">
<div class="accordion">
<ul>
<li v-for="(item, index) in parItem" :key="index">
<div class="title">
<router-link :to="item.url">
{{ item.title }}<br />{{ item.title2 }}<br />
<button>查看详情</button>
</router-link>
</div>
<router-link :to="item.url">
<img :src="item.imgs" />
</router-link>
</li>
</ul>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'HomeView',
data () {
return {
login: true,
userName: 'ddmt',
squareUrl: require('@/assets/images/1.jpg'),
parItem: [
{
title: '环境治理',
title2: '保护和改善环境质量',
imgs: require('@/assets/images/1.jpg'),
url: '/scheme'
},
{
title: '可持续资源开发',
title2: '环境和社会的可持续性',
imgs: require('@/assets/images/2.jpg'),
url: '/resourceHome'
},
{
title: '生态环保',
title2: '维护生态平衡',
imgs: require('@/assets/images/3.jpg'),
url: '/environmental'
},
{
title: '清洁能源应用',
title2: '减少环境污染',
imgs: require('@/assets/images/4.jpg'),
url: '/cleanEnergy'
},
{
title: '清洁能源应用',
title2: '减少环境污染',
imgs: require('@/assets/images/1.jpg'),
url: '/cleanEnergy'
}
]
}
}
}
</script>
<style lang="less" scoped>
.navigationBar {
width: 100%;
height: 80px;
border: 1px solid black;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
.img-logo {
margin-left: 5px;
width: auto;
height: 80px;
float: left;
}
.navUser {
float: right;
margin-right: 100px;
.block,
.el-button {
display: inline-block;
margin-top: 15px;
cursor: pointer;
}
span {
float: right;
line-height: 80px;
margin-left: 10px;
cursor: default;
}
}
}
.content {
img {
width: 100%;
}
}
.particulars {
width: 100%;
height: 320px;
background-color: rgba(231, 226, 226, 0.5);
img {
width: 100%;
height: 100%;
}
}
.accordion {
width: 905px;
height: 320px;
overflow: hidden;
margin: 10px auto;
position: relative;
box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.4);
ul {
width: 3000px;
}
li {
display: block;
width: 180px;
height: 320px;
overflow: hidden;
position: relative;
float: left;
border-left: 1px solid #aaa;
box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.4);
-webkit-transition: all 0.8s;
-moz-transition: all 0.8s;
-ms-transition: all 0.8s;
-o-transition: all 0.8s;
transition: all 0.8s;
animation-duration: 3s;
animation-name: slidein;
animation-delay: 0.5s;
animation-delay: .5s;
// animation: slidein 0.5s reverse;
}
@keyframes slidein {
0% {
width: 740px;
}
100% {
width: 180px;
}
}
li img {
object-fit: cover;
width: 100%;
height: 100%;
display: block;
}
ul:hover li {
width: 40px;
}
ul li:hover {
width: 740px;
}
.title {
position: absolute;
left: 0;
bottom: 0;
width: 740px;
height: 100px;
background-color: rgba(0, 0, 0, 0.4);
}
.title a {
display: block;
color: #fff;
font-size: 16px;
padding: 10px;
}
button {
width: 100px;
height: 30px;
background-color: rgba(255, 255, 255, 0.4);
border: none;
color: #fff;
cursor: pointer;
margin-top: 5px;
border-radius: 30px;
}
}
</style>