class pageExclusivePlan {
    constructor() {
        this.init()

    }

    init() {
        var _self = this;
        $('.plan-list-wrap').on('click', '.common-look-more', function (e) {
            var $this = $(this);
            var href = $this.prev().find('#pageNum span:last-child a').attr('href');
            var url = location.origin + location.pathname + href;

            $.get(url, function (ret) {
                var $ele = $(ret).find('.plan-list').children()
                $this.prev().find('#pageNum').remove();
                var index = $ele.find("#pageNow").index()
                var totalpage = $ele.filter("#pageNum").children().length;
                if (index == totalpage - 1)
                    $this.remove()
                $(".plan-list-wrap .plan-list").append($ele)
            })

            e.preventDefault()
        })

        this.checkPage()
    }
    //检查是否只有一页，只有一页则隐藏加载更多按钮
    checkPage() {
        if ($('#pageNum').children().length == 1)
            $('.common-look-more').remove()
    }
}

$(() => {
    new pageExclusivePlan
})
