diff --git a/api/commonRequest.js b/api/commonRequest.js index 22c4448..d44b516 100644 --- a/api/commonRequest.js +++ b/api/commonRequest.js @@ -1,5 +1,5 @@ -let aqEnnable = true // 参数加密开关 -const commonUrl = "http://10.40.92.105:18080/zhgd/"; +let aqEnnable = false // 参数加密开关 +const commonUrl = "http://10.40.92.33:18080/zhgd/"; /* 登录相关 */ const login_url = commonUrl + "auth/login"; // 登录url const login_out = commonUrl + "auth/logout"; // 登出url @@ -10,7 +10,7 @@ const login_sg_index = "http://10.40.92.33:8100/pages/home/navigation.html" // const login_sc_index = "http://10.40.92.33:8101/pages/web/index.html" // 省侧大屏首页 /* POST 请求 */ -function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType,isAes) { +function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType, isAes) { $.ajax({ url: url, type: type, @@ -33,7 +33,8 @@ function ajaxRequest2(url, type, token, successFn, errorFn) { url: url, type: type, headers: { - "authorization": token + "authorization": token, + "decrypt": 'decrypt' }, success: successFn, error: errorFn @@ -66,9 +67,9 @@ function ajaxRequestGetExport(url, type, async, beforeFn, successFn, errorFn, is "authorization": sessionStorage.getItem("zhgd_token"), "decrypt": isAes ? '' : 'decrypt' }, - xhrFields: { - responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob - }, + xhrFields: { + responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob + }, async: async, beforeSend: beforeFn, success: successFn, diff --git a/js/login/login.js b/js/login/login.js index 574f2bd..be85304 100644 --- a/js/login/login.js +++ b/js/login/login.js @@ -18,8 +18,8 @@ layui.use(function () { } let encryptStr = encryptCBC(JSON.stringify(params)); ajaxRequest(login_url, "POST", encryptStr, true, function () { + $('.layui-btn-fluid').empty().append('登录中,请稍后...').attr("disabled", true); }, function (result) { - console.log(result); if (result.code === 200) { top.layer.msg(result.msg, { icon: 1, time: 500 }, function () { sessionStorage.setItem("zhgd_token", result.data.access_token); @@ -37,6 +37,7 @@ layui.use(function () { } }, function (xhr, status, error) { error(xhr, status, error) - }, "application/json",aqEnnable); + $('.layui-btn-fluid').empty().append('登 录'); + }, "application/json", aqEnnable); }); }); \ No newline at end of file diff --git a/js/pages/home/navigation.js b/js/pages/home/navigation.js index 0f0598e..642423c 100644 --- a/js/pages/home/navigation.js +++ b/js/pages/home/navigation.js @@ -7,6 +7,7 @@ layui.use(['layer', 'element'], function () { const bidCodeParam = GetQueryString('bidCode'); const tokenParam = GetQueryString('token'); if (bidCodeParam && tokenParam) { + aqEnnable = !aqEnnable ? true : true; // 省侧大屏跳转施工大屏 调用后台返回用户信息 bidCode = decryptCBC(bidCodeParam); const token = decryptCBC(tokenParam); @@ -68,18 +69,25 @@ function reloadMenuData(us, bidCode) { } /* 初始化菜单 */ -function setMenusData(menus) { - let html = ''; - if (menus && menus.length > 0) { - $.each(menus[0].childer, function (index, item) { - if (index === 0) { - html += '
  • ' + item.menuName + '

  • ' - } else { - html += '
  • ' + item.menuName + '

  • ' - } +function setMenusData(data) { + if (data && data.length > 0) { + const menus = data.filter(item => { + return item.menuName === '施工大屏' }) + let html = ''; + if (menus && menus.length > 0) { + $.each(menus[0].childer, function (index, item) { + if (index === 0 && item.menuName !== '数据操作') { + html += '
  • ' + item.menuName + '

  • ' + } else if (index !== 0 && item.menuName !== '数据操作') { + html += '
  • ' + item.menuName + '

  • ' + } else if (item.menuName === '数据操作') { + html += '
  • ' + item.menuName + '

  • ' + } + }) + } + $('#nav-right ul').empty().append(html); } - $('#nav-right ul').empty().append(html); } /* 初始化用户绑定标段工程 */ @@ -110,4 +118,18 @@ const GetQueryString = (name) => { /* 返回省侧大屏 */ $('#nav-left button').on('click', function () { window.location.href = login_sc_index; -}) \ No newline at end of file +}) + +/* 跳转后台 */ +function goBackground() { + aqEnnable = !aqEnnable ? true : true; + const params = { + 'token': token + }; + // 将参数转换为查询字符串 + const queryString = Object.keys(params) + .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(encryptCBC(params[key]))) + .join('&'); + const hrefUrl = "http://10.40.92.113:9527/#/sso" + "?" + queryString; + const newWindow = window.open(hrefUrl,'newwindow'); +} \ No newline at end of file diff --git a/pages/web/index.html b/pages/web/index.html index fc33498..5c9a0f4 100644 --- a/pages/web/index.html +++ b/pages/web/index.html @@ -23,7 +23,7 @@
    diff --git a/sg_login.html b/sg_login.html index 9a4dccf..af49dc1 100644 --- a/sg_login.html +++ b/sg_login.html @@ -40,7 +40,8 @@
    - +