info-controller.js 1.78 KB
/**
 * 验证结果控制器
 */
define(
    "check/info-controller",
    [
        'mk7/controller',
        'mk7/url',
        'mk7/utils',
        'mk7/modals',
        'mk7/jweixin'
    ],
    function (ctrl, url, utils, modals, jweixin) {
        var ctrl = new ctrl();
        var $$ = Dom7;
        var t7 = Template7;

        ctrl.run = function () {
            var me = this;
            me.setPageTitle("验证结果");
            me.loadData(me.params.uuid, me.params.number_code)
        };

        ctrl.bindEvents = function () {
            var me = this;
            $$(".back-button").click(function () {
                window.history.go(-1);
            });
        };

        ctrl.loadData = function (uuid, numberCode) {
            var me = this;
            $$.ajax({
                method : "POST",
                url: url.to('check/default/get-info'),
                data : {uuid: uuid, number_code: numberCode},
                dataType : "json",
                beforeSend : function(){
                    me.showIndicator();
                },
                success : function(res){
                    try {
                        if(res.success) {
                            me.render(res.data);
                        } else {
                            utils.toast({content:res.message, closeDelay:3000});
                        }
                    } catch(ex) {
                        utils.toast({content:'出错', closeDelay:3000});
                    }
                },
                error : function(res){
                    utils.toast({content:"提交出错,请联系系统管理员"});
                },
                complete : function(res){
                    me.hideIndicator();
                },
            });
        }
        return ctrl;
    }
);