<template>
    <div class="el-course_show_detail_mobile_1">

        <div class="course_show_detail_mobile_1">
            <!--以下视频部分-->
            <div class="liveshow-video">
                <div class="appbar appbar-transparency liveshow-appicon"><!--头部标题栏-->
                    <span class="goback"><a href="javascript:history.go(-1)">返回</a></span>
                    <!--          <span class="appbar-moreicon">-->
                    <!--            <a href=""><img src="images/details_icon01.png" alt=""></a>-->
                    <!--            <a href=""><img src="images/details_icon02.png" alt=""></a>-->
                    <!--            <a href=""><img src="images/details_icon03.png" alt=""></a>-->
                    <!--            <a href=""><img src="images/details_icon04.png" alt=""></a>-->
                    <!--         </span>-->
                </div>
                <!--直播源-->
                <div id="player_video" class="video-js"></div>
                <!--<video id="my-player" poster="images/pic04.png" class="video-js vjs-big-play-centered video-diystyle" style="object-fit: fill;"  x5-playsinline="" playsinline="" webkit-playsinline="" controls>-->
                <!--<source src="http://cloud-play.hhalloy.com/live/cf4d66edc142b2f0cc8c71bca56b2268.m3u8" type="application/x-mpegURL">-->
                <!--<p class="vjs-no-js">-->
                <!--not support-->
                <!--</p>-->
                <!--</video>-->
                <div class="details-pic-tip">
<!--                    <span class="sp2">2146人</span>-->
                </div>
                <!--<span class="video-see">-->
                <!--<a href=""><img src="images/play-icon1.png" alt=""></a>-->
                <!--<span>试看结束</span>-->
                <!--</span>-->
                <span class="video-kecheng-tip">
        <a v-if="classDetail.csModel==1">公需课</a>
        <a v-else-if="classDetail.csModel==2">专业课</a>
            <a v-else-if="classDetail.csModel==3">开放课</a>
     </span>
            </div>
            <!--详情简介-->
            <div class="details-list">
                <span class="sp1">{{classDetail.csName}}</span>
                <span class="sp5">
         <span v-if="classDetail.csPrice==0 || classDetail.csPrice=='0.00'"></span>
         <span v-else class="spp1">¥{{classDetail.csPrice}}</span>
                    <!--         <span class="spp2">¥30.00</span>-->
      </span>
                <span class="sp6">
         <span class="spp1"><i>{{parseInt(classDetail.csStudylength)}}</i>学时丨<i>{{classDetail.studyNum}}</i>人已报名</span>
                    <!--         <span class="spp2">完成率<i>69%</i></span>-->
      </span>
                <span class="sp6" v-if="csLearn!=''">
         <span class="spp1">最近学习：<i>{{csLearn.csName}}</i></span>
         <span class="spp2"><a :href="'courseplay?id='+ csId" class="goon-btn">继续学习</a></span>
      </span>
            </div>
            <!--各种进度卡片-->
            <!--      <div class="plan-card-body">-->
            <!--        <span class="plan-card-jdt"><span style="width: 40%;">18分1秒 40%</span></span>-->
            <!--        <div class="plan-card">-->
            <!--          <ul class="ul1">-->
            <!--            <li><i>12</i>学时<span>已获学时</span></li>-->
            <!--            <li><i>12</i>分<span>已获积分</span></li>-->
            <!--            <li><i>12</i>/343<span>全网进度排名</span></li>-->
            <!--            <li><i>12</i>/123<span>单位进度排名</span></li>-->
            <!--            <li><i>12</i>%<span>课程学习进度</span></li>-->
            <!--          </ul>-->
            <!--          <ul class="ul2 clearfix">-->
            <!--            <span class="sp1">学习勋章</span>-->
            <!--            <li><img src="images/xunzhang1.png" alt=""></li>-->
            <!--            <li><img src="images/xunzhang2.png" alt=""></li>-->
            <!--            <li><img src="images/xunzhang3.png" alt=""></li>-->
            <!--          </ul>-->
            <!--          <a href="" class="shouqi-btn">收起</a>-->
            <!--        </div>-->
            <!--      </div>-->
            <!--tab页-->
            <div class="grade-list">
                <div class="grade-list-tab2">
                    <ul>
                        <li @click="showcs(1)" :class="{active:showcsid===1}"><a>章节</a></li>
                        <li @click="showcs(2)" :class="{active:showcsid===2}"><a>简介</a></li>
                        <li @click="showcs(3)" :class="{active:showcsid===3}"><a>师资</a></li>
                        <li @click="showcs(4)" :class="{active:showcsid===4}"><a>评价</a></li>
                    </ul>
                </div>
                <div class="course-section" v-show="showcsid===1"><!--章节-->
