'use strict';
/**
*
*
* @author Zhong
* @date 2018/11/30
* @version
*/
//header相关的公共操作接口
const CommonHeader = (function () {
//帮助-联系客服
const csDom = $('#customerService');
//获取办事处客服列表
//@param {Number}category @return {void}
function getCategoryList(category = -1, titile = '') {
if (titile) {
$('#upgrade-title').text(titile);
}
$.ajax({
type: 'get',
url: '/cld/getCategoryStaff?category=' + category,
dataType: 'json',
timeout: 5000,
success: function (response) {
if (response.error !== 0) {
alert('获取CLD人员信息失败!');
} else {
let staffList = response.data;
let staffhtml = '';
$.each(staffList, function (key, staff) {
staffhtml += '
' +
'
' +
'
' +
'
' + staff.username + '
' +
'' + staff.category + '
' +
' ' +
'
' +
'- ' + staff.qq + '
' +
'- ' + staff.telephone + '
' +
'- ' + staff.phone + '
' +
'
';
});
$('#staffList').html(staffhtml);
$('#activ').modal('show');
}
},
error: function () {
console.log('请求超时');
}
})
}
//绑定事件
//@return {void}
function addEventListener(){
csDom.click(function () {
getCategoryList(-1, '联系客服');
});
}
//取消浏览器自带右键
//@return {void}
function banNavigatorContextMenu() {
document.oncontextmenu = function(event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
}
return {getCategoryList, addEventListener, banNavigatorContextMenu};
})();
CommonHeader.banNavigatorContextMenu();
$(document).ready(function(){
CommonHeader.addEventListener();
});