This commit is contained in:
parent
14f0d1402f
commit
41e1b5ba31
|
|
@ -3,7 +3,11 @@ const commonUrl = "http://10.40.92.33:18080/zhgd/";
|
|||
/* 登录相关 */
|
||||
const login_url = commonUrl + "auth/login"; // 登录url
|
||||
const login_out = commonUrl + "auth/logout"; // 登出url
|
||||
const login_page = "http://127.0.0.1:8100/login.html" // 登录页面
|
||||
const page_jump = commonUrl + "auth/pageJump"; // 登出url
|
||||
const login_sg_page = "http://10.40.92.33:8101/sg_login.html" // 施工大屏登录页面
|
||||
const login_sc_page = "http://10.40.92.33:8100/sc_login.html" // 省侧大屏登录页面
|
||||
const login_sg_index = "http://10.40.92.33:8101/pages/home/navigation.html" // 施工大屏首页
|
||||
const login_sc_index = "http://10.40.92.33:8100/pages/web/index.html" // 省侧大屏首页
|
||||
|
||||
// ajax 请求封装
|
||||
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType) {
|
||||
|
|
@ -11,7 +15,7 @@ function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, conte
|
|||
url: url,
|
||||
type: type,
|
||||
headers: {
|
||||
"authorization": localStorage.getItem("zhgd_token")
|
||||
"authorization": sessionStorage.getItem("zhgd_token")
|
||||
},
|
||||
data: data,
|
||||
async: async,
|
||||
|
|
@ -20,4 +24,17 @@ function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, conte
|
|||
success: successFn,
|
||||
error: errorFn
|
||||
});
|
||||
}
|
||||
|
||||
/* 施工大屏跳转 ajax请求封装 */
|
||||
function ajaxRequest2(url, type, token, successFn, errorFn) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: type,
|
||||
headers: {
|
||||
"authorization": token
|
||||
},
|
||||
success: successFn,
|
||||
error: errorFn
|
||||
});
|
||||
}
|
||||
|
|
@ -22,14 +22,53 @@ html {
|
|||
width: 27%;
|
||||
height: 100%;
|
||||
}
|
||||
#nav-left p{
|
||||
margin-top: 50px;
|
||||
|
||||
#nav-left button {
|
||||
position: absolute;
|
||||
left: 22%;
|
||||
top: 1.5%;
|
||||
width: 80px;
|
||||
height: 40px;
|
||||
background-position: center center !important;
|
||||
color: #00FFF4;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#nav-left form {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
align-items: self-end;
|
||||
}
|
||||
|
||||
.layui-form-select {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.layui-form-select .layui-input {
|
||||
background-color: transparent;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to bottom, #DAF8F4FF, #44DEC9FA);
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
font-weight: bold;
|
||||
border-color: #2EA699;
|
||||
}
|
||||
|
||||
.layui-form-select .layui-edge {
|
||||
border-top-color: #2EA699;
|
||||
}
|
||||
|
||||
|
||||
.layui-input:hover,
|
||||
.layui-textarea:hover {
|
||||
border-color: #16b777 !important;
|
||||
}
|
||||
|
||||
#nav-icon {
|
||||
width: 120px;
|
||||
height: 30px;
|
||||
|
|
@ -37,10 +76,13 @@ html {
|
|||
left: 81%;
|
||||
top: 0.5%;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
#nav-icon img{
|
||||
|
||||
#nav-icon img {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#nav-right {
|
||||
width: 73%;
|
||||
height: 100%;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ html {
|
|||
color: #fff;
|
||||
}
|
||||
|
||||
.layui-input:hover, .layui-textarea:hover {
|
||||
border-color: #16b777 !important;
|
||||
}
|
||||
|
||||
input::-webkit-input-placeholder {
|
||||
color: rgb(153, 152, 152) !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,33 @@ layui.use(function () {
|
|||
layer = layui.layer;
|
||||
form.on('submit(demo-login)', function (data) {
|
||||
let field = data.field;
|
||||
let loginType = "";
|
||||
let hrefUrl = window.location.href;
|
||||
if (hrefUrl && hrefUrl.indexOf("sg_login") > 0) {
|
||||
loginType = "2"
|
||||
} else if (hrefUrl && hrefUrl.indexOf("sc_login") > 0) {
|
||||
loginType = "1"
|
||||
}
|
||||
const params = {
|
||||
"username": field.username,
|
||||
"password": field.password,
|
||||
"loginType": "2"
|
||||
"loginType": loginType
|
||||
}
|
||||
let encryptStr = encryptCBC(JSON.stringify(params));
|
||||
ajaxRequest(login_url, "POST", encryptStr, true, function () {
|
||||
}, function (result) {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
top.layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
|
||||
localStorage.setItem("zhgd_token", result.data.access_token);
|
||||
localStorage.setItem("zhgd_us", result.data.us);
|
||||
window.location.href = "pages/home/navigation.html";
|
||||
top.layer.msg(result.msg, { icon: 1, time: 500 }, function () {
|
||||
sessionStorage.setItem("zhgd_token", result.data.access_token);
|
||||
sessionStorage.setItem("zhgd_us", result.data.us);
|
||||
const us = JSON.parse(result.data.us);
|
||||
sessionStorage.setItem("zhgd_type", us.jumpType);
|
||||
if (us.jumpType === '2') {
|
||||
window.location.href = "pages/home/navigation.html";
|
||||
} else if (us.jumpType === '1') {
|
||||
window.location.href = "pages/web/index.html";
|
||||
}
|
||||
});
|
||||
} else if (result.code === 500) {
|
||||
layer.msg(result.msg, { icon: 2 });
|
||||
|
|
|
|||
|
|
@ -1,18 +1,104 @@
|
|||
let element, layer;
|
||||
let element, layer, bidCode;
|
||||
layui.use(['layer', 'element'], function () {
|
||||
element = layui.element;
|
||||
layer = layui.layer;
|
||||
// 获取地址栏上的参数
|
||||
const bidCodeParam = GetQueryString('bidCode');
|
||||
const tokenParam = GetQueryString('token');
|
||||
if (bidCodeParam && tokenParam) {
|
||||
// 省侧大屏跳转施工大屏 调用后台返回用户信息
|
||||
bidCode = decryptCBC(bidCodeParam);
|
||||
const token = decryptCBC(tokenParam);
|
||||
ajaxRequest2(page_jump, "GET", token, function (result) {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
sessionStorage.setItem("zhgd_token", result.data.access_token);
|
||||
sessionStorage.setItem("zhgd_us", result.data.us.sysUser);
|
||||
sessionStorage.setItem("zhgd_type", result.data.us.sysUser.jumpType);
|
||||
reloadMenuData(result.data.us.sysUser, bidCode);
|
||||
$('#nav-left button').removeAttr('style')
|
||||
} else if (result.code === 500) {
|
||||
layer.msg(result.msg, { icon: 2 }, function () {
|
||||
window.location.href = login_sc_index;
|
||||
});
|
||||
} else if (result.code === 401) {
|
||||
layer.msg(result.msg, { icon: 2 }, function () {
|
||||
loginout(1);
|
||||
});
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
} else {
|
||||
// 由施工大屏登录
|
||||
reloadMenuData(JSON.parse(us), bidCode);
|
||||
}
|
||||
});
|
||||
|
||||
$('#indexIframe').attr('src', '../index/index.html');
|
||||
|
||||
$('#nav-right ul li').on('click', function () {
|
||||
$('#nav-right ul li').each(function (index, item) {
|
||||
if ($(this).hasClass('checked')) {
|
||||
$(this).removeClass('checked').addClass('nocheck');
|
||||
}
|
||||
/* 页面数据加载 */
|
||||
function reloadMenuData(us, bidCode) {
|
||||
let menus = us.menus;
|
||||
let bidCodeList = us.bidProVoList;
|
||||
setBandingPro(bidCodeList, bidCode);
|
||||
setMenusData(menus);
|
||||
if ($('#nav-right ul li').length > 0) {
|
||||
let hrefValue = $('#nav-right ul li').eq(0).attr('hrefValue');
|
||||
$('#indexIframe').attr('src', hrefValue);
|
||||
}
|
||||
$('#nav-right ul li').on('click', function () {
|
||||
$('#nav-right ul li').each(function (index, item) {
|
||||
if ($(this).hasClass('checked')) {
|
||||
$(this).removeClass('checked').addClass('nocheck');
|
||||
}
|
||||
})
|
||||
$(this).removeClass('nocheck').addClass('checked');
|
||||
const hrefValue = $(this).attr('hrefValue');
|
||||
$('#indexIframe').attr('src', hrefValue);
|
||||
})
|
||||
$(this).removeClass('nocheck').addClass('checked');
|
||||
const hrefValue = $(this).attr('hrefValue');
|
||||
$('#indexIframe').attr('src', hrefValue);
|
||||
}
|
||||
|
||||
/* 初始化菜单 */
|
||||
function setMenusData(menus) {
|
||||
let html = '';
|
||||
if (menus && menus.length > 0) {
|
||||
$.each(menus[0].childer, function (index, item) {
|
||||
if (index === 0) {
|
||||
html += '<li class="layout checked" hrefValue="' + item.url + '"><p>' + item.menuName + '</p></li>'
|
||||
} else {
|
||||
html += '<li class="layout nocheck" hrefValue="' + item.url + '"><p>' + item.menuName + '</p></li>'
|
||||
}
|
||||
})
|
||||
}
|
||||
$('#nav-right ul').empty().append(html);
|
||||
}
|
||||
|
||||
/* 初始化用户绑定标段工程 */
|
||||
function setBandingPro(bidCodeList) {
|
||||
let html = '';
|
||||
if (bidCodeList && bidCodeList.length > 0) {
|
||||
$.each(bidCodeList, function (index, item) {
|
||||
if (bidCode && bidCode === item.bidCode) {
|
||||
html += '<option value="' + item.bidCode + '" selected>' + item.proName + '</option>'
|
||||
} else {
|
||||
html += '<option value="' + item.bidCode + '">' + item.proName + '</option>'
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
$('#bidPro').empty().append(html);
|
||||
layui.form.render();
|
||||
}
|
||||
|
||||
/* 获取地址栏后的参数 */
|
||||
const GetQueryString = (name) => {
|
||||
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
let r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return decodeURIComponent(r[2]);
|
||||
return null;
|
||||
};
|
||||
|
||||
/* 返回省侧大屏 */
|
||||
$('#nav-left button').on('click', function () {
|
||||
window.location.href = login_sc_index;
|
||||
})
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
const token = localStorage.getItem("zhgd_token");
|
||||
const us = localStorage.getItem("zhgd_us");
|
||||
const token = sessionStorage.getItem("zhgd_token");
|
||||
const us = sessionStorage.getItem("zhgd_us");
|
||||
const zhgd_type = sessionStorage.getItem("zhgd_type");
|
||||
|
||||
/* 退出登录 */
|
||||
function loginout(type) {
|
||||
if (type) {
|
||||
localStorage.removeItem("zhgd_token");
|
||||
localStorage.removeItem("zhgd_us");
|
||||
sessionStorage.removeItem("zhgd_token");
|
||||
sessionStorage.removeItem("zhgd_us");
|
||||
sessionStorage.removeItem("zhgd_type");
|
||||
top.layer.confirm('登录已过期,请点击确定后重新登录!', {
|
||||
btn: ['确认', '取消'],
|
||||
move: false,
|
||||
cancel: function (index, layero) {
|
||||
top.location.href = login_page;
|
||||
backLoginPage();
|
||||
}
|
||||
}, function () {
|
||||
top.location.href = login_page;
|
||||
backLoginPage();
|
||||
}, function () {
|
||||
top.location.href = login_page;
|
||||
backLoginPage();
|
||||
});
|
||||
} else {
|
||||
top.layer.confirm('请您确定注销?', {
|
||||
|
|
@ -32,9 +34,14 @@ function loginout(type) {
|
|||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
top.layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
|
||||
localStorage.removeItem("zhgd_token");
|
||||
localStorage.removeItem("zhgd_us");
|
||||
top.location.href = login_page;
|
||||
sessionStorage.removeItem("zhgd_token");
|
||||
sessionStorage.removeItem("zhgd_us");
|
||||
sessionStorage.removeItem("zhgd_type");
|
||||
if (zhgd_type === "2") {
|
||||
top.location.href = login_sg_page;
|
||||
} else if (zhgd_type === "1") {
|
||||
top.location.href = login_sc_page;
|
||||
}
|
||||
});
|
||||
} else if (result.code === 500) {
|
||||
layer.msg(result.msg, { icon: 2 });
|
||||
|
|
@ -43,4 +50,13 @@ function loginout(type) {
|
|||
error(xhr)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* 返回登录页 */
|
||||
function backLoginPage() {
|
||||
if (zhgd_type === "2") {
|
||||
top.location.href = login_sg_page;
|
||||
} else if (zhgd_type === "1") {
|
||||
top.location.href = login_sc_page;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<script src="../../js/publics/public.js"></script>
|
||||
<script src="../../plugin/layui-v2.9.7/layui/layui.js"></script>
|
||||
<script src="../../plugin/toolTip/mTips.js"></script>
|
||||
<script src="../../js/publics/sm3.js"></script>
|
||||
<script src="../../js/publics/aescbc.js"></script>
|
||||
<script src="../../api/commonRequest.js" type="text/javascript"></script>
|
||||
<title>导航页</title>
|
||||
</head>
|
||||
|
|
@ -24,20 +24,14 @@
|
|||
<img src="../../img/navigation/logout.png" onclick="loginout()" alt="退出" data-mtpis="退出">
|
||||
</div>
|
||||
<div id="nav-left" class="layout">
|
||||
<p>汪墩—挥手π入高皇变220kV线路工程</p>
|
||||
<button style="display: none;">返回省侧</button>
|
||||
<form class="layui-form layout">
|
||||
<select class="layui-form" lay-search id="bidPro">
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
<div id="nav-right" class="layout">
|
||||
<ul class="layout">
|
||||
<li class="layout checked" hrefValue="../index/index.html"><p>首页</p></li>
|
||||
<li class="layout nocheck" hrefValue="../video/video.html"><p>视频监控</p></li>
|
||||
<li class="layout nocheck" hrefValue="../towerAssInspect/towerAssInspect.html"><p>组塔检测</p></li>
|
||||
<li class="layout nocheck" hrefValue="../operEnvironment/operEnvironment.html"><p>作业环境</p></li>
|
||||
<li class="layout nocheck" hrefValue="../consQuality/consQuality.html"><p>施工质量</p></li>
|
||||
<li class="layout nocheck" hrefValue="../personnelControl/personnelControl.html"><p>人员管控</p></li>
|
||||
<li class="layout nocheck" hrefValue="../accessMge/accessMge.html"><p>出入管理</p></li>
|
||||
<li class="layout nocheck" hrefValue="../alarmMge/alarmMge.html"><p>告警管理</p></li>
|
||||
<li class="layout nocheck" hrefValue="../dataOprea/dataOprea.html"><p>数据操作</p></li>
|
||||
</ul>
|
||||
<ul class="layout"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ifr-box">
|
||||
|
|
|
|||
|
|
@ -11,22 +11,41 @@
|
|||
<script src="../../js/publics/jquery-3.6.0.min.js" type="text/javascript"></script>
|
||||
<script src="../../js/publics/public.js"></script>
|
||||
<script src="../../plugin/layui-v2.9.7/layui/layui.js"></script>
|
||||
<script src="../../api/commonRequest.js" type="text/javascript"></script>
|
||||
<script src="../../plugin/toolTip/mTips.js"></script>
|
||||
<script src="../../js/publics/aes.js"></script>
|
||||
<script src="../../js/publics/aescbc.js"></script>
|
||||
<script src="../../js/publics/sm3.js"></script>
|
||||
<title>导航页</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="nav-box" class="layout">
|
||||
<div id="nav-icon">
|
||||
<img src="../../img/navigation/logout.png" alt="退出" data-mtpis="退出">
|
||||
<div id="nav-box" class="layout">
|
||||
<div id="nav-icon">
|
||||
<img src="../../img/navigation/logout.png" onclick="loginout()" alt="退出" data-mtpis="退出">
|
||||
<p style="color: #fff;" onclick="goSg()">点击跳转施工大屏</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ifr-box">
|
||||
<iframe id="indexIframe" width="100%" height="99%" frameborder="0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ifr-box">
|
||||
<iframe id="indexIframe" width="100%" height="99%" frameborder="0"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
function goSg() {
|
||||
aqEnnable = true;
|
||||
// 参数对象
|
||||
const params = {
|
||||
'bidCode': '666',
|
||||
'token': token
|
||||
};
|
||||
// 将参数转换为查询字符串
|
||||
const queryString = Object.keys(params)
|
||||
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(encryptCBC(params[key])))
|
||||
.join('&');
|
||||
console.log(queryString);
|
||||
window.open(login_sg_index + "?" + queryString, "_self");
|
||||
}
|
||||
</script>
|
||||
<!--<script src="../../js/pages/home/navigation.js" type="text/javascript"></script>-->
|
||||
<script src="./js/main.js" type="text/javascript"></script>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue