jjsp_web/bns/js/system/htmlpermission.js

45 lines
1008 B
JavaScript
Raw Normal View History

2024-12-12 14:08:30 +08:00
getLocalpath();
function getLocalpath(){
var currentPath = window.location.pathname;
var url=currentPath.split("/html");
let usJosn=JSON.parse(us);
let yq=getHtmlPermission(usJosn.menus,url[1]);
console.log(yq)
2024-12-13 14:34:16 +08:00
if(!yq){
2024-12-13 14:10:18 +08:00
addLogs(url,url[1],usJosn.nickName);
2024-12-13 14:34:16 +08:00
top.window.location.href = login_url;
2024-12-12 14:08:30 +08:00
}
}
function getHtmlPermission(menus,html){
for (var i = 0; i < menus.length; i++) {
var child=menus[i].childer;
if(!child || child.length<1){
if(menus[i].url.indexOf(html)!='-1'){
return true;
}
}else{
let wyq=getHtmlPermission(child,html);
if(wyq){
return true;
}
}
}
return false;
2024-12-13 14:10:18 +08:00
}
function addLogs(url,urlParam,userName) {
$.ajax({
url: dataUrl + 'system/sys/logs/addLogs' ,
headers: {
'Authorization': localStorage.getItem("tokens")
},
data: {
'userName': userName ,
'operParam': url,
'operMeth': urlParam
},
type: 'post',
success: function () {
}
});
2024-12-12 14:08:30 +08:00
}