$(function () { try { if ($.fn.pagination) { $.fn.pagination.defaults.beforePageText = '第'; $.fn.pagination.defaults.afterPageText = '共{pages}页'; $.fn.pagination.defaults.displayMsg = '显示{from}到{to},共{total}记录'; } let stff = decodeURIComponent(window.atob($.cookie('s2b2b_staff'))) let staff = JSON.parse(stff); console.log(staff); const selectitem = window.top.jQuery("#sidemenu").sidemenu('options'); console.log(selectitem.curMenu); if (selectitem.curMenu == undefined || selectitem.curMenu == '') { return } let rest = getPermission(staff.IKEY, selectitem.curMenu.IKEY, -1); console.log(rest) for (let i = 0; i < rest.rows.length; i++) { let d = rest.rows[i]; // console.log(d); if (d.IKEY != '-100') { $('#' + d.OPERATION).css('display', ''); //以id名称按键 有权限按键设置为可见,无权限按键直接移除标签 } else {//移除没权限的标签 let btn = document.getElementById(d.OPERATION); if (btn != null || btn != undefined) { btn.parentNode.removeChild(btn); } } } } catch (ex) { // $.messager.alert('提示', ex); } // 自定义电话号码校验规则 $.extend($.fn.validatebox.defaults.rules, { phone: { validator: function(value, param){ return /^1[3-9]\d{9}$/.test(value); }, message: '请输入有效的手机号码' } }); // //监听全局点击事件 // $(document).click(function (event) { // console.log(event); // console.log('触发了'); // function isCookieExpired(cookieString, cookieName) { // const cookies = cookieString.split('; '); // for (let i = 0; i < cookies.length; i++) { // const [name, value] = cookies[i].split('='); // if (name.trim() === cookieName) { // 判断是否为指定的 Cookie 名称 // const expires = new Date(value); // return expires <= new Date(); // } // } // return false; // } // //判断Cookie 是否过期(过期跳转出去页面) // const currentCookie = document.cookie; // const cookieName = "s2b2b_staff"; // if (!$.cookie("s2b2b_staff")) { // // showAlert('hint', '登录过期,请重新登录') // showAlert('hint', '登录过期,请重新登录') // setTimeout(() => { // parent.location.href = "/index.html"; // }, 2000); // } else { // if (isCookieExpired(currentCookie, cookieName)) { // // showAlert('hint', '登录过期,请重新登录')/ // parent.location.href = "/index.html"; // } else { // // console.log(`${cookieName} 未过期`); // } // } // }); })