diff --git a/component/pear/modules/admin.js b/component/pear/modules/admin.js index bcfba70..ca22e3f 100644 --- a/component/pear/modules/admin.js +++ b/component/pear/modules/admin.js @@ -1,4 +1,4 @@ -layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame', 'theme'], +layui.define(['table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme'], function(exports) { "use strict"; @@ -26,7 +26,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame this.setConfigPath = function(path) { configPath = path; } - + this.setConfigType = function(type) { configType = type; } @@ -40,18 +40,16 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame } this.readConfig = function() { - if(configType === "yml"){ + if (configType === "yml") { return yaml.load(configPath); - } - else - { + } else { let data; $.ajax({ - url:configPath, - type:'get', - dataType:'json', + url: configPath, + type: 'get', + dataType: 'json', async: false, - success:function(result){ + success: function(result) { data = result; } }) @@ -93,7 +91,8 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame refreshA.addClass("layui-anim-rotate"); refreshA.addClass("layui-anim-loop"); refreshA.addClass("layui-icon-loading"); - bodyTab.refresh(400); + if (param.tab.muiltTab) bodyTab.refresh(400); + else bodyFrame.refresh(400); setTimeout(function() { refreshA.addClass("layui-icon-refresh-1"); refreshA.removeClass("layui-anim"); @@ -121,12 +120,12 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame title: param.tab.index.title, close: false }], - success: function(id){ - if(param.tab.session){ - setTimeout(function(){ + success: function(id) { + if (param.tab.session) { + setTimeout(function() { sideMenu.selectItem(id); bodyTab.positionTab(); - },500) + }, 500) } } }); @@ -139,7 +138,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame }) sideMenu.click(function(dom, data) { - + bodyTab.addTabOnly({ id: data.menuId, title: data.menuTitle, @@ -148,7 +147,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame close: true }, 300); compatible(); - + }) } else { bodyFrame = pearFrame.render({ @@ -249,7 +248,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame }); body.on("click", ".setting", function() { - + let bgColorHtml = '
  • ' + '' + @@ -310,7 +309,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame layer.close(index); }); }) - + $('#closeTheme').click(function() { const $layero = $('#layui-layer' + index); $layero.animate({ @@ -323,7 +322,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame }); }); - function bottomTool(){ + function bottomTool() { return "" } diff --git a/component/pear/modules/frame.js b/component/pear/modules/frame.js index 6a00864..712e1eb 100644 --- a/component/pear/modules/frame.js +++ b/component/pear/modules/frame.js @@ -39,6 +39,21 @@ layui.define(['table', 'jquery', 'element'], function (exports) { } } + pearFrame.prototype.changePageByElement = function(elem,url,title,loading){ + if(loading){ + var loading = $("#"+elem).find(".pear-frame-loading"); + loading.css({display:'block'}); + } + $("#"+elem+" iframe").attr("src",url); + $("#"+elem+" .title").html(title); + if(loading){ + var loading = $("#"+elem).find(".pear-frame-loading"); + setTimeout(function(){ + loading.css({display:'none'}); + },800) + } + } + pearFrame.prototype.refresh = function (time) { if(time!=false){ var loading = $("#"+this.option.elem).find(".pear-frame-loading"); diff --git a/view/document/button.html b/view/document/button.html index 9469649..a13c426 100644 --- a/view/document/button.html +++ b/view/document/button.html @@ -233,6 +233,36 @@ +
    +
    +
    + Load 手动 +
    +
    + + + +
    +
    +
    +
    +
    +
    +

    显示代码

    +
    +
    +								layui.use(["jquery"], function() {
    +								    var $ = layui.jquery;
    +								    
    +									$("[to]").click(function(){
    +										top.layui.frame.changePageByElement("content","http://www.baidu.com","百度一下",true)
    +									})
    +								})
    +							
    +
    +
    +
    +
    @@ -268,6 +298,10 @@ popup.failure("已停止"); }); }) + + $("[to]").click(function(){ + top.layui.frame.changePageByElement("content","http://www.baidu.com","百度一下",true) + }) })