'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 + '
' + '
' + '
'; }); $('#staffList').html(staffhtml); $('#activ').modal('show'); } }, error: function () { console.log('请求超时'); } }) } //绑定事件 //@return {void} function addEventListener(){ csDom.click(function () { getCategoryList(-1, '联系客服'); }); } return {getCategoryList, addEventListener} })(); $(document).ready(function(){ CommonHeader.addEventListener(); });