achievementsOne.vue 5.04 KB
<template>
  <div class="cardBox">
    <!-- <van-tabs v-model="tabsName">
      <van-tab title="红色教育"></van-tab>
      <van-tab title="劳动教育"></van-tab>
      <van-tab title="课外实践"></van-tab>
      <van-tab title="研学旅行"></van-tab>
    </van-tabs> -->

    <div class="contextBox" v-if="newsList.length != 0">
      <div
        class="art_card_pic"
        v-for="(v, i) in newsList"
        :key="i"
        @click="toDetails(v)"
      >
        <div class="art_context">
          <div class="art_title">{{ v.titleDesc }}</div>
          <div class="art_bot">
            <!-- <div class="redSticky" v-if="v.readNumber">置顶</div> -->
            <div class="greyTime">发布于 {{ v.createTime ? Moment(v.createTime).format('YYYY-MM-DD HH:mm:ss') : ''}}</div>
            <div class="greyFont">浏览量 {{ v.readNumber }}</div>
          </div>
        </div>
        <div class="art_pic">
          <img :src="v.imgUrl" />
        </div>
      </div>
    </div>

    <van-empty description="暂无数据" v-else/>

    <div class="imgPic" @click="toChoose">
      <img src="@/assets/changeSchool.png" />
    </div>

    <tabbar4 active="fruit"></tabbar4>
  </div>
</template>

<script>
import Tabbar4 from "@/component/Tabbar4";
export default {
  components: { Tabbar4 },
  data() {
    return {
      tabsName: 1,
      newsList: [],
    };
  },
  methods: {
    //详情新闻
    toDetails(v) {
      this.$router.push({ name: "pageDetails" ,query: {schoolId:v.schoolId,dataId: v.id}});
    },
    //选择
    toChoose() {
      this.$router.push({ name: "chooseSchoolOne" });
    },
    getData() {
      let schoolId = this.$route.query.schoolId?this.$route.query.schoolId: ''

      this.yxAxios
        .get(`${this.kqUrl}/schoolConsult/consultList?pageNum=1&pageSize=999&schoolId=`+schoolId)
        .then((res) => {
          if (res.data.code == 200) {
            this.newsList = res.data.data.list;
          } else {
            this.$message.warning(res.data.message);
          }
        });
      // this.yxAxios
      //   .post(`${this.dataUrl}/sys/yx/consultList`, {
      //     page: 1,
      //     pageSize: 999,
      //     schoolId: this.$route.query.schoolId*1
      //   })
      //   .then((res) => {
      //     if (res.data.success) {
      //       this.newsList = res.data.data.list;
      //     } else {
      //       this.$message.warning(res.data.message);
      //     }
      //   });
    },
  },
  mounted() {
    this.getData()
  }
};
</script>

<style lang="scss" scoped>
.cardBox {
  padding: 2vw 0;
  box-sizing: border-box;

  .contextBox {
    margin-bottom: 140px;
    .art_card {
      padding: 28px;
      box-sizing: border-box;

      .art_title {
        width: 100%;
        font-size: 34px;
        font-weight: bold;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1; //限制行数
        overflow: hidden; //超出部分隐藏
        text-overflow: ellipsis; //用一个省略号代替超出的内容
      }

      .art_bot {
        padding-top: 22px;
        box-sizing: border-box;
        display: flex;
        align-items: center;

        .redSticky {
          color: #ff4444;
          font-size: 24px;
          padding: 2px;
          box-sizing: border-box;
          border: 1px solid #ff4444;
        }

        .greyTime {
          color: #999;
          font-size: 24px;
          margin: 0 20px;
        }

        .greyFont {
          color: #999;
          font-size: 24px;
          
        }
      }
    }
    .art_card_pic {
      padding: 28px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;

      .art_context {
        height: 180px;
        display: flex;
        align-content: space-between;
        flex-wrap: wrap;

        .art_title {
          width: 100%;
          font-size: 34px;
          font-weight: bold;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2; //限制行数
          overflow: hidden; //超出部分隐藏
          text-overflow: ellipsis; //用一个省略号代替超出的内容
        }

        .art_bot {
          padding-top: 22px;
          box-sizing: border-box;
          display: flex;
          align-items: center;

          .redSticky {
            color: #ff4444;
            font-size: 24px;
            padding: 2px;
            box-sizing: border-box;
            border: 1px solid #ff4444;
          }

          .greyTime {
            color: #999;
            font-size: 24px;
            margin: 0 ;
          }

          .greyFont {
            color: #999;
            font-size: 24px;
            margin-left: 20px;
          }
        }
      }
      .art_pic {
        width: 180px;
        height: 180px;
        flex-shrink: 0;
        background-color: #ff4444;

        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  .imgPic {
    position: fixed;
    right: 2vw;
    bottom: 40vw;
    width: 26vw;
    height: 26vw;

    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>