wenhua-webui/src/components/index/VueIndex.vue

249 lines
4.9 KiB
Vue
Raw Normal View History

2024-04-15 14:47:48 +00:00
<template>
<div class="index">
<!-- 轮播图 -->
<el-carousel indicator-position="outside">
<el-carousel-item v-for="(item, index) in imgs" :key="index">
<h3><img :src="item.url" alt="" /></h3>
</el-carousel-item>
</el-carousel>
<div class="sub">
<div class="sublist">
<div class="item">
<img src="../../assets/12.jpg" alt="" />
<p>添加</p>
</div>
<div class="item">
<img src="../../assets/12.jpg" alt="" />
<p>编辑</p>
</div>
<div class="item">
<img src="../../assets/12.jpg" alt="" />
<p>删除</p>
</div>
</div>
</div>
<h2>文化长廊</h2>
<div class="changlang">
<div class="cllist">
<div
class="cllist_item"
v-for="(item, index) in list"
:key="index"
@click="desc(item.id,item.userId)"
>
<img :src="item.cultureImage" alt="" />
<div class="item_box">
<p>{{ item.cultureTitle }}</p>
<p v-html="item.cultureContent"></p>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { apiServe } from '@/api/api.js'
export default {
data() {
return {
imgs: [
{
url: "https://qiniu.ltshgs.com/5cfc3b6898394a9681d9fed627100d1e.jpg",
},
{
url: "https://qiniu.ltshgs.com/501d1c0683724753a1f8f43ba9d53b32.jpg",
},
{
url: "https://qiniu.ltshgs.com/a32b4f50c0184073bb12aaaa9ebce3b5.jpg",
},
{
url: "https://qiniu.ltshgs.com/4d0888b9477a4ec69a2387e53ff1c8a9.jpg",
},
],
list: [
],
cdata:{
},
};
},
mounted() {
this.cdata.token = localStorage.getItem('token')
console.log(this.token);
this.searchUser()
},
methods: {
desc(id,cid) {
console.log(id);
this.$router.push({ path:"/desc", query: { id: id} });
},
searchUser() {
apiServe.Cllist(this.cdata).then((res) => {
console.log(res);
this.list = res.data.data
});
},
},
};
</script>
<style scoped lang="less">
.index::v-deep {
height: 100%;
// background-color: #ccc;
.el-carousel__container {
height: 780px;
position: relative;
}
.el-carousel__item h3 {
color: #475669;
font-size: 16px;
margin: 0;
img {
width: 100%;
height: 780px;
}
}
.el-carousel__indicators--horizontal {
// height: 1px;
position: absolute;
bottom: 24px;
left: 50%;
transform: translate(-50%);
z-index: 99;
// background-color: aqua;
}
.el-carousel__indicators--horizontal button {
width: 50px;
background-color: #ffffff;
height: 5px !important;
}
.el-carousel__arrow--left {
width: 50px;
height: 50px;
font-size: 20px;
position: absolute;
left: 30px;
top: 50%;
z-index: 99;
}
.el-carousel__arrow--right {
width: 50px;
height: 50px;
font-size: 20px;
position: absolute;
right: 30px;
top: 50%;
z-index: 99;
}
.sub {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin-top: 40px;
// background-color: red;
.sublist {
width: 1250px;
height: 200px;
// margin: 0 auto;
background-color: #fff;
border-radius: 10px;
// box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.3);
border: 1px solid #ccc;
// background-color: aqua;
display: flex;
justify-content: space-around;
align-items: center;
.item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
img {
width: 100px;
height: 100px;
margin-bottom: 10px;
border-radius: 10px;
}
}
}
}
h2 {
text-align: center;
margin-top: 40px;
font-size: 32px;
}
.changlang {
width: 100%;
margin-top: 20px;
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 30px;
.cllist {
width: 1250px;
height: 100%;
border: 1px solid #ccc;
// box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.3);
// background-color: #fff;
border-radius: 5px;
.cllist_item {
width: 100%;
display: flex;
align-items: center;
padding: 30px;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 10px;
margin-bottom: 20px;
img {
width: 120px;
height: 120px;
border-radius: 5px;
}
.item_box {
margin-left: 20px;
p:first-child {
margin-bottom: 30px;
font-size: 24px;
}
p:last-child {
// margin-bottom: 30px;
font-size: 16px;
color: #979797;
}
}
}
}
}
}
</style>