From 8876b8b8ba7e620c70d84e92ab853c1eb334d6d4 Mon Sep 17 00:00:00 2001 From: zhizou Date: Thu, 18 Jul 2019 10:44:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3IE=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/echartsData.js | 12 ++++++------ js/mapTest.js | 8 ++++---- js/okadmin.js | 13 +++++++------ lib/layui/lay/okmodules/countUp.js | 11 ++++++++--- lib/layui/lay/okmodules/okTab.js | 21 +++++++++++++-------- lib/layui/lay/okmodules/okUtils.js | 5 +++-- lib/layui/layui.js | 26 +++++++++++++++++++++++++- 7 files changed, 66 insertions(+), 30 deletions(-) diff --git a/js/echartsData.js b/js/echartsData.js index 9ee43e5..70e6662 100644 --- a/js/echartsData.js +++ b/js/echartsData.js @@ -560,12 +560,12 @@ layui.define(function (exports) { ]; exports('echartsData', { - mapTree, - mapCircle, - mapChina3, - mapChina2, - mapChina, - Address + mapTree:mapTree, + mapCircle:mapCircle, + mapChina3:mapChina3, + mapChina2:mapChina2, + mapChina:mapChina, + Address:Address }); }); diff --git a/js/mapTest.js b/js/mapTest.js index f4d2c71..98b2726 100644 --- a/js/mapTest.js +++ b/js/mapTest.js @@ -317,9 +317,9 @@ layui.define(function (exports) { }; exports('mapTest', { - option_a, - option_b, - option_c, - option_d + option_a:option_a, + option_b:option_b, + option_c:option_c, + option_d:option_d }); }); diff --git a/js/okadmin.js b/js/okadmin.js index 42cec5c..300548b 100644 --- a/js/okadmin.js +++ b/js/okadmin.js @@ -74,11 +74,11 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { }); $("body").on("click", "#fullScreen", function () { if ($(this).children("i").hasClass("okicon-screen-restore")) { - screenFun(2).then(() => { + screenFun(2).then(function(){ $(this).children("i").eq(0).removeClass("okicon-screen-restore"); }); } else { - screenFun(1).then(() => { + screenFun(1).then(function(){ $(this).children("i").eq(0).addClass("okicon-screen-restore"); }); } @@ -90,7 +90,8 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { * num为1代表全屏 * num为2代表退出全屏 */ - function screenFun(num = 1) { + function screenFun(num) { + num = num || 1; num = num * 1; var docElm = document.documentElement; @@ -119,7 +120,7 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { break; } - return new Promise((res, rej) => { + return new Promise(function(res, rej){ res("返回值"); }); } @@ -145,7 +146,7 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { content: "ok-admin v2.0上线啦(^し^)
" + "在此郑重承诺该模板永久免费为大家提供" + "
若有更好的建议欢迎加入QQ群一起聊", - yes: (index) => { + yes: function(index){ if (srcWidth > 800) { layer.tips('公告跑到这里去啦', '#notice', { tips: [1, '#000'], @@ -155,7 +156,7 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { sessionStorage.setItem("notice", "true"); layer.close(index); }, - cancel: (index) => { + cancel: function(index){ if (srcWidth > 800) { layer.tips('公告跑到这里去啦', '#notice', { tips: [1, '#000'], diff --git a/lib/layui/lay/okmodules/countUp.js b/lib/layui/lay/okmodules/countUp.js index cf703f1..16c0bce 100644 --- a/lib/layui/lay/okmodules/countUp.js +++ b/lib/layui/lay/okmodules/countUp.js @@ -39,15 +39,20 @@ layui.define(['jquery'], function (exports) { argums.target = $(argums.target)[0]; argums.endVal = argums.endVal || $($(argums.target)[0]).text(); - var { + /*var { target, startVal, endVal, decimals, duration, options - } = argums;// 这里是ES6语法 - + } = argums;// 这里是ES6语法*/ + var target = argums.target, + startVal = target.startVal, + endVal = target.endVal, + decimals = target.decimals, + duration = target.duration, + options = target.options; var self = this; self.version = function () { return "1.9.2" diff --git a/lib/layui/lay/okmodules/okTab.js b/lib/layui/lay/okmodules/okTab.js index 3fccd42..51bddf5 100644 --- a/lib/layui/lay/okmodules/okTab.js +++ b/lib/layui/lay/okmodules/okTab.js @@ -115,7 +115,9 @@ layui.define(["element", "jquery"], function (exports) { okTab.prototype.tab = function () { var that = this; var filter = this.tabConfig.tabFilter; - element.on(`tab(${filter})`, function (data) { + // "hello {0}".format("world"); + //`tab(${filter})` + element.on("tab({0})".format(filter), function (data) { var index = data.index;//点击的某个tab索引 var elSuper = $(".ok-tab"),//视窗元素 elMove = $(".ok-tab-title"),//移动的元素 @@ -129,7 +131,8 @@ layui.define(["element", "jquery"], function (exports) { okTab.prototype.tabDelete = function () { var that = this; var filter = this.tabConfig.tabFilter; - element.on(`tabDelete(${filter})`, function (data) { + //`tabDelete(${filter})` + element.on("tabDelete({0})".format(filter), function (data) { // that.navMove("right"); }); }; @@ -184,12 +187,13 @@ layui.define(["element", "jquery"], function (exports) { layer.msg('最多只能同时打开' + openTabNum + '个选项卡哦。不然系统会卡的!'); return; } + var contentIframe = ("").format(url,tabId); element.tabAdd(tabFilter, { - title: html - , content: ` - - ` - , id: tabId + title: html, + content: contentIframe, + id: tabId }); // 切换选项卡 @@ -320,7 +324,8 @@ layui.define(["element", "jquery"], function (exports) { * 2:代表关闭其他标签页 * 3:代表关闭所有标签页 */ - okTab.prototype.tabClose = function (num = 1) { + okTab.prototype.tabClose = function (num) { + num = num || 1; num = num * 1;//强制转换成数字 var that = this; let openTabs = $('.ok-tab-title > li strong[lay-id]').not('strong[is-close=false]'),//获取已打开的tab元素(除开不会被关闭的导航) diff --git a/lib/layui/lay/okmodules/okUtils.js b/lib/layui/lay/okmodules/okUtils.js index eb7859f..0dd0bd0 100644 --- a/lib/layui/lay/okmodules/okUtils.js +++ b/lib/layui/lay/okmodules/okUtils.js @@ -4,7 +4,7 @@ layui.define(["jquery"], function (exprots) { getBodyWidth: function () { return document.body.scrollWidth;//body的总宽度 }, - echartsResize(...elemnt) { + echartsResize: function(elemnt) { /* * 主要用于对echart视图自动适应宽度 * elemnt:可变参数 @@ -13,7 +13,8 @@ layui.define(["jquery"], function (exprots) { * var mapTree2 = echarts.init($("#mapOne")[0], "mytheme"); * resize(mapTree,mapTree2); * */ - window.addEventListener("resize", () => { + elemnt = elemnt || []; + window.addEventListener("resize", function(){ for (var i = 0; i < elemnt.length; i++) { elemnt[i].resize(); } diff --git a/lib/layui/layui.js b/lib/layui/layui.js index 87b5f8a..ee2b22e 100644 --- a/lib/layui/layui.js +++ b/lib/layui/layui.js @@ -1,5 +1,29 @@ /** layui-v2.5.4 MIT License By https://www.layui.com */ -;!function (e) { +if (!Object.assign) { + Object.defineProperty(Object, "assign", { + enumerable: false, + configurable: true, + writable: true, + value: function(target, firstSource) { + "use strict"; + if (target === undefined || target === null) + throw new TypeError("Cannot convert first argument to object"); + var to = Object(target); + for (var i = 1; i < arguments.length; i++) { + var nextSource = arguments[i]; + if (nextSource === undefined || nextSource === null) continue; + var keysArray = Object.keys(Object(nextSource)); + for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { + var nextKey = keysArray[nextIndex]; + var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); + if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey]; + } + } + return to; + } + }); +} +!function (e) { "use strict"; var okmodules = { "okTab": "okmodules/okTab",