/** Admin-only sensitive-information viewer. Every request is audited by the server. */
|
var SensitiveInfo = {
|
view: function (url, showIdCard) {
|
layer.confirm('查看完整敏感信息将记录操作日志,是否继续?', {
|
icon: 3,
|
title: '敏感信息查看'
|
}, function (index) {
|
$.ajax({
|
url: Feng.ctxPath + url,
|
type: 'GET',
|
success: function (data) {
|
layer.close(index);
|
if (!data) {
|
Feng.info('未查询到敏感信息');
|
return;
|
}
|
// 弹窗只展示手机号;接口中的 id、name 等定位字段不应暴露给页面。
|
var phone = data.phone || data.mobile || data.telephone || data.tel || data.name;
|
if (!phone) {
|
Feng.info('未查询到手机号');
|
return;
|
}
|
var fields = '<div class="form-group">'
|
+ '<label class="col-sm-4 control-label">手机号:</label><div class="col-sm-8">'
|
+ '<p class="form-control-static">' + SensitiveInfo.escape(String(phone))
|
+ '</p></div></div>';
|
if (showIdCard && data.idCard) {
|
fields += '<div class="form-group">'
|
+ '<label class="col-sm-4 control-label">身份证号:</label><div class="col-sm-8">'
|
+ '<p class="form-control-static">' + SensitiveInfo.escape(String(data.idCard))
|
+ '</p></div></div>';
|
}
|
var content = '<div class="form-horizontal" style="padding:20px">' + fields + '</div>';
|
layer.open({type: 1, title: '敏感信息', area: ['480px', 'auto'], content: content});
|
},
|
error: function (xhr) {
|
layer.close(index);
|
Feng.error(xhr.responseJSON && xhr.responseJSON.message ? xhr.responseJSON.message : '敏感信息查询失败');
|
}
|
});
|
});
|
},
|
escape: function (value) {
|
return value.replace(/[&<>'"]/g, function (char) {
|
return {'&': '&', '<': '<', '>': '>', "'": ''', '"': '"'}[char];
|
});
|
}
|
};
|