<template>
  <div class="el-resource_show_fixrecord_pc_2">
    <div class="resource_show_fixrecord_pc_2">
   <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="/courselist?type=kczy&name=课程资源">查看更多~</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="'/coursedetail?id='+list.csId" ><img v-if="list.csPhoto" class="cover" :src="list.csPhoto" alt="">
                        <img v-else class="cover" src="../../theme-chalk/src/images/zyk-word-pic.jpg" alt=""></a>
                        <span class="info">
                           <a :href="'/coursedetail?id='+list.csId"  class="a1">{{list.csName}}</a>
                           <span class="span1">
                              <span class="spp1">课时：{{Number(list.csStudylength)}}课时</span>
                             <!-- <span class="spp2">560</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: 'ElResourceShowFixrecordPc2',
  mixins: [formMixin],
  model: {},
  data(){
    return {
      sites:'',
      courseList:[],
      defaults:1,
      orderType:1
    }
   },
   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 = 1;
       }else{
         this.orderType = 0;
       }
       this.defaults = de;

       this.list();

     },
     list(){
        $.util
        .ajax(
          lenye_base.base_data.getapiUrl() +
            "/course-service/common/crsCourse/queryShowPage.do",
          lenye_base.base_data.getformatting({
            csTjStatus: 1,
            rows: 4,
            page:1,
            sites:this.sites,
            orderType:this.orderType,


          })
        )
        .then(res => {
          if (res.success == "1") {
            this.courseList = res.data;
          } else {
            msg.error(res.message);
          }
        });
     }
   },
};
</script>
