<template>
|
<div class="minWidth">
|
<el-carousel :height="screenheight + 'px'" v-show="bannerState">
|
<el-carousel-item v-for="item in bannerList" :key="item.id">
|
<div class="bannerBox imgBox" :style="item.caupress_link ? 'cursor: pointer' : ''">
|
<img class="bannerImg" :src="item.icon" @click="bannerLink(item)" />
|
</div>
|
</el-carousel-item>
|
</el-carousel>
|
<div
|
:class="!bannerState ? 'show stow' : 'stow'"
|
@click="bannerState = !bannerState"
|
>
|
{{ bannerState ? "收起" : "显示" }}
|
轮播图
|
<i
|
:class="bannerState ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
|
></i>
|
</div>
|
<div class="contentBox">
|
<List
|
:channel="
|
this.$route.query.searchPath
|
? this.$route.query.searchPath
|
: 'caupress_bookMall'
|
"
|
:searchOptionHidden="searchOptionHidden"
|
:detailRoute="detailRoute"
|
></List>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import List from "@/components/list";
|
export default {
|
name: "bookStore-index",
|
components: {
|
List,
|
},
|
data() {
|
return {
|
bannerList: [],
|
detailRoute: "bookStore-detail",
|
searchOptionHidden: this.$route.query.searchOptionHidden
|
? this.$route.query.searchOptionHidden
|
: false,
|
bannerState: true,
|
screenheight: document.documentElement.clientWidth / 2.628,
|
};
|
},
|
created() {
|
window.onresize = () => {
|
let c = 2.628;
|
if (document.documentElement.clientWidth >= 1220) {
|
this.screenheight = document.documentElement.clientWidth / c;
|
}
|
};
|
this.getBanner();
|
setTimeout(() => {
|
this.bannerState = false;
|
}, 15000);
|
},
|
methods: {
|
bannerLink(val) {
|
if (val.caupress_link) {
|
window.open(val.caupress_link);
|
}
|
},
|
getBanner() {
|
this.MG.resource
|
.getItem({
|
path: "caupress_banner\\caupress_mall",
|
fields: {
|
caupress_link: [],
|
},
|
coverSize: {
|
height: 750,
|
},
|
paging: {
|
start: 0,
|
size: 999,
|
},
|
})
|
.then((res) => {
|
this.bannerList = res.datas;
|
});
|
},
|
},
|
// 如果跳转页面不是详情,则将当前页面不缓存
|
beforeRouteLeave(to, from, next) {
|
if (to.name != "bookStore-detail") {
|
this.$store.commit("delKeepAlive", from.name);
|
}
|
next();
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.autoImg {
|
max-height: none;
|
}
|
.minWidth {
|
min-width: 1220px;
|
}
|
.stow {
|
width: 160px;
|
margin: 0 auto;
|
text-align: center;
|
border: 1px solid #b3b3b3;
|
font-size: 16px;
|
line-height: 40px;
|
border-radius: 21px;
|
color: #b3b3b3;
|
cursor: pointer;
|
margin-top: 5px;
|
}
|
.show {
|
margin-top: 20px;
|
}
|
.bannerBox {
|
background: #f3f3f3;
|
}
|
.imgBox {
|
position: relative;
|
width: 100%;
|
height: 100%;
|
}
|
.contentBox {
|
background-color: rgb(241, 248, 244);
|
margin-top: 20px;
|
}
|
</style>
|