info-controller.js
2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* 验证结果控制器
*/
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)
me.popstate();
};
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();
},
});
}
ctrl.popstate = function () {
window.addEventListener("popstate", function (e) {
// 监听到了浏览器的返回按钮事件,根据自己的需求实现自己的功能
window.location.href = url.to('check#index');
}, false);
}
return ctrl;
}
);