<!--                    <span class="cs-first active-color"></span>&lt;!&ndash;第一章&ndash;&gt;-->
                    <ul class="cs-second-ul" style="display: block;">
                        <li class="cs-second-li" v-for="item in csDetailList" :key="item.cptId">
                            <span class="cs-second  active-color" @click="parCivck(item)">{{item.cptName}}</span>
                            <ul class="cs-third" style="display: block;" v-show="!item.cptId"
                               v-for="(item1,index3) in item.childs">
                                <li :key="index3" class="state1">
                                    <a class="cptresult_a" :id="item1.cptId" :data-name="item1.cptId"
                                       @click="playvideo(item1.cp[0].resId,item1.cptName,item1.cptId)"
                                       href="javascript:;">
                                        {{item1.cptName}}</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
<!--                <span v-if="csLearn==''">-->
                    <div class="timu-footer" v-if="classDetail.csPrice==0 || classDetail.csPrice=='0.00'">
                        <span  class="timu-footer-price">免费学习</span>
                    </div>
                    <div class="timu-footer" v-else>
                        <span class="timu-footer-price">¥{{classDetail.csPrice}}元</span>
                        <span class="timu-footer-btn">
<!--               <a href="" class="timu-footer-add">加入购物车</a>-->
                           <a @click="baoming()" class="timu-footer-buy">立即购买</a>
                        </span>
                    </div>
<!--                </span>-->
                </div>
                <div class="course-intro" v-show="showcsid===2"><!--简介-->
                    <p>{{classDetail.lylInfo}}</p>
                    <!--          <p>从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训。</p>-->
                    <!--          <p class="p-img"><img src="images/jslndx-online-apply-pic.png" alt=""></p>-->
                    <!--          <p>从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训，从国家现状衍生出的电工类作业取证培训。</p>-->
                </div>
            </div>
            <div class="course-teachers" v-show="showcsid===3"><!--师资-->
                <div class="course-teachers-list" v-for="item in teachList.list"><!--师资循环-->
                    <div class="ctl-part1">
                        <span class="sp1"><img :src="item.etPhoto" alt=""></span>
                        <span class="sp2">
                  <span class="spp1">{{item.etName}}</span>
                  <span class="spp2">{{item.etKeywords}}</span>
               </span>
                    </div>
                    <!--            <div class="ctl-part2">-->
                    <!--              <span class="sp3">所授课程：</span>-->
                    <!--              <ul class="ul1">-->
                    <!--                <li><a href="">电工类作业取证培训要求(一)</a></li>-->
                    <!--                <li><a href="">电工类作业取证培训要求(二)</a></li>-->
                    <!--                <li><a href="">电工类作业取证培训要求(三)</a></li>-->
                    <!--                <li><a href="">电工类作业取证培训要求(四)</a></li>-->
                    <!--              </ul>-->
                    <!--            </div>-->
                    <!--          </div>-->
                    <!--          <div class="course-teachers-list">&lt;!&ndash;师资循环&ndash;&gt;-->
                    <!--            <div class="ctl-part1">-->
                    <!--              <span class="sp1"><img src="images/header.png" alt=""></span>-->
                    <!--              <span class="sp2">-->
                    <!--                  <span class="spp1">何国辉<i class="teacher2">辅导老师</i></span>-->
                    <!--                  <span class="spp2">这里是教师简介是教师简介，这里是教师简介这里是教师简介，这里是教师简介，这里是教师简介是教师简介，这里是教师简介，这里是教师简介，这里是教师简介。</span>-->
                    <!--               </span>-->
                    <!--            </div>-->
                    <!--            <div class="ctl-part2">-->
                    <!--              <span class="sp3">所授课程：</span>-->
                    <!--              <ul class="ul1">-->
                    <!--                <li><a href="">电工类作业取证培训要求(一)</a></li>-->
                    <!--                <li><a href="">电工类作业取证培训要求(二)</a></li>-->
                    <!--                <li><a href="">电工类作业取证培训要求(三)</a></li>-->
                    <!--                <li><a href="">电工类作业取证培训要求(四)</a></li>-->
                    <!--              </ul>-->
                    <!--            </div>-->
                </div>
            </div>
            <div class="course-comment" v-show="showcsid===4"><!--评价-->
                <!--            <van-pagination v-model="currentPage" :total-items="50" :show-page-size="5">-->
                <span class="cc-title">所有评价<i>({{totalCount}}条)</i></span>
                <fyer-load-more style="margin-bottom: 127px;"
                                ref="pulldown"
                                :pageIndex="pageSize"
                                :page-size="row"
                                :totalCount="totalCount"
                                :openRefresh="false"
                                @loadmore="loadmore"
                                @refresh="refresh"
                >

                    <div class="course-comment-list" v-for="item in judgeMent" :key="item.cptId"><!--评价循环-->
                        <div class="ccl-part1">
               <span class="sp1 clearfix">
