You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
6.7 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 注销
function loginOut() {
doRefresh(null, "DCLOGIN", "clearUser", "", function (_data) {
p.location.href = webHome + "/login.html";
});
}
// 得到登录用户信息
function getLoginUser(userDiv, selMenu, pDiv, _fun) {
var h = "";
//设置主页去向
$(".maindiv").width($(window).width() - $(".menudiv").width());
$(".maindiv").css("left", $(".menudiv").width());
$(".maindiv").show();
// $("#l_userid").html("<span class=\"icon-user\"></span>&nbsp;用户id" + p.thisLogUser.userId);
// $("#l_usernick").html("<span class=\"icon-user\"></span>&nbsp;用户姓名:" + p.thisLogUser.username);
// $("#l_ulink").html("<span class=\"icon-user\"></span>&nbsp;联系方式:" + p.thisLogUser.mobile);
setMenuBar(selMenu, pDiv, p.menuList);
let _h = ($(document).height() - $(".maindiv").height()) / 2;
$(".maindiv").parent().append("<div id='l_mqmsg_p' style=\"position: fixed;let:0px;bottom: 0px;height: " + (_h) + "px;width: 190px;z-index: 100;overflow-y: scroll;\"><div class='padding' style='width:100%;position: absolute;bottom: 0px;' id='l_mqmsg'></div></div>");
p.removeWait();
if (_fun != null) {
_fun();
}
//天气预报注释掉不要
//$(".bread-p iframe:first").attr("src", "http://tianqi.2345.com/plugin/widget/index.htm?s=3&z=1&t=0&v=0&d=2&bd=0&k=000000&f=&q=1&e=1&a=1&c=54511&w=524&h=28&align=center");
//$(".bread-p iframe:first").attr("src", "http://tianqi.2345.com/plugin/widget/index.htm?s=3&z=1&t=1&v=0&d=1&bd=0&k=&f=&ltf=009944&htf=cc0000&q=1&e=0&a=1&c=54511&w=317&h=28&align=center");
// reSetLocalTimeInte(_data.today, _data.time);
// startMQTT(_data.mqtt);
// removeWait();
}
// 设置菜单
function setMenuBar(selMenu, pDiv) {
var barDiv = "div_menu";
var h = "";
if (p.menuList != null) {
// 顶层
//平台大数据先隐藏 20210715
//h += "<li id=\"m_index\"><a target=\"_self\" href=\"" + webHome + "/center/center.html\" onclick='p.addWait(5000)'> <i class=\"icon-home\"></i> <span class=\"menu-text\"> 大数据平台</span></a></li>";
for (var i = 0; i < p.menuList.length; i++) {
var oneFM = p.menuList[i];
if(oneFM.isiframe)
{
//debugger
h += "<li id=\"m_" + oneFM.id + "\"><a target=\"_self\" href=\""
+ (oneFM.url == "" ? "#" : oneFM.url)
+ "\" class=\"dropdown-toggle\"" + (oneFM.sub.length > 0 ? "" : "onclick='p.addWait(5000)'") + "> <i class=\"" + oneFM.img
+ "\"></i> <span class=\"menu-text\"> " + oneFM.name + (oneFM.sub.length > 0 ? " [" + oneFM.sub.length + "]" : "")
+ " </span>" + (oneFM.sub.length > 0 ? "<b class=\"myarrow icon-angle-down\"></b>" : "") + " </a>";
}
else if (oneFM.func == null || oneFM.func == "") {
h += "<li id=\"m_" + oneFM.id + "\"><a target=\"_self\" href=\""
+ (oneFM.url == "" ? "#" : (webHome + oneFM.url))
+ "\" class=\"dropdown-toggle\"" + (oneFM.sub.length > 0 ? "" : "onclick='p.addWait(5000)'") + "> <i class=\"" + oneFM.img
+ "\"></i> <span class=\"menu-text\"> " + oneFM.name + (oneFM.sub.length > 0 ? " [" + oneFM.sub.length + "]" : "")
+ " </span>" + (oneFM.sub.length > 0 ? "<b class=\"myarrow icon-angle-down\"></b>" : "") + " </a>";
} else if (oneFM.openurl != null && oneFM.openurl != "") {
h += "<li id=\"m_" + oneFM.id + "\"><a target=\"m_" + oneFM.id + "\" href='" + oneFM.openurl + "'> <i class=\"" + oneFM.img
+ "\"></i> <span class=\"menu-text\"> " + oneFM.name + (oneFM.sub.length > 0 ? " [" + oneFM.sub.length + "]" : "")
+ " </span>" + (oneFM.sub.length > 0 ? "<b class=\"myarrow icon-angle-down\"></b>" : "") + " </a>";
} else {
h += "<li id=\"m_" + oneFM.id + "\"><a target=\"#\" href='javascript:void();' onclick=\""
+ (oneFM.func + "('" + (webHome + oneFM.url) + "')") + "\"> <i class=\"" + oneFM.img
+ "\"></i> <span class=\"menu-text\"> " + oneFM.name + (oneFM.sub.length > 0 ? " [" + oneFM.sub.length + "]" : "")
+ " </span>" + (oneFM.sub.length > 0 ? "<b class=\"myarrow icon-angle-down\"></b>" : "") + " </a>";
}
if (oneFM.sub.length > 0) {
h += "<ul class=\"submenu\">";
for (var j = 0; j < oneFM.sub.length; j++) {
var oneSM = oneFM.sub[j];
if(oneSM.isiframe)
{
h += "<li id=\"m_" + oneSM.id
+ "\"><a target=\"_self\" href=\""
+ (oneSM.url == "" ? "#" : oneSM.url)
+ "\" onclick='p.addWait(5000)'> <i class=\"" + oneSM.img + "\"></i> "
+ oneSM.name + "</a></li>";
}
else
{
h += "<li id=\"m_" + oneSM.id
+ "\"><a target=\"_self\" href=\""
+ (oneSM.url == "" ? "#" : (webHome + oneSM.url))
+ "\" onclick='p.addWait(5000)'> <i class=\"" + oneSM.img + "\"></i> "
+ oneSM.name + "</a></li>";
}
}
h += "</ul>";
}
}
}
$("#" + barDiv).html(h);
//this.parent.$("#div_menu").html(h)
// 处理当前的
thisMenuId = "m_" + selMenu;
if (selMenu != null && selMenu != "") {
$("#m_" + selMenu).addClass("active");
} else {
$("#m_index").addClass("active");
}
if (pDiv != null && pDiv != "") {
$("#m_" + pDiv).addClass("active open");
$("#m_" + pDiv + " ul").addClass("show");
thisMenuId = "m_" + pDiv;
}
tempMenuId = thisMenuId;
iniMenu();
}
function iniMenu() {
$(".open ul").addClass("show");
$(".dropdown-toggle").parent().bind("click", function () {
var thisId = $(this).attr("id");
if (thisId != tempMenuId) {
// 关闭当前的
$("#" + tempMenuId).removeClass("open");
$("#" + tempMenuId + " ul").removeClass("show");
$("#" + tempMenuId + " ul").addClass("hidden");
}
tempMenuId = thisId;
if ($("ul", this).hasClass("show")) {
$(this).removeClass("open");
$("ul", this).removeClass("show");
$("ul", this).addClass("hidden");
} else {
// 关闭的状态
$(this).addClass("open");
$("ul", this).addClass("show");
$("ul", this).removeClass("hidden");
}
});
}
function toParent(_html) {
p.location.href = _html;
}