<template>
  <div class="el-resource_show_fixrecord_pc_3">
    <div class="resource_show_fixrecord_pc_3">
   <div class="container">
      <div class="row">
         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <div class="resource-title clearfix">
               <span class="sp1">精品视频</span>
               <ul class="ul1">
                  <li :class="{on:defaults===1}" @click="course(1)">最新视频</li>
                  <li :class="{on:defaults===2}" @click="course(2)">热门视频</li>
               </ul>
              <!-- <span class="sp2"><a href="/resourcelist?type=mtzy">查看更多~</a></span>-->
            </div>
            <div class="resource-body">
               <div class="row"><!--精品文档-->

                  <div v-for="(list,i) in courseList" :key="i" class="col-lg-3 col-md-4 col-sm-6 col-xs-12"><!--循环-->
                     <div class="resource-part">

                       <a :href="'/resourcedetail?id='+list.resId"> <img v-if="list.resPhoto" class="cover" :src="list.resPhoto" alt="">
                        <img v-else class="cover" src="../../theme-chalk/src/images/zyk-word-pic.jpg" alt=""></a>
                        <span class="info">
                           <a :href="'/resourcedetail?id='+list.resId" class="a1">{{list.resName}}</a>
                           <span class="span1">
                              <span class="spp1">{{list.siteName}}</span>
                              <span class="spp2">{{Number(list.studyNum)}}</span>
                           </span>
                        </span>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>

</div>
  </div>
</template>

<script>
  import {httpPost} from '../../../src/utils/utils';
  import formMixin from '../../../src/mixins/formMixin';
  import lenye_base from 'lenye_base';
  import $ from 'fy-kit';
  import msg from "../../message";
export default {
  name: 'ElResourceShowFixrecordPc3',
  mixins: [formMixin],
  model: {},
  data(){
    return {
      sites:'',
      courseList:[],
      defaults:1,
      orderType:2
    }
   },
   mounted() {
     this.init();
   },
   created() {
     this.sites= lenye_base.site_data.getsiteData().siteId;
   },
   components:{
     msg
   },
   computed: {},
   methods: {
     init(){
      // common/crsCourse/queryShowPage.do
      this.list();
     },
     course(de){
       if(de===1){  //最新
         this.orderType = 2;
          this.resTjStatus = ''
       }else{ //最热
         this.orderType = '';
         this.resTjStatus = 1;
       }
       this.defaults = de;

       this.list();

     },
     list(){
        $.util
        .ajax(
          lenye_base.base_data.getapiUrl() +
            "/resource-service/api/resResource/queryShowPage.do",
          lenye_base.base_data.getformatting({
            resTjStatus: 1,   //最热（推荐状态）
            rows: 4,
            page:1,
            sites:this.sites,
            resType:1,
            orderType:this.orderType,  //上传时间倒叙
          })
        )
        .then(res => {
          if (res.success == "1") {
            this.courseList = res.data;
          } else {
            msg.error(res.message);
          }
        });
     }
   },
};
</script>