<!--                  <img class="img1" src="images/header.png" alt="">-->
                  <span class="spp1">
                     <span class="sppp1">{{item.createByName}}<img :src="item.photo" alt=""></span>
                     <span class="sppp2">{{item.cmtDate}}</span>
                  </span>
               </span>
                            <span class="sp2">
<!--                  <span>课程完成率<i class="i1">78%</i></span>-->
                  <span>评价：<i class="i1" v-if="item.starNum==5">非常满意</i><i class="i2" v-if="item.starNum==4">满意</i><i
                          class="i3" v-if="item.starNum==3">一般</i><i class="i4" v-if="item.starNum==2">不满意</i><i
                          class="i5" v-if="item.starNum==1">非常不满意</i></span>
               </span>
                        </div>
                        <span class="ccl-part2">
               {{item.content}}
            </span>
                        <!--            <span class="ccl-part3">-->
                        <!--               <span>22天后发布追评</span>-->
                        <!--               <i>追评</i>课程非常好，老师讲解的也很风趣，知识要点也很全面，给个4.5分，保留0.5分作为进步空间-->
                        <!--            </span>-->
                    </div>
                </fyer-load-more>
                <div class="details-comment" style="display: block;"><!--发表评论div-->
                    <ul class="details-comment-ul">
                        <li @click="issueMent(5)" :class="{active:xingId===5}">非常满意</li>
                        <li @click="issueMent(4)" :class="{active:xingId===4}">满意</li>
                        <li @click="issueMent(3)" :class="{active:xingId===3}">一般</li>
                        <li @click="issueMent(2)" :class="{active:xingId===2}">不满意</li>
                        <li @click="issueMent(1)" :class="{active:xingId===1}">非常不满意</li>
                    </ul>
                    <span class="details-comment-inp">
               <textarea name="" v-model="comment"></textarea>
                        <!--               <a href="" class="messface"><img src="images/mess-face.png" alt=""></a>-->
               <input type="button" @click="issfa()" value="发表">
            </span>
                </div>
                <!--            </van-pagination>-->
            </div>

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

<script>
    import {httpPost} from '../../../src/utils/utils';
    import formMixin from '../../../src/mixins/formMixin';
    import lenye_base from 'lenye_base';
    import Player from 'xgplayer';
    // import HlsJsPlayer from 'xgplayer-hls.js';
    import fyerLoadMore from "fyer-load-more";
    // require('../../../src/utils/e3c-play');

    import $ from "fy-kit";
    import {Toast} from "vant";

    export default {
        name: 'ElCourseShowDetailMobile1',
        mixins: [formMixin],
        components: {
           // [Divider.name]: Divider,
            fyerLoadMore
        },
        model: {},
        created() {
            this.csId = $.util.urlParams('id')
        },
        data() {
            return {
                csId: "00265283429247a7acf0002a35a5d257",//
                classDetail: [],//获取详情
                csDetailList: [],//获取章节列表
                judgeMent: [],//获取评论
                showcsid: 1,
                csLearn: '',
                xingId: '',
                comment: '',
                teachList: {},
                row: 5,
                pageSize: 1,
                totalCount: '',
                playVideoList: [],
                playList: {},
                fileresList: [],
                studyTime: {
                    time: 0,
                    type: 'nologin',
                    learClockTime: 0,
                },
                learClockTime: 0,
                newPlay: '',
                isplay: true,
                islearsave: true,
                studyBreakpoint: '',
                userdata: '',
                newplayer:'',
            }
        },
        mounted() {
            this.csId = $.util.urlParams('id');
            this.userdata = lenye_base.user_data.getuserData();
            this.getDetail();
            this.getDetailList();
            this.getlist();
            this.islogin();
            if (lenye_base.user_data.getuserData() && lenye_base.user_data.getuserData() != 'undefined') {
                this.getHotList();//判断用户登录是否为报名用户
            };
            let script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = '//' + lenye_base.base_data.getDomain() + '/dist/e3c-play.js';
            document.getElementsByTagName('head')[0].appendChild(script);
            // let loadJS = function (url) {
            //     let script = document.createElement('script');
            //     script.type = 'text/javascript';
            //     script.src = url;
            //     document.getElementsByTagName('head')[0].appendChild(script);
            // };
            // loadJS("http://dsw.jsou.cn/assets/sdk/play-sdk/dist/e3c-play.js");

        },
        computed: {},
        methods: {
            getDetail() {
                const that = this;
                httpPost(
                    lenye_base.base_data.getapiUrl() +
                    '/course-service/common/crsCourse/queryById.do',
                    lenye_base.base_data.getformatting({
                        csId: that.csId
                    }),
                    function (data) {
                        that.classDetail = data.data;
                        // console.log(data)
                    }
                );

                //获取授课老师列表
                httpPost(
                    lenye_base.base_data.getapiUrl() +
                    '/course-service/common/csrCourseTutorRel/queryListByCsId.do',
                    lenye_base.base_data.getformatting({
                        csId: that.csId
                    }),
                    function (data) {
                        that.teachList = data.data[0];
                    }
                );
            },
            //获取章节
            getDetailList() {
                const that = this;
                httpPost(
                    lenye_base.base_data.getapiUrl() +
                    '/course-service/common/crsChapter/treeList.do',
                    lenye_base.base_data.getformatting({
                        csId: that.csId
                    }),
                    function (e) {
                        // that.csDetailList = e.data;
                        if (e.success === '1') {
                            if (e.data.length) {
                                // 先获取到章节列表
                                for (let i = 0; i < e.data.length; i++) {
                                    // 通过章节列表绑定章节小节的小节资源
                                    for (let j = 0; j < e.data[i].childs.length; j++) {
                                        lenye_base.httpPost(lenye_base.base_data.getapiUrl() + lenye_base.api_url.course.queryResources, lenye_base.base_data.getformatting({
                                            cptId: e.data[i].childs[j].cptId,
                                            sorts: '1',
                                        }), function (res) {
                                            e.data[i].childs[j].cp = res.data;
                                            // console.log('cp1111' + JSON.stringify(e.data[i].childs[j].cp));
                                            /*获取资源url*/
                                            if (e.data[i].childs[j].cp && e.data[i].childs[j].cp.length) {
                                                for (let n = 0; n < e.data[i].childs[j].cp.length; n++) {
                                                    that.fileresList.push(e.data[i].childs[j].cp[0].resId);
                                                    // console.log('fileList1111' + JSON.stringify(that.fileresList));
                                                }
                                            }
                                        });
                                    }
                                }
                                setTimeout(function () {
                                    that.csDetailList = e.data;
                                    if (that.fileresList) {
                                        // console.log('fileList1111' + JSON.stringify(that.fileresList));
                                        that.videoList(that.fileresList);
                                    }
                                    ;
                                }, 1000);
                            }
                        }
                    }
                );

                //获取当前章节
                // httpPost(
                //   lenye_base.base_data.getapiUrl() +
                //   '/course-service/common/crsCustLearnCourse/queryUserCoursePage.do',
                //   lenye_base.base_data.getformatting({
                //     csId: that.csId
                //   }),
                //   function(data) {
                //     that.getDetailList = data.data;
                //   }
                // );
                //获取评星
                // getxing() {
                //   const that = this;
                //   httpPost(
                //     lenye_base.base_data.getapiUrl() +
                //     '/interact-service/api2/inaGainStars/isStar.do',
                //     lenye_base.base_data.getformatting({
                //       csId: that.csId
                //     }),
                //     function(data) {
                //       that.xingList = data;
                //     }
                //   );
            },
            /*获取资源播放列表*/
            videoList(resids) {
                const that = this;
                console.log(1111, resids.toString());
                lenye_base.httpPost(lenye_base.base_data.getapiUrl() + '/resource-service/common/resResource/detail.do', lenye_base.base_data.getformatting({
                    resId: resids.toString()
                }), function (e) {
                    if (e.success === '1' && e.data.length) {
                        for (let i = 0; i < e.data.length; i++) {
                            that.playList[e.data[i].resId] = {
                                resid: e.data[i].resId,
                                file: e.data[i].resFiles.length ? e.data[i].resFiles[0].fileId : '',
                                resPhoto: e.data[i].resPhoto,
                                thirdResource: e.data[i].thirdResource,
                                thirdSource: e.data[i].thirdSource,
                                thirdResId: e.data[i].thirdResId
                            };
                            console.log(that.playList);
                        }
                    }
                });
            },
            islogin() {
                const that = this;
                /*是否登录*/
                if (that.userdata.custId) {
                    /*课程是否完成*/
                    lenye_base.httpPost(lenye_base.base_data.getapiUrl() + lenye_base.api_url.course.queryUserCoursePageById, lenye_base.base_data.getformatting({
                        csId: that.csId,
                        orderType: '1',
                    }), function (e) {
                        if (e.success === '1') {
                            if (e && e.data.length) {
                                that.studyTime.type = 'study';
                                setTimeout(function () {
                                    document.querySelectorAll('.cptresult_a')[0].click();
                                }, 1500)
                            } else {
                                lenye_base.httpPost(lenye_base.base_data.getapiUrl() + '/course-service/api2/crsCustLearnCourse/addUserCourse.do', lenye_base.base_data.getformatting({
                                    studyUserId: that.userdata.custId,
                                    csId: that.csId,
                                    lcsNormal: 1
                                }), function (res) {
                                    if (res.success === '1') {
                                        that.$message({
                                            showClose: true,
                                            message: '成功选课！',
                                            type: 'success'
                                        });
                                    }
                                });
                                setTimeout(function () {
                                    document.querySelectorAll('.cptresult_a')[0].click();
                                }, 1500)
                                // that.studyTime.time = that.studycontrol();
                                that.studyTime.type = 'nostudy';
                            }
                        }
                    });
                } else {
                    // that.studyTime.time = that.studycontrol();
                    that.studyTime.type = 'nologin';
                    setTimeout(function () {
                        document.querySelectorAll('.cptresult_a')[0].click();
                    }, 3000)
                }
            },
            /*播放视频*/
            playvideo(resId, cptname, cptid) {
                const that = this;
                // pagepara.resId = resId;
                that.cptnametitle = cptname ? cptname : '';
                that.cptidvalue = cptid ? cptid : '';
                that.playlists(resId);
                if (that.playVideoList[0].thirdResource) {
                    httpPost(lenye_base.base_data.getapiUrl() + '/resource-service/common/resResource/gainPlayUrlFromDSW.do', lenye_base.base_data.getformatting({
                            dswResId: that.playVideoList[0].thirdResId
                        }),
                        function (res) {
                            if (res.success === '1') {
                                if (!that.newplayer) {
                                    that.newplayer = new E3CPlayer({
                                        id: 'player_video',
                                        type: res.data.type,
                                        playbackRates: {
                                            enable: false, //true 默认优先H5，false 优先Flash方式
                                            source: 'hls',
                                            src: res.data.playUrl
                                        },
                                        //playlist: $("#hls_playlist").val(),
                                        //disableControlBar:flag,  // 此处禁用整个菜单栏
                                        // disableProgressBar: flag,   // 此处是禁用进度条，防止第一次观看视频时用户进行拖拽快进
                                        controlBar: {}
                                    })
                                } else {
                                    document.getElementById('player_video').innerHTML = '';
                                    that.newplayer = new E3CPlayer({
                                        id: 'player_video',
                                        type: res.data.type,
                                        playbackRates: {
                                            enable: false, //true 默认优先H5，false 优先Flash方式
                                            source: 'hls',
                                            src: res.data.playUrl
                                        },
                                        //playlist: $("#hls_playlist").val(),
                                        //disableControlBar:flag,  // 此处禁用整个菜单栏
                                        // disableProgressBar: flag,   // 此处是禁用进度条，防止第一次观看视频时用户进行拖拽快进
                                        controlBar: {}
                                    })
                                } ;
                                //
                                // let playbackRates =
                                //     {
                                //         enable: false, //true 默认优先H5，false 优先Flash方式
                                //         source: 'hls',
                                //         src: res.data.playUrl
                                //     };
                                //
                                // let options = {
                                //     id: 'player_video',
                                //     type: res.data.type,
                                //     playbackRates: playbackRates,
                                //     //playlist: $("#hls_playlist").val(),
                                //     //disableControlBar:flag,  // 此处禁用整个菜单栏
                                //     // disableProgressBar: flag,   // 此处是禁用进度条，防止第一次观看视频时用户进行拖拽快进
                                //     controlBar: {}
                                // }
                                // setTimeout(function () {
                                //     new E3CPlayer(options)
                                // },1500)
                                // that.playVideoList = data.data;
                                // if (data.data[0].thirdResource) {
                                //
                                // } else {
                                //     that.playvideo(data.data[0]);
                                //     console.log(data.data);
                                // }

                            };
                        }
                    );
                } else {
                    setInterval(() => {
                        that.learClockTime++
                    }, 1000);
                    if (!that.newPlay) {
                        that.newPlay = new Player({
                            id: 'player_video',
                            autoplay: true,
                            url: that.playVideoList[0] && that.playVideoList[0].file,
                            height: '100%',
                            width: '100%',
                            lang: 'zh-cn',
                            videoInit: true,
                            playbackRate: [0.5, 0.75, 1, 1.5, 2],
                            defaultPlaybackRate: 1,
                        });
                        that.newPlay.on('play', function () {
                            that.newPlay.currentTime = that.isplay ? that.studyBreakpoint : 0;
                            that.isplay = false;
                        }).on('pause', function () {
                            /*暂停*/
                            that.saveTime(resId, that.newPlay.currentTime, that.learClockTime);
                            that.learClockTime = 0;
                        }).on('ended', function () {
                            /*结束*/
                            that.saveTime(resId, that.newPlay.currentTime, that.learClockTime);
                            that.learClockTime = 0;
                            that.nextcourse();
                        }).on('timeupdate', function () {
                            console.log('timeupdate', that.learClockTime, resId);
                            if (that.learClockTime > 30 && that.islearsave) {
                                that.islearsave = false;
                                that.saveTime(resId, that.newPlay.currentTime, that.learClockTime);
                                that.learClockTime = 0;
                            }
                        });
                    } else {
                        that.newPlay.src = that.playVideoList[0] && that.playVideoList[0].file;
                    }
                }

            },
            /*上次资源播放进度*/
            getLastBreakPosition(resId) {
                const that = this;
                lenye_base.httpPost(lenye_base.base_data.getapiUrl() + lenye_base.api_url.resource.queryResources, lenye_base.base_data.getformatting({
                    resId: resId,
                    studyUserId: this.userdata.custId,
                    resinfo: '0',
                }), function (e) {
                    if (e.success === '1') {
                        that.studyBreakpoint = e.data[0].studyBreakpoint ? e.data[0].studyBreakpoint : 0;
                    }
                    ;
                });
            },
            /*播放列表*/
            playlists(id) {
                const that = this;
                let ist = false;
                that.playVideoList = [];
                if (id) {
                    for (let i in that.playList) {
                        if (that.playList[i].file || that.playList[i].thirdResource) {
                            if (i === id || ist) {
                                ist = true;
                                that.playVideoList.push({
                                    'image': that.playList[i].resPhoto,
                                    'id': i,
                                    'file': that.playList[i].file,
                                    'thirdResource': that.playList[i].thirdResource,
                                    'thirdSource': that.playList[i].thirdSource,
                                    'thirdResId': that.playList[i].thirdResId
                                });
                            }
                        }
                    }
                }
            },
            /*资源学习提交计时*/
            saveTime(id, point, time) {
                // if (!libs.getUserData()) {
                //     return false;
                // }
                const that = this;
                lenye_base.httpPost(lenye_base.base_data.getapiUrl() + lenye_base.api_url.resource.learnSave, lenye_base.base_data.getformatting({
                    'studyUserId': this.userdata.custId,
                    'resId': id,
                    'studyBreakpoint': parseInt(point) + '',
                    'studyTime': time + '',
                }), function (e) {
                    if (e.success === '1') {
                        that.learClockTime = 0;
                        that.islearsave = true;
                    }
                    ;
                });
            },
            issueMent(id) {
                this.xingId = id
            },
            //发布评价
            issfa() {
                const that = this;
                if (that.comment == '') {
                    // this.Toast({
                    //     message: '请填写评论',
                    //     type: 'warning'
                    // });
                    Toast.fail('请填写评论');

                } else if (that.xingId == '') {
                    // this.Toast({
                    //     message: '',
                    //     type: 'warning'
                    // });
                    Toast.fail('请选择满意度');
                } else {
                    if (lenye_base.user_data.getuserData() && lenye_base.user_data.getuserData() != 'undefined') {
                        lenye_base.httpPost(
                            lenye_base.base_data.getapiUrl() +
                            '/interact-service/api2/itaComment/insert.do',
                            lenye_base.base_data.getformatting({
                                objId: that.csId,
                                starNum: that.xingId,
                                content: that.comment,
                                userAuth: 1,
                                type: 'course'
                            }),
                            function (data) {
                                if(data.success==1){
                                    that.comment = '';
                                    that.xingId = '';
                                    that.getlist();
                                }else {
                                    Toast.fail(data.message);
                                }



                            }
                        );

                    } else {
                        // this.$message({
                        //     message: '',
                        //     type: 'warning'
                        // });
                        Toast({
                            message: '登录之后才能发表评论',
                            position: 'top',
                        });

                    }
                }

            },
            async getlist() {
                let {data, totalCount} = await $.util.ajax(
                    lenye_base.base_data.getapiUrl() +
                    "/interact-service/common/itaComment/queryPage.do",
                    lenye_base.base_data.getformatting({
                        objId: this.csId,
                        rows: this.row,
                        page: this.pageSize,
                        siteIds: lenye_base.site_data.getsiteData().siteId,
                        sorts: 'cmtDate=0',
                        type: 'course'
                    })
                );
                this.judgeMent = this.judgeMent.concat(data);
                this.totalCount = totalCount;
                // const that = this;
                // //获取评论
                // httpPost(
                //     lenye_base.base_data.getapiUrl() +
                //     '/interact-service/common/itaComment/queryPage.do',
                //     lenye_base.base_data.getformatting({
                //         objId: that.csId,
                //         rows: that.row,
                //         page: that.pageSize,
                //         siteIds: lenye_base.site_data.getsiteData().siteId,
                //         sorts: 'cmtDate=0',
                //         type: 'course'
                //
                //     }),
                //     function (data) {
                //         that.judgeMent = data;
                //     }
                // );

            },
            //获取学员是否加入
            getHotList() {

                const that = this;
                httpPost(
                    lenye_base.base_data.getapiUrl() +
                    '/course-service/api2/crsCustLearnCourse/queryUserCoursePageById.do',
                    lenye_base.base_data.getformatting({
                        csId: that.csId
                    }),
                    function (data) {
                        that.csLearn = data.data;
                        console.log(data.data);
                    }
                );
            },
            showcs(id) {
                this.showcsid = id
            },
            parCivck(item) {
                item.cptId = !item.cptId;
            },
            loadmore(page) {
                this.pageSize = page;
                this.getlist();
            },
            refresh() {
                this.pageSize = 1;
                this.getlist();
            },
            baoming() {
                if (lenye_base.user_data.getuserData() && lenye_base.user_data.getuserData() != 'undefined') {
                    window.location.href = '/projectorderpay?id=' + this.csId + '&type=1';
                } else {
                    Toast.fail('请先登录');
                }
            },
        }

    };
</script>
