rename abc() to collaspe()

develop
就眠仪式 2020-11-23 17:25:05 +08:00
parent 5e446c4fe2
commit 1187d7d5d9
2 changed files with 41 additions and 40 deletions

View File

@ -15,41 +15,41 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
let config; let config;
const body = $('body'); const body = $('body');
const pearAdmin = new function () { const pearAdmin = new function() {
let configPath = ''; let configPath = '';
this.setConfigPath = function (path) { this.setConfigPath = function(path) {
configPath = path; configPath = path;
} }
this.render = function (initConfig) { this.render = function(initConfig) {
if (initConfig !== undefined) { if (initConfig !== undefined) {
applyConfig(initConfig); applyConfig(initConfig);
} else { } else {
pearAdmin.readConfig().then(function (param) { pearAdmin.readConfig().then(function(param) {
applyConfig(param); applyConfig(param);
}); });
} }
} }
this.readConfig = function () { this.readConfig = function() {
const defer = $.Deferred(); const defer = $.Deferred();
const configUrl = (configPath === '' ? "pear.config.json" : configPath) + "?fresh=" + Math.random(); const configUrl = (configPath === '' ? "pear.config.json" : configPath) + "?fresh=" + Math.random();
$.getJSON(configUrl, function (result) { $.getJSON(configUrl, function(result) {
defer.resolve(result) defer.resolve(result)
}); });
return defer.promise(); return defer.promise();
} }
this.logoRender = function (param) { this.logoRender = function(param) {
$(".layui-logo .logo").attr("src", param.logo.image); $(".layui-logo .logo").attr("src", param.logo.image);
$(".layui-logo .title").html(param.logo.title); $(".layui-logo .title").html(param.logo.title);
} }
this.menuRender = function (param) { this.menuRender = function(param) {
sideMenu = pearMenu.render({ sideMenu = pearMenu.render({
elem: 'sideMenu', elem: 'sideMenu',
async: param.menu.async !== undefined ? param.menu.async : true, async: param.menu.async !== undefined ? param.menu.async : true,
@ -61,17 +61,17 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
url: param.menu.data, url: param.menu.data,
data: param.menu.data, //async为false时传入菜单数组 data: param.menu.data, //async为false时传入菜单数组
parseData: false, parseData: false,
change: function () { change: function() {
compatible(); compatible();
}, },
done: function () { done: function() {
sideMenu.selectItem(param.menu.select); sideMenu.selectItem(param.menu.select);
} }
}); });
} }
this.bodyRender = function (param) { this.bodyRender = function(param) {
body.on("click", ".refresh", function () { body.on("click", ".refresh", function() {
const refreshA = $(".refresh a"); const refreshA = $(".refresh a");
refreshA.removeClass("layui-icon-refresh-1"); refreshA.removeClass("layui-icon-refresh-1");
refreshA.addClass("layui-anim"); refreshA.addClass("layui-anim");
@ -79,7 +79,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
refreshA.addClass("layui-anim-loop"); refreshA.addClass("layui-anim-loop");
refreshA.addClass("layui-icon-loading"); refreshA.addClass("layui-icon-loading");
bodyTab.refresh(400); bodyTab.refresh(400);
setTimeout(function () { setTimeout(function() {
refreshA.addClass("layui-icon-refresh-1"); refreshA.addClass("layui-icon-refresh-1");
refreshA.removeClass("layui-anim"); refreshA.removeClass("layui-anim");
refreshA.removeClass("layui-anim-rotate"); refreshA.removeClass("layui-anim-rotate");
@ -96,7 +96,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
height: '100%', height: '100%',
index: 0, index: 0,
tabMax: param.tab.tabMax, tabMax: param.tab.tabMax,
closeEvent: function (id) { closeEvent: function(id) {
sideMenu.selectItem(id); sideMenu.selectItem(id);
}, },
data: [{ data: [{
@ -106,7 +106,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
close: false close: false
}] }]
}); });
bodyTab.click(function (id) { bodyTab.click(function(id) {
if (!param.tab.keepState) { if (!param.tab.keepState) {
bodyTab.refresh(false); bodyTab.refresh(false);
} }
@ -114,7 +114,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
sideMenu.selectItem(id); sideMenu.selectItem(id);
}) })
sideMenu.click(function (dom, data) { sideMenu.click(function(dom, data) {
bodyTab.addTabOnly({ bodyTab.addTabOnly({
id: data.menuId, id: data.menuId,
title: data.menuTitle, title: data.menuTitle,
@ -133,21 +133,21 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
height: '100%' height: '100%'
}); });
sideMenu.click(function (dom, data) { sideMenu.click(function(dom, data) {
bodyFrame.changePage(data.menuUrl, data.menuPath, true); bodyFrame.changePage(data.menuUrl, data.menuPath, true);
compatible() compatible()
}) })
} }
} }
this.keepLoad = function (param) { this.keepLoad = function(param) {
compatible() compatible()
setTimeout(function () { setTimeout(function() {
$(".loader-main").fadeOut(200); $(".loader-main").fadeOut(200);
}, param.other.keepLoad) }, param.other.keepLoad)
} }
this.themeRender = function (option) { this.themeRender = function(option) {
if (option.theme.allowCustom === false) { if (option.theme.allowCustom === false) {
$(".setting").remove(); $(".setting").remove();
} }
@ -167,14 +167,14 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
this.menuSkin(menu); this.menuSkin(menu);
} }
this.menuSkin = function (theme) { this.menuSkin = function(theme) {
const pearAdmin = $(".pear-admin"); const pearAdmin = $(".pear-admin");
pearAdmin.removeClass("light-theme"); pearAdmin.removeClass("light-theme");
pearAdmin.removeClass("dark-theme"); pearAdmin.removeClass("dark-theme");
pearAdmin.addClass(theme); pearAdmin.addClass(theme);
} }
this.colorSet = function (color) { this.colorSet = function(color) {
let style = ''; let style = '';
// 自 定 义 菜 单 配 色 // 自 定 义 菜 单 配 色
style += style +=
@ -226,7 +226,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
} }
}; };
function abc(){ function collaspe() {
sideMenu.collaspe(); sideMenu.collaspe();
const admin = $(".pear-admin"); const admin = $(".pear-admin");
const left = $(".layui-icon-spread-left") const left = $(".layui-icon-spread-left")
@ -243,7 +243,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
} }
body.on("click", ".collaspe,.pear-cover", function() { body.on("click", ".collaspe,.pear-cover", function() {
abc() collaspe()
}); });
body.on("click", ".fullScreen", function() { body.on("click", ".fullScreen", function() {
@ -404,7 +404,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
function compatible() { function compatible() {
if ($(window).width() <= 768) { if ($(window).width() <= 768) {
abc() collaspe()
} }
} }

View File

@ -24,19 +24,20 @@ layui.config({
drawer: "drawer", // 抽屉弹层组件 drawer: "drawer", // 抽屉弹层组件
notice: "notice", // 消息提示组件 notice: "notice", // 消息提示组件
step:"step", // 分布表单组件 step:"step", // 分布表单组件
tag:"tag", // 标签主键 tag:"tag",
popup:"popup", // 通用弹层 popup:"popup",
iconPicker:"iconPicker", // 图标选择组件 iconPicker:"iconPicker",
treetable:"treetable", // 树形表格组件 treetable:"treetable",
dtree:"dtree", // 树型组件 dtree:"dtree",
tinymce:"tinymce/tinymce", // 文本编辑器 tinymce:"tinymce/tinymce",
area:"area", // 区域选择 area:"area",
count:"count", // 数字滚动 count:"count",
topBar: "topBar", // 返回顶部组件 topBar: "topBar",
button: "button", // 按钮组件 button: "button",
design: "design", // 布局设计器 design: "design",
dropdown: "dropdown", // 通用下拉组件 dropdown: "dropdown",
card: "card", // 卡片组件 card: "card",
loading: "loading", // 加载组件, loading: "loading",
cropper:"cropper"//裁剪组件 cropper:"cropper",
convert:"convert"
}); });