更新依赖pear-admin-layui到3.8.3,增加前端渲染配置接口
This commit is contained in:
@@ -1,9 +1,27 @@
|
||||
SYSTEM_NAME = "Pear Admin"
|
||||
# 主题面板的链接列表配置
|
||||
SYSTEM_PANEL_LINKS = [
|
||||
{
|
||||
"icon": "layui-icon layui-icon-auz",
|
||||
"title": "官方网站",
|
||||
"href": "http://www.pearadmin.com"
|
||||
},
|
||||
{
|
||||
"icon": "layui-icon layui-icon-auz",
|
||||
"title": "开发文档",
|
||||
"href": "http://www.pearadmin.com"
|
||||
},
|
||||
{
|
||||
"icon": "layui-icon layui-icon-auz",
|
||||
"title": "开源地址",
|
||||
"href": "https://gitee.com/Jmysy/Pear-Admin-Layui"
|
||||
}
|
||||
]
|
||||
# 密钥
|
||||
# 密钥配置(flask session需要) 记得修改
|
||||
import os
|
||||
|
||||
SECRET_KEY = 'pear-admin-flask'
|
||||
|
||||
UPLOADED_PHOTOS_DEST = 'static/upload'
|
||||
UPLOADED_FILES_ALLOW = ['gif', 'jpg']
|
||||
|
||||
# JSON配置
|
||||
JSON_AS_ASCII = False
|
||||
@@ -1,5 +1,5 @@
|
||||
from io import BytesIO
|
||||
from flask import session, make_response
|
||||
from flask import session, make_response, current_app
|
||||
from flask_login import current_user
|
||||
from applications.models.admin_power import PowerSchema
|
||||
from applications.service.captcha import gen_captcha
|
||||
@@ -71,3 +71,75 @@ def get_captcha():
|
||||
resp = make_response(out.read())
|
||||
resp.content_type = 'image/png'
|
||||
return resp, code
|
||||
|
||||
|
||||
def get_render_config():
|
||||
# 网站配置
|
||||
config = dict(logo={
|
||||
# 网站名称
|
||||
"title": current_app.config.get("SYSTEM_NAME"),
|
||||
# 网站图标
|
||||
"image": "/static/admin/admin/images/logo.png"
|
||||
# 菜单配置
|
||||
}, menu={
|
||||
# 菜单数据来源
|
||||
"data": "/admin/menu",
|
||||
"collaspe": True,
|
||||
# 是否同时只打开一个菜单目录
|
||||
"accordion": True,
|
||||
"method": "GET",
|
||||
# 是否开启多系统菜单模式
|
||||
"control": False,
|
||||
# 默认选中的菜单项
|
||||
"select": "0",
|
||||
# 是否开启异步菜单,false 时 data 属性设置为菜单数据,false 时为 json 文件或后端接口
|
||||
"async": True
|
||||
}, tab={
|
||||
# 是否开启多选项卡
|
||||
"muiltTab": True,
|
||||
# 切换选项卡时,是否刷新页面状态
|
||||
"keepState": True,
|
||||
# 是否开启 Tab 记忆
|
||||
"session": True,
|
||||
# 最大可打开的选项卡数量
|
||||
"tabMax": 30,
|
||||
"index": {
|
||||
# 标识 ID , 建议与菜单项中的 ID 一致
|
||||
"id": "10",
|
||||
# 页面地址
|
||||
"href": "/admin/welcome",
|
||||
# 标题
|
||||
"title": "首页"
|
||||
}
|
||||
}, theme={
|
||||
# 默认主题色,对应 colors 配置中的 ID 标识
|
||||
"defaultColor": "2",
|
||||
# 默认的菜单主题 dark-theme 黑 / light-theme 白
|
||||
"defaultMenu": "dark-theme",
|
||||
# 是否允许用户切换主题,false 时关闭自定义主题面板
|
||||
"allowCustom": True
|
||||
}, colors=[{
|
||||
"id": "1",
|
||||
"color": "#2d8cf0"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"color": "#5FB878"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"color": "#1E9FFF"
|
||||
}, {
|
||||
"id": "4",
|
||||
"color": "#FFB800"
|
||||
}, {
|
||||
"id": "5",
|
||||
"color": "darkgray"
|
||||
}
|
||||
], links=current_app.config.get("SYSTEM_PANEL_LINKS"), other={
|
||||
# 主页动画时长
|
||||
"keepLoad": 1200,
|
||||
# 布局顶部主题
|
||||
"autoHead": False
|
||||
}, header=False)
|
||||
return config
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from flask import Blueprint, render_template, jsonify, request, session, redirect, url_for
|
||||
from flask import Blueprint, render_template, jsonify, request, session, redirect, url_for, current_app
|
||||
from flask_login import login_user, login_required, logout_user, current_user
|
||||
from applications.service.admin import index_curd
|
||||
from applications.service.admin_log import login_log
|
||||
@@ -16,6 +16,13 @@ def index():
|
||||
return render_template('admin/index.html', user=user)
|
||||
|
||||
|
||||
# 渲染配置
|
||||
@admin_index.route('/config')
|
||||
@login_required
|
||||
def config():
|
||||
return index_curd.get_render_config()
|
||||
|
||||
|
||||
# 获取验证码
|
||||
@admin_index.route('/getCaptcha', methods=["GET"])
|
||||
def getCaptcha():
|
||||
|
||||
@@ -93,7 +93,6 @@ body,
|
||||
.pear-admin .layui-body {
|
||||
left: 230px;
|
||||
bottom: 0px;
|
||||
margin-top: 60px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,11 @@
|
||||
}
|
||||
|
||||
.layui-input:focus {
|
||||
box-shadow: 0px 0px 3px 1px #5FB878 !important;
|
||||
box-shadow: 0px 0px 2px 1px #5FB878 !important;
|
||||
}
|
||||
|
||||
.layui-form-danger:focus{
|
||||
box-shadow: 0px 0px 2px 1px #f56c6c !important;
|
||||
}
|
||||
|
||||
.logo {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
.dept-tree {
|
||||
width: 100%;
|
||||
height: -webkit-calc(100vh - 247px);
|
||||
height: -moz-calc(100vh - 247px);
|
||||
height: calc(100vh - 247px);
|
||||
margin-top: 20px;
|
||||
}
|
||||
.dtree-laySimple-item-this{
|
||||
background-color: transparent!important;
|
||||
}
|
||||
.dtree-nav-div:hover{
|
||||
background-color: transparent!important;
|
||||
}
|
||||
.button{
|
||||
margin-top: 10px;
|
||||
width: 94%;
|
||||
margin-left: 3%;
|
||||
display: block;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 15px;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
font-size: 14.5px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
display:inline-block;
|
||||
outline: 0;
|
||||
border-radius: 2px;
|
||||
-webkit-appearance: none;
|
||||
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.button-primary{
|
||||
background-color: #5FB878;
|
||||
color: white;
|
||||
}
|
||||
.button-default{
|
||||
color: #2f495e;
|
||||
background-color: #edf2f7;
|
||||
}
|
||||
.user-main{
|
||||
width: calc(100% - 312px);
|
||||
float: right;
|
||||
}
|
||||
.user-left{
|
||||
width: 300px;
|
||||
float: left;
|
||||
}
|
||||
.user-collasped.user-main{
|
||||
width: 100%;
|
||||
}
|
||||
.user-collasped.user-left{
|
||||
width: 0px;
|
||||
}
|
||||
.user-collasped.user-left .user-group{
|
||||
display: none;
|
||||
}
|
||||
@@ -45,7 +45,8 @@
|
||||
"title": "基础组件",
|
||||
"icon": "layui-icon layui-icon-console",
|
||||
"type": 0,
|
||||
"children": [{
|
||||
"children": [
|
||||
{
|
||||
"id": 2011,
|
||||
"title": "功能按钮",
|
||||
"icon": "layui-icon layui-icon-face-smile",
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG",
|
||||
"salt": null,
|
||||
"status": null,
|
||||
"realName": "超级管理员",
|
||||
"email": "8540854@qq.com",
|
||||
"realName": "超级'管'理员",
|
||||
"email": "854085'4@'qq.com",
|
||||
"avatar": null,
|
||||
"sex": "1",
|
||||
"phone": "15543526531",
|
||||
@@ -22,7 +22,7 @@
|
||||
"password": null,
|
||||
"salt": null,
|
||||
"status": null,
|
||||
"realName": "就眠仪式",
|
||||
"realName": "就\"眠\"仪式",
|
||||
"email": null,
|
||||
"avatar": null,
|
||||
"sex": "1",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -205,6 +205,8 @@ body::-webkit-scrollbar-corner {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media all and (min-width:993px) and (max-width:1199px) {
|
||||
|
||||
.pear-col-md-offset1 {
|
||||
margin-left: 4.16%;
|
||||
}
|
||||
@@ -300,6 +302,8 @@ body::-webkit-scrollbar-corner {
|
||||
.pear-col-md-offset24 {
|
||||
margin-left: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media all and (max-width:768px) {
|
||||
.pear-col-xs1 {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
.pear-nav-tree .layui-nav-item>a {
|
||||
height: 56px;
|
||||
line-height: 56px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.pear-nav-tree .layui-nav-item dd a {
|
||||
@@ -14,6 +16,14 @@
|
||||
line-height: 48px;
|
||||
}
|
||||
|
||||
.pear-side-scroll::-webkit-scrollbar {
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
.pear-side-scroll{
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.pear-nav-tree .layui-nav-child {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
@@ -188,7 +198,7 @@
|
||||
/** 下 拉 图 标 */
|
||||
.pear-nav-tree.arrow .layui-nav-more {
|
||||
font-family: layui-icon !important;
|
||||
font-size: 12px;
|
||||
font-size: 10px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
@@ -198,7 +208,7 @@
|
||||
line-height: normal;
|
||||
border: none;
|
||||
top: 23px;
|
||||
margin-right: 5px !important;
|
||||
margin-right: 2px !important;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
color: #333;
|
||||
font-size: 13.5px;
|
||||
line-height: 20px;
|
||||
cursor:pointer;
|
||||
}
|
||||
.pear-tab-menu .item:hover{
|
||||
background: #36b368;
|
||||
|
||||
@@ -2,7 +2,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
function(exports) {
|
||||
"use strict";
|
||||
|
||||
const $ = layui.jquery,
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
element = layui.element,
|
||||
yaml = layui.yaml,
|
||||
@@ -13,20 +13,20 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
pearTheme = layui.theme,
|
||||
message = layui.message;
|
||||
|
||||
let bodyFrame;
|
||||
let sideMenu;
|
||||
let bodyTab;
|
||||
let config;
|
||||
let logout = function() {};
|
||||
let msgInstance;
|
||||
var bodyFrame;
|
||||
var sideMenu;
|
||||
var bodyTab;
|
||||
var config;
|
||||
var logout = function() {};
|
||||
var msgInstance;
|
||||
|
||||
const body = $('body');
|
||||
var body = $('body');
|
||||
|
||||
const pearAdmin = new function() {
|
||||
var pearAdmin = new function() {
|
||||
|
||||
// 默认配置
|
||||
let configType = 'yml';
|
||||
let configPath = 'pear.config.yml';
|
||||
var configType = 'yml';
|
||||
var configPath = 'pear.config.yml';
|
||||
|
||||
this.setConfigPath = function(path) {
|
||||
configPath = path;
|
||||
@@ -38,7 +38,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
|
||||
this.setAvatar = function(url, username) {
|
||||
var image = new Image();
|
||||
image.src = "admin/images/avatar.jpg";
|
||||
image.src = url || "admin/images/avatar.jpg";
|
||||
image.onload = function() {
|
||||
$(".layui-nav-img").attr("src", convert.imageToBase64(image));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
if (configType === "yml") {
|
||||
return yaml.load(configPath);
|
||||
} else {
|
||||
let data;
|
||||
var data;
|
||||
$.ajax({
|
||||
url: configPath,
|
||||
type: 'get',
|
||||
@@ -109,7 +109,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
|
||||
this.bodyRender = function(param) {
|
||||
body.on("click", ".refresh", function() {
|
||||
const refreshA = $(".refresh a");
|
||||
var refreshA = $(".refresh a");
|
||||
refreshA.removeClass("layui-icon-refresh-1");
|
||||
refreshA.addClass("layui-anim");
|
||||
refreshA.addClass("layui-anim-rotate");
|
||||
@@ -200,13 +200,13 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
if (option.theme.allowCustom === false) {
|
||||
$(".setting").remove();
|
||||
}
|
||||
const colorId = localStorage.getItem("theme-color");
|
||||
const currentColor = getColorById(colorId);
|
||||
var colorId = localStorage.getItem("theme-color");
|
||||
var currentColor = getColorById(colorId);
|
||||
localStorage.setItem("theme-color", currentColor.id);
|
||||
localStorage.setItem("theme-color-context", currentColor.color);
|
||||
pearTheme.changeTheme(window, option.other.autoHead);
|
||||
let menu = localStorage.getItem("theme-menu");
|
||||
if (menu === "null") {
|
||||
var menu = localStorage.getItem("theme-menu");
|
||||
if (menu == null) {
|
||||
menu = option.theme.defaultMenu;
|
||||
} else {
|
||||
if (option.theme.allowCustom === false) {
|
||||
@@ -218,7 +218,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
}
|
||||
|
||||
this.menuSkin = function(theme) {
|
||||
const pearAdmin = $(".pear-admin");
|
||||
var pearAdmin = $(".pear-admin");
|
||||
pearAdmin.removeClass("light-theme");
|
||||
pearAdmin.removeClass("dark-theme");
|
||||
pearAdmin.addClass(theme);
|
||||
@@ -238,8 +238,13 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
|
||||
this.jump = function(id, title, url) {
|
||||
if (config.tab.muiltTab) {
|
||||
bodyTab.addTabOnly({id: id,title: title,url: url,icon: null,close: true},
|
||||
300);
|
||||
bodyTab.addTabOnly({
|
||||
id: id,
|
||||
title: title,
|
||||
url: url,
|
||||
icon: null,
|
||||
close: true
|
||||
}, 300);
|
||||
} else {
|
||||
sideMenu.selectItem(id);
|
||||
bodyFrame.changePage(url, title, true);
|
||||
@@ -267,9 +272,9 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
|
||||
function collaspe() {
|
||||
sideMenu.collaspe();
|
||||
const admin = $(".pear-admin");
|
||||
const left = $(".layui-icon-spread-left")
|
||||
const right = $(".layui-icon-shrink-right")
|
||||
var admin = $(".pear-admin");
|
||||
var left = $(".layui-icon-spread-left")
|
||||
var right = $(".layui-icon-shrink-right")
|
||||
if (admin.is(".pear-mini")) {
|
||||
left.addClass("layui-icon-shrink-right")
|
||||
left.removeClass("layui-icon-spread-left")
|
||||
@@ -323,7 +328,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
|
||||
body.on("click", ".setting", function() {
|
||||
|
||||
let bgColorHtml =
|
||||
var bgColorHtml =
|
||||
'<li class="layui-this" data-select-bgcolor="dark-theme" >' +
|
||||
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
|
||||
'<div><span style="display:block; width: 20%; float: left; height: 12px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 12px; background: white;"></span></div>' +
|
||||
@@ -339,7 +344,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
'</a>' +
|
||||
'</li>';
|
||||
|
||||
const html =
|
||||
var html =
|
||||
'<div class="pearone-color">\n' +
|
||||
'<div class="color-title">整体风格</div>\n' +
|
||||
'<div class="color-content">\n' +
|
||||
@@ -360,23 +365,20 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
move: false,
|
||||
content: html + buildColorHtml() + buildLinkHtml() + bottomTool(),
|
||||
success: function(layero, index) {
|
||||
form.render();
|
||||
|
||||
const color = localStorage.getItem("theme-color");
|
||||
const menu = localStorage.getItem("theme-menu");
|
||||
var color = localStorage.getItem("theme-color");
|
||||
var menu = localStorage.getItem("theme-menu");
|
||||
|
||||
if (color !== "null") {
|
||||
$(".select-color-item").removeClass("layui-icon")
|
||||
.removeClass("layui-icon-ok");
|
||||
$("*[color-id='" + color + "']").addClass("layui-icon")
|
||||
.addClass("layui-icon-ok");
|
||||
$(".select-color-item").removeClass("layui-icon").removeClass("layui-icon-ok");
|
||||
$("*[color-id='" + color + "']").addClass("layui-icon").addClass("layui-icon-ok");
|
||||
}
|
||||
if (menu !== "null") {
|
||||
$("*[data-select-bgcolor]").removeClass("layui-this");
|
||||
$("[data-select-bgcolor='" + menu + "']").addClass("layui-this");
|
||||
}
|
||||
$('#layui-layer-shade' + index).click(function() {
|
||||
const $layero = $('#layui-layer' + index);
|
||||
var $layero = $('#layui-layer' + index);
|
||||
$layero.animate({
|
||||
left: $layero.offset().left + $layero.width()
|
||||
}, 200, function() {
|
||||
@@ -385,7 +387,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
})
|
||||
|
||||
$('#closeTheme').click(function() {
|
||||
const $layero = $('#layui-layer' + index);
|
||||
var $layero = $('#layui-layer' + index);
|
||||
$layero.animate({
|
||||
left: $layero.offset().left + $layero.width()
|
||||
}, 200, function() {
|
||||
@@ -401,7 +403,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
}
|
||||
|
||||
body.on('click', '[data-select-bgcolor]', function() {
|
||||
const theme = $(this).attr('data-select-bgcolor');
|
||||
var theme = $(this).attr('data-select-bgcolor');
|
||||
$('[data-select-bgcolor]').removeClass("layui-this");
|
||||
$(this).addClass("layui-this");
|
||||
localStorage.setItem("theme-menu", theme);
|
||||
@@ -411,8 +413,8 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
body.on('click', '.select-color-item', function() {
|
||||
$(".select-color-item").removeClass("layui-icon").removeClass("layui-icon-ok");
|
||||
$(this).addClass("layui-icon").addClass("layui-icon-ok");
|
||||
const colorId = $(".select-color-item.layui-icon-ok").attr("color-id");
|
||||
const currentColor = getColorById(colorId);
|
||||
var colorId = $(".select-color-item.layui-icon-ok").attr("color-id");
|
||||
var currentColor = getColorById(colorId);
|
||||
localStorage.setItem("theme-color", currentColor.id);
|
||||
localStorage.setItem("theme-color-context", currentColor.color);
|
||||
pearTheme.changeTheme(window, config.other.autoHead);
|
||||
@@ -431,8 +433,8 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
}
|
||||
|
||||
function getColorById(id) {
|
||||
let color;
|
||||
let flag = false;
|
||||
var color;
|
||||
var flag = false;
|
||||
$.each(config.colors, function(i, value) {
|
||||
if (value.id === id) {
|
||||
color = value;
|
||||
@@ -450,9 +452,10 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
}
|
||||
|
||||
function buildLinkHtml() {
|
||||
let links = "";
|
||||
var links = "";
|
||||
$.each(config.links, function(i, value) {
|
||||
links += '<a class="more-menu-item" href="' + value.href + '" target="_blank">' +
|
||||
// value.target 存在,则为新窗口打开,增加 target="_blank" 属性
|
||||
links += '<a class="more-menu-item" href="' + value.href + '" '+(value.target?' target="_blank" ':'')+'>' +
|
||||
'<i class="' + value.icon + '" style="font-size: 19px;"></i> ' + value.title +
|
||||
'</a>'
|
||||
})
|
||||
@@ -460,7 +463,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
}
|
||||
|
||||
function buildColorHtml() {
|
||||
let colors = "";
|
||||
var colors = "";
|
||||
$.each(config.colors, function(i, value) {
|
||||
colors += "<span class='select-color-item' color-id='" + value.id + "' style='background-color:" + value.color +
|
||||
";'></span>";
|
||||
@@ -478,7 +481,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
||||
function screenFun(num) {
|
||||
num = num || 1;
|
||||
num = num * 1;
|
||||
const docElm = document.documentElement;
|
||||
var docElm = document.documentElement;
|
||||
switch (num) {
|
||||
case 1:
|
||||
if (docElm.requestFullscreen) {
|
||||
|
||||
@@ -25,10 +25,13 @@ layui.define(['jquery'], function(exports) {
|
||||
|
||||
$(option.elem).html("<i class='layui-anim layui-anim-rotate layui-icon layui-anim-loop layui-icon-loading'/>");
|
||||
|
||||
$(option.elem).attr("disabled", "disabled");
|
||||
|
||||
var buttons = $(option.elem);
|
||||
|
||||
if (option.time != "" || option.time !=false) {
|
||||
setTimeout(function() {
|
||||
$(option.elem).attr("disabled", false);
|
||||
buttons.html(text);
|
||||
option.done();
|
||||
}, option.time);
|
||||
@@ -41,8 +44,9 @@ layui.define(['jquery'], function(exports) {
|
||||
* Button stop loaded
|
||||
* */
|
||||
button.prototype.stop = function(success) {
|
||||
$(this.option.elem).attr("disabled", false);
|
||||
$(this.option.elem).html(this.option.text);
|
||||
success();
|
||||
success && success();
|
||||
}
|
||||
|
||||
exports(MOD_NAME, new button());
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -42,10 +42,11 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
}
|
||||
} else {
|
||||
//renderMenu中需要调用done事件,done事件中需要menu对象,但是此时还未返回menu对象,做个延时提前返回对象
|
||||
window.setTimeout(function() {
|
||||
renderMenu(option);
|
||||
}, 500);
|
||||
window.setTimeout(function() { renderMenu(option);}, 500);
|
||||
}
|
||||
|
||||
// 处理高度
|
||||
$("#"+opt.elem).height(option.height)
|
||||
return new pearMenu(opt);
|
||||
}
|
||||
|
||||
@@ -194,7 +195,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
}
|
||||
|
||||
function createMenu(option) {
|
||||
var menuHtml = '<ul lay-filter="' + option.elem +
|
||||
var menuHtml = '<div style="height:100%!important;" class="pear-side-scroll layui-side-scroll ' + option.theme + '"><ul lay-filter="' + option.elem +
|
||||
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree">'
|
||||
$.each(option.data, function(i, item) {
|
||||
var content = '<li class="layui-nav-item" >';
|
||||
@@ -227,7 +228,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
menuHtml += content;
|
||||
});
|
||||
// 结 束 菜 单 结 构 的 初 始 化
|
||||
menuHtml += "</ul>";
|
||||
menuHtml += "</ul></div>";
|
||||
// 将 菜 单 拼 接 到 初 始 化 容 器 中
|
||||
$("#" + option.elem).html(menuHtml);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||
|
||||
var notice = '<li class="layui-nav-item" lay-unselect="">' +
|
||||
'<a href="#" class="notice layui-icon layui-icon-notice"><span class="layui-badge-dot"></span></a>' +
|
||||
'<div class="layui-nav-child layui-tab pear-notice" style="left: -200px;">';
|
||||
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;;left: -200px;">';
|
||||
|
||||
var noticeTitle = '<ul class="layui-tab-title">';
|
||||
var noticeContent = '<div class="layui-tab-content" style="height:' + option.height + ';overflow-x: hidden;">';
|
||||
|
||||
@@ -70,6 +70,9 @@ layui.define(["jquery","layer"], function (exports) {
|
||||
style += '.pear-tab-menu .item:hover{background-color:'+color+'!important}'
|
||||
style += '.layui-form-danger:focus {border-color:#FF5722 !important}'
|
||||
style += '.pear-admin .user a:hover{color:'+color+'!important}'
|
||||
style += '.pear-admin .user .layui-this a:hover{color:white!important}'
|
||||
style += '.pear-notice .layui-this{color:'+color+'!important}'
|
||||
style += '.layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i{color:' + color + ' !important}';
|
||||
var colorPane = $("#pear-admin-color");
|
||||
if(colorPane.length>0){
|
||||
colorPane.html(style);
|
||||
|
||||
@@ -16,7 +16,7 @@ layui.define(['layer', 'table'], function (exports) {
|
||||
} else {
|
||||
$.getJSON(param.url, param.where, function (res) {
|
||||
if(param.parseData){
|
||||
res.data = param.parseData(res);
|
||||
res = param.parseData(res);
|
||||
param.data = res.data;
|
||||
}
|
||||
treetable.init(param, res.data);
|
||||
|
||||
@@ -5,7 +5,7 @@ window.rootPath = (function(src) {
|
||||
|
||||
layui.config({
|
||||
base: rootPath + "module/",
|
||||
version: "3.7.6.Release"
|
||||
version: "3.8.0.Release"
|
||||
}).extend({
|
||||
admin: "admin", // 框架布局组件
|
||||
menu: "menu", // 数据菜单组件
|
||||
@@ -37,7 +37,7 @@ layui.config({
|
||||
context: "context", // 上下文组件
|
||||
http: "http", // ajax请求组件
|
||||
theme: "theme", // 主题转换
|
||||
message: "message" // 通知组件
|
||||
message: "message", // 通知组件
|
||||
}).use(['layer', 'theme'], function () {
|
||||
layui.theme.changeTheme(window, false);
|
||||
});
|
||||
@@ -1,66 +0,0 @@
|
||||
{
|
||||
"logo": {
|
||||
"title": "Pear Admin",
|
||||
"image": "admin/images/logo.png"
|
||||
},
|
||||
"menu": {
|
||||
"data": "admin/data/menu.json",
|
||||
"accordion": true,
|
||||
"control": false,
|
||||
"select": "0"
|
||||
},
|
||||
"tab": {
|
||||
"muiltTab": true,
|
||||
"keepState": true,
|
||||
"tabMax": 30,
|
||||
"index": {
|
||||
"id": "0",
|
||||
"href": "view/console/console1.html",
|
||||
"title": "首页"
|
||||
}
|
||||
},
|
||||
"theme": {
|
||||
"defaultColor": "2",
|
||||
"defaultMenu": "dark-theme",
|
||||
"allowCustom": true
|
||||
},
|
||||
"colors": [{
|
||||
"id": "1",
|
||||
"color": "#2d8cf0"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"color": "#5FB878"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"color": "#1E9FFF"
|
||||
}, {
|
||||
"id": "4",
|
||||
"color": "#FFB800"
|
||||
}, {
|
||||
"id": "5",
|
||||
"color": "darkgray"
|
||||
}
|
||||
],
|
||||
"links": [{
|
||||
"icon": "layui-icon layui-icon-auz",
|
||||
"title": "官方网站",
|
||||
"href": "http://www.pearadmin.com"
|
||||
},
|
||||
{
|
||||
"icon": "layui-icon layui-icon-auz",
|
||||
"title": "开发文档",
|
||||
"href": "http://www.pearadmin.com"
|
||||
},
|
||||
{
|
||||
"icon": "layui-icon layui-icon-auz",
|
||||
"title": "开源地址",
|
||||
"href": "https://gitee.com/Jmysy/Pear-Admin-Layui"
|
||||
}
|
||||
],
|
||||
"other": {
|
||||
"keepLoad": 1200,
|
||||
"autoHead": false
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
---
|
||||
## 网站配置
|
||||
logo:
|
||||
## 网站名称
|
||||
title: "Pear Admin"
|
||||
## 网站图标
|
||||
image: "/static/admin/admin/images/logo.png"
|
||||
## 菜单配置
|
||||
menu:
|
||||
## 菜单数据来源
|
||||
data: "/admin/menu"
|
||||
## 是否同时只打开一个菜单目录
|
||||
accordion: true
|
||||
## 是否开启多系统菜单模式
|
||||
control: false
|
||||
## 默认选中的菜单项
|
||||
select: "10"
|
||||
## 是否开启异步菜单,false 时 data 属性设置为菜单数据,false 时为 json 文件或后端接口
|
||||
async: true
|
||||
## 视图内容配置
|
||||
tab:
|
||||
## 是否开启多选项卡
|
||||
muiltTab: true
|
||||
## 切换选项卡时,是否刷新页面状态
|
||||
keepState: true
|
||||
## 是否开启 Tab 记忆
|
||||
session: true
|
||||
## 最大可打开的选项卡数量
|
||||
tabMax: "30"
|
||||
## 默认选项卡数据
|
||||
index:
|
||||
id: "10" ## 标识 ID , 建议与菜单项中的 ID 一致
|
||||
href: "/admin/welcome" ## 页面地址
|
||||
title: "首页" ## 标题
|
||||
## 主题配置
|
||||
theme:
|
||||
## 默认主题色,对应 colors 配置中的 ID 标识
|
||||
defaultColor: "2"
|
||||
## 默认的菜单主题 dark-theme 黑 / light-theme 白
|
||||
defaultMenu: "dark-theme"
|
||||
## 是否允许用户切换主题,false 时关闭自定义主题面板
|
||||
allowCustom: true
|
||||
## 供选择的主题色配置列表
|
||||
colors:
|
||||
- id: "1"
|
||||
color: "#2d8cf0"
|
||||
- id: "2"
|
||||
color: "#36b368"
|
||||
- id: "3"
|
||||
color: "#f6ad55"
|
||||
- id: "4"
|
||||
color: "#f56c6c"
|
||||
- id: "5"
|
||||
color: "darkgray"
|
||||
## 主题面板的链接列表配置
|
||||
links:
|
||||
- icon: "layui-icon layui-icon-website"
|
||||
title: "官方网站"
|
||||
href: "http://www.pearadmin.com"
|
||||
- icon: "layui-icon layui-icon-read"
|
||||
title: "开发文档"
|
||||
href: "http://www.pearadmin.com/doc/"
|
||||
- icon: "layui-icon layui-icon-fonts-code"
|
||||
title: "开源地址"
|
||||
href: "https://gitee.com/pear-admin/Pear-Admin-Layui"
|
||||
- icon: "layui-icon layui-icon-survey"
|
||||
title: "问答社区"
|
||||
href: "http://forum.pearadmin.com/"
|
||||
## 其他配置
|
||||
other:
|
||||
## 主页动画时长
|
||||
keepLoad: "1200"
|
||||
## 布局顶部主题
|
||||
autoHead: false
|
||||
|
||||
header:
|
||||
## 站内消息,数据来源,通过 false 设置关闭
|
||||
false
|
||||
@@ -77,8 +77,8 @@
|
||||
// 框架初始化时会读取 根目录下 pear.config.yml 文件作为初始化配置
|
||||
// 你可以通过 admin.setConfigPath 方法修改配置文件位置
|
||||
// 你可以通过 admin.setConfigType 方法修改配置文件类型
|
||||
admin.setConfigType("yml");
|
||||
admin.setConfigPath("/static/admin/config/pear.config.yml");
|
||||
admin.setConfigType("json");
|
||||
admin.setConfigPath("{{ url_for('adminIndex.config') }}");
|
||||
|
||||
admin.render();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user