1.首先在dwz.core.js中添加403的状态。
statusCode: {ok:200, error:300, timeout:301, forbidden:403},
2.添加ajaxDone响应逻辑。
ajaxDone:function(json){
if (json.statusCode === undefined && json.message === undefined) { // for iframeCallback
if (alertMsg) return alertMsg.error(json);
else return alert(json);
}
if(json.statusCode == DWZ.statusCode.error) {
if(json.message && alertMsg) alertMsg.error(json.message);
} else if (json.statusCode == DWZ.statusCode.timeout) {
if(alertMsg) alertMsg.error(json.message || DWZ.msg("sessionTimout"), {okCall:DWZ.loadLogin});
else DWZ.loadLogin();
} else if (json.statusCode == DWZ.statusCode.forbidden) {
if(alertMsg) alertMsg.error(json.message || DWZ.msg("forbidden"));
else navTab.closeCurrentTab();
} else {
if(json.message && alertMsg) alertMsg.correct(json.message);
};
},
3.添加$.ajax中的success响应逻辑。
if (json.statusCode==DWZ.statusCode.forbidden){
alertMsg.error(json.message || DWZ.msg("forbidden"), {okCall:function(){
if ($.pdialog) $.pdialog.checkTimeout();
if (navTab) navTab.checkTimeout();
// 关闭当前Tab
navTab.closeCurrentTab();
}});
}
4.在dwz.frag.xml中添加默认状态信息。
<_MSG_ id="forbidden"><![CDATA[权限不足!]]></_MSG_>
DWZ其他参考教程: http://blog.csdn.net/jiweigang1/article/category/890878