1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- '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 += '<div class="col-4 mb-4"> ' +
- '<div class="card"> ' +
- '<div class="card-body"> ' +
- '<h4 class="card-title">' + staff.username + '</h4> ' +
- '<h6 class="card-subtitle mb-2 text-muted">' + staff.category + '</h6> ' +
- '</div> ' +
- '<ul class="list-group list-group-flush"> ' +
- '<li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="腾讯QQ"><i class="fa fa-qq"></i> ' + staff.qq + '</li> ' +
- '<li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="手机号码"><i class="fa fa-tablet"></i> ' + staff.telephone + '</li> ' +
- '<li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="固定电话"><i class="fa fa-phone"></i> ' + staff.phone + '</li> ' +
- '</ul> </div> </div>';
- });
- $('#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();
- });
|