| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <div class="swiper" v-if="imagelist.length>0">
- <el-carousel
- :interval="5000"
- class="roll_in"
- indicator-class="custom-indicator"
- @change="handleIndicatorChange">
- <el-carousel-item v-for="item in imagelist" :key="item">
- <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" :title="item.title">
- <img :src="item.imgurl" :alt="item.title">
-
- <span class="swiper_dot1 dot1 roll_phone_none">
- {{ item.title }}
- </span>
- <span class="roll_dot2 roll_pc_none">
- {{ item.title }}
- </span>
- </NuxtLink>
- </el-carousel-item>
- </el-carousel>
- </div>
- </template>
- <script setup>
- import { ElCarousel, ElCarouselItem } from 'element-plus'
- //获取焦点图数据 start---------------------------------------->
- const imagelist = ref("")
- async function getModelData1() {
- const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
- method: 'GET',
- query: {
- 'imgnum': 5,
- 'textnum': 0,
- 'level': 2,
- 'placeid': 0,
- 'id': ''
- },
- });
- if (mkdata.code == 200) {
- imagelist.value = mkdata.data.img;
- } else {
- console.log("错误位置错误:获取首页轮播图", mkdata.message)
- }
- }
- getModelData1()
- let currentIndex = ref(0)
- let handleIndicatorChange = (val) => {
- currentIndex.value = val
- }
- //获取焦点图数据 end---------------------------------------->
- </script>
- <style lang="less" scoped>
- .dot1 {
- display: block;
- word-break: keep-all;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .swiper {
- width: 100%;
- height: 405px;
- position: relative;
- img {
- width: 100%;
- height: 405px;
- }
- .swiper_dot1 {
- display: block;
- width: 100%;
- line-height: 60px;
- height: 60px;
- color: #fff;
- font-size: 24px;
- text-indent: 20px;
- position: absolute;
- bottom: 0;
- left: 0;
- z-index: 10;
- box-sizing: border-box;
- padding-right: 244px;
- background: rgba(0, 0, 0, .5);
- }
- }
- .el-carousel {
- /deep/.el-carousel__arrow i {
- font-size: 30px !important;
- }
- /deep/.el-carousel__arrow--left {
- left: 16px;
- width: 35px;
- height: 57px;
- color: #616358;
- background: #dcdedc;
- position: absolute;
- left: 0px;
- border: none;
- border-radius: 0;
- }
- /deep/.el-carousel__arrow--right {
- right: 16px;
- width: 35px;
- height: 57px;
- color: #616358;
- background: #dcdedc;
- position: absolute;
- right: 0;
- border: none;
- border-radius: 0;
- }
- /deep/ .el-carousel__indicators {
- // 指示器
- left: unset;
- transform: unset;
- right: 10px;
- bottom: 11px;
- }
- /deep/ .el-carousel__button {
- // 指示器按钮
- width: 10px;
- height: 10px;
- border: none;
- border-radius: 5px;
- background: #ccc;
- opacity: 1;
- }
- /deep/ .is-active .el-carousel__button {
- // 指示器激活按钮
- background: #fff;
- width: 58px;
- opacity: 1;
- }
- /deep/ .el-carousel__container {
- height: 100%;
- }
- }
- .custom-indicator button {
- background-color: #fff;
- opacity: 1;
- width: 8px;
- height: 8px;
- }
- .custom-indicator button.is-active {
- background-color: #DD7D18;
- width: 58px;
- opacity: 1;
- }
- </style>
- <style lang="less" scoped>
-
- @media screen and (min-width:801px){/*pc*/
-
- .roll_in{height:405px;}
-
- .swiper /deep/.el-carousel__indicators{display:none;}
- .roll_pc_none{display:none!important;}
- .pc_none{display:none;}
- }
- @media screen and (max-width:800px){/*ipad_phone*/
- .swiper{height:100%;}
-
- .swiper /deep/ul.el-carousel__indicators{width:100%; right:0px;text-align:center;}
- .swiper img{width:100%;height:100%;}
- .roll_in{height:55vw;}
-
- .el-carousel /deep/.el-icon svg{width:.4em;display:none;}
- .el-carousel /deep/.el-carousel__button{width:10px;height:10px;margin:0px 4px;}
- .roll_dot2{
- width:100%;line-height:22px; height:54px;font-size:16px;
- padding:10px 10px 0;top:0px;
- display: inline-block;
- box-sizing: border-box;
- position: absolute;
- left: 0;
- font-family: Source Han Sans, Source Han Sans;
- font-weight: 800;
- color: #FFFFFF;
- background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
- overflow:hidden;display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
- }
- /deep/.el-carousel .el-carousel__button{width:10px!important;}
- /deep/.el-carousel .el-carousel__indicators{bottom:0px;}
- /deep/.el-carousel .is-active .el-carousel__button{background:#489d97;}
- .roll_in /deep/.el-carousel__arrow{display:none;}
- .roll_phone_none{display:none!important;}
- .phone_none{display:none;}
- }
- </style>
|