123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <template>
- <div>
- <!-- 新闻资讯 PC-->
- <div class="platform-news-information mta-hidden-xs">
- <!-- 新闻资讯 -->
- <div class="client-container">
- <h4 class="client-title-news">新闻资讯</h4>
- <ul>
- <li style="font-size: 16px" v-for="(item, index) in curNewsData" :key="index">
- <div>
- <img :src="item.pic" alt="新闻资讯"/>
- <h4 class="new_title" @click="checkInfo(item)">{{ item.title }}</h4>
- <span class="new_date">发布时间:{{ item.yyyy }}-{{ item.mmdd }}</span>
- <p class="new_des">{{ item.intro }}</p>
- </div>
- </li>
- </ul>
- </div>
- </div>
- <!-- 新闻资讯 手机-->
- <div class="client-newsInfo-phone mta-hidden-sm">
- <div class="client-container">
- <h4 class="client-title-news">新闻资讯</h4>
- <el-carousel :interval="5000" type="card" height="300px" indicator-position="none" arrow="never">
- <el-carousel-item v-for="(item,index) in curNewsData" @click="checkInfo(item)" :key="index" class="el-row">
- <img :src="item.pic" alt="新闻资讯"/>
- <div class="newsInfo-card-content">
- <a style="display: none" :href="`${baseUrl}/news/${item.code}`"></a>
- <h4>{{ item.title }}<i></i></h4>
- <span>{{ item.yyyy }}-{{ item.mmdd }}</span>
- <p>{{ item.intro }}</p>
- </div>
- </el-carousel-item>
- </el-carousel>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {mapGetters} from "vuex";
- export default {
- name: "newsComp",
- props: {
- newsData: {
- type: Array,
- default: () => ([])
- }
- },
- data() {
- return {
- checkIsPc: false,
- }
- },
- computed: {
- baseUrl() {
- return this.getBaseUrl;
- },
- curNewsData() {
- return this.newsData && this.newsData.length<4?this.newsData:this.newsData.slice(0,4)
- },
- ...mapGetters(['getBaseUrl']),
- },
- methods: {
- isPC() {
- const browserWidth = document.documentElement.clientWidth;
- if (browserWidth <= 768) {
- return false;
- } else {
- return true;
- }
- },
- checkInfo(data) {
- const opt = {
- id: data.code,
- };
- this.$router.push({name: 'news-id', params: opt});
- }
- },
- mounted() {
- this.checkIsPc = this.isPC();
- }
- }
- </script>
- <style lang="scss" scoped>
- .platform-news-information {
- overflow: hidden;
- h4.client-title-news {
- font-weight: 800;
- text-align: center;
- color: #333;
- font-size: 18px;
- padding-top: 20px;
- }
- ul > li {
- .new_title {
- font-size: 18px;
- color: #333;
- text-align: left;
- font-weight: 800;
- margin-bottom: 8px;
- }
- .new_date {
- font-size: 12px;
- font-weight: 500;
- color: #565656;
- position: relative;
- margin-bottom: 20px;
- &:after {
- content: '';
- position: absolute;
- bottom: -10px;
- left: 250px;
- width: 60px;
- height: 2px;
- background: #00B96B;
- }
- }
- .new_des {
- height: 96px;
- font-size: 14px;
- line-height: 24px;
- font-weight: 500;
- color: #565656;
- text-align: justify;
- }
- }
- ul > li > div {
- border-bottom: none;
- margin-bottom: 66px;
- img {
- width: 226px;
- height: 154px;
- }
- }
- }
- .client-newsInfo-phone{
- background-color: rgb(238, 238, 238);
- .client-title-news {
- text-align: center;
- font-weight: 800;
- font-size: 18px;
- }
- // 轮播外层
- .el-carousel{
- padding: 20px 0 40px;
- // card
- .el-carousel__item{
- width: 80%;left: -15%;color: rgb(16, 16, 16);background: #fff;box-shadow: rgba(0, 0, 0, 0.4) 0px 0px 6px -1px;
- img{width: 100%;height: 135px;}
- }
- // 文字区域
- .newsInfo-card-content{
- padding: 24px 20px;
- h4{
- font-size: 14px;
- color: #333;
- font-weight: 400;
- }
- span{margin-top: 16px; font-size: 12px; display: block}
- p{min-height: 40px;margin-top: 16px; font-size: 12px;
- -webkit-line-clamp:4;
- text-overflow: ellipsis;
- -o-text-overflow: ellipsis;
- overflow: hidden;
- word-wrap: break-word;
- display: -webkit-box;
- white-space: normal !important;
- -webkit-box-orient: vertical;
- }
- }
- }
- }
- </style>
|