<template>
 <div class="twinfo_show_fixrecord_pc_4">
   <div class="container">
      <div class="row">
         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <div class="twinfo-show-title">
               <span class="sp1">新闻/公告</span>
            </div>
            <div class="twinfo-show-hd">
               <ul>
                  <li @click="show=0" class="l1" :class="{on:show==0}">新闻/法规</li>
                  <li @click="show=1"  class="l2" :class="{on:show==1}">通知/资讯</li>
               </ul>
            </div>
            <div class="twinfo-show-bd">
               <div class="row" v-show="show==0">
                  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                     <div class="twinfo-show-part twinfo-show-part-left">
                        <div class="twinfo-show-part-title clearfix">
                           <span class="sp1">新闻政策</span>
                           <span class="sp2"><a @click="xinwen()" href="javascript:;" target="_blank">更多>></a></span>
                        </div>
                        <ul class="twinfo-show-part-ul">
                          <li  v-for="(item,index) in newName"  :key="index"><a target="_blank" :href="'/infodetail?id='+item.articleId" :title="item.title" >{{item.title}}</a><span>{{item.createDate | format}}</span></li>
                        </ul>
                     </div>
                  </div>
                  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                     <div class="twinfo-show-part twinfo-show-part-right">
                        <div class="twinfo-show-part-title clearfix">
                           <span class="sp1">法律法规</span>
                           <span class="sp2"><a @click="falv()" href="javascript:;" target="_blank">更多>></a></span>
                        </div>
                        <ul class="twinfo-show-part-ul">
                            <li  v-for="(item,index) in layName"  :key="index"><a target="_blank" :href="'/infodetail?id='+item.articleId" :title="item.title">{{item.title}}</a><span>{{item.createDate | format}}</span></li>
                        </ul>
                     </div>
                  </div>
               </div>
               <div class="row" v-show="show==1">
                  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                     <div class="twinfo-show-part twinfo-show-part-left">
                        <div class="twinfo-show-part-title clearfix">
                           <span class="sp1">通知公告</span>
                           <span class="sp2"><a @click="gonggao()" href="javascript:;" target="_blank">更多>></a></span>
                        </div>
                        <ul class="twinfo-show-part-ul">
                           <li  v-for="(item,index) in informName"  :key="index"><a :href="'/infodetail?id='+item.articleId" :title="item.title">{{item.title}}</a><span>{{item.createDate | format}}</span></li>
                        </ul>
                     </div>
                  </div>
                  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                     <div class="twinfo-show-part  twinfo-show-part-right">
                        <div class="twinfo-show-part-title clearfix">
                           <span class="sp1">分站资讯</span>
                           <span class="sp2"><a href="javascript:;" @click="fenzhan()" target="_blank">更多>></a></span>
                        </div>
                        <ul class="twinfo-show-part-ul">
                           <li  v-for="(item,index) in consultName" :key="index"><a target="_blank" :href="'/infodetail?id='+item.articleId" :title="item.title">{{item.title}}</a><span>{{item.createDate | format}}</span></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
   </div>
</template>

<script type="text/babel">
import formMixin from "../../../src/mixins/formMixin";
import lenye_base from "lenye_base";
import $ from "fy-kit";

export default {
  name: "ElTwinfoShowFixrecordPc4",

  mixins: [formMixin],
  components: {},
  data() {
    return {
      //显示与隐藏
      show:0,
      // 站点数据
      siteData: "",
      // 用户信息
      userData: "",
      // 右边不带图新闻列表里
      newsRight: [],
      // 左边带图新闻列表
      newsLeft: [],
      // 通知公告
      informName:[],
      //分站咨询
      consultName:[],
      //新闻政策
      newName:[],
      //法律法规
      layName:[],
      // 新闻请求数据
      getNewsListData: {
        siteId: "",
        catId: "",
        sorts: "createDate=0",
        page: 1,
        rows: 10,
        posid: "",
      },
    };
  },
  created() {
    // this.siteData = lenye_base.site_data.getsiteData();
    // this.getNewsListData.siteId = this.siteData.siteId;
    // if (lenye_base.user_data.getuserData()) {
    //   this.user = lenye_base.user_data.getuserData();
    // }
  },
  mounted() {
    this.getNewsListRight();
    this.getNewsListLeft();
  },
  filters: {
    format(val) {
      return $.date.moment(val).format("YYYY-MM-DD");
    },
  },
  computed: {},
  methods: {
    // 更多
    more() {
      this.$message({
        message: "暂未开通此功能！",
        type: "warning",
      });
    },
    // 跳转到详情
    // goDetails(articleId) {
    //   window.open("/infodetail);
    // },
    //请求新闻列表，右边不带图的
    getNewsListRight() {
      const that = this;
      lenye_base.httpPost(
        lenye_base.base_data.getapiUrl() +
         "/news-service/common/newsArticle/queryShowPage.do",
        lenye_base.base_data.getformatting({
          catName: "通知公告",
          sorts: "createDate=0",
          rows: 10,
        }),
        function (data) {
          that.informName = data.data;
        }
      );
       lenye_base.httpPost(
        lenye_base.base_data.getapiUrl() +
         "/news-service/common/newsArticle/queryShowPage.do",
        lenye_base.base_data.getformatting({
          catName: "分站资讯",
          sorts: "createDate=0",
          rows: 10,
        }),
        function (data) {
          that.consultName = data.data;
        }
      );
       lenye_base.httpPost(
        lenye_base.base_data.getapiUrl() +
         "/news-service/common/newsArticle/queryShowPage.do",
        lenye_base.base_data.getformatting({
          catName: "新闻政策",
          sorts: "createDate=0",
          rows: 10,
        }),
        function (data) {
          that.newName = data.data;
        }
      );
       lenye_base.httpPost(
        lenye_base.base_data.getapiUrl() +
         "/news-service/common/newsArticle/queryShowPage.do",
        lenye_base.base_data.getformatting({
          catName: "法律法规",
          sorts: "createDate=0",
          rows: 10,
        }),
        function (data) {
          that.layName = data.data;
        }
      );
    },
    // 请求新闻列表，左边带图的
    getNewsListLeft() {
      this.getNewsListData.posid = "1";
      const that = this;
      var obj = {
        url: lenye_base.api_url.news.queryShowPage,
        data: this.getNewsListData,
        Ajax: function (data) {
          that.newsLeft = data.data;
        },
      };
      this.getData(obj);
    },
     fenzhan(){
       window.open("/infolist?name=资讯中心&type=zxzx")
     },
     gonggao(){
        window.open("/infolist?name=资讯中心&type=zxzx")
     },
     falv(){
        window.open("/infolist?name=资讯中心&type=zxzx")
     },
     xinwen(){
        window.open("/infolist?name=资讯中心&type=zxzx")
     },
    // 请求函数
    getData(obj) {
      // 请求的api，格式为 lenye_base.api_url.setting.queryShowPage
      const url = obj.url;
      //请求的数据，类型是对象
      const data = obj.data;
      // 只能是箭头函数
      const Ajax = obj.Ajax;
      lenye_base.httpPost(
        lenye_base.base_data.getapiUrl() + url,
        lenye_base.base_data.getformatting(data),
        Ajax
      );
    },
  },
};
</script>