(function () {
    //banner图切换
    $('.banner_container').swiperBanner({
        pointClass: '.points',
        loopNode: '.banner_img'
    })

    //案例切换

    // 只执行一次
    let one = true
    $('.j_case_tab>li').hover(function () {
        var idx = $(this).index()
        $(this).addClass('active').siblings().removeClass('active')
        $(this).parent().siblings('.box').find('.item').hide().eq(idx).show()
        if (idx === 2 && !$(this).data('has')) {
            if ($('.j_admitTable').find('tr').length > 0) {
                new Marqueen('.j_scrollCase').init()
                $(this).data('has', 1)
            }
        }
        if (idx === 3 && !$(this).data('has')) {
            if ($('.j_admitTable').find('tr').length > 0) {
                new Marqueen('.j_scrollCase3').init()
                $(this).data('has', 1)
            }
        }
        if (one) {
            admitCaseFun.init()
        }
        if (idx === 1 && !$(this).data('has')) {//提分案例
            new Marqueen('.j_scrollCase2').init()
            $(this).data('has', 2);
            var tr = $('.case_content .f_high .table_container tr');
            for (var i = 0; i < tr.length; i++) {
                if (i % 2 == 0) {
                    tr.eq(i).addClass('odd');
                }
            }
        }
    })
    //出国考试培训
    $('.j_test_tabs>li').hover(function () {
        let idx = $(this).index()
        $(this).addClass('active').siblings().removeClass('active')
        $(this).parents('.xt_test').find('.box>div').eq(idx).addClass('active').siblings().removeClass('active')
    })

    //考试技巧左侧二级导航
    $('.j_skill_subTabs>li').hover(function () {
        var idx = $(this).index()
        $(this).addClass('active').siblings().removeClass('active')
        $(this).parent().siblings('.sub_contains').find('.s_it').hide().eq(idx).show()
    })

    //表单的点击出现下拉菜单
    $('.j_sliderBtn,.j_arrow').click(function () {
        var parentObj = $(this).parent();
        var ul = parentObj.find(".j_list");
        var show = function () { ul.slideDown(150); }
        var hide = function () { ul.slideUp(150); }
        ul.is(":hidden") ? show() : hide();
        $("body").click(function (i) {
            $(i.target).parent("")[0] != parentObj[0] ? hide() : "";
        });
    })
    //下拉选项列表
    $('.j_list>li').click(function () {
        var txt = $(this).text();
        $(this).parent().siblings('input').val(txt).css('color', '#333')
        $(this).parent().hide()
    })
    //留学选校评估
    $('.j_evaluateSubmit').click(function (event) {
        var form = $('.evaluate_form')[0]
        checkEvaluateForm(form)
    });

    var evaluateFormTrueTel = 0;
    function getCaptcha(L, R, TEL) {
        sliderCaptcha({
            id: 'captcha',
            width: 350,
            height: 240,
            sliderL: parseInt(L),
            sliderR: parseInt(R),
            offset: 5,
            loadingText: '正在加载中...',
            failedText: '再试一次',
            barText: '向右拖动滑块完成拼图',
            setSrc: function () {
                return 'https://www.igo.cn/captcha/captchaImg/' + (Math.round(Math.random() * 5) + 1) + '.jpg';
            },
            onSuccess: function () {
                $.ajax({
                    type: "POST",
                    url: "/php/sendYzmWithExpire.php",
                    data: {
                        action: "sendyzmnew",
                        tel: TEL,
                        L: L,
                        R: R,
                    },
                    dataType: "json"
                }).done(function (res) {
                    if (res.code === "1") {
                        evaluateFormTrueTel = TEL;
                        $('#captchabox').fadeOut()
                    }
                    else {
                        alert("短信发送失败！");
                    }
                }).fail(function (err) {
                    alert("接口调用失败！");
                });
            },
            onFail: function () {

            },
        });
    }

    $(".evaluate_form .get-code").on("click", function () {
        if ($(this).is(".code-stop")) return false;
        $.getScript("https://www.igo.cn/captcha/longbow.slidercaptcha.min.js");
        const form = $(".evaluate_form")[0];
        const tel = form.userphone.value.replace(/\s/g, "");
        if (!tel) {
            alert("请填写您的手机号码！");
            return false;
        }
        let num = 120,
            self = $(this)
        $.ajax({
            type: "POST",
            url: "/php/sendYzmWithExpire.php",
            data: {
                action: "getslidernums",
            },
            dataType: "json"
        }).done(function (res) {
            if (res.sliderL) {
                self.addClass('code-stop').text('120s')
                let timer = setInterval(function () {
                    self.text(--num + "s")
                    if (num == 0) {
                        clearInterval(timer)
                        self.removeClass('code-stop').text('发送验证码')
                        $('#captcha').html('')
                    }
                }, 1000)
                $('#captchabox').fadeIn()
                getCaptcha(res.sliderL, res.sliderR, tel)
            }
            else {
                alert("图形验证码创建失败！");
            }
        }).fail(function (err) {
            alert("接口调用失败！");
        });

    });
    function checkEvaluateForm(form) {
        var country = form.country.value,
            step = form.step.value,
            sort = form.sort.value,
            subject = form.subject.value,
            fee = form.fee.value,
            language = form.language.value,
            username = form.username.value,
            city = form.city.value,
            code = form.code.value;
        if (!code.trim()) {
            alert("请填写验证码！");
            return false;
        }
        $.ajax({
            type: "GET",
            url: "/php/sendYzmWithExpire.php",
            data: {
                action: "checkyzm",
                tel: evaluateFormTrueTel,
                usercode: code
            },
            dataType: "json"
        }).done(function (res) {
            if (res.code === "1") {
                if (country == '') {
                    alert('请选择求学目的地！')
                    return false;
                }
                if (step == '') {
                    alert('请选择入读阶段！')
                    return false;
                }
                if (sort == '') {
                    alert('请选择院校标准！')
                    return false;
                }
                if (subject == '') {
                    alert('请选择您要申请的专业！')
                    return false;
                }
                if (fee == '') {
                    alert('请选择您的留学预算！')
                    return false;
                }
                if (language == '') {
                    alert('请选择您的语言水平！')
                    return false;
                }
                if (username == '') {
                    alert('请输入您的姓名！')
                    return false;
                }
                if (city == '') {
                    alert('请选择您的所在城市！')
                    return false;
                }
                var note = '入读阶段：' + step + '；\n院校标准：' + sort + '；\n专业选择：' + subject + '；\n留学预算：' + fee;
                var params = {
                    custName: username,
                    tel: evaluateFormTrueTel,
                    city: city,
                    country: country,
                    note: note,
                    yzm: code,
                    oper: 'save',
                    partId: $(".E-partId").val(),
                    partName: $(".E-partName").val()
                }
                var szData = {}
                szData.params = params;
                szData.form = form;
                submitForm(szData, 'y')
            } else alert("验证码错误！");
        }).fail(function (err) {
            alert("接口调用失败！");
            console.error(err);
        });
    }
    //在线模拟考试预约表单
    $('.j_testSubmit').click(function () {
        var form = $('.testOnline_form')[0]
        checkOnlineForm(form)
    });
    function checkOnlineForm(form) {
        var username = form.username.value,
            subject = form.usersubject.value,
            phone = form.userphone.value;
        if (username == '') {
            alert('请输入您的姓名！')
            return false;
        }
        if (subject == '') {
            alert('请选择您要考试的科目！')
            return false;
        }
        if (phone == '') {
            alert('请输入您的手机号码！')
            return false;
        }
        var params = {
            custName: username,
            tel: phone,
            note: '考试科目：' + subject,
            oper: 'save',
            partId: $(".T-partId").val(),
            partName: $(".T-partName").val()
        }
        var szData = {}
        szData.params = params;
        szData.form = form;
        submitForm(szData)
    }
    function submitForm(data, withyzm) {// withyzm是要校验验证码， 是=y

        withyzm = 'n'
        var ajaxUrl;
        if (withyzm == 'y') {
            ajaxUrl = "https://www.igo.cn/php/freeTestWithYzm.php";
        } else {
            ajaxUrl = "https://www.igo.cn/php/freeTest.php";
        }
        $.ajax({
            type: 'POST',
            url: ajaxUrl,
            data: data.params,
            success: function (xml) {
                var rootNode = $(xml).find("root");
                var szCode = $(rootNode).find("code").text();
                if (szCode == '2') {
                    alert("提交失败！");
                } else if (szCode == '5') {
                    alert("您已经提交过信息。");
                    data.form.reset()
                } else {
                    alert("提交成功，我们会有专业顾问老师与您联系。");
                    data.form.reset()
                    //回传ocpc数据
                    $.post("https://www.igo.cn/php/api/baidu/ocpc/baidu.api.php?action=sendConvertData", data.params, function (data) {
                        console.log(data);
                    });
                }
            }
        })
    }
    //考试日历
    var cal_data = {
        month: (new Date().getMonth() + 1),
        subject: 'ielts'
    }
    $('.selected-month i').text(cal_data.month + '月')
    getTestDate(cal_data);
    $('.j_testCSelect').click(function (event) {
        $(this).siblings('.list').slideToggle()
    });
    //考试日历筛选查看
    $('.j_canlendarList>li').click(function (event) {
        var parentUL = $(this).parent(),
            type = parentUL.attr('aria-type')
        if (type == 'month') {
            cal_data.month = $(this).text();
        } else if (type == 'subject') {
            cal_data.subject = $(this).data('value');
        }
        parentUL.siblings('span').find('i').text($(this).text())
        parentUL.hide()
        getTestDate(cal_data)
    });
    function getTestDate(params) {//获取考试日期
        /*var url = "https://www.igo.cn/include/static/index/examdays/" + params.subject + "_" + parseInt(params.month) + ".json";
        $.get(url, function (res) {
            if (!window.clndr) {
                initCalendar(res, parseInt(params.month))
            } else {
                changeCalendar(res, parseInt(params.month))
            }
        });*/

        var url = "https://phppc.igo.cn/pscript/php/api/index2019.api.php?action=examdays&lang=" + params.subject + "&month=" + parseInt(params.month);
        myAjax({
            data: {
                action: 'examdays',
                lang: params.subject,
                month: parseInt(params.month)
            }
        }, function (res) {
            if (!window.clndr) {
                initCalendar(res.list, parseInt(params.month))
            } else {
                changeCalendar(res.list, parseInt(params.month))
            }

        })
    }
    function changeCalendar(data, month) {//根据考试时间初始化考试日历
        var eventArray = getTestDay(data, month);
        clndr.setMonth(month - 1)
        clndr.setEvents(eventArray)
    }
    function getTestDay(data, month) {
        var thisMonth = moment().month(month - 1).format('YYYY-MM');
        var eventArray = [];
        if (data.length > 0) {
            for (var i = 0, len = data.length; i < len; i++) {
                var monthDay = {}
                data[i] = data[i] > 9 ? data[i] : ('0' + data[i])
                monthDay.date = thisMonth + '-' + data[i]
                eventArray.push(monthDay)
            }
        }
        return eventArray
    }
    function initCalendar(data, month) {//根据考试时间初始化考试日历
        var eventArray = getTestDay(data, month);
        clndr = $('.cal1').clndr({
            events: eventArray,
            numberOfRows: 6,
            multiDayEvents: {
                singleDay: 'date'
            },
            daysOfTheWeek: ['日', '一', '二', '三', '四', '五', '六'],
        });
    }
    function myAjax(params, callback) {
        var ajaxUrl = "https://phppc.igo.cn/pscript/php/api/index2019.api.php";
        $.ajax({
            type: 'POST',
            url: ajaxUrl,
            data: params.data || {},
            dataType: 'JSON',
            success: function (res) {
                //if (res.code == 1) {
                callback && callback(res)
                //} else {
                //alert('数据获取失败，请刷新后重试')
                //}
            },
            error: function (err) {
                console.log(err)
            }
        })
    }

    // 录取捷报
    var admitCaseFun = {
        init: function () {
            var self = this
            this.ajaxData(function (data) {
                self.initDom(data)

            })
        },
        ajaxData: function (callback) {
            myAjax({
                data: {
                    action: 'enrollstu',
                    limit: 20
                }
            }, function (res) {
                one = false
                callback && callback(res.list)
            })
        },
        initDom: function (data) {
            var adminsList = $('.j_admitTable'), str = ''
            if (data && data.length > 0) {
                for (var i = 0, len = data.length; i < len; i++) {
                    str += (i % 2 == 0) ? '<tr class="odd">' : '<tr>'
                    str += '<td width="65"><a href="' + data[i].URL + '" target="_blank">' + data[i].T_NAME + '</a></td>' +
                        '<td width="180"><a href="' + data[i].URL + '" target="_blank">' + data[i].T_COLLEGE_NAME + '</a></td>' +
                        '<td width="73"><a href="' + data[i].URL + '" target="_blank">' + data[i].DEGREE + '</a></td>' +
                        '<td width="124"><a href="' + data[i].URL + '" target="_blank">' + data[i].T_SPECIALTY + '</a></td>' +
                        '<td><a href="javascript:void(0)" class=" btn trs" onclick="leyubtn()">在线咨询</a></td>' +
                        '</tr>'
                }
            } else {
                str += '<tr><td>暂无录取捷报</td></tr>';
            }
            adminsList.html(str);
        }
    }

    //录取捷报滚动
    function Marqueen(obj) {
        this.obj = $(obj)
    }
    Marqueen.prototype = {
        constructor: Marqueen,
        init: function () {
            this.count = 0;
            this.loopWrapper = this.obj.find('.table_body')
            this.loopNode = this.loopWrapper.find('tr')
            this.height = this.loopNode.outerHeight(true)
            this.bindEvent()
        },
        bindEvent: function () {
            var self = this;
            var parent = self.obj.parent()
            if (parent.is(":hidden")) {
                self.stopPlay()
            } else {
                self.autoPlay()
            }
            self.obj.hover(function () {
                self.stopPlay()
            }, function () {
                self.autoPlay()
            })
        },
        stopPlay: function () {
            clearInterval(this.timer)
        },
        autoPlay: function () {
            var self = this
            this.timer = setInterval(function () {
                self.count--;
                self.loopWrapper.css({
                    marginTop: self.count
                })
                if (Math.abs(self.count) > self.height) {
                    self.count = 0
                    self.loopWrapper.find('tbody').append(self.loopWrapper.find('tbody').children().first())
                    self.loopWrapper.css({ marginTop: 0 })
                }
            }, 100)
        }
    }

    //top教师
    var topTeacherFun = {
        init: function () {
            var self = this;
            self.bindEvent()
        },
        bindEvent: function () {
            $('.j_t_slide').hover(function () {
                $(this).addClass('maxWidth').siblings().addClass('minWidth')
            }, function () {
                $(this).removeClass('maxWidth').siblings().removeClass('minWidth')
            })
        },
    }
    topTeacherFun.init()
    //板块右侧的tab切换
    var linksArr = ['https://www.igo.cn/teacher/', 'https://www.igo.cn/kp/teachers/']
    $('.panel .right_tabs>li').hover(function () {
        var hrefLink = $(this).find('.more').length;
        var more = $(this).data('more')
        if (hrefLink) {
            return;
        }
        if (more) {//变化教师团队更多链接
            $(this).siblings('li').find('a').attr('href', linksArr[more - 1])
            if (!$(this).data('hasData')) {
                topTeacherFun.init(more)
                $(this).data('hasData', 1)
            }
        }
        var idx = $(this).index()
        $(this).addClass('active').siblings().removeClass('active')
        $(this).parent().siblings('.j_boxContains').find('.item').hide().eq(idx).show()
    })
    // 新通块讯疫情特辑模块点击数统计
    $('#fybox a').click(function () {
        $.get('https://m.igo.cn/php/count/general_api.php?action=addcount&site=igo&partId=igo-index-yqtj', function (data) {
            console.log(data);
        });
    })


    // 获取视频list
    let video_list = {
        //函数执行,ajax调用
        init: function () {
            let self = this;
            $.ajax({
                type: 'POST',
                url: 'https://phppc.xt.cn/pscript/php/api/xcx.api.php',
                data: {
                    action: 'getshortvideolist',
                    page: 1,
                    perpage: 5,
                    status: 1, // 1为上线  2为下线
                },
                dataType: 'JSON',
                success: function (res) {
                    self.initDom(res.list)
                },
                error: function (err) {
                    console.log(err)
                    $('.xt_video').html(nodataVideos + nodataActivity2)
                }
            })
        },
        //数据处理
        initDom: function (data) {
            let str = ''
            for (let i = 0; i < data.length; i++) {
                const e = data[i];
                str += '<div class="video">' +
                    '<a href="https://www.igo.cn/study/video/play.shtml?xtwtid' + e.SV_ID + '" target="_blank">' +
                    '<video poster="' + e.SV_LINKS + '?x-oss-process=video/snapshot,t_10,f_jpg,w_200">' +
                    '</video>' +
                    '<img src="/images/play.png" alt="" class="po_center">' +
                    '<p class="dis_c"><span>' + e.SV_NAME + '</span></p>' +
                    '</a>' +
                    '</div>'
            }
            $('.xt_video').find('.videos').find('.loading').remove()
            $('.xt_video').find('.videos').html(str)
        }
    }
    // 待回放
    let outTime_data = {
        //函数执行,ajax调用
        init: function (len) {
            let self = this;
            $.ajax({
                type: 'POST',
                url: 'https://phppc.xt.cn/pscript/php/api/xcx.api.php',
                data: {
                    action: 'getactlist',
                    expire: 1,
                    page: 1,
                    perpage: 9999
                },
                dataType: 'JSON',
                success: function (res) {
                    self.initDom(res.list, len)
                },
                error: function (err) {
                    console.log(err)
                }
            })
        },
        //数据处理
        initDom: function (data, len) {
            let str = '', new_data = [];
            new_data = data.filter(function (item) {
                return item.ACT_PLAYLINK != ""
            })
            new_data.sort(function (a, b) {
                return new Date(b.ACT_TIMESTART) - new Date(a.ACT_TIMESTART)
            })
            new_data.length = len
            for (let i = 0; i < new_data.length; i++) {
                const e = new_data[i];
                let link = 'https://www.igo.cn/study/live/play.shtml'
                str +=
                    '<li class="item dis_e">' +
                    '<a href="' + link + '?act_id=' + e.ACT_ID + '" class="dis_c" target="_blank">' +
                    '<div class="time dis_c">' + e.ACT_TIMESTART + '</div>' +
                    '<div class="img">' +
                    '<img src="' + e.ACT_PIC + '" alt="' + e.ACT_NAME + '">' +
                    '<span class="dis_c"><i class="green"></i>听回放</span>' +
                    '</div>' +
                    '<p class="i_t">' + e.ACT_NAME + '</p>' +
                    '</a>' +
                    '</li>'
            }
            $('.xt_video').find('.item_box').append(str)
            $('.xt_video').find('.item_box').find('.loading').remove()
        }
    }
    // 待直播
    let getAct0 = {
        //函数执行,ajax调用
        init: function () {
            let self = this;
            $.ajax({
                type: "POST",
                url: "https://phppc.xt.cn/pscript/php/api/xcx.api.php",
                data: {
                    action: "getactlist",
                    expire: 2,
                    page: 1,
                    perpage: 9999,
                },
                dataType: "JSON",
                success: function (res) {
                    self.initDom(res.list);
                },
                error: function (err) {
                    console.log(err);
                },
            });
        },
        //数据处理
        initDom: function (data) {
            // 获取所近活动
            let date = new Date(),
                new_data = [], //活动
                s_data = [],  //时间未过期的活动
                l_data = [],  //时间已过期，存在周期时间长的活动
                length = 4,
                str = "",
                outLink_arr = [],
                link = ""

            // 除去当前小于当前日期的数据
            data.forEach(function (e, i) {
                let time = e.ACT_TIMESTART.replace('.', '/').replace('.', '/')
                let timeend = e.ACT_TIMEEND.replace('.', '/').replace('.', '/')
                if (e.ACT_ISSHOW == 1) {
                    if (new Date(timeend) - date > 0) {
                        l_data.push(e)
                        if (new Date(time) - date > 0) {
                            s_data.push(e)
                        }
                    }

                }
            })
            new_data = s_data.length > 0 ? s_data : l_data
            if (new_data.length == 0) {
                length = 5
            } else {
                // 获取与当前日期最近的活动
                new_data.sort(function (a, b) {
                    return new Date(a.ACT_TIMESTART.replace('.', '/').replace('.', '/')) - new Date(b.ACT_TIMESTART.replace('.', '/').replace('.', '/'))
                })
                new_data = new_data[0]
                if (new_data.ACT_OUTLINK && new_data.ACT_OUTLINK != " ") {
                    outLink_arr = new_data.ACT_OUTLINK.split(',')
                    if (outLink_arr.length > 0 && outLink_arr[0] != " " && outLink_arr[0] != "") {
                        outLink_arr.forEach(function (e) {
                            if (e.indexOf("https://m.igo.cn/") >= 0) {
                                outLink_m = e
                            } else {
                                outLink_p = e
                            }
                        })
                    }
                    link = outLink_p
                }
                else {
                    link = 'https://www.igo.cn/study/live/?act_id=' + new_data.ACT_ID
                }
                str = '<li class="item dis_e">' +
                    '<a href="' + link + '" class="dis_e" target="_blank">' +
                    '<div class="time dis_c">' + new_data.ACT_TIMESTART + '</div>' +
                    '<div class="img">' +
                    '<img src="' + new_data.ACT_PIC + '" alt="' + new_data.ACT_NAME + '">' +
                    '<span class="dis_c"><i class="red"></i>待直播</span>' +
                    '</div>' +
                    '<p class="i_t">' + new_data.ACT_NAME + '</p>' +
                    '</a>' +
                    '</li>'
            }

            $('.xt_video').find('.item_box').append(str)
            outTime_data.init(length)
        },
    };

    // 获取视频
    video_list.init()
    // 获取所有活动
    // getAct0.init()


    let getAct = {
        //函数执行,ajax调用
        init: function (e) {
            let self = this;
            $.ajax({
                type: 'POST',
                url: 'https://phppc.xt.cn/pscript/php/api/xcx.api.php',
                data: {
                    action: 'getchannellivelist2',
                    recentlimit: 1,
                    upcominglimit: 50,
                    expiredlimit: 15,
                    ongoinglimit: 30,
                },
                dataType: 'JSON',
                success: function (res) {
                    if (res.code == 1) {
                        self.initDom(res.list, e)
                        self.initDom2(res.list, e)
                    }
                },
                error: function (err) {
                    $('.hot_activity').html(nodataActivity1)
                }
            })
        },
        str: function (t1, t2, data) {
            let d = ""
            const link = data.ACT_OUTLINK ? data.ACT_OUTLINK : 'https://www.igo.cn/study/live/?act_id=' + data.ACT_ID
            if (t1 == 'end') {
                timestr = ""
            }
            d =
                '<a class="dis-f ' + t1 + '" href="' + link + '" target="_blank">' +
                '<span class="date">' + data.ACT_TIMESTART.substring(5, 10) + '</span>' +
                '<i></i>' +
                '<div class="right">' +
                '<p title="' + data.ACT_NAME + '">' + data.ACT_NAME + '</p>' +
                '<p class="time">' + data.ACT_TIMESTART.substring(10, 16) + '</p>' +
                '</div>' +
                '<div class="activitybtn dis-c" onclick="leyubtn()">' + t2 + '</div>' +
                '</a>'
            return d
        },
        //数据处理
        initDom: function (data, e) {
            let _recent = data.list_recent[0] || null,
                _coming = data.list_upcoming,
                _ongoing = data.list_ongoing.reverse(),
                _expired = data.list_expired,
                that = this
            let str = ''
            let hotact = ""
            if (!_recent && _coming.length > 0) {
                _recent = _coming[0]
                _coming.shift()
            } else if (!_recent && _ongoing.length > 0) {
                _recent = _ongoing[0]
                _ongoing.shift()
            } else if (!_recent && _expired.length > 0) {
                _recent = _expired[0]
                _expired.shift()
            }
            hotact = '<p>' + _recent.ACT_NAME + '</p>' +
                '<p class="time">直播时间：' + _recent.ACT_TIMESTART.substring(5, 19) + '</p>' +
                '<img src="' + _recent.ACT_PIC + '" alt=""></img>' +
                '<span class="bg"  style="background-image:url(' + _recent.ACT_PIC + ')"></span>'
            $('.hotActivity').html(hotact).attr('href', _recent.ACT_OUTLINK ? _recent.ACT_OUTLINK : 'https://www.igo.cn/study/live/?act_id=' + _recent.ACT_ID)

            if (_coming.length > 0) {
                for (let i = 0; i < _coming.length; i++) {
                    str += that.str('', '预约', _coming[i])
                }
            }
            if (_ongoing.length > 0) {
                for (let i = 0; i < _ongoing.length; i++) {
                    str += that.str('', '预约', _ongoing[i])
                }
            }
            if (_expired.length > 0) {
                for (let i = 0; i < _expired.length; i++) {
                    str += that.str("end", (_expired[i].ACT_PLAYLINK != "" ? "听回放" : "已结束"), _expired[i])
                }
            }
            $('.hot_activity .list').html(str)
        },
        initDom2: function (data, e) {
            let _recent = data.list_recent[0] || null
            let _expired = data.list_expired
            if (!_recent && data.list_upcoming.length > 0) {
                _recent = data.list_upcoming[0]
            } else if (!_recent && data.list_ongoing.length > 0) {
                _recent = data.list_ongoing[0]
            } else if (!_recent && data.list_expired.length > 0) {
                _recent = data.list_expired[0]
                _expired.shift()
            }
            let _recentLink = _recent.ACT_OUTLINK ? _recent.ACT_OUTLINK : 'https://www.igo.cn/study/live/?act_id=' + _recent.ACT_ID
            let str = ""
            if (_recent) {
                str = '<li class="item dis_e">' +
                    '<a href="' + _recentLink + '" class="dis_e" target="_blank">' +
                    '<div class="time dis_c">' + _recent.ACT_TIMESTART.substring(0, 16) + '</div>' +
                    '<div class="img">' +
                    '<img src="' + _recent.ACT_PIC + '" alt="' + _recent.ACT_NAME + '">' +
                    '<span class="dis_c"><i class="red"></i>待直播</span>' +
                    '</div>' +
                    '<p class="i_t">' + _recent.ACT_NAME + '</p>' +
                    '</a>' +
                    '</li>'
            }

            const Fdata = _expired.filter((e) => e.ACT_PLAYLINK != "");
            for (let i = 0; i < 4; i++) {
                const e = Fdata[i];
                if (e.ACT_PLAYLINK) {
                    let link = 'https://www.igo.cn/study/live/play.shtml?act_id=' + e.ACT_ID
                    str += '<li class="item dis_e">' +
                        '<a href="' + link + '" class="dis_e" target="_blank">' +
                        '<div class="time dis_c">' + e.ACT_TIMESTART.substring(0, 16) + '</div>' +
                        '<div class="img">' +
                        '<img src="' + e.ACT_PIC + '" alt="' + e.ACT_NAME + '">' +
                        '<span class="dis_c"><i class="green"></i>听回放</span>' +
                        '</div>' +
                        '<p class="i_t">' + e.ACT_NAME + '</p>' +
                        '</a>' +
                        '</li>'
                }
            }
            $('.xt_video').find('.item_box').html(str)
        }
    }
    getAct.init()


    //乐语按钮
    $('body').on('click', '.j_leyu_href', function (event) {
        leyubtn()
        return false;
    });
}())


