Js权限判断处理

时间:2022-09-28 16:58:20

主要实现自动处理视频点击判断权限。

function lookVideo() {
var review_con = document.getElementById("review").getElementsByClassName("review_con");
for (var i = 0; i < review_con.length; i++) {

(function (i) {
var li_as = review_con[i].getElementsByTagName("ul");

for (var j = 0; j < li_as.length; j++) {
//$("li_as li a").on("click",function(){alert("123")})

var lis = li_as[j].getElementsByTagName("li");
for (var k = 0; k < lis.length; k++) {
var as = lis[k].getElementsByTagName("a");
for (var p = 0; p < as.length; p++) {
as[p].onclick = function () {
var level = document.getElementById("level").value;

return checkQuanXian(i, level);

};
}
}

}
})(i);
}
}

function checkQuanXian(categoryId, level) {

var islogin = true;
if (level == 0) {
islogin = false;
}
//stat投资学堂 \数据英雄榜
if (categoryId === 0 || categoryId === 3) {
if (!islogin) {
setRegOrLogin(1);
return false;
}
if (level !== "3") {

InfoAlert("您不是实盘及以上客户,权限不足");
return false;
}

}//end投资学堂

//start 数据抢先看
if (categoryId == 2 && level == "3") {
var roid = document.getElementById("rid").value;
if (roid !== "10") {
InfoAlert("您不是VIP客户,权限不足");

return false;
}
return false;

}//end 数据抢先看

}