{"size": 2226, "ext": "js", "max_stars_repo_path": "mip-ppkao-calenderslide/mip-ppkao-calenderslide.js", "max_stars_repo_name": "mipengine/mip-extensions-platform", "max_stars_repo_stars_event_min_datetime": "2017-07-07T01:15:46.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-28T06:26:57.000Z", "max_issues_repo_path": "mip-ppkao-calenderslide/mip-ppkao-calenderslide.js", "max_issues_repo_name": "mipengine/mip-extensions-platform", "max_issues_repo_issues_event_min_datetime": "2017-02-15T11:01:58.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-22T03:05:38.000Z", "max_forks_repo_path": "mip-ppkao-calenderslide/mip-ppkao-calenderslide.js", "max_forks_repo_name": "mipengine/mip-extensions-platform", "max_forks_repo_forks_event_min_datetime": "2017-03-02T06:39:22.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-02T06:49:31.000Z"}
{"max_stars_count": 35, "max_issues_count": 48, "max_forks_count": 86, "avg_line_length": 36.4918032787, "max_line_length": 114, "alphanum_fraction": 0.4456424079}
/**
 * @file mip-ppkao-calenderslide 组件
 * @author
 */

define(function (require) {
    var $ = require('zepto');
    var customElement = require('customElement').create();

    /**
     * 第一次进入可视区回调，只会执行一次
     */
    customElement.prototype.firstInviewCallback = function () {
        var ele = this.element;
        var showmore = $(ele);
        var button = showmore.parents('.kaoshi-fenlei').find('.title');
        $('mip-ppkao-calenderslide').hide();
        button.on('click', function () {
            showmore.toggle(400);
        });
        var calenderContainer = showmore.parents('.kaoshi-fenlei').find('.calender-container');
        var xscs = true;
        var url = '//api.ppkao.com/Interface/PageAPI.ashx?action=Get_ksTimeInfo';
        showmore.find('.kemulist li').on('click', function () {
            button.find('b').text($(this).text());
            var CategoryID = $(this).data('categoryid');
            var ChannelID = $(this).data('channelid');
            getInfoClick(CategoryID, ChannelID);
            function getInfoClick(CategoryID, ChannelID) {
                if (xscs) {
                    calenderContainer.html(
                        '<div class=\'loading\'>'
                    +        '<mip-img src=\'http://static.ppkao.com/phone/new/image/sx.gif\'></mip-img> 正在加载...'
                    +    '</div>'
                    );
                    viewMore(CategoryID, ChannelID);
                }
            }
            function viewMore(CategoryID, ChannelID) {
                xscs = false;
                $.ajax({
                    url: url + '&CategoryID=' + CategoryID + '&ChannelID=' + ChannelID,
                    type: 'POST',
                    dataType: 'json',
                    cache: false,
                    success: function (data) {
                        xscs = true;
                        var list = data;
                        if (list.List === '') {
                            return;
                        }
                        calenderContainer.html(list.List);
                    }
                });
            }
        });
    };

    return customElement;
});
