(function () {
    //数据
    var studentSeeData = {
        dataTimeList: [{
            value: "0",
            text: "-学年第-学期"
        }],
        data: {
            dataList: [
                { name: '酒店管理2（礼仪、会议）', achievement: '96' }
            ]
        }
    }

    var dataTimeList = studentSeeData.dataTimeList;
    var page = {
        isScroll: false,
        init: function ($page) {
            //获取学年学期列表
            learun.httpget(config.webapi + "StuPunishment/academicAndSemesterList", {}, (data) => {
                if (data == null || data.length <= 0) {
                    $('.studSeeSec2 .tips').show();
                    return;
                }
                studentSeeData.dataTimeList = data;
                dataTimeList = studentSeeData.dataTimeList;
                //获取列表
                getListAjax(dataTimeList[0].value);
                //学年学期选择框
                $page.find('.studSeeSec1Box').lrpicker({
                    placeholder: dataTimeList[0].text,
                    data: dataTimeList,
                    callbacks: function (res) {
                        getListAjax(res.value)
                    }
                });
            });

        }
    };
    //数据处理
    function getListAjax(id) {
        var param = { value: id };
        learun.httpget(config.webapi + "StuPunishment/punishmentList", param, (data) => {
            var html = '';
            $.each(data, function (i, n) {
                html += '<li>';
                html += '<div><b>' + n.PunishName + '</b>';
                if (n.WithdrawDate != null) {
                    html += '<b>【已撤销】</b>';
                }
                html += '</div > ';
                html += '<div>' + n.PunishReason + '</div>';
                html += '<div class="dateRow">处分日期：' + n.PunishDate + '</div>';
                if (n.WithdrawDate != null) {
                    html += '<div class="dateRow">撤销日期：' + n.WithdrawDate + '</div>';
                }
                html += '</li>';
            });
            $('.studSeeSec2List').html(html);
        });
    }
    return page;
})();