// var tailIp = "192.168.0.14:1928"; var tailIp = "192.168.0.14:1928"; var ctxPath = getContextPath(); var systemPath = "http://" + tailIp + ctxPath + "/statics" function getContextPath() { var pathName = document.location.pathname; console.log(pathName); var index = pathName.substr(1).indexOf("/"); var result = pathName.substr(0, index + 1); return result; } console.log("sysytemPatge=" + systemPath) function checkPermission() { var pers = []; $.ajax({ type: 'get', url: ctxPath + '/permission/owns', contentType: "application/json; charset=utf-8", async: false, success: function (data) { pers = data; $("[permission]").each(function () { var per = $(this).attr("permission"); if ($.inArray(per, data) < 0) { $(this).hide(); } }); } }); return pers; } /** * 加密(需要先加载lib/aes/aes.min.js文件) * @param word * @returns {*} */ function encrypt(word){ var key = CryptoJS.enc.Utf8.parse("bonus@admin12345"); var srcs = CryptoJS.enc.Utf8.parse(word); var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7}); return encrypted.toString(); } /** * 解密 * @param word * @returns {*} */ function decrypt(word){ var key = CryptoJS.enc.Utf8.parse("bonus@admin12345"); var decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7}); return CryptoJS.enc.Utf8.stringify(decrypt).toString(); } // 编辑按钮 function buttonEdits(id, permission, pers) { if (permission != "") { if ($.inArray(permission, pers) < 0) { return ""; } } let btn = $(""); return btn.prop("outerHTML"); } // 删除按钮 function buttonDel(id, sysUserRoleId, permission, pers) { if (permission != "") { if ($.inArray(permission, pers) < 0) { return ""; } } let btn = $(""); return btn.prop("outerHTML"); } /** * 获取url参数 依据名称目前ifrea是id * @param name * @returns {string} */ function geturl(name) { var reg = new RegExp("[^\?&]?" + encodeURI(name) + "=[^&]+"); var arr = window.parent.document.getElementById("ifr").contentWindow.location.search.match(reg); if (arr != null) { return decodeURI(arr[0].substring(arr[0].search("=") + 1)); } return ""; } //判断字符是否为空的方法 function isEmpty(obj) { return typeof obj == "undefined" || obj == null || obj === "" || obj === ''; } function transformation(obj) { if (typeof obj == "undefined" || obj == null || obj === "" || obj === '') { return ""; } else { return obj; } } // 二级页面背景弹框动态高度、宽度 let getDefaultWidth = () => { return $(top.window).width() * 0.571875; }; let autoResizeWidth = (index) => { layer.style(index, {width: getDefaultWidth().toFixed(0) + 'px'}); $('#layui-layer-iframe'+index).width(getDefaultWidth().toFixed(0)); }; let getDefaultHeight = () => { return $(top.window).height() * 0.7407407; }; let autoResizeHeight = (index) => { layer.style(index, {height: getDefaultHeight().toFixed(0) + 'px'}); $('#layui-layer-iframe'+index).height(getDefaultHeight().toFixed(0)); }; let autoParentResizeWidth = (index) => { parent.layer.style(index, {width: getDefaultWidth().toFixed(0) + 'px'}); $('#layui-layer-iframe'+index).width(getDefaultWidth().toFixed(0)); }; let autoParentResizeHeight = (index) => { parent.layer.style(index, {height: getDefaultHeight().toFixed(0) + 'px'}); $('#layui-layer-iframe'+index).width(getDefaultHeight().toFixed(0)); }; // 提示背景弹框动态高度、宽度 let getConfirmWidth = () => { return $(top.window).width() * 0.283854; }; let autoConfirmResizeWidth = (index) => { layer.style(index, {width: getConfirmWidth().toFixed(0) + 'px'}); }; let getConfirmHeight = () => { return $(top.window).height() * 0.288889; }; let autoConfirmResizeHeight = (index) => { layer.style(index, {height: getConfirmHeight().toFixed(0) + 'px'}); }; let autoParentConfirmResizeWidth = (index) => { layer.style(index, {width: getConfirmWidth().toFixed(0) + 'px'}); }; let autoParentConfirmResizeHeight = (index) => { layer.style(index, {height: getConfirmHeight().toFixed(0) + 'px'}); };