79 lines
1.8 KiB
JavaScript
79 lines
1.8 KiB
JavaScript
apiready = function() {
|
|
var ctrl = {
|
|
id: null,
|
|
type: null,
|
|
init: {},
|
|
bind: {},
|
|
|
|
initVerifyNotice: {},
|
|
}
|
|
|
|
ctrl.init = function() {
|
|
// 适配安卓状态栏
|
|
CommonModel.fitInStatusBar();
|
|
this.id = api.pageParam.messageId;
|
|
this.type = api.pageParam.type;
|
|
this.bind();
|
|
|
|
switch (this.type) {
|
|
case 4001: //审核通知
|
|
this.initVerifyNotice();
|
|
break;
|
|
default:
|
|
|
|
}
|
|
}
|
|
|
|
ctrl.bind = function() {
|
|
//点击返回按钮
|
|
$api.addEvt($api.dom("#back"), "touchend", function() {
|
|
api.closeWin();
|
|
})
|
|
}
|
|
|
|
//显示审核通知
|
|
ctrl.initVerifyNotice = function() {
|
|
var url = '/ems/rest/message';
|
|
var args = {
|
|
msgId: this.id
|
|
};
|
|
|
|
$api.get(url, args, function(data, err) {
|
|
|
|
if (data && data.code == '200' && data.body) {
|
|
|
|
var msg = data.body;
|
|
var content = msg.msgDetail;
|
|
$('#content').html(content);
|
|
var dateUtils = new DateUtils();
|
|
var time = dateUtils.getFormattedDate(dateUtils.setDate(msg.createTime))
|
|
$('#time').html(time);
|
|
|
|
} else if (data.code == 404) {
|
|
var msg = "消息已过期";
|
|
var messageId = api.pageParam.messageId;
|
|
toast(msg);
|
|
api.sendEvent({
|
|
name: 'removeMessage',
|
|
extra: {
|
|
messageId: messageId
|
|
}
|
|
});
|
|
|
|
window.setTimeout(function() {
|
|
api.closeWin();
|
|
}, 2000);
|
|
|
|
} else {
|
|
|
|
toast('网络错误:' + data.code);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
ctrl.init();
|
|
}
|