pycharm下格式化模板文件,统一风格

This commit is contained in:
zhengxinonly
2021-06-13 12:45:11 +08:00
parent d9a5bcb0de
commit 5faf88283f
39 changed files with 2829 additions and 2712 deletions
+3 -3
View File
@@ -3,18 +3,18 @@ from flask import jsonify
def success_api(msg: str = "成功"):
""" 成功响应 默认值”成功“ """
return jsonify(success=True, message=msg)
return jsonify(success=True, msg=msg)
def fail_api(msg: str = "失败"):
""" 失败响应 默认值“失败” """
return jsonify(success=False, message=msg)
return jsonify(success=False, msg=msg)
def table_api(msg: str = "", count=0, data=None, limit=10):
""" 动态表格渲染响应 """
res = {
'message': msg,
'msg': msg,
'code': 0,
'data': data,
'count': count,
+2
View File
@@ -16,6 +16,8 @@ class BaseConfig:
MYSQL_PORT = int(os.getenv('MYSQL_PORT') or 3306)
MYSQL_DATABASE = os.getenv('MYSQL_DATABASE') or "PearAdminFlask"
UPLOADED_PHOTOS_DEST = '/static'
# mysql 数据库的配置信息
SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://{MYSQL_USERNAME}:{MYSQL_PASSWORD}@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DATABASE}"
# 默认日志等级
@@ -40,74 +40,74 @@
</script>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'form', 'jquery', 'element', 'util'], function () {
let table = layui.table;
let form = layui.form;
layui.use(['table', 'form', 'jquery', 'element', 'util'], function () {
let table = layui.table
let form = layui.form
let MODULE_PATH = "/admin/log/";
let MODULE_PATH = '/admin/log/'
let cols = [
[
{title: 'ID', field: 'id', align: 'center'},
{title: '请求方式', field: 'method', align: 'center'},
{title: '接口', field: 'url', align: 'center'},
{title: '浏览器', field: 'user_agent', align: 'center'},
{title: '操作地址', field: 'ip', align: 'center'},
{title: '访问时间', field: 'create_time', templet: '#log-createTime', align: 'center'},
{title: '操作人ID', field: 'uid', align: 'center'},
{title: '描述', field: 'desc', align: 'center'},
{title: '访问状态', templet: '#log-status', align: 'center'}
]
];
let cols = [
[
{ title: 'ID', field: 'id', align: 'center' },
{ title: '请求方式', field: 'method', align: 'center' },
{ title: '接口', field: 'url', align: 'center' },
{ title: '浏览器', field: 'user_agent', align: 'center' },
{ title: '操作地址', field: 'ip', align: 'center' },
{ title: '访问时间', field: 'create_time', templet: '#log-createTime', align: 'center' },
{ title: '操作人ID', field: 'uid', align: 'center' },
{ title: '描述', field: 'desc', align: 'center' },
{ title: '访问状态', templet: '#log-status', align: 'center' }
]
]
table.render({
elem: '#log-operate-table',
url: MODULE_PATH + 'operateLog',
page: true,
cols: cols,
skin: 'line',
toolbar: false
});
table.render({
elem: '#log-login-table',
url: MODULE_PATH + 'loginLog',
page: true,
cols: cols,
skin: 'line',
toolbar: false
});
form.on('submit(dict-type-query)', function (data) {
table.reload('dict-type-table', {where: data.field});
return false;
});
table.on('tool(log-operate-table)', function (obj) {
if (obj.event === 'details') {
window.info(obj);
}
});
table.on('tool(log-login-table)', function (obj) {
if (obj.event === 'details') {
window.info(obj);
}
});
window.info = function (obj) {
layer.open({
type: 2,
title: '详细信息',
shade: 0,
area: ['400px', '400px'],
content: MODULE_PATH + "info",
success: function (layero) {
let iframeWin = window[layero.find('iframe')[0]['name']];
iframeWin.show(obj.data);
}
});
}
table.render({
elem: '#log-operate-table',
url: MODULE_PATH + 'operateLog',
page: true,
cols: cols,
skin: 'line',
toolbar: false
})
table.render({
elem: '#log-login-table',
url: MODULE_PATH + 'loginLog',
page: true,
cols: cols,
skin: 'line',
toolbar: false
})
form.on('submit(dict-type-query)', function (data) {
table.reload('dict-type-table', { where: data.field })
return false
})
table.on('tool(log-operate-table)', function (obj) {
if (obj.event === 'details') {
window.info(obj)
}
})
table.on('tool(log-login-table)', function (obj) {
if (obj.event === 'details') {
window.info(obj)
}
})
window.info = function (obj) {
layer.open({
type: 2,
title: '详细信息',
shade: 0,
area: ['400px', '400px'],
content: MODULE_PATH + 'info',
success: function (layero) {
let iframeWin = window[layero.find('iframe')[0]['name']]
iframeWin.show(obj.data)
}
})
}
})
</script>
</html>
@@ -2,4 +2,4 @@
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/component/pear/css/pear.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/component/pear/css/pear.css') }}"/>
+400 -343
View File
@@ -1,356 +1,413 @@
<!DOCTYPE html>
<html>
<head>
<title>首页</title>
{% include 'admin/common/header.html' %}
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/console1.css') }}" />
<head>
<title>首页</title>
{% include 'admin/common/header.html' %}
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/console1.css') }}"/>
<!-- 主 题 更 换 -->
<style id="pearadmin-bg-color"></style>
</head>
<body class="pear-container">
<div>
<div class="layui-row layui-col-space10">
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">今日访问</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value1">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 1024 1024" width="200" height="200" t="1591462258798"
p-id="942" version="1.1">
<path fill="#fcc66f" d="M 262.7 835 c -15.3 0 -28.1 -11.4 -29.8 -26.6 L 174.1 291 c -0.6 -5.1 1 -10.2 4.5 -14 s 8.3 -6 13.4 -6 h 640 c 5.1 0 10 2.2 13.4 6 s 5 8.9 4.5 14 l -58.8 517.4 c -1.7 15.2 -14.5 26.6 -29.8 26.6 H 262.7 Z" p-id="943" />
<path fill="#ffd79c" d="M 802 289 l -58.8 517.4 c -0.7 6.1 -5.8 10.6 -11.9 10.6 h 30 c 6.1 0 11.2 -4.6 11.9 -10.6 L 832 289 h -30 Z" p-id="944" />
<path fill="#f56e73" d="M 164 307 c -16.5 0 -30 -13.5 -30 -30 v -58 c 0 -16.5 13.5 -30 30 -30 h 696 c 16.5 0 30 13.5 30 30 v 58 c 0 16.5 -13.5 30 -30 30 H 164 Z" p-id="945" />
<path fill="#ffa1a8" d="M 860 207 h -30 c 6.6 0 12 5.4 12 12 v 58 c 0 6.6 -5.4 12 -12 12 h 30 c 6.6 0 12 -5.4 12 -12 v -58 c 0 -6.6 -5.4 -12 -12 -12 Z" p-id="946" />
<path fill="#65c8ff" d="M 190.9 651.5 c -31.4 0 -56.9 -25.5 -56.9 -56.9 V 219 c 0 -16.5 13.5 -30 30 -30 h 466.2 c 9.9 0 18 8.1 18 18 v 301.1 c 0 34.7 -28.2 62.9 -62.9 62.9 s -62.9 -28.2 -62.9 -62.9 V 393.5 c 0 -23.2 -18.8 -42 -42 -42 s -42 18.8 -42 42 v 68.1 c 0 29.4 -23.9 53.4 -53.4 53.4 s -53.4 -23.9 -53.4 -53.4 v -68.1 c 0 -23.2 -18.8 -42 -42 -42 s -42 18.8 -42 42 v 201.1 c 0.1 31.4 -25.4 56.9 -56.7 56.9 Z" p-id="947" />
<path fill="#b3eaff" d="M 277.8 321.5 c -33.1 0 -60 26.9 -60 60 v 201.1 c 0 21.5 -17.4 38.9 -38.9 38.9 c -7.7 0 -14.8 -2.2 -20.8 -6.1 c 6.9 10.9 19 18.1 32.8 18.1 c 21.5 0 38.9 -17.4 38.9 -38.9 V 393.5 c 0 -33.1 26.9 -60 60 -60 c 13.5 0 25.9 4.5 36 12 c -11 -14.5 -28.4 -24 -48 -24 Z M 618.3 207 v 289.1 c 0 24.8 -20.1 44.9 -44.9 44.9 c -9.3 0 -18 -2.8 -25.2 -7.7 c 8.1 11.9 21.7 19.7 37.2 19.7 c 24.8 0 44.9 -20.1 44.9 -44.9 V 207 h -12 Z M 468.5 321.5 c -33.1 0 -60 26.9 -60 60 v 68.1 c 0 19.5 -15.8 35.4 -35.4 35.4 c -6.7 0 -12.9 -1.9 -18.3 -5.1 c 6.2 10.2 17.4 17.1 30.3 17.1 c 19.5 0 35.4 -15.8 35.4 -35.4 v -68.1 c 0 -33.1 26.9 -60 60 -60 c 13.5 0 25.9 4.5 36 12 c -11 -14.5 -28.4 -24 -48 -24 Z" p-id="948" />
<path fill="#453b56" d="M 698 729.4 m -18 0 a 18 18 0 1 0 36 0 a 18 18 0 1 0 -36 0 Z" p-id="949" />
<path fill="#453b56" d="M 860 171 H 632.5 v 0.1 c -0.7 0 -1.5 -0.1 -2.2 -0.1 H 164 c -26.5 0 -48 21.5 -48 48 v 375.6 c 0 41.3 33.6 74.9 74.9 74.9 c 2.7 0 5.4 -0.2 8.1 -0.5 l 16 141.4 c 2.8 24.3 23.3 42.6 47.7 42.6 h 498.6 c 24.4 0 44.9 -18.3 47.7 -42.6 l 55.2 -485.6 c 24.5 -2.1 43.8 -22.7 43.8 -47.8 v -58 c 0 -26.5 -21.5 -48 -48 -48 Z M 190.9 633.5 c -21.5 0 -38.9 -17.4 -38.9 -38.9 V 219 c 0 -6.6 5.4 -12 12 -12 h 466.3 v 301.1 c 0 24.8 -20.1 44.9 -44.9 44.9 c -24.8 0 -44.9 -20.1 -44.9 -44.9 V 393.5 c 0 -33.1 -26.9 -60 -60 -60 s -60 26.9 -60 60 v 68.1 c 0 19.5 -15.8 35.4 -35.4 35.4 c -19.5 0 -35.4 -15.8 -35.4 -35.4 v -68.1 c 0 -33.1 -26.9 -60 -60 -60 s -60 26.9 -60 60 v 201.1 c 0.1 21.5 -17.4 38.9 -38.8 38.9 Z m 582.3 172.9 c -0.7 6.1 -5.8 10.6 -11.9 10.6 H 262.7 c -6.1 0 -11.2 -4.6 -11.9 -10.6 l -6.7 -59 h 396.6 c 9.9 0 18 -8.1 18 -18 s -8.1 -18 -18 -18 H 240 l -6.3 -55.4 c 19.3 -13.6 32.1 -36 32.1 -61.3 V 393.5 c 0 -13.2 10.8 -24 24 -24 s 24 10.8 24 24 v 68.1 c 0 39.4 32 71.4 71.4 71.4 s 71.4 -32 71.4 -71.4 v -68.1 c 0 -13.2 10.8 -24 24 -24 s 24 10.8 24 24 v 114.6 c 0 44.6 36.3 80.9 80.9 80.9 c 44.6 0 80.9 -36.3 80.9 -80.9 V 325 h 161.7 l -54.9 481.4 Z M 872 277 c 0 6.6 -5.4 12 -12 12 H 666.3 v -82 H 860 c 6.6 0 12 5.4 12 12 v 58 Z" p-id="950" /></svg>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">提交次数</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value2">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg t="1591462430908" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="3170" width="200" height="200">
<path d="M532 784.2c0 24.4-19.8 44.3-44.3 44.3s-44.3-19.8-44.3-44.3c0-24.4 44.3-80.3 44.3-80.3s44.3 55.8 44.3 80.3zM766 784.2c0 24.4 19.8 44.3 44.3 44.3 24.4 0 44.3-19.8 44.3-44.3 0-24.4-44.3-80.3-44.3-80.3S766 759.7 766 784.2z"
fill="#97DCFF" p-id="3171"></path>
<path d="M123.5 471.3c-9.9 0-18-8.1-18-18v-302c0-9.9 8.1-18 18-18h58c9.9 0 18 8.1 18 18v302c0 9.9-8.1 18-18 18h-58z"
fill="#FCC66F" p-id="3172"></path>
<path d="M181.5 151.3v302h-58v-302h58m0-36h-58c-19.9 0-36 16.1-36 36v302c0 19.9 16.1 36 36 36h58c19.9 0 36-16.1 36-36v-302c0-19.8-16.1-36-36-36z"
fill="#453B56" p-id="3173"></path>
<path d="M266.4 210.7m-18 0a18 18 0 1 0 36 0 18 18 0 1 0-36 0Z" fill="#453B56" p-id="3174"></path>
<path d="M430.8 641.1c-9.9 0-18-8.1-18-18v-21.6c0-130.3 106-236.3 236.3-236.3s236.3 106 236.3 236.3v21.6c0 9.9-8.1 18-18 18H430.8z"
fill="#FCC66F" p-id="3175"></path>
<path d="M649 383.2c-5 0-10 0.2-15 0.6 113.5 7.7 203.3 102.2 203.3 217.7v21.6h30v-21.6c0-120.6-97.7-218.3-218.3-218.3z"
fill="#FFD79C" p-id="3176"></path>
<path d="M419.6 694.4c-22.1 0-40.1-18-40.1-40.1s18-40.1 40.1-40.1h458.8c22.1 0 40.1 18 40.1 40.1s-18 40.1-40.1 40.1H419.6z"
fill="#F56E73" p-id="3177"></path>
<path d="M878.4 632.3h-30c12.2 0 22.1 9.9 22.1 22.1s-9.9 22.1-22.1 22.1h30c12.2 0 22.1-9.9 22.1-22.1s-9.9-22.1-22.1-22.1z"
fill="#FFA1A8" p-id="3178"></path>
<path d="M693.3 846.4c0 24.4-19.8 44.3-44.3 44.3-24.4 0-44.3-19.8-44.3-44.3s44.3-80.3 44.3-80.3 44.3 55.9 44.3 80.3z"
fill="#97DCFF" p-id="3179"></path>
<path d="M649 908.7c-34.3 0-62.3-27.9-62.3-62.3 0-28.5 36.9-77.2 48.1-91.4 3.4-4.3 8.6-6.8 14.1-6.8s10.7 2.5 14.1 6.8c11.3 14.2 48.1 62.9 48.1 91.4 0.2 34.3-27.8 62.3-62.1 62.3z m0-112.3c-14.1 20.4-26.3 41.9-26.3 50 0 14.5 11.8 26.3 26.3 26.3s26.3-11.8 26.3-26.3c0-8.1-12.1-29.6-26.3-50z"
fill="#453B56" p-id="3180"></path>
<path d="M903.3 601.9v-0.5c0-134.1-104.4-244.3-236.3-253.6v-30.7c0-68.7-55.9-124.6-124.6-124.6H326.5c-9.9 0-18 8.1-18 18s8.1 18 18 18h215.9c48.8 0 88.6 39.7 88.6 88.6v30.7c-131.8 9.3-236.3 119.4-236.3 253.6v0.5c-19.6 9.3-33.2 29.3-33.2 52.4 0 32 26 58.1 58.1 58.1H459c-14.8 21-33.5 51.5-33.5 71.8 0 34.3 27.9 62.3 62.3 62.3 34.3 0 62.2-27.9 62.2-62.3 0-20.3-18.6-50.7-33.5-71.8h264.9c-14.8 21-33.5 51.5-33.5 71.8 0 34.3 27.9 62.3 62.3 62.3 34.3 0 62.3-27.9 62.3-62.3 0-20.3-18.6-50.7-33.5-71.8h39.4c32 0 58.1-26 58.1-58.1 0-23.1-13.6-43-33.2-52.4zM487.8 810.4c-14.5 0-26.3-11.8-26.3-26.3 0-8.1 12.1-29.6 26.3-50 14.1 20.4 26.2 41.9 26.2 50 0 14.5-11.8 26.3-26.2 26.3z m322.5 0c-14.5 0-26.3-11.8-26.3-26.3 0-8.1 12.1-29.6 26.3-50 14.1 20.4 26.3 41.9 26.3 50-0.1 14.5-11.9 26.3-26.3 26.3zM649 383.2c118.8 0 215.4 94.9 218.1 213.1H430.9c2.8-118.1 99.3-213.1 218.1-213.1z m251.5 271.1c0 12.2-9.9 22.1-22.1 22.1H419.6c-12.2 0-22.1-9.9-22.1-22.1 0-12.2 9.9-22.1 22.1-22.1h458.8c12.2 0.1 22.1 10 22.1 22.1z"
fill="#453B56" p-id="3181"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">下载数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value3">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg t="1591462464512" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="3311" width="200" height="200">
<path d="M750.4 216.5h-130v-15.3c0-32.9-26.8-59.7-59.7-59.7h-97.3c-32.9 0-59.7 26.8-59.7 59.7v15.3h-130c-30.7 0-55.6 25-55.6 55.6v72.4c0 9.9 8.1 18 18 18h31.5v478c0 23.2 18.8 42 42 42h405c23.2 0 42-18.8 42-42v-478H788c9.9 0 18-8.1 18-18v-72.4c0-30.6-25-55.6-55.6-55.6z"
fill="#FCC66F" p-id="3312"></path>
<path d="M708.5 344.5v496c0 13.3-10.7 24-24 24h30c13.3 0 24-10.7 24-24v-496h-30z" fill="#FFD79C" p-id="3313"></path>
<path d="M309.5 882.5c-23.2 0-42-18.8-42-42V596c0-9.9 8.1-18 18-18h36.8c30.2 0 54.8 24.6 54.8 54.8v231.7c0 9.9-8.1 18-18 18h-49.6zM664.9 882.5c-9.9 0-18-8.1-18-18V632.8c0-30.2 24.6-54.8 54.8-54.8h36.8c9.9 0 18 8.1 18 18v244.5c0 23.2-18.8 42-42 42h-49.6z"
fill="#F56E73" p-id="3314"></path>
<path d="M708.5 596v244.5c0 13.3-10.7 24-24 24h30c13.3 0 24-10.7 24-24V596h-30z" fill="#FFA1A8" p-id="3315"></path>
<path d="M475.2 882.5c-9.9 0-18-8.1-18-18V632.8c0-30.2 24.6-54.8 54.8-54.8 30.2 0 54.8 24.6 54.8 54.8v231.7c0 9.9-8.1 18-18 18h-73.6z"
fill="#F56E73" p-id="3316"></path>
<path d="M560.7 159.5h-18c23 0 41.7 18.7 41.7 41.7V221h18v-19.8c-0.1-23-18.7-41.7-41.7-41.7zM750.4 234.5h-30c20.8 0 37.6 16.8 37.6 37.6v72.4h30v-72.4c0-20.8-16.8-37.6-37.6-37.6z"
fill="#FFD79C" p-id="3317"></path>
<path d="M750.4 198.5H638.2c-1.4-41.6-35.6-75-77.5-75h-97.3c-41.9 0-76.1 33.4-77.5 75H273.6c-40.6 0-73.6 33-73.6 73.6v72.4c0 19.9 16.1 36 36 36h13.5v460c0 33.1 26.9 60 60 60H714.7c33.1 0 60-26.9 60-60v-460H788c19.9 0 36-16.1 36-36v-72.4c0-40.6-33-73.6-73.6-73.6z m-287.1-39h97.3c22.1 0 40.2 17.2 41.5 39H421.8c1.4-21.8 19.4-39 41.5-39z m-104.2 705h-49.6c-13.3 0-24-10.7-24-24V596h36.8c20.3 0 36.8 16.5 36.8 36.8v231.7z m189.7 0h-73.6V632.8c0-20.3 16.5-36.8 36.8-36.8 20.3 0 36.8 16.5 36.8 36.8v231.7z m189.7-24c0 13.3-10.7 24-24 24h-49.6V632.8c0-20.3 16.5-36.8 36.8-36.8h36.8v244.5z m0-280.5h-36.8c-40.1 0-72.8 32.6-72.8 72.8v231.7h-44.2V632.8c0-40.1-32.6-72.8-72.8-72.8-40.1 0-72.8 32.6-72.8 72.8v231.7h-44.2V632.8c0-40.1-32.6-72.8-72.8-72.8h-36.8v-74.5h279c9.9 0 18-8.1 18-18s-8.1-18-18-18h-279v-69h453V560zM788 344.5H236v-72.4c0-20.8 16.8-37.6 37.6-37.6h476.8c20.8 0 37.6 16.8 37.6 37.6v72.4z"
fill="#453B56" p-id="3318"></path>
<path d="M621.8 467.5m-18 0a18 18 0 1 0 36 0 18 18 0 1 0-36 0Z" fill="#453B56" p-id="3319"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">流量统计</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value4">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg t="1591462491887" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="3449" width="200" height="200">
<path d="M363.2 807c-9.9 0-18-8.1-18-18v-75.5c0-9.9 8.1-18 18-18h108.5c9.9 0 18 8.1 18 18V789c0 9.9-8.1 18-18 18H363.2z"
fill="#F56E73" p-id="3450"></path>
<path d="M441.7 713.5h30V789h-30z" fill="#FFA1A8" p-id="3451"></path>
<path d="M259.6 398c-9.9 0-18-8.1-18-18V178.6c0-23.8 19.3-43.1 43.1-43.1s43.1 19.3 43.1 43.1V380c0 9.9-8.1 18-18 18h-50.2zM525.1 398c-9.9 0-18-8.1-18-18V178.6c0-23.8 19.3-43.1 43.1-43.1s43.1 19.3 43.1 43.1V380c0 9.9-8.1 18-18 18h-50.2z"
fill="#65C8FF" p-id="3452"></path>
<path d="M550.2 153.5c-3.2 0-6.2 0.7-9 1.7 9.4 3.6 16.1 12.7 16.1 23.4V380h18V178.6c0.1-13.9-11.2-25.1-25.1-25.1z"
fill="#97DCFF" p-id="3453"></path>
<path d="M686 330.5H149c-9.9 0-18 8.1-18 18v63c0 9.9 8.1 18 18 18h33.2l45 225c8.7 43.4 47.1 75 91.4 75h197.6c44.3 0 82.7-31.5 91.4-75l45-225H686c9.9 0 18-8.1 18-18v-63c0-9.9-8.1-18-18-18z"
fill="#FCC66F" p-id="3454"></path>
<path d="M608 411.5L560.1 651c-7 35.2-37.9 60.5-73.8 60.5h30c35.9 0 66.7-25.3 73.8-60.5L638 411.5h-30zM656 348.5h30v63h-30z"
fill="#FFD79C" p-id="3455"></path>
<path d="M474.2 543.5m-18 0a18 18 0 1 0 36 0 18 18 0 1 0-36 0Z" fill="#453B56" p-id="3456"></path>
<path d="M416.9 525.5h-125c-9.9 0-18 8.1-18 18s8.1 18 18 18h125c9.9 0 18-8.1 18-18s-8.1-18-18-18zM893 543.5h-33.4c-65.2 0-118.2 53-118.2 118.2v19.6c0 9.9 8.1 18 18 18s18-8.1 18-18v-19.6c0-45.3 36.9-82.2 82.2-82.2H893c9.9 0 18-8.1 18-18s-8-18-18-18zM772.2 744.2c7-7 7-18.4 0-25.5-7-7-18.4-7-25.5 0s-7 18.4 0 25.5 18.4 7.1 25.5 0z"
fill="#453B56" p-id="3457"></path>
<path d="M759.5 761.6c-9.9 0-18 8.1-18 18v11.6c0 43.7-35.6 79.3-79.3 79.3H487.3c-26.4 0-48.3-19.9-51.4-45.5h35.8c19.9 0 36-16.1 36-36v-41.5h8.6c52.8 0 98.7-37.6 109.1-89.4l42.1-210.6H686c19.9 0 36-16.1 36-36v-63c0-19.9-16.1-36-36-36h-74.6V178.6c0-33.7-27.4-61.1-61.1-61.1s-61.1 27.4-61.1 61.1v133.9H345.9V178.6c0-33.7-27.4-61.1-61.1-61.1s-61.1 27.4-61.1 61.1v133.9H149c-19.9 0-36 16.1-36 36v63c0 19.9 16.1 36 36 36h18.5l42.1 210.6c10.4 51.8 56.2 89.4 109.1 89.4h8.6V789c0 19.9 16.1 36 36 36h36.6c3.3 45.5 41.2 81.5 87.5 81.5h174.8c63.6 0 115.3-51.7 115.3-115.3v-11.6c0-10-8.1-18-18-18z m-234.4-583c0-13.9 11.2-25.1 25.1-25.1s25.1 11.2 25.1 25.1v133.9H525V178.6z m-265.5 0c0-13.9 11.2-25.1 25.1-25.1s25.1 11.2 25.1 25.1v133.9h-50.3V178.6zM149 411.5v-63h537v63H149z m169.7 300c-35.9 0-66.7-25.3-73.8-60.5l-40.7-203.5h426.6L590.1 651c-7 35.2-37.9 60.5-73.8 60.5H318.7z m44.5 77.5v-41.5h108.5V789H363.2z"
fill="#453B56" p-id="3458"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-row layui-col-space10">
<div class="layui-col-md9">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab custom-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">动态</div>
<div class="layui-card-body">
<dl class="layuiadmin-card-status">
<dd>
<div class="layui-status-img"><a href="javascript:;"><img style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>七彩枫叶 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear Admin 专区</a> 回答问题</p>
<span>几秒前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>简 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear Admin 专区</a> 进行了 <a class="pear-text" lay-href="http://fly.layui.com/vipclub/list/layuiadmin/column/quiz/">提问</a></p>
<span>2天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>恒宇少年 将 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear Admin </a> 更新至 2.3.0 版本</p>
<span>7天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>如花 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear Admin 社区</a> 发布了 <a class="pear-text" lay-href="http://fly.layui.com/column/suggest/">建议</a></p>
<span>7天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>就眠仪式 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear Admin 社区</a> 发布了 <a class="pear-text" lay-href="http://fly.layui.com/column/suggest/">建议</a></p>
<span>8天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>贤心 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear Admin 专区</a> 进行了 <a class="pear-text" lay-href="http://fly.layui.com/vipclub/list/layuiadmin/column/quiz/">提问</a></p>
<span>8天前</span>
</div>
</dd>
</dl>
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">最近更新</div>
<div class="layui-card-body">
<ul class="list">
<li class="list-item"><span class="title">优化代码格式</span><span class="footer">2020-06-04 11:28</span></li>
<li class="list-item"><span class="title">新增消息组件</span><span class="footer">2020-06-01 04:23</span></li>
<li class="list-item"><span class="title">移动端兼容</span><span class="footer">2020-05-22 21:38</span></li>
<li class="list-item"><span class="title">系统布局优化</span><span class="footer">2020-05-15 14:26</span></li>
<li class="list-item"><span class="title">兼容多系统菜单模式</span><span class="footer">2020-05-13 16:32</span></li>
<li class="list-item"><span class="title">兼容多标签页切换</span><span class="footer">2019-12-9 14:58</span></li>
<li class="list-item"><span class="title">扩展下拉组件</span><span class="footer">2019-12-7 9:06</span></li>
<li class="list-item"><span class="title">扩展卡片样式</span><span class="footer">2019-12-1 10:26</span></li>
</ul>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">
链接
</div>
<div class="layui-card-body">
<a target="_blank" href="http://www.pearadmin.com" class="pear-btn pear-btn-primary layui-btn-fluid" style="margin-top: 8px;height: 50px;line-height: 50px;">官 网</a>
<br/>
<a target="_blank" href="https://gitee.com/pear-admin/Pear-Admin-Layui" class="pear-btn pear-btn-warming layui-btn-fluid" style="margin-top: 8px;height: 50px;line-height: 50px;">下 载</a>
<br/>
<a target="_blank" href="https://gitee.com/pear-admin/pear-admin-flask" class="pear-btn pear-btn-danger layui-btn-fluid" style="margin-top: 8px;height: 50px;line-height: 50px;">后 端</a>
</div>
</div>
</div>
</div>
</div>
<!--</div>-->
{% include 'admin/common/footer.html' %}
<script>
layui.use(['layer', 'echarts', 'element', 'count'], function() {
var $ = layui.jquery,
layer = layui.layer,
element = layui.element,
count = layui.count,
echarts = layui.echarts;
<!-- 主 题 更 换 -->
<style id="pearadmin-bg-color"></style>
</head>
<body class="pear-container">
<div>
<div class="layui-row layui-col-space10">
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">今日访问</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value1">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 1024 1024" width="200"
height="200" t="1591462258798"
p-id="942" version="1.1">
<path fill="#fcc66f"
d="M 262.7 835 c -15.3 0 -28.1 -11.4 -29.8 -26.6 L 174.1 291 c -0.6 -5.1 1 -10.2 4.5 -14 s 8.3 -6 13.4 -6 h 640 c 5.1 0 10 2.2 13.4 6 s 5 8.9 4.5 14 l -58.8 517.4 c -1.7 15.2 -14.5 26.6 -29.8 26.6 H 262.7 Z"
p-id="943"/>
<path fill="#ffd79c"
d="M 802 289 l -58.8 517.4 c -0.7 6.1 -5.8 10.6 -11.9 10.6 h 30 c 6.1 0 11.2 -4.6 11.9 -10.6 L 832 289 h -30 Z"
p-id="944"/>
<path fill="#f56e73"
d="M 164 307 c -16.5 0 -30 -13.5 -30 -30 v -58 c 0 -16.5 13.5 -30 30 -30 h 696 c 16.5 0 30 13.5 30 30 v 58 c 0 16.5 -13.5 30 -30 30 H 164 Z"
p-id="945"/>
<path fill="#ffa1a8"
d="M 860 207 h -30 c 6.6 0 12 5.4 12 12 v 58 c 0 6.6 -5.4 12 -12 12 h 30 c 6.6 0 12 -5.4 12 -12 v -58 c 0 -6.6 -5.4 -12 -12 -12 Z"
p-id="946"/>
<path fill="#65c8ff"
d="M 190.9 651.5 c -31.4 0 -56.9 -25.5 -56.9 -56.9 V 219 c 0 -16.5 13.5 -30 30 -30 h 466.2 c 9.9 0 18 8.1 18 18 v 301.1 c 0 34.7 -28.2 62.9 -62.9 62.9 s -62.9 -28.2 -62.9 -62.9 V 393.5 c 0 -23.2 -18.8 -42 -42 -42 s -42 18.8 -42 42 v 68.1 c 0 29.4 -23.9 53.4 -53.4 53.4 s -53.4 -23.9 -53.4 -53.4 v -68.1 c 0 -23.2 -18.8 -42 -42 -42 s -42 18.8 -42 42 v 201.1 c 0.1 31.4 -25.4 56.9 -56.7 56.9 Z"
p-id="947"/>
<path fill="#b3eaff"
d="M 277.8 321.5 c -33.1 0 -60 26.9 -60 60 v 201.1 c 0 21.5 -17.4 38.9 -38.9 38.9 c -7.7 0 -14.8 -2.2 -20.8 -6.1 c 6.9 10.9 19 18.1 32.8 18.1 c 21.5 0 38.9 -17.4 38.9 -38.9 V 393.5 c 0 -33.1 26.9 -60 60 -60 c 13.5 0 25.9 4.5 36 12 c -11 -14.5 -28.4 -24 -48 -24 Z M 618.3 207 v 289.1 c 0 24.8 -20.1 44.9 -44.9 44.9 c -9.3 0 -18 -2.8 -25.2 -7.7 c 8.1 11.9 21.7 19.7 37.2 19.7 c 24.8 0 44.9 -20.1 44.9 -44.9 V 207 h -12 Z M 468.5 321.5 c -33.1 0 -60 26.9 -60 60 v 68.1 c 0 19.5 -15.8 35.4 -35.4 35.4 c -6.7 0 -12.9 -1.9 -18.3 -5.1 c 6.2 10.2 17.4 17.1 30.3 17.1 c 19.5 0 35.4 -15.8 35.4 -35.4 v -68.1 c 0 -33.1 26.9 -60 60 -60 c 13.5 0 25.9 4.5 36 12 c -11 -14.5 -28.4 -24 -48 -24 Z"
p-id="948"/>
<path fill="#453b56" d="M 698 729.4 m -18 0 a 18 18 0 1 0 36 0 a 18 18 0 1 0 -36 0 Z"
p-id="949"/>
<path fill="#453b56"
d="M 860 171 H 632.5 v 0.1 c -0.7 0 -1.5 -0.1 -2.2 -0.1 H 164 c -26.5 0 -48 21.5 -48 48 v 375.6 c 0 41.3 33.6 74.9 74.9 74.9 c 2.7 0 5.4 -0.2 8.1 -0.5 l 16 141.4 c 2.8 24.3 23.3 42.6 47.7 42.6 h 498.6 c 24.4 0 44.9 -18.3 47.7 -42.6 l 55.2 -485.6 c 24.5 -2.1 43.8 -22.7 43.8 -47.8 v -58 c 0 -26.5 -21.5 -48 -48 -48 Z M 190.9 633.5 c -21.5 0 -38.9 -17.4 -38.9 -38.9 V 219 c 0 -6.6 5.4 -12 12 -12 h 466.3 v 301.1 c 0 24.8 -20.1 44.9 -44.9 44.9 c -24.8 0 -44.9 -20.1 -44.9 -44.9 V 393.5 c 0 -33.1 -26.9 -60 -60 -60 s -60 26.9 -60 60 v 68.1 c 0 19.5 -15.8 35.4 -35.4 35.4 c -19.5 0 -35.4 -15.8 -35.4 -35.4 v -68.1 c 0 -33.1 -26.9 -60 -60 -60 s -60 26.9 -60 60 v 201.1 c 0.1 21.5 -17.4 38.9 -38.8 38.9 Z m 582.3 172.9 c -0.7 6.1 -5.8 10.6 -11.9 10.6 H 262.7 c -6.1 0 -11.2 -4.6 -11.9 -10.6 l -6.7 -59 h 396.6 c 9.9 0 18 -8.1 18 -18 s -8.1 -18 -18 -18 H 240 l -6.3 -55.4 c 19.3 -13.6 32.1 -36 32.1 -61.3 V 393.5 c 0 -13.2 10.8 -24 24 -24 s 24 10.8 24 24 v 68.1 c 0 39.4 32 71.4 71.4 71.4 s 71.4 -32 71.4 -71.4 v -68.1 c 0 -13.2 10.8 -24 24 -24 s 24 10.8 24 24 v 114.6 c 0 44.6 36.3 80.9 80.9 80.9 c 44.6 0 80.9 -36.3 80.9 -80.9 V 325 h 161.7 l -54.9 481.4 Z M 872 277 c 0 6.6 -5.4 12 -12 12 H 666.3 v -82 H 860 c 6.6 0 12 5.4 12 12 v 58 Z"
p-id="950"/>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">提交次数</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value2">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg t="1591462430908" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="3170" width="200" height="200">
<path d="M532 784.2c0 24.4-19.8 44.3-44.3 44.3s-44.3-19.8-44.3-44.3c0-24.4 44.3-80.3 44.3-80.3s44.3 55.8 44.3 80.3zM766 784.2c0 24.4 19.8 44.3 44.3 44.3 24.4 0 44.3-19.8 44.3-44.3 0-24.4-44.3-80.3-44.3-80.3S766 759.7 766 784.2z"
fill="#97DCFF" p-id="3171"></path>
<path d="M123.5 471.3c-9.9 0-18-8.1-18-18v-302c0-9.9 8.1-18 18-18h58c9.9 0 18 8.1 18 18v302c0 9.9-8.1 18-18 18h-58z"
fill="#FCC66F" p-id="3172"></path>
<path d="M181.5 151.3v302h-58v-302h58m0-36h-58c-19.9 0-36 16.1-36 36v302c0 19.9 16.1 36 36 36h58c19.9 0 36-16.1 36-36v-302c0-19.8-16.1-36-36-36z"
fill="#453B56" p-id="3173"></path>
<path d="M266.4 210.7m-18 0a18 18 0 1 0 36 0 18 18 0 1 0-36 0Z" fill="#453B56"
p-id="3174"></path>
<path d="M430.8 641.1c-9.9 0-18-8.1-18-18v-21.6c0-130.3 106-236.3 236.3-236.3s236.3 106 236.3 236.3v21.6c0 9.9-8.1 18-18 18H430.8z"
fill="#FCC66F" p-id="3175"></path>
<path d="M649 383.2c-5 0-10 0.2-15 0.6 113.5 7.7 203.3 102.2 203.3 217.7v21.6h30v-21.6c0-120.6-97.7-218.3-218.3-218.3z"
fill="#FFD79C" p-id="3176"></path>
<path d="M419.6 694.4c-22.1 0-40.1-18-40.1-40.1s18-40.1 40.1-40.1h458.8c22.1 0 40.1 18 40.1 40.1s-18 40.1-40.1 40.1H419.6z"
fill="#F56E73" p-id="3177"></path>
<path d="M878.4 632.3h-30c12.2 0 22.1 9.9 22.1 22.1s-9.9 22.1-22.1 22.1h30c12.2 0 22.1-9.9 22.1-22.1s-9.9-22.1-22.1-22.1z"
fill="#FFA1A8" p-id="3178"></path>
<path d="M693.3 846.4c0 24.4-19.8 44.3-44.3 44.3-24.4 0-44.3-19.8-44.3-44.3s44.3-80.3 44.3-80.3 44.3 55.9 44.3 80.3z"
fill="#97DCFF" p-id="3179"></path>
<path d="M649 908.7c-34.3 0-62.3-27.9-62.3-62.3 0-28.5 36.9-77.2 48.1-91.4 3.4-4.3 8.6-6.8 14.1-6.8s10.7 2.5 14.1 6.8c11.3 14.2 48.1 62.9 48.1 91.4 0.2 34.3-27.8 62.3-62.1 62.3z m0-112.3c-14.1 20.4-26.3 41.9-26.3 50 0 14.5 11.8 26.3 26.3 26.3s26.3-11.8 26.3-26.3c0-8.1-12.1-29.6-26.3-50z"
fill="#453B56" p-id="3180"></path>
<path d="M903.3 601.9v-0.5c0-134.1-104.4-244.3-236.3-253.6v-30.7c0-68.7-55.9-124.6-124.6-124.6H326.5c-9.9 0-18 8.1-18 18s8.1 18 18 18h215.9c48.8 0 88.6 39.7 88.6 88.6v30.7c-131.8 9.3-236.3 119.4-236.3 253.6v0.5c-19.6 9.3-33.2 29.3-33.2 52.4 0 32 26 58.1 58.1 58.1H459c-14.8 21-33.5 51.5-33.5 71.8 0 34.3 27.9 62.3 62.3 62.3 34.3 0 62.2-27.9 62.2-62.3 0-20.3-18.6-50.7-33.5-71.8h264.9c-14.8 21-33.5 51.5-33.5 71.8 0 34.3 27.9 62.3 62.3 62.3 34.3 0 62.3-27.9 62.3-62.3 0-20.3-18.6-50.7-33.5-71.8h39.4c32 0 58.1-26 58.1-58.1 0-23.1-13.6-43-33.2-52.4zM487.8 810.4c-14.5 0-26.3-11.8-26.3-26.3 0-8.1 12.1-29.6 26.3-50 14.1 20.4 26.2 41.9 26.2 50 0 14.5-11.8 26.3-26.2 26.3z m322.5 0c-14.5 0-26.3-11.8-26.3-26.3 0-8.1 12.1-29.6 26.3-50 14.1 20.4 26.3 41.9 26.3 50-0.1 14.5-11.9 26.3-26.3 26.3zM649 383.2c118.8 0 215.4 94.9 218.1 213.1H430.9c2.8-118.1 99.3-213.1 218.1-213.1z m251.5 271.1c0 12.2-9.9 22.1-22.1 22.1H419.6c-12.2 0-22.1-9.9-22.1-22.1 0-12.2 9.9-22.1 22.1-22.1h458.8c12.2 0.1 22.1 10 22.1 22.1z"
fill="#453B56" p-id="3181"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">下载数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value3">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg t="1591462464512" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="3311" width="200" height="200">
<path d="M750.4 216.5h-130v-15.3c0-32.9-26.8-59.7-59.7-59.7h-97.3c-32.9 0-59.7 26.8-59.7 59.7v15.3h-130c-30.7 0-55.6 25-55.6 55.6v72.4c0 9.9 8.1 18 18 18h31.5v478c0 23.2 18.8 42 42 42h405c23.2 0 42-18.8 42-42v-478H788c9.9 0 18-8.1 18-18v-72.4c0-30.6-25-55.6-55.6-55.6z"
fill="#FCC66F" p-id="3312"></path>
<path d="M708.5 344.5v496c0 13.3-10.7 24-24 24h30c13.3 0 24-10.7 24-24v-496h-30z"
fill="#FFD79C" p-id="3313"></path>
<path d="M309.5 882.5c-23.2 0-42-18.8-42-42V596c0-9.9 8.1-18 18-18h36.8c30.2 0 54.8 24.6 54.8 54.8v231.7c0 9.9-8.1 18-18 18h-49.6zM664.9 882.5c-9.9 0-18-8.1-18-18V632.8c0-30.2 24.6-54.8 54.8-54.8h36.8c9.9 0 18 8.1 18 18v244.5c0 23.2-18.8 42-42 42h-49.6z"
fill="#F56E73" p-id="3314"></path>
<path d="M708.5 596v244.5c0 13.3-10.7 24-24 24h30c13.3 0 24-10.7 24-24V596h-30z"
fill="#FFA1A8" p-id="3315"></path>
<path d="M475.2 882.5c-9.9 0-18-8.1-18-18V632.8c0-30.2 24.6-54.8 54.8-54.8 30.2 0 54.8 24.6 54.8 54.8v231.7c0 9.9-8.1 18-18 18h-73.6z"
fill="#F56E73" p-id="3316"></path>
<path d="M560.7 159.5h-18c23 0 41.7 18.7 41.7 41.7V221h18v-19.8c-0.1-23-18.7-41.7-41.7-41.7zM750.4 234.5h-30c20.8 0 37.6 16.8 37.6 37.6v72.4h30v-72.4c0-20.8-16.8-37.6-37.6-37.6z"
fill="#FFD79C" p-id="3317"></path>
<path d="M750.4 198.5H638.2c-1.4-41.6-35.6-75-77.5-75h-97.3c-41.9 0-76.1 33.4-77.5 75H273.6c-40.6 0-73.6 33-73.6 73.6v72.4c0 19.9 16.1 36 36 36h13.5v460c0 33.1 26.9 60 60 60H714.7c33.1 0 60-26.9 60-60v-460H788c19.9 0 36-16.1 36-36v-72.4c0-40.6-33-73.6-73.6-73.6z m-287.1-39h97.3c22.1 0 40.2 17.2 41.5 39H421.8c1.4-21.8 19.4-39 41.5-39z m-104.2 705h-49.6c-13.3 0-24-10.7-24-24V596h36.8c20.3 0 36.8 16.5 36.8 36.8v231.7z m189.7 0h-73.6V632.8c0-20.3 16.5-36.8 36.8-36.8 20.3 0 36.8 16.5 36.8 36.8v231.7z m189.7-24c0 13.3-10.7 24-24 24h-49.6V632.8c0-20.3 16.5-36.8 36.8-36.8h36.8v244.5z m0-280.5h-36.8c-40.1 0-72.8 32.6-72.8 72.8v231.7h-44.2V632.8c0-40.1-32.6-72.8-72.8-72.8-40.1 0-72.8 32.6-72.8 72.8v231.7h-44.2V632.8c0-40.1-32.6-72.8-72.8-72.8h-36.8v-74.5h279c9.9 0 18-8.1 18-18s-8.1-18-18-18h-279v-69h453V560zM788 344.5H236v-72.4c0-20.8 16.8-37.6 37.6-37.6h476.8c20.8 0 37.6 16.8 37.6 37.6v72.4z"
fill="#453B56" p-id="3318"></path>
<path d="M621.8 467.5m-18 0a18 18 0 1 0 36 0 18 18 0 1 0-36 0Z" fill="#453B56"
p-id="3319"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">流量统计</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;" id="value4">
0
</div>
<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
<svg t="1591462491887" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="3449" width="200" height="200">
<path d="M363.2 807c-9.9 0-18-8.1-18-18v-75.5c0-9.9 8.1-18 18-18h108.5c9.9 0 18 8.1 18 18V789c0 9.9-8.1 18-18 18H363.2z"
fill="#F56E73" p-id="3450"></path>
<path d="M441.7 713.5h30V789h-30z" fill="#FFA1A8" p-id="3451"></path>
<path d="M259.6 398c-9.9 0-18-8.1-18-18V178.6c0-23.8 19.3-43.1 43.1-43.1s43.1 19.3 43.1 43.1V380c0 9.9-8.1 18-18 18h-50.2zM525.1 398c-9.9 0-18-8.1-18-18V178.6c0-23.8 19.3-43.1 43.1-43.1s43.1 19.3 43.1 43.1V380c0 9.9-8.1 18-18 18h-50.2z"
fill="#65C8FF" p-id="3452"></path>
<path d="M550.2 153.5c-3.2 0-6.2 0.7-9 1.7 9.4 3.6 16.1 12.7 16.1 23.4V380h18V178.6c0.1-13.9-11.2-25.1-25.1-25.1z"
fill="#97DCFF" p-id="3453"></path>
<path d="M686 330.5H149c-9.9 0-18 8.1-18 18v63c0 9.9 8.1 18 18 18h33.2l45 225c8.7 43.4 47.1 75 91.4 75h197.6c44.3 0 82.7-31.5 91.4-75l45-225H686c9.9 0 18-8.1 18-18v-63c0-9.9-8.1-18-18-18z"
fill="#FCC66F" p-id="3454"></path>
<path d="M608 411.5L560.1 651c-7 35.2-37.9 60.5-73.8 60.5h30c35.9 0 66.7-25.3 73.8-60.5L638 411.5h-30zM656 348.5h30v63h-30z"
fill="#FFD79C" p-id="3455"></path>
<path d="M474.2 543.5m-18 0a18 18 0 1 0 36 0 18 18 0 1 0-36 0Z" fill="#453B56"
p-id="3456"></path>
<path d="M416.9 525.5h-125c-9.9 0-18 8.1-18 18s8.1 18 18 18h125c9.9 0 18-8.1 18-18s-8.1-18-18-18zM893 543.5h-33.4c-65.2 0-118.2 53-118.2 118.2v19.6c0 9.9 8.1 18 18 18s18-8.1 18-18v-19.6c0-45.3 36.9-82.2 82.2-82.2H893c9.9 0 18-8.1 18-18s-8-18-18-18zM772.2 744.2c7-7 7-18.4 0-25.5-7-7-18.4-7-25.5 0s-7 18.4 0 25.5 18.4 7.1 25.5 0z"
fill="#453B56" p-id="3457"></path>
<path d="M759.5 761.6c-9.9 0-18 8.1-18 18v11.6c0 43.7-35.6 79.3-79.3 79.3H487.3c-26.4 0-48.3-19.9-51.4-45.5h35.8c19.9 0 36-16.1 36-36v-41.5h8.6c52.8 0 98.7-37.6 109.1-89.4l42.1-210.6H686c19.9 0 36-16.1 36-36v-63c0-19.9-16.1-36-36-36h-74.6V178.6c0-33.7-27.4-61.1-61.1-61.1s-61.1 27.4-61.1 61.1v133.9H345.9V178.6c0-33.7-27.4-61.1-61.1-61.1s-61.1 27.4-61.1 61.1v133.9H149c-19.9 0-36 16.1-36 36v63c0 19.9 16.1 36 36 36h18.5l42.1 210.6c10.4 51.8 56.2 89.4 109.1 89.4h8.6V789c0 19.9 16.1 36 36 36h36.6c3.3 45.5 41.2 81.5 87.5 81.5h174.8c63.6 0 115.3-51.7 115.3-115.3v-11.6c0-10-8.1-18-18-18z m-234.4-583c0-13.9 11.2-25.1 25.1-25.1s25.1 11.2 25.1 25.1v133.9H525V178.6z m-265.5 0c0-13.9 11.2-25.1 25.1-25.1s25.1 11.2 25.1 25.1v133.9h-50.3V178.6zM149 411.5v-63h537v63H149z m169.7 300c-35.9 0-66.7-25.3-73.8-60.5l-40.7-203.5h426.6L590.1 651c-7 35.2-37.9 60.5-73.8 60.5H318.7z m44.5 77.5v-41.5h108.5V789H363.2z"
fill="#453B56" p-id="3458"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-row layui-col-space10">
<div class="layui-col-md9">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab custom-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">动态</div>
<div class="layui-card-body">
<dl class="layuiadmin-card-status">
<dd>
<div class="layui-status-img"><a href="javascript:;"><img
style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>七彩枫叶 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear
Admin 专区</a> 回答问题</p>
<span>几秒前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img
style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>简 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear
Admin 专区</a> 进行了 <a class="pear-text"
lay-href="http://fly.layui.com/vipclub/list/layuiadmin/column/quiz/">提问</a>
</p>
<span>2天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img
style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>恒宇少年 将 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear
Admin </a> 更新至 2.3.0 版本</p>
<span>7天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img
style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>如花 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear
Admin 社区</a> 发布了 <a class="pear-text"
lay-href="http://fly.layui.com/column/suggest/">建议</a></p>
<span>7天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img
style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>就眠仪式 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear
Admin 社区</a> 发布了 <a class="pear-text"
lay-href="http://fly.layui.com/column/suggest/">建议</a></p>
<span>8天前</span>
</div>
</dd>
<dd>
<div class="layui-status-img"><a href="javascript:;"><img
style="width: 32px;height: 32px;border-radius: 50px;"
src="{{ url_for('static', filename='admin/admin/images/avatar.jpg') }}"></a></div>
<div>
<p>贤心 在 <a class="pear-text" lay-href="https://gitee.com/Jmysy/Pear-Admin-Layui">Pear
Admin 专区</a> 进行了 <a class="pear-text"
lay-href="http://fly.layui.com/vipclub/list/layuiadmin/column/quiz/">提问</a>
</p>
<span>8天前</span>
</div>
</dd>
</dl>
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">最近更新</div>
<div class="layui-card-body">
<ul class="list">
<li class="list-item"><span class="title">优化代码格式</span><span
class="footer">2020-06-04 11:28</span></li>
<li class="list-item"><span class="title">新增消息组件</span><span
class="footer">2020-06-01 04:23</span></li>
<li class="list-item"><span class="title">移动端兼容</span><span
class="footer">2020-05-22 21:38</span></li>
<li class="list-item"><span class="title">系统布局优化</span><span
class="footer">2020-05-15 14:26</span></li>
<li class="list-item"><span class="title">兼容多系统菜单模式</span><span
class="footer">2020-05-13 16:32</span></li>
<li class="list-item"><span class="title">兼容多标签页切换</span><span
class="footer">2019-12-9 14:58</span></li>
<li class="list-item"><span class="title">扩展下拉组件</span><span
class="footer">2019-12-7 9:06</span></li>
<li class="list-item"><span class="title">扩展卡片样式</span><span
class="footer">2019-12-1 10:26</span></li>
</ul>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">
链接
</div>
<div class="layui-card-body">
<a target="_blank" href="http://www.pearadmin.com"
class="pear-btn pear-btn-primary layui-btn-fluid"
style="margin-top: 8px;height: 50px;line-height: 50px;">官 网</a>
<br/>
<a target="_blank" href="https://gitee.com/pear-admin/Pear-Admin-Layui"
class="pear-btn pear-btn-warming layui-btn-fluid"
style="margin-top: 8px;height: 50px;line-height: 50px;">下 载</a>
<br/>
<a target="_blank" href="https://gitee.com/pear-admin/pear-admin-flask"
class="pear-btn pear-btn-danger layui-btn-fluid"
style="margin-top: 8px;height: 50px;line-height: 50px;">后 端</a>
</div>
</div>
</div>
</div>
</div>
<!--</div>-->
{% include 'admin/common/footer.html' %}
<script>
layui.use(['layer', 'echarts', 'element', 'count'], function () {
var $ = layui.jquery,
layer = layui.layer,
element = layui.element,
count = layui.count,
echarts = layui.echarts
count.up("value1", {
time: 4000,
num: 440.34,
bit: 2,
regulator: 50
});
count.up('value1', {
time: 4000,
num: 440.34,
bit: 2,
regulator: 50
})
count.up("value2", {
time: 4000,
num: 236.30,
bit: 2,
regulator: 50
});
count.up('value2', {
time: 4000,
num: 236.30,
bit: 2,
regulator: 50
})
count.up("value3", {
time: 4000,
num: 634.43,
bit: 2,
regulator: 50
});
count.up('value3', {
time: 4000,
num: 634.43,
bit: 2,
regulator: 50
})
count.up("value4", {
time: 4000,
bit: 2,
num: 373.23,
regulator: 50
});
count.up('value4', {
time: 4000,
bit: 2,
num: 373.23,
regulator: 50
})
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden')
var option = {
tooltip: {
trigger: 'axis'
},
xAxis: [{
type: 'category',
data: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06'],
axisLine: {
lineStyle: {
color: "#999"
}
}
}],
yAxis: [{
type: 'value',
splitNumber: 4,
splitLine: {
lineStyle: {
type: 'dashed',
color: '#DDD'
}
},
axisLine: {
show: false,
lineStyle: {
color: "#333"
},
},
nameTextStyle: {
color: "#999"
},
splitArea: {
show: false
}
}],
series: [{
name: '课时',
type: 'line',
data: [23, 60, 20, 36, 23, 85],
lineStyle: {
normal: {
width: 8,
color: {
type: 'linear',
var option = {
tooltip: {
trigger: 'axis'
},
xAxis: [{
type: 'category',
data: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06'],
axisLine: {
lineStyle: {
color: '#999'
}
}
}],
yAxis: [{
type: 'value',
splitNumber: 4,
splitLine: {
lineStyle: {
type: 'dashed',
color: '#DDD'
}
},
axisLine: {
show: false,
lineStyle: {
color: '#333'
},
},
nameTextStyle: {
color: '#999'
},
splitArea: {
show: false
}
}],
series: [{
name: '课时',
type: 'line',
data: [23, 60, 20, 36, 23, 85],
lineStyle: {
normal: {
width: 8,
color: {
type: 'linear',
colorStops: [{
offset: 0,
color: '#A9F387' // 0% 处的颜色
}, {
offset: 1,
color: '#48D8BF' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
},
shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20
}
},
itemStyle: {
normal: {
color: '#fff',
borderWidth: 10,
/*shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 100,*/
borderColor: "#A9F387"
}
},
smooth: true
}]
};
echartsRecords.setOption(option);
colorStops: [{
offset: 0,
color: '#A9F387' // 0% 处的颜色
}, {
offset: 1,
color: '#48D8BF' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
},
shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20
}
},
itemStyle: {
normal: {
color: '#fff',
borderWidth: 10,
/*shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 100,*/
borderColor: '#A9F387'
}
},
smooth: true
}]
}
echartsRecords.setOption(option)
window.onresize = function() {
echartsRecords.resize();
}
window.onresize = function () {
echartsRecords.resize()
}
});
</script>
</body>
})
</script>
</body>
</html>
+35 -35
View File
@@ -81,43 +81,43 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery','dtree'], function () {
let form = layui.form;
let $ = layui.jquery;
let dtree = layui.dtree;
layui.use(['form', 'jquery', 'dtree'], function () {
let form = layui.form
let $ = layui.jquery
let dtree = layui.dtree
dtree.renderSelect({
elem: "#selectParent",
url: "/admin/dept/tree",
method: 'get',
selectInputName: {nodeId: "parentId", context: "parentName"},
skin: "layui",
dataFormat: "list",
response: {treeId: "deptId", parentId: "parentId", title: "deptName"},
selectInitVal: "1"
});
form.on('submit(dept-save)', function (data) {
$.ajax({
url: '/admin/dept/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));
parent.render();
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
dtree.renderSelect({
elem: '#selectParent',
url: '/admin/dept/tree',
method: 'get',
selectInputName: { nodeId: 'parentId', context: 'parentName' },
skin: 'layui',
dataFormat: 'list',
response: { treeId: 'deptId', parentId: 'parentId', title: 'deptName' },
selectInitVal: '1'
})
form.on('submit(dept-save)', function (data) {
$.ajax({
url: '/admin/dept/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))
parent.render()
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+36 -30
View File
@@ -26,21 +26,24 @@
<div class="layui-form-item">
<label class="layui-form-label">负责人</label>
<div class="layui-input-block">
<input type="text" value="{{ dept.leader }}" name="leader" lay-verify="title" autocomplete="off" placeholder="请输入标题"
<input type="text" value="{{ dept.leader }}" name="leader" lay-verify="title" autocomplete="off"
placeholder="请输入标题"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">
<input type="text" value="{{ dept.email }}" name="email" lay-verify="title" autocomplete="off" placeholder="请输入标题"
<input type="text" value="{{ dept.email }}" name="email" lay-verify="title" autocomplete="off"
placeholder="请输入标题"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">联系方式</label>
<div class="layui-input-block">
<input type="text" value="{{ dept.phone }}" name="phone" lay-verify="title" autocomplete="off" placeholder="请输入标题"
<input type="text" value="{{ dept.phone }}" name="phone" lay-verify="title" autocomplete="off"
placeholder="请输入标题"
class="layui-input">
</div>
</div>
@@ -48,16 +51,19 @@
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<input type="radio" name="status"{% if dept.status == 1 %}checked{% endif %} value="1" title="开启">
<input type="radio" name="status" {% if dept.status == 1 %}checked{% endif %} value="1"
title="开启">
<input type="radio" name="status" {% if dept.status == 0 %}checked{% endif %} value="0" title="关闭"
>
<input type="radio" name="status" {% if dept.status == 0 %}checked{% endif %} value="0"
title="关闭"
>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-block">
<input type="text" name="sort" value="{{ dept.sort }}" lay-verify="title" autocomplete="off" placeholder="请输入标题"
<input type="text" name="sort" value="{{ dept.sort }}" lay-verify="title" autocomplete="off"
placeholder="请输入标题"
class="layui-input">
</div>
</div>
@@ -87,31 +93,31 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(dept-update)', function (data) {
$.ajax({
url: '/admin/dept/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.render();
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
form.on('submit(dept-update)', function (data) {
$.ajax({
url: '/admin/dept/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.render()
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+165 -162
View File
@@ -34,33 +34,36 @@
<script type="text/html" id="dept-toolbar">
{% if authorize("admin:dept:edit") %}
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
{% endif %}
{% if authorize("admin:dept:remove") %}
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
{% endif %}
</script>
<script type="text/html" id="dept-bar">
{% if authorize("admin:dept:edit") %}
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
</button>
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i
class="layui-icon layui-icon-edit"></i>
</button>
{% endif %}
{% if authorize("admin:dept:remove") %}
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
</button>
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
class="layui-icon layui-icon-delete"></i>
</button>
{% endif %}
</script>
<script type="text/html" id="dept-status">
<input type="checkbox" name="status" value="{{"{{ d.deptId }}"}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="dept-enable"
{{"{{# if(d.status==1){ }} checked {{# } }}"}}>
<input type="checkbox" name="status" value="{{ "{{ d.deptId }}" }}" lay-skin="switch" lay-text="启用|禁用"
lay-filter="dept-enable"
{{ "{{# if(d.status==1){ }} checked {{# } }}" }}>
</script>
</body>
@@ -68,158 +71,158 @@
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'form', 'jquery', 'treetable','popup'], function () {
let table = layui.table;
let form = layui.form;
let $ = layui.jquery;
let treetable = layui.treetable;
let popup = layui.popup;
layui.use(['table', 'form', 'jquery', 'treetable', 'popup'], function () {
let table = layui.table
let form = layui.form
let $ = layui.jquery
let treetable = layui.treetable
let popup = layui.popup
let MODULE_PATH = "/admin/dept/";
let MODULE_PATH = '/admin/dept/'
window.render = function () {
treetable.render({
treeColIndex: 1,
treeSpid: 0,
treeIdName: 'deptId',
treePidName: 'parentId',
skin: 'line',
method: 'post',
treeDefaultClose: false,
toolbar: '#dept-toolbar',
elem: '#dept-table',
url: '/admin/dept/data',
page: false,
cols: [
[
{type: 'checkbox'},
{field: 'deptName', minWidth: 200, title: '部门名称'},
{field: 'leader', title: '负责人'},
{field: 'phone', title: '联系方式'},
{field: 'email', title: '邮箱'},
{field: 'address', title: '详细地址'},
{field: 'status', title: '状态',templet:'#dept-status'},
{field: 'sort', title: '排序', width: 100},
{title: '操作', templet: '#dept-bar', width: 120, align: 'center'}
]
]
});
};
window.render = function () {
treetable.render({
treeColIndex: 1,
treeSpid: 0,
treeIdName: 'deptId',
treePidName: 'parentId',
skin: 'line',
method: 'post',
treeDefaultClose: false,
toolbar: '#dept-toolbar',
elem: '#dept-table',
url: '/admin/dept/data',
page: false,
cols: [
[
{ type: 'checkbox' },
{ field: 'deptName', minWidth: 200, title: '部门名称' },
{ field: 'leader', title: '负责人' },
{ field: 'phone', title: '联系方式' },
{ field: 'email', title: '邮箱' },
{ field: 'address', title: '详细地址' },
{ field: 'status', title: '状态', templet: '#dept-status' },
{ field: 'sort', title: '排序', width: 100 },
{ title: '操作', templet: '#dept-bar', width: 120, align: 'center' }
]
]
})
}
form.on('submit(dept-query)', function (data) {
var keyword = data.field.deptName;
var $tds = $('#dept-table').next('.treeTable').find('.layui-table-body tbody tr td');
if (!keyword) {
$tds.css('background-color', 'transparent');
layer.msg("请输入关键字", {icon: 5});
return;
}
var searchCount = 0;
$tds.each(function () {
$(this).css('background-color', 'transparent');
if ($(this).text().indexOf(keyword) >= 0) {
$(this).css('background-color', 'rgba(250,230,160,0.5)');
if (searchCount === 0) {
$('body,html').stop(true);
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
}
searchCount++;
}
});
if (searchCount === 0) {
layer.msg("没有匹配结果", {icon: 5});
} else {
treetable.expandAll('#dept-table');
}
return false;
});
render();
table.on('tool(dept-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'edit') {
window.edit(obj);
}
});
table.on('toolbar(dept-table)', function (obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
form.on('switch(dept-enable)', function (obj) {
let operate;
if (obj.elem.checked) {
operate = "enable";
} else {
operate = "disable";
}
let loading = layer.load();
$.ajax({
url: '/admin/dept/' + operate,
data: JSON.stringify({deptId: this.value}),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg);
} else {
popup.failure(result.msg);
}
}
})
});
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'add'
});
};
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId']
});
};
window.remove = function (obj) {
layer.confirm('确定要删除该部门', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "remove/" + obj.data['deptId'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg, function () {
obj.del();
});
} else {
popup.failure(result.msg);
}
}
})
});
form.on('submit(dept-query)', function (data) {
var keyword = data.field.deptName
var $tds = $('#dept-table').next('.treeTable').find('.layui-table-body tbody tr td')
if (!keyword) {
$tds.css('background-color', 'transparent')
layer.msg('请输入关键字', { icon: 5 })
return
}
var searchCount = 0
$tds.each(function () {
$(this).css('background-color', 'transparent')
if ($(this).text().indexOf(keyword) >= 0) {
$(this).css('background-color', 'rgba(250,230,160,0.5)')
if (searchCount === 0) {
$('body,html').stop(true)
$('body,html').animate({ scrollTop: $(this).offset().top - 150 }, 500)
}
searchCount++
}
})
if (searchCount === 0) {
layer.msg('没有匹配结果', { icon: 5 })
} else {
treetable.expandAll('#dept-table')
}
return false
})
render()
table.on('tool(dept-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj)
} else if (obj.event === 'edit') {
window.edit(obj)
}
})
table.on('toolbar(dept-table)', function (obj) {
if (obj.event === 'add') {
window.add()
} else if (obj.event === 'refresh') {
window.refresh()
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj)
}
})
form.on('switch(dept-enable)', function (obj) {
let operate
if (obj.elem.checked) {
operate = 'enable'
} else {
operate = 'disable'
}
let loading = layer.load()
$.ajax({
url: '/admin/dept/' + operate,
data: JSON.stringify({ deptId: this.value }),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg)
} else {
popup.failure(result.msg)
}
}
})
})
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'add'
})
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId']
})
}
window.remove = function (obj) {
layer.confirm('确定要删除该部门', { icon: 3, title: '提示' }, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'remove/' + obj.data['deptId'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
obj.del()
})
} else {
popup.failure(result.msg)
}
}
})
})
}
})
</script>
</html>
+23 -23
View File
@@ -55,31 +55,31 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(dict-type-save)', function (data) {
$.ajax({
url: '/admin/dict/dictType/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("dict-type-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
form.on('submit(dict-type-save)', function (data) {
$.ajax({
url: '/admin/dict/dictType/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('dict-type-table')
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+25 -24
View File
@@ -26,7 +26,8 @@
<div class="layui-form-item">
<label class="layui-form-label">标识</label>
<div class="layui-input-block">
<input type="text" value="{{type_code}}" readonly="readonly" name="typeCode" lay-verify="title"
<input type="text" value="{{ type_code }}" readonly="readonly" name="typeCode"
lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
@@ -62,31 +63,31 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(dict-data-save)', function (data) {
$.ajax({
url: '/admin/dict/dictData/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("dict-data-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
form.on('submit(dict-data-save)', function (data) {
$.ajax({
url: '/admin/dict/dictData/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('dict-data-table')
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
@@ -32,7 +32,7 @@
<div class="layui-form-item">
<label class="layui-form-label">标识</label>
<div class="layui-input-block">
<input type="text" value="{{dict_data.type_code}}" readonly="readonly" name="typeCode"
<input type="text" value="{{ dict_data.type_code }}" readonly="readonly" name="typeCode"
lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
@@ -48,7 +48,7 @@
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<textarea placeholder="请输入描述" name="remark"
<textarea placeholder="请输入描述" name="remark"
class="layui-textarea">{{ dict_data.remark }}</textarea>
</div>
</div>
@@ -71,31 +71,31 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(dict-data-save)', function (data) {
$.ajax({
url: '/admin/dict/dictData/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("dict-data-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
form.on('submit(dict-data-save)', function (data) {
$.ajax({
url: '/admin/dict/dictData/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('dict-data-table')
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+29 -29
View File
@@ -12,21 +12,21 @@
<div class="layui-form-item layui-hide">
<label class="layui-form-label">编号</label>
<div class="layui-input-block">
<input type="text" value="{{dict_type.id}}" name="id" lay-verify="title" autocomplete="off"
<input type="text" value="{{ dict_type.id }}" name="id" lay-verify="title" autocomplete="off"
placeholder="请输入标题" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-block">
<input type="text" value="{{dict_type.type_name}}" name="typeName" lay-verify="title"
<input type="text" value="{{ dict_type.type_name }}" name="typeName" lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">标识</label>
<div class="layui-input-block">
<input type="text" value="{{dict_type.type_code}}" readonly name="typeCode"
<input type="text" value="{{ dict_type.type_code }}" readonly name="typeCode"
lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
@@ -42,8 +42,8 @@
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<textarea placeholder="请输入描述" name="description"
class="layui-textarea">{{dict_type.description}}</textarea>
<textarea placeholder="请输入描述" name="description"
class="layui-textarea">{{ dict_type.description }}</textarea>
</div>
</div>
</div>
@@ -63,33 +63,33 @@
</div>
</div>
</form>
{% include 'admin/common/footer.html' %}
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(dict-type-update)', function (data) {
$.ajax({
url: '/admin/dict/dictType/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("dict-type-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
form.on('submit(dict-type-update)', function (data) {
$.ajax({
url: '/admin/dict/dictType/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('dict-type-table')
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+272 -249
View File
@@ -38,7 +38,29 @@
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-body">
<svg class="empty" style="margin-top: 50px;margin-left: 220px;margin-bottom: 80px;" width="184" height="152" viewBox="0 0 184 152" xmlns="http://www.w3.org/2000/svg"><g fill="none" fillRule="evenodd"><g transform="translate(24 31.67)"><ellipse fillOpacity=".8" fill="#F5F5F7" cx="67.797" cy="106.89" rx="67.797" ry="12.668"></ellipse><path d="M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z" fill="#AEB8C2"></path><path d="M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z" fill="url(#linearGradient-1)" transform="translate(13.56)"></path><path d="M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z" fill="#F5F5F7"></path><path d="M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z" fill="#DCE0E6"></path></g><path d="M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z" fill="#DCE0E6"></path><g transform="translate(149.65 15.383)" fill="#FFF"><ellipse cx="20.654" cy="3.167" rx="2.849" ry="2.815"></ellipse><path d="M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"></path></g></g></svg>
<svg class="empty" style="margin-top: 50px;margin-left: 220px;margin-bottom: 80px;" width="184"
height="152" viewBox="0 0 184 152" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fillRule="evenodd">
<g transform="translate(24 31.67)">
<ellipse fillOpacity=".8" fill="#F5F5F7" cx="67.797" cy="106.89" rx="67.797"
ry="12.668"></ellipse>
<path d="M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"
fill="#AEB8C2"></path>
<path d="M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z"
fill="url(#linearGradient-1)" transform="translate(13.56)"></path>
<path d="M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"
fill="#F5F5F7"></path>
<path d="M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"
fill="#DCE0E6"></path>
</g>
<path d="M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"
fill="#DCE0E6"></path>
<g transform="translate(149.65 15.383)" fill="#FFF">
<ellipse cx="20.654" cy="3.167" rx="2.849" ry="2.815"></ellipse>
<path d="M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"></path>
</g>
</g>
</svg>
<table id="dict-data-table" lay-filter="dict-data-table"></table>
</div>
</div>
@@ -70,8 +92,8 @@
</script>
<script type="text/html" id="dict-type-enable">
<input type="checkbox" value="{{"{{ d.id }}"}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="dict-type-enable"
{{"{{# if(d.enable==1){ }} checked {{# } }}"}}>
<input type="checkbox" value="{{ "{{ d.id }}" }}" lay-skin="switch" lay-text="启用|禁用" lay-filter="dict-type-enable"
{{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
</script>
<script type="text/html" id="dict-data-toolbar">
@@ -93,259 +115,260 @@
</script>
<script type="text/html" id="dict-data-enable">
<input type="checkbox" value="{{"{{ d.dataId }}"}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="dict-data-enable"
{{"{{# if(d.enable==1){ }} checked {{# } }}"}}>
<input type="checkbox" value="{{ "{{ d.dataId }}" }}" lay-skin="switch" lay-text="启用|禁用"
lay-filter="dict-data-enable"
{{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
</script>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'form', 'jquery','popup'], function () {
let table = layui.table;
let form = layui.form;
let $ = layui.jquery;
let popup = layui.popup;
layui.use(['table', 'form', 'jquery', 'popup'], function () {
let table = layui.table
let form = layui.form
let $ = layui.jquery
let popup = layui.popup
let typeCode;
let typeCode
let cols = [
[
{type: 'checkbox'},
{title: '字典名称', field: 'typeName', align: 'center', width: 120},
{title: '描述', field: 'description', align: 'center'},
{title: '字典状态', field: 'enable', align: 'center', templet: '#dict-type-enable'},
{title: '操作', toolbar: '#dict-type-bar', align: 'center', width: 180}
]
];
let cols = [
[
{ type: 'checkbox' },
{ title: '字典名称', field: 'typeName', align: 'center', width: 120 },
{ title: '描述', field: 'description', align: 'center' },
{ title: '字典状态', field: 'enable', align: 'center', templet: '#dict-type-enable' },
{ title: '操作', toolbar: '#dict-type-bar', align: 'center', width: 180 }
]
]
let dataCols = [
[
{type: 'checkbox'},
{title: '标签', field: 'dataLabel', align: 'center', width: 120},
{title: '对应值', field: 'dataValue', align: 'center'},
{title: '状态', field: 'enable', align: 'center', templet: '#dict-data-enable'},
{title: '操作', toolbar: '#dict-data-bar', align: 'center', width: 180}
]
];
let dataCols = [
[
{ type: 'checkbox' },
{ title: '标签', field: 'dataLabel', align: 'center', width: 120 },
{ title: '对应值', field: 'dataValue', align: 'center' },
{ title: '状态', field: 'enable', align: 'center', templet: '#dict-data-enable' },
{ title: '操作', toolbar: '#dict-data-bar', align: 'center', width: 180 }
]
]
table.render({
elem: '#dict-type-table',
url: '/admin/dict/dictType/data',
page: true,
cols: cols,
skin: 'line',
height: 'full-148',
toolbar: '#dict-type-toolbar',
defaultToolbar: [{
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
});
window.renderData = function(code){
typeCode = code;
$(".empty").hide();
table.render({
elem: '#dict-data-table',
url: '/admin/dict/dictData/data?typeCode=' + typeCode,
page: true,
height: 'full-148',
cols: dataCols,
skin: 'line',
toolbar: '#dict-data-toolbar'
});
};
table.on('tool(dict-type-table)', function (obj) {
if (obj.event === 'remove') {
window.removeType(obj);
} else if (obj.event === 'edit') {
window.editType(obj);
} else if (obj.event === 'details') {
window.renderData(obj.data['typeCode'])
}
});
table.on('toolbar(dict-type-table)', function (obj) {
if (obj.event === 'add') {
window.addType();
} else if (obj.event === 'refresh') {
window.refreshType();
}
});
form.on('submit(dict-type-query)', function (data) {
table.reload('dict-type-table', {where: data.field});
return false;
});
form.on('switch(dict-type-enable)', function (obj) {
let operate;
if (obj.elem.checked) {
operate = "enable";
} else {
operate = "disable";
}
let loading = layer.load();
$.ajax({
url: '/admin/dict/dictType/' + operate,
data: JSON.stringify({id: this.value}),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg);
} else {
popup.failure(result.msg);
}
}
})
});
window.addType = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['500px', '400px'],
content: '/admin/dict/dictType/add'
});
};
window.editType = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['500px', '400px'],
content: '/admin/dict/dictType/edit?dictTypeId=' + obj.data['id']
});
};
window.removeType = function (obj) {
layer.confirm('确定要删除该字典分类', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/admin/dict/dictType/remove/" + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg, function(){
if(typeCode === obj.data['typeCode']){
$("[lay-id='dict-data-table']").remove();
$(".empty").show();
}
obj.del();
})
} else {
popup.failure(result.msg);
}
}
})
});
};
window.refreshType = function () {
table.reload('dict-type-table');
};
window.addData = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['500px', '450px'],
content: '/admin/dict/dictData/add?typeCode='+typeCode
});
};
window.editData = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['500px', '450px'],
content: '/admin/dict/dictData/edit?dataId=' + obj.data['dataId']
});
};
window.removeData = function (obj) {
layer.confirm('确定要删除该字典值', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/admin/dict/dictData/remove/" + obj.data['dataId'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg,function(){
obj.del();
})
} else {
popup.failure(result.msg);
}
}
})
});
};
table.on('tool(dict-data-table)', function (obj) {
if (obj.event === 'remove') {
window.removeData(obj);
} else if (obj.event === 'edit') {
window.editData(obj);
} else if (obj.event === 'details') {
window.details(obj);
}
});
table.on('toolbar(dict-data-table)', function (obj) {
if (obj.event === 'add') {
window.addData();
} else if (obj.event === 'refresh') {
window.refreshData();
}
});
form.on('submit(dict-data-query)', function (data) {
data.field.typeCode = typeCode;
table.reload('dict-data-table', {where: data.field});
return false;
});
form.on('switch(dict-data-enable)', function (obj) {
let operate;
if (obj.elem.checked) {
operate = "enable";
} else {
operate = "disable";
}
let loading = layer.load();
$.ajax({
url: '/admin/dict/dictData/' + operate,
data: JSON.stringify({dataId: this.value}),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg);
} else {
popup.failure(result.msg);
}
}
})
});
window.refreshData = function () {
table.reload('dict-data-table');
}
table.render({
elem: '#dict-type-table',
url: '/admin/dict/dictType/data',
page: true,
cols: cols,
skin: 'line',
height: 'full-148',
toolbar: '#dict-type-toolbar',
defaultToolbar: [{
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
})
window.renderData = function (code) {
typeCode = code
$('.empty').hide()
table.render({
elem: '#dict-data-table',
url: '/admin/dict/dictData/data?typeCode=' + typeCode,
page: true,
height: 'full-148',
cols: dataCols,
skin: 'line',
toolbar: '#dict-data-toolbar'
})
}
table.on('tool(dict-type-table)', function (obj) {
if (obj.event === 'remove') {
window.removeType(obj)
} else if (obj.event === 'edit') {
window.editType(obj)
} else if (obj.event === 'details') {
window.renderData(obj.data['typeCode'])
}
})
table.on('toolbar(dict-type-table)', function (obj) {
if (obj.event === 'add') {
window.addType()
} else if (obj.event === 'refresh') {
window.refreshType()
}
})
form.on('submit(dict-type-query)', function (data) {
table.reload('dict-type-table', { where: data.field })
return false
})
form.on('switch(dict-type-enable)', function (obj) {
let operate
if (obj.elem.checked) {
operate = 'enable'
} else {
operate = 'disable'
}
let loading = layer.load()
$.ajax({
url: '/admin/dict/dictType/' + operate,
data: JSON.stringify({ id: this.value }),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg)
} else {
popup.failure(result.msg)
}
}
})
})
window.addType = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['500px', '400px'],
content: '/admin/dict/dictType/add'
})
}
window.editType = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['500px', '400px'],
content: '/admin/dict/dictType/edit?dictTypeId=' + obj.data['id']
})
}
window.removeType = function (obj) {
layer.confirm('确定要删除该字典分类', { icon: 3, title: '提示' }, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: '/admin/dict/dictType/remove/' + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
if (typeCode === obj.data['typeCode']) {
$('[lay-id=\'dict-data-table\']').remove()
$('.empty').show()
}
obj.del()
})
} else {
popup.failure(result.msg)
}
}
})
})
}
window.refreshType = function () {
table.reload('dict-type-table')
}
window.addData = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['500px', '450px'],
content: '/admin/dict/dictData/add?typeCode=' + typeCode
})
}
window.editData = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['500px', '450px'],
content: '/admin/dict/dictData/edit?dataId=' + obj.data['dataId']
})
}
window.removeData = function (obj) {
layer.confirm('确定要删除该字典值', { icon: 3, title: '提示' }, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: '/admin/dict/dictData/remove/' + obj.data['dataId'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
obj.del()
})
} else {
popup.failure(result.msg)
}
}
})
})
}
table.on('tool(dict-data-table)', function (obj) {
if (obj.event === 'remove') {
window.removeData(obj)
} else if (obj.event === 'edit') {
window.editData(obj)
} else if (obj.event === 'details') {
window.details(obj)
}
})
table.on('toolbar(dict-data-table)', function (obj) {
if (obj.event === 'add') {
window.addData()
} else if (obj.event === 'refresh') {
window.refreshData()
}
})
form.on('submit(dict-data-query)', function (data) {
data.field.typeCode = typeCode
table.reload('dict-data-table', { where: data.field })
return false
})
form.on('switch(dict-data-enable)', function (obj) {
let operate
if (obj.elem.checked) {
operate = 'enable'
} else {
operate = 'disable'
}
let loading = layer.load()
$.ajax({
url: '/admin/dict/dictData/' + operate,
data: JSON.stringify({ dataId: this.value }),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg)
} else {
popup.failure(result.msg)
}
}
})
})
window.refreshData = function () {
table.reload('dict-data-table')
}
})
</script>
</html>
+31 -32
View File
@@ -71,43 +71,42 @@
<!-- 依 赖 脚 本 -->
{% include 'admin/common/footer.html' %}
<script>
layui.use(['admin', 'jquery', 'layer', 'popup'], function () {
let admin = layui.admin;
let $ = layui.jquery;
let layer = layui.layer;
let popup = layui.popup;
layui.use(['admin', 'jquery', 'layer', 'popup'], function () {
let admin = layui.admin
let $ = layui.jquery
let layer = layui.layer
let popup = layui.popup
// 框架初始化时会读取 根目录下 pear.configs.yml 文件作为初始化配置
// 你可以通过 admin.setConfigPath 方法修改配置文件位置
// 你可以通过 admin.setConfigType 方法修改配置文件类型
admin.setConfigType("json");
admin.setConfigPath("{{ url_for('adminIndex.configs') }}");
// 框架初始化时会读取 根目录下 pear.configs.yml 文件作为初始化配置
// 你可以通过 admin.setConfigPath 方法修改配置文件位置
// 你可以通过 admin.setConfigType 方法修改配置文件类型
admin.setConfigType('json')
admin.setConfigPath("{{ url_for('adminIndex.configs') }}")
admin.render();
admin.render()
// 注销实现
admin.logout(function () {
let loading = layer.load();
$.ajax({
url: '/admin/logout',
dataType: 'json',
type: 'post',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg, function () {
location.href = "/admin";
});
return true;
}
}
// 注销实现
admin.logout(function () {
let loading = layer.load()
$.ajax({
url: '/admin/logout',
dataType: 'json',
type: 'post',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
location.href = '/admin'
})
});
// 初始化消息事件
admin.message();
return true
}
}
})
})
// 初始化消息事件
admin.message()
})
</script>
</body>
</html>
+30 -27
View File
@@ -1,30 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta charset="utf-8">
<title>登录</title>
<!-- 样 式 文 件 -->
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/component/pear/css/pear.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/login.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/component/pear/css/pear.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/login.css') }}"/>
</head>
<!-- 代 码 结 构 -->
<body background="{{ url_for('static', filename='/admin/admin/images/background.svg') }}" style="background-size: cover;">
<body background="{{ url_for('static', filename='/admin/admin/images/background.svg') }}"
style="background-size: cover;">
<form class="layui-form" action="javascript:void(0);">
<div class="layui-form-item">
<img class="logo" src="{{ url_for('static', filename='/admin/admin/images/logo.png') }}" />
<img class="logo" src="{{ url_for('static', filename='/admin/admin/images/logo.png') }}"/>
<div class="title">Pear Admin</div>
<div class="desc">
明 湖 区 最 具 影 响 力 的 设 计 规 范 之 一
</div>
</div>
<div class="layui-form-item">
<input name="username" type="text" placeholder="账 户 : admin " value="admin" hover class="layui-input" />
<input name="username" type="text" placeholder="账 户 : admin " value="admin" hover class="layui-input"/>
</div>
<div class="layui-form-item">
<input name="password" type="password" placeholder="密 码 : 123456 " value="123456" hover class="layui-input" />
<input name="password" type="password" placeholder="密 码 : 123456 " value="123456" hover class="layui-input"/>
</div>
<div class="layui-form-item">
<input placeholder="验证码 : " name="captcha" hover class="code layui-input layui-input-inline" />
<input placeholder="验证码 : " name="captcha" hover class="code layui-input layui-input-inline"/>
<img src="{{ url_for('adminIndex.get_captcha') }}" class="codeImage" id="captchaImage"/>
</div>
<div class="layui-form-item">
@@ -38,7 +39,7 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form','jquery','layer','button','popup'], function() {
layui.use(['form', 'jquery', 'layer', 'button', 'popup'], function () {
let form = layui.form;
let $ = layui.jquery;
let layer = layui.layer;
@@ -46,23 +47,23 @@
let popup = layui.popup;
let captchaPath = "{{ url_for('adminIndex.get_captcha') }}";
form.on('submit(login)', function(data){
form.on('submit(login)', function (data) {
let loader = layer.load();
let btn = button.load({elem: '.login'});
$.ajax({
data:data.field,
type:"post",
dataType:'json',
success:function(result){
data: data.field,
type: "post",
dataType: 'json',
success: function (result) {
layer.close(loader);
btn.stop(function(){
if(result.success){
popup.success(result.msg,function(){
btn.stop(function () {
if (result.success) {
popup.success(result.msg, function () {
location.href = "{{ url_for('adminIndex.index') }}";
})
}else{
popup.failure(result.msg,function(){
document.getElementById("captchaImage").src=captchaPath + "?" + Math.random();
} else {
popup.failure(result.msg, function () {
document.getElementById("captchaImage").src = captchaPath + "?" + Math.random();
});
}
})
@@ -71,16 +72,18 @@
return false;
});
$("#captchaImage").click(function(){
document.getElementById("captchaImage").src= captchaPath + "?" + Math.random();
})
setInterval(function(){
document.getElementById("captchaImage").src= captchaPath + "?" + Math.random();
},30 * 1000);
$("#captchaImage").click(function () {
document.getElementById("captchaImage").src = captchaPath + "?" + Math.random();
});
setInterval(function () {
document.getElementById("captchaImage").src = captchaPath + "?" + Math.random();
}, 30 * 1000);
})
</script>
<script>
if(window!=top){ top.location.href = location.href; }
if (window != top) {
top.location.href = location.href;
}
</script>
</body>
</html>
+32 -33
View File
@@ -3,7 +3,7 @@
<head>
<title>首页</title>
{% include 'admin/common/header.html' %}
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/console2.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/console2.css') }}"/>
</head>
<body class="pear-container">
<div class="layui-row layui-col-space10">
@@ -19,13 +19,13 @@
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">
<div class="pear-card2">
<div class="title">核心数</div>
<div class="count pear-text" >{{ cpu_count }}</div>
<div class="count pear-text">{{ cpu_count }}</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">
<div class="pear-card2">
<div class="title">空闲率</div>
<div class="count pear-text" ></div>
<div class="count pear-text"></div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">
@@ -96,20 +96,20 @@
<div class="layui-card-header">磁盘信息</div>
<div class="layui-card-body">
<ul class="pear-card-status">
{% for i in disk_partitions_list %}
<li >
<p >{{ i.device }}</p>
<p >{{ i.fstype }}</p>
磁盘大小&nbsp;<span >{{ i.total }}M</span>&nbsp;&nbsp;
空闲大小&nbsp;<span>{{ i.free }}M</span>&nbsp;&nbsp;
<br/>
<br/>
已经使用&nbsp;<span>{{ i.used }}M</span>&nbsp;&nbsp;
使用概率&nbsp;<span>{{ i.percent }}%</span>
<br/>
<a href="javascript:;" data-id="1" class="pear-btn pear-btn-xs pear-btn-primary pear-reply">详情</a>
</li>
{% endfor %}
{% for i in disk_partitions_list %}
<li>
<p>{{ i.device }}</p>
<p>{{ i.fstype }}</p>
磁盘大小&nbsp;<span>{{ i.total }}M</span>&nbsp;&nbsp;
空闲大小&nbsp;<span>{{ i.free }}M</span>&nbsp;&nbsp;
<br/>
<br/>
已经使用&nbsp;<span>{{ i.used }}M</span>&nbsp;&nbsp;
使用概率&nbsp;<span>{{ i.percent }}%</span>
<br/>
<a href="javascript:;" data-id="1" class="pear-btn pear-btn-xs pear-btn-primary pear-reply">详情</a>
</li>
{% endfor %}
</ul>
</div>
</div>
@@ -153,14 +153,14 @@
</div>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['layer', 'echarts','popup'], function() {
layui.use(['layer', 'echarts', 'popup'], function () {
var $ = layui.jquery,
echarts = layui.echarts;
let popup = layui.popup;
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
$("body").on("click", "[data-url]", function() {
$("body").on("click", "[data-url]", function () {
parent.layui.tab.addTabOnlyByElem("content", {
id: $(this).attr("data-id"),
title: $(this).attr("data-title"),
@@ -215,7 +215,7 @@
},
tooltip: {
trigger: "axis",
formatter: function(params) {
formatter: function (params) {
let html = '';
params.forEach(v => {
html +=
@@ -364,22 +364,22 @@
echartsRecords.setOption(option);
window.onresize = function() {
window.onresize = function () {
echartsRecords.resize();
}
};
setInterval(ajaxPolling, 1000 * 10)
setInterval(ajaxPolling, 1000 * 10);
function ajaxPolling() {
$.ajax({
$.ajax({
url: "/admin/monitor/polling",
success: function(data) {
success: function (data) {
echartData.push({
name: data.time_now,
cpu_percent: data.cups_percent,
memory_percent: data.memory_used
});
if(echartData.length>8){
if (echartData.length > 8) {
echartData.shift();
}
@@ -387,20 +387,19 @@
yAxisData1 = echartData.map(v => v.cpu_percent);
yAxisData2 = echartData.map(v => v.memory_percent);
option.xAxis[0].data=xAxisData
option.series[0].data=yAxisData1
option.series[1].data=yAxisData2
option.xAxis[0].data = xAxisData;
option.series[0].data = yAxisData1;
option.series[1].data = yAxisData2;
echartsRecords.setOption(option);
},
error: function(xhr, type, errorThrown) {
error: function (xhr, type, errorThrown) {
popup.failure("api错误");
}
})
}
})
}
});
+226 -226
View File
@@ -37,234 +37,234 @@
</script>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'form', 'jquery'], function () {
let table = layui.table;
let form = layui.form;
let $ = layui.jquery;
let cols = [
[
{
type: 'checkbox'
},
{
field: 'id',
title: 'ID',
sort: true,
align: 'center',
unresize: true,
width: 80
},
{
field: 'name',
title: '文件名称',
unresize: true,
align: 'center'
},
{
field: 'href',
title: '图片',
unresize: true,
align: 'center',
templet: function (d) {
return '<img class="photo" style="max-width: 100%;\n' +
' height: 100%;\n' +
' cursor: pointer;" lay-event="photo" src=" ' + d.href + '"></i>';
}
layui.use(['table', 'form', 'jquery'], function () {
let table = layui.table
let form = layui.form
let $ = layui.jquery
let cols = [
[
{
type: 'checkbox'
},
{
field: 'id',
title: 'ID',
sort: true,
align: 'center',
unresize: true,
width: 80
},
{
field: 'name',
title: '文件名称',
unresize: true,
align: 'center'
},
{
field: 'href',
title: '图片',
unresize: true,
align: 'center',
templet: function (d) {
return '<img class="photo" style="max-width: 100%;\n' +
' height: 100%;\n' +
' cursor: pointer;" lay-event="photo" src=" ' + d.href + '"></i>'
}
},
{
field: 'mime',
title: 'mime类型',
unresize: true,
align: 'center'
},
{
field: 'size',
title: '文件大小',
unresize: true,
align: 'center'
},
{
field: 'create_time',
title: '创建时间',
templet: '#file-uploadTime',
unresize: true,
align: 'center'
},
{
title: '操作',
toolbar: '#user-bar',
align: 'center',
unresize: true,
width: 200
}
]
];
table.render({
elem: '#dataTable',
url: 'table',
page: true,
cols: cols,
skin: 'line',
toolbar: '#toolbar',
defaultToolbar: [{
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
});
table.on('tool(dataTable)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'photo') {
window.photo(obj);
}
});
table.on('toolbar(dataTable)', function (obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
//弹出窗设置 自己设置弹出百分比
function screen() {
if (typeof width !== 'number' || width === 0) {
width = $(window).width() * 0.8;
}
if (typeof height !== 'number' || height === 0) {
height = $(window).height() - 20;
}
return [width + 'px', height + 'px'];
},
{
field: 'mime',
title: 'mime类型',
unresize: true,
align: 'center'
},
{
field: 'size',
title: '文件大小',
unresize: true,
align: 'center'
},
{
field: 'create_time',
title: '创建时间',
templet: '#file-uploadTime',
unresize: true,
align: 'center'
},
{
title: '操作',
toolbar: '#user-bar',
align: 'center',
unresize: true,
width: 200
}
]
]
window.add = function () {
layer.open({
type: 2,
maxmin: true,
title: '新增图片',
shade: 0.1,
area: screen(),
content: 'upload'
});
};
window.remove = function (obj) {
layer.confirm('确定要删除该图片', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: 'delete',
data: {id: obj.data['id']},
dataType: 'json',
type: 'POST',
success: function (res) {
layer.close(loading);
if (res.success) {
layer.msg(res.msg, {
icon: 1,
time: 1000
}, function () {
obj.del();
});
} else {
layer.msg(res.msg, {
icon: 2,
time: 1000
});
}
}
})
});
};
window.batchRemove = function (obj) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
layer.msg("未选中数据", {
icon: 3,
time: 1000
});
return false;
}
var ids = [];
var hasCheck = table.checkStatus('dataTable');
var hasCheckData = hasCheck.data;
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
layer.confirm('确定要删除这些图片', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "{{ url_for('adminFile.batch_remove') }}",
data: {ids: ids},
dataType: 'json',
type: 'POST',
success: function (res) {
layer.close(loading);
if (res.success) {
layer.msg(res.msg, {
icon: 1,
time: 1000
}, function () {
table.reload('dataTable');
});
} else {
layer.msg(res.msg, {
icon: 2,
time: 1000
});
}
}
})
});
};
window.refresh = function () {
table.reload('dataTable');
};
// 查看大图
window.photo = function (obj) {
if (!obj.data.href || obj.data.href === "") {
layer.msg("图片地址错误!");
return;
}
var auto_img = {};
var img = new Image();
img.src = obj.data.href;
img.onload = function () {
var max_height = $(window).height() - 100;
var max_width = $(window).width();
var rate1 = max_height / img.height;
var rate2 = max_width / img.width;
var rate3 = 1;
var rate = Math.min(rate1, rate2, rate3);
auto_img.height = img.height * rate;
auto_img.width = img.width * rate;
layer.open({
type: 1,
title: false,
area: ['auto'],
skin: 'layui-layer-nobg', //没有背景色
shadeClose: true,
content: "<img src='" + obj.data['href'] + "' width='" + auto_img.width + "px' height='" + auto_img.height + "px'>"
});
}
};
table.render({
elem: '#dataTable',
url: 'table',
page: true,
cols: cols,
skin: 'line',
toolbar: '#toolbar',
defaultToolbar: [{
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
})
table.on('tool(dataTable)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj)
} else if (obj.event === 'photo') {
window.photo(obj)
}
})
table.on('toolbar(dataTable)', function (obj) {
if (obj.event === 'add') {
window.add()
} else if (obj.event === 'refresh') {
window.refresh()
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj)
}
})
//弹出窗设置 自己设置弹出百分比
function screen () {
if (typeof width !== 'number' || width === 0) {
width = $(window).width() * 0.8
}
if (typeof height !== 'number' || height === 0) {
height = $(window).height() - 20
}
return [width + 'px', height + 'px']
}
window.add = function () {
layer.open({
type: 2,
maxmin: true,
title: '新增图片',
shade: 0.1,
area: screen(),
content: 'upload'
})
}
window.remove = function (obj) {
layer.confirm('确定要删除该图片', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: 'delete',
data: { id: obj.data['id'] },
dataType: 'json',
type: 'POST',
success: function (res) {
layer.close(loading)
if (res.success) {
layer.msg(res.msg, {
icon: 1,
time: 1000
}, function () {
obj.del()
})
} else {
layer.msg(res.msg, {
icon: 2,
time: 1000
})
}
}
})
})
}
window.batchRemove = function (obj) {
let data = table.checkStatus(obj.config.id).data
if (data.length === 0) {
layer.msg('未选中数据', {
icon: 3,
time: 1000
})
return false
}
var ids = []
var hasCheck = table.checkStatus('dataTable')
var hasCheckData = hasCheck.data
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
layer.confirm('确定要删除这些图片', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: "{{ url_for('adminFile.batch_remove') }}",
data: { ids: ids },
dataType: 'json',
type: 'POST',
success: function (res) {
layer.close(loading)
if (res.success) {
layer.msg(res.msg, {
icon: 1,
time: 1000
}, function () {
table.reload('dataTable')
})
} else {
layer.msg(res.msg, {
icon: 2,
time: 1000
})
}
}
})
})
}
window.refresh = function () {
table.reload('dataTable')
}
// 查看大图
window.photo = function (obj) {
if (!obj.data.href || obj.data.href === '') {
layer.msg('图片地址错误!')
return
}
var auto_img = {}
var img = new Image()
img.src = obj.data.href
img.onload = function () {
var max_height = $(window).height() - 100
var max_width = $(window).width()
var rate1 = max_height / img.height
var rate2 = max_width / img.width
var rate3 = 1
var rate = Math.min(rate1, rate2, rate3)
auto_img.height = img.height * rate
auto_img.width = img.width * rate
layer.open({
type: 1,
title: false,
area: ['auto'],
skin: 'layui-layer-nobg', //没有背景色
shadeClose: true,
content: '<img src=\'' + obj.data['href'] + '\' width=\'' + auto_img.width + 'px\' height=\'' + auto_img.height + 'px\'>'
})
}
}
})
</script>
+81 -78
View File
@@ -25,7 +25,8 @@
<div class="layui-form-item" id="powerCodeItem">
<label class="layui-form-label">标识</label>
<div class="layui-input-block">
<input type="text" id="powerCode" name="powerCode" autocomplete="off" placeholder="权限标识" class="layui-input">
<input type="text" id="powerCode" name="powerCode" autocomplete="off" placeholder="权限标识"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
@@ -39,7 +40,8 @@
<div class="layui-form-item" id="powerUrlItem">
<label class="layui-form-label">路径</label>
<div class="layui-input-block">
<input type="text" id="powerUrl" name="powerUrl" autocomplete="off" placeholder="菜单路径" class="layui-input">
<input type="text" id="powerUrl" name="powerUrl" autocomplete="off" placeholder="菜单路径"
class="layui-input">
</div>
</div>
<div class="layui-form-item" id="openTypeItem">
@@ -61,7 +63,8 @@
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-block">
<input type="text" name="sort" lay-verify="title" autocomplete="off" placeholder="排序" class="layui-input">
<input type="text" name="sort" lay-verify="title" autocomplete="off" placeholder="排序"
class="layui-input">
</div>
</div>
</div>
@@ -82,83 +85,83 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function () {
let form = layui.form;
let $ = layui.jquery;
let iconPicker = layui.iconPicker;
let dtree = layui.dtree;
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function () {
let form = layui.form
let $ = layui.jquery
let iconPicker = layui.iconPicker
let dtree = layui.dtree
dtree.renderSelect({
elem: "#selectParent",
url: "/admin/power/selectParent",
method: 'get',
selectInputName: {nodeId: "parentId", context: "powerName"},
skin: "layui",
dataFormat: "list",
response: {treeId: "powerId", parentId: "parentId", title: "powerName"}, //修改response中返回数据的定义
selectInitVal: "0"
});
form.on("radio(powerType)", function () {
if (this.value == '0') {
$("#powerUrlItem").hide();
$("#powerCodeItem").hide();
$("#openTypeItem").hide();
$("#powerUrl").val("");
$("#powerCode").val("");
$("#openType").val("");
} else if (this.value == '1') {
$("#powerUrlItem").show();
$("#powerCodeItem").show();
$("#openTypeItem").show();
} else if (this.value == '2') {
$("#powerUrlItem").hide();
$("#openTypeItem").hide();
$("#powerCodeItem").show();
$("#powerUrl").val("");
$("#openType").val("");
}
});
form.on('submit(power-save)', function (data) {
data.field.icon = "layui-icon " + data.field.icon;
$.ajax({
url: '/admin/power/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.render();
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
})
return false;
});
iconPicker.render({
// 选择器,推荐使用input
elem: '#icon',
// 数据类型:fontClass/unicode,推荐使用fontClass
type: 'fontClass',
// 是否开启搜索:true/false
search: true,
// 是否开启分页
page: true,
// 每页显示数量,默认12
limit: 12,
// 点击回调
click: function (data) {
console.log(data);
}
});
dtree.renderSelect({
elem: '#selectParent',
url: '/admin/power/selectParent',
method: 'get',
selectInputName: { nodeId: 'parentId', context: 'powerName' },
skin: 'layui',
dataFormat: 'list',
response: { treeId: 'powerId', parentId: 'parentId', title: 'powerName' }, //修改response中返回数据的定义
selectInitVal: '0'
})
form.on('radio(powerType)', function () {
if (this.value == '0') {
$('#powerUrlItem').hide()
$('#powerCodeItem').hide()
$('#openTypeItem').hide()
$('#powerUrl').val('')
$('#powerCode').val('')
$('#openType').val('')
} else if (this.value == '1') {
$('#powerUrlItem').show()
$('#powerCodeItem').show()
$('#openTypeItem').show()
} else if (this.value == '2') {
$('#powerUrlItem').hide()
$('#openTypeItem').hide()
$('#powerCodeItem').show()
$('#powerUrl').val('')
$('#openType').val('')
}
})
form.on('submit(power-save)', function (data) {
data.field.icon = 'layui-icon ' + data.field.icon
$.ajax({
url: '/admin/power/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.render()
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
iconPicker.render({
// 选择器,推荐使用input
elem: '#icon',
// 数据类型:fontClass/unicode,推荐使用fontClass
type: 'fontClass',
// 是否开启搜索:true/false
search: true,
// 是否开启分页
page: true,
// 每页显示数量,默认12
limit: 12,
// 点击回调
click: function (data) {
console.log(data)
}
})
})
</script>
<script>
</script>
+96 -95
View File
@@ -59,7 +59,8 @@
<div class="layui-input-block">
<select name="openType" id="openType">
<option value=""></option>
<option value="_iframe" {% if power.open_type == "_iframe" %} selected{% endif %}>框架</option>
<option value="_iframe" {% if power.open_type == "_iframe" %} selected{% endif %}>框架
</option>
<option value="_blank" {% if power.open_type == "_blank" %} selected{% endif %}>签页</option>
</select>
</div>
@@ -96,102 +97,102 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function () {
let form = layui.form;
let $ = layui.jquery;
let iconPicker = layui.iconPicker;
let dtree = layui.dtree;
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function () {
let form = layui.form
let $ = layui.jquery
let iconPicker = layui.iconPicker
let dtree = layui.dtree
dtree.renderSelect({
elem: "#selectParent",
url: "/admin/power/selectParent",
method: 'get',
selectInputName: {nodeId: "parentId", context: "powerName"},
skin: "layui",
dataFormat: "list",
response: {treeId: "powerId", parentId: "parentId", title: "powerName"},
selectInitVal: "{{ power.parent_id }}"
});
form.on("radio(powerType)", function (data) {
if (this.value == '0') {
$("#powerUrlItem").hide();
$("#powerCodeItem").hide();
$("#openTypeItem").hide();
$("#powerUrl").val("");
$("#powerCode").val("");
$("#openType").val("");
} else if (this.value == '1') {
$("#powerUrlItem").show();
$("#powerCodeItem").show();
$("#openTypeItem").show();
} else if (this.value == '2') {
$("#powerUrlItem").hide();
$("#openTypeItem").hide();
$("#powerCodeItem").show();
$("#powerUrl").val("");
$("#openType").val("");
}
});
form.on('submit(power-save)', function (data) {
data.field.icon = "layui-icon " + data.field.icon;
$.ajax({
url: '/admin/power/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.render();
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
})
return false;
});
iconPicker.render({
elem: '#icon',
type: 'fontClass',
search: true,
page: true,
limit: 12,
click: function (data) {
console.log(data);
}
});
iconPicker.checkIcon("icon", "{{ icon }}");
window.init = function (type) {
if (type == '0') {
$("#powerUrlItem").hide();
$("#powerCodeItem").hide();
$("#openTypeItem").hide();
$("#powerUrl").val("");
$("#powerCode").val("");
$("#openType").val("");
} else if (type == '1') {
$("#powerUrlItem").show();
$("#powerCodeItem").show();
$("#openTypeItem").show();
} else if (type == '2') {
$("#powerUrlItem").hide();
$("#openTypeItem").hide();
$("#powerCodeItem").show();
$("#powerUrl").val("");
$("#openType").val("");
}
}
window.init("{{ power.type}}");
dtree.renderSelect({
elem: '#selectParent',
url: '/admin/power/selectParent',
method: 'get',
selectInputName: { nodeId: 'parentId', context: 'powerName' },
skin: 'layui',
dataFormat: 'list',
response: { treeId: 'powerId', parentId: 'parentId', title: 'powerName' },
selectInitVal: "{{ power.parent_id }}"
})
form.on('radio(powerType)', function (data) {
if (this.value == '0') {
$('#powerUrlItem').hide()
$('#powerCodeItem').hide()
$('#openTypeItem').hide()
$('#powerUrl').val('')
$('#powerCode').val('')
$('#openType').val('')
} else if (this.value == '1') {
$('#powerUrlItem').show()
$('#powerCodeItem').show()
$('#openTypeItem').show()
} else if (this.value == '2') {
$('#powerUrlItem').hide()
$('#openTypeItem').hide()
$('#powerCodeItem').show()
$('#powerUrl').val('')
$('#openType').val('')
}
})
form.on('submit(power-save)', function (data) {
data.field.icon = 'layui-icon ' + data.field.icon
$.ajax({
url: '/admin/power/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.render()
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
iconPicker.render({
elem: '#icon',
type: 'fontClass',
search: true,
page: true,
limit: 12,
click: function (data) {
console.log(data)
}
})
iconPicker.checkIcon('icon', "{{ icon }}")
window.init = function (type) {
if (type == '0') {
$('#powerUrlItem').hide()
$('#powerCodeItem').hide()
$('#openTypeItem').hide()
$('#powerUrl').val('')
$('#powerCode').val('')
$('#openType').val('')
} else if (type == '1') {
$('#powerUrlItem').show()
$('#powerCodeItem').show()
$('#openTypeItem').show()
} else if (type == '2') {
$('#powerUrlItem').hide()
$('#openTypeItem').hide()
$('#powerCodeItem').show()
$('#powerUrl').val('')
$('#openType').val('')
}
}
window.init("{{ power.type}}")
})
</script>
<script>
</script>
+209 -207
View File
@@ -33,27 +33,29 @@
<script type="text/html" id="power-toolbar">
{% if authorize("admin:power:add") %}
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
{% endif %}
{% if authorize("admin:role:remove") %}
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
{% endif %}
</script>
<script type="text/html" id="power-bar">
{% if authorize("admin:role:edit") %}
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
</button>
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i
class="layui-icon layui-icon-edit"></i>
</button>
{% endif %}
{% if authorize("admin:role:remove") %}
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
</button>
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
class="layui-icon layui-icon-delete"></i>
</button>
{% endif %}
</script>
@@ -67,12 +69,13 @@
<span>按钮</span>
{{# } }}
" |safe}}
" |safe }}
</script>
<script type="text/html" id="power-enable">
<input type="checkbox" name="enable" value="{{ "{{d.powerId}}" }}" lay-skin="switch" lay-text="启用|禁用" lay-filter="power-enable" {{"{{# if(d.enable==1){ }} checked {{# } }}"}}>
<input type="checkbox" name="enable" value="{{ "{{d.powerId}}" }}" lay-skin="switch" lay-text="启用|禁用"
lay-filter="power-enable" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
</script>
<script type="text/html" id="icon">
@@ -82,202 +85,201 @@
</body>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'form', 'jquery', 'treetable','popup'], function () {
let table = layui.table;
let form = layui.form;
let $ = layui.jquery;
let treetable = layui.treetable;
let popup = layui.popup;
layui.use(['table', 'form', 'jquery', 'treetable', 'popup'], function () {
let table = layui.table
let form = layui.form
let $ = layui.jquery
let treetable = layui.treetable
let popup = layui.popup
let MODULE_PATH = "/admin/power/";
let MODULE_PATH = '/admin/power/'
window.render = function () {
treetable.render({
treeColIndex: 1,
treeSpid: 0,
treeIdName: 'powerId',
treePidName: 'parentId',
skin: 'line',
method: 'post',
treeDefaultClose: true,
toolbar: '#power-toolbar',
elem: '#power-table',
url: '/admin/power/data',
page: false,
cols: [
[
{% if authorize("admin:role:remove") %}
{type: 'checkbox'},
{% endif %}
{field: 'powerName', minWidth: 200, title: '权限名称'},
{field: 'icon', title: '图标', templet: '#icon'},
{field: 'powerType', title: '权限类型', templet: '#power-type'},
{field: 'enable', title: '是否可用', templet: '#power-enable'},
{field: 'sort', title: '排序'},
{title: '操作', templet: '#power-bar', width: 150, align: 'center'}
]
]
});
window.render = function () {
treetable.render({
treeColIndex: 1,
treeSpid: 0,
treeIdName: 'powerId',
treePidName: 'parentId',
skin: 'line',
method: 'post',
treeDefaultClose: true,
toolbar: '#power-toolbar',
elem: '#power-table',
url: '/admin/power/data',
page: false,
cols: [
[
{% if authorize("admin:role:remove") %}
{ type: 'checkbox' },
{% endif %}
{ field: 'powerName', minWidth: 200, title: '权限名称' },
{ field: 'icon', title: '图标', templet: '#icon' },
{ field: 'powerType', title: '权限类型', templet: '#power-type' },
{ field: 'enable', title: '是否可用', templet: '#power-enable' },
{ field: 'sort', title: '排序' },
{ title: '操作', templet: '#power-bar', width: 150, align: 'center' }
]
]
})
}
render()
form.on('submit(power-query)', function (data) {
var keyword = data.field.powerName
var $tds = $('#power-table').next('.treeTable').find('.layui-table-body tbody tr td')
if (!keyword) {
$tds.css('background-color', 'transparent')
layer.msg('请输入关键字', { icon: 5 })
return
}
var searchCount = 0
$tds.each(function () {
$(this).css('background-color', 'transparent')
if ($(this).text().indexOf(keyword) >= 0) {
$(this).css('background-color', 'rgba(250,230,160,0.5)')
if (searchCount === 0) {
$('body,html').stop(true)
$('body,html').animate({ scrollTop: $(this).offset().top - 150 }, 500)
}
searchCount++
}
render();
form.on('submit(power-query)', function (data) {
var keyword = data.field.powerName;
var $tds = $('#power-table').next('.treeTable').find('.layui-table-body tbody tr td');
if (!keyword) {
$tds.css('background-color', 'transparent');
layer.msg("请输入关键字", {icon: 5});
return;
}
var searchCount = 0;
$tds.each(function () {
$(this).css('background-color', 'transparent');
if ($(this).text().indexOf(keyword) >= 0) {
$(this).css('background-color', 'rgba(250,230,160,0.5)');
if (searchCount == 0) {
$('body,html').stop(true);
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
}
searchCount++;
}
});
if (searchCount == 0) {
layer.msg("没有匹配结果", {icon: 5});
} else {
treetable.expandAll('#power-table');
}
return false;
});
table.on('tool(power-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'edit') {
window.edit(obj);
}
})
table.on('toolbar(power-table)', function (obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
form.on('switch(power-enable)', function (obj) {
let operate;
if (obj.elem.checked) {
operate = "enable";
} else {
operate = "disable";
}
let loading = layer.load();
$.ajax({
url: '/admin/power/' + operate,
data: JSON.stringify({powerId: this.value}),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg);
} else {
popup.failure(result.msg);
}
}
})
});
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'add'
});
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'edit/' + obj.data['powerId']
});
}
window.remove = function (obj) {
layer.confirm('确定要删除该权限', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "remove/" + obj.data['powerId'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg,function(){
console.log(obj);
obj.del();
})
} else {
popup.failure(result.msg);
}
}
})
});
}
window.batchRemove = function(obj) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
layer.msg("未选中数据", {
icon: 3,
time: 1000
});
return false;
}
var ids = []
var hasCheck = table.checkStatus('power-table')
var hasCheckData = hasCheck.data
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
layer.confirm('确定要删除选中权限', {
icon: 3,
title: '提示'
}, function(index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "batchRemove",
data: {ids:ids},
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg, function () {
console.log(obj);
obj.del();
});
} else {
popup.failure(result.msg);
}
}
})
});
}
})
if (searchCount === 0) {
layer.msg('没有匹配结果', { icon: 5 })
} else {
treetable.expandAll('#power-table')
}
return false
})
table.on('tool(power-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj)
} else if (obj.event === 'edit') {
window.edit(obj)
}
})
table.on('toolbar(power-table)', function (obj) {
if (obj.event === 'add') {
window.add()
} else if (obj.event === 'refresh') {
window.refresh()
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj)
}
})
form.on('switch(power-enable)', function (obj) {
let operate
if (obj.elem.checked) {
operate = 'enable'
} else {
operate = 'disable'
}
let loading = layer.load()
$.ajax({
url: '/admin/power/' + operate,
data: JSON.stringify({ powerId: this.value }),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg)
} else {
popup.failure(result.msg)
}
}
})
})
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'add'
})
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['450px', '500px'],
content: MODULE_PATH + 'edit/' + obj.data['powerId']
})
}
window.remove = function (obj) {
layer.confirm('确定要删除该权限', { icon: 3, title: '提示' }, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'remove/' + obj.data['powerId'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
console.log(obj)
obj.del()
})
} else {
popup.failure(result.msg)
}
}
})
})
}
window.batchRemove = function (obj) {
let data = table.checkStatus(obj.config.id).data
if (data.length === 0) {
layer.msg('未选中数据', {
icon: 3,
time: 1000
})
return false
}
var ids = []
var hasCheck = table.checkStatus('power-table')
var hasCheckData = hasCheck.data
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
layer.confirm('确定要删除选中权限', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'batchRemove',
data: { ids: ids },
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
console.log(obj)
obj.del()
})
} else {
popup.failure(result.msg)
}
}
})
})
}
})
</script>
</html>
+22 -22
View File
@@ -60,31 +60,31 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(role-save)', function (data) {
$.ajax({
url: '/admin/role/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("role-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
form.on('submit(role-save)', function (data) {
$.ajax({
url: '/admin/role/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('role-table')
})
return false;
});
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
</body>
</html>
+30 -27
View File
@@ -11,7 +11,7 @@
<div class="layui-form-item layui-hide">
<label class="layui-form-label">编号</label>
<div class="layui-input-block">
<input type="text" value="{{role.id}}" name="roleId" lay-verify="title"
<input type="text" value="{{ role.id }}" name="roleId" lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
@@ -32,14 +32,17 @@
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<input type="radio" name="enable" {% if role.enable == 0 %}checked {% endif %}value="0" title="开启">
<input type="radio" name="enable" {% if role.enable == 1 %}checked {% endif %} value="1" title="关闭">
<input type="radio" name="enable" {% if role.enable == 0 %}checked {% endif %}value="0"
title="开启">
<input type="radio" name="enable" {% if role.enable == 1 %}checked {% endif %} value="1"
title="关闭">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-block">
<input type="text" name="sort" value="{{ role.sort }}" lay-verify="title" autocomplete="off" placeholder="请输入标题"
<input type="text" name="sort" value="{{ role.sort }}" lay-verify="title" autocomplete="off"
placeholder="请输入标题"
class="layui-input">
</div>
</div>
@@ -47,7 +50,7 @@
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<textarea placeholder="请输入内容" name="details"
class="layui-textarea">{{role.details}}</textarea>
class="layui-textarea">{{ role.details }}</textarea>
</div>
</div>
</div>
@@ -69,31 +72,31 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(role-update)', function (data) {
$.ajax({
url: '/admin/role/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("role-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
form.on('submit(role-update)', function (data) {
$.ajax({
url: '/admin/role/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('role-table')
})
return false;
});
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+201 -197
View File
@@ -37,223 +37,227 @@
<script type="text/html" id="role-toolbar">
{% if authorize("admin:role:add") %}
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
{% endif %}
{% if authorize("admin:role:remove") %}
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
{% endif %}
</script>
<script type="text/html" id="role-bar">
{% if authorize("admin:role:edit") %}
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
</button>
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i
class="layui-icon layui-icon-edit"></i>
</button>
{% endif %}
{% if authorize("admin:role:power") %}
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="power"><i class="layui-icon layui-icon-vercode"></i>
</button>
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="power"><i
class="layui-icon layui-icon-vercode"></i>
</button>
{% endif %}
{% if authorize("admin:role:remove") %}
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
</button>
{% endif %}
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
class="layui-icon layui-icon-delete"></i>
</button>
{% endif %}
</script>
<script type="text/html" id="role-enable">
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用" lay-filter="role-enable" {{"{{# if(d.enable==1){ }} checked {{# } }}"}}>
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用"
lay-filter="role-enable" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
</script>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'form', 'jquery','popup','common'], function () {
let table = layui.table;
let form = layui.form;
let $ = layui.jquery;
let popup = layui.popup;
layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
let table = layui.table
let form = layui.form
let $ = layui.jquery
let popup = layui.popup
let MODULE_PATH = "/admin/role/";
let MODULE_PATH = '/admin/role/'
let cols = [
[
{% if authorize("admin:role:remove") %}
{type: 'checkbox'},
{% endif %}
{title: '角色名', field: 'roleName', align: 'center', width: 100},
{title: 'Key值', field: 'roleCode', align: 'center'},
{title: '描述', field: 'details', align: 'center'},
{title: '是否可用', field: 'enable', align: 'center', templet: '#role-enable'},
{title: '排序', field: 'sort', align: 'center'},
{title: '操作', toolbar: '#role-bar', align: 'center', width: 195}
]
]
let cols = [
[
{% if authorize("admin:role:remove") %}
{ type: 'checkbox' },
{% endif %}
{ title: '角色名', field: 'roleName', align: 'center', width: 100 },
{ title: 'Key值', field: 'roleCode', align: 'center' },
{ title: '描述', field: 'details', align: 'center' },
{ title: '是否可用', field: 'enable', align: 'center', templet: '#role-enable' },
{ title: '排序', field: 'sort', align: 'center' },
{ title: '操作', toolbar: '#role-bar', align: 'center', width: 195 }
]
]
table.render({
elem: '#role-table',
url: MODULE_PATH + 'data',
page: true,
cols: cols,
skin: 'line',
toolbar: '#role-toolbar',
defaultToolbar: [{
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
});
table.on('tool(role-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'edit') {
window.edit(obj);
} else if (obj.event === 'power') {
window.power(obj);
}
});
table.on('toolbar(role-table)', function (obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
form.on('submit(role-query)', function (data) {
table.reload('role-table', {where: data.field})
return false;
});
form.on('switch(role-enable)', function (obj) {
let operate;
if (obj.elem.checked) {
operate = "enable";
} else {
operate = "disable";
}
let loading = layer.load()
$.ajax({
url: '/admin/role/' + operate,
data: JSON.stringify({roleId: this.value}),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading);
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
})
});
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['500px', '500px'],
content: MODULE_PATH + 'add'
});
}
window.power = function (obj) {
layer.open({
type: 2,
title: '授权',
shade: 0.1,
area: ['320px', '400px'],
content: MODULE_PATH + 'power/' + obj.data["id"]
});
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['500px', '500px'],
content: MODULE_PATH + 'edit/' + obj.data['id']
});
}
window.remove = function (obj) {
layer.confirm('确定要删除该角色', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "remove/" + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
obj.del();
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
})
});
}
window.batchRemove = function(obj) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
layer.msg("未选中数据", {
icon: 3,
time: 1000
});
return false;
}
var ids = []
var hasCheck = table.checkStatus('role-table')
var hasCheckData = hasCheck.data
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
console.log(ids)
layer.confirm('确定要删除选中角色', {
icon: 3,
title: '提示'
}, function(index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "batchRemove",
data: {ids:ids},
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg, function () {
table.reload('role-table');
});
} else {
popup.failure(result.msg);
}
}
})
});
}
window.refresh = function () {
table.reload('role-table');
}
table.render({
elem: '#role-table',
url: MODULE_PATH + 'data',
page: true,
cols: cols,
skin: 'line',
toolbar: '#role-toolbar',
defaultToolbar: [{
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
})
table.on('tool(role-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj)
} else if (obj.event === 'edit') {
window.edit(obj)
} else if (obj.event === 'power') {
window.power(obj)
}
})
table.on('toolbar(role-table)', function (obj) {
if (obj.event === 'add') {
window.add()
} else if (obj.event === 'refresh') {
window.refresh()
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj)
}
})
form.on('submit(role-query)', function (data) {
table.reload('role-table', { where: data.field })
return false
})
form.on('switch(role-enable)', function (obj) {
let operate
if (obj.elem.checked) {
operate = 'enable'
} else {
operate = 'disable'
}
let loading = layer.load()
$.ajax({
url: '/admin/role/' + operate,
data: JSON.stringify({ roleId: this.value }),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading)
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 })
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
})
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['500px', '500px'],
content: MODULE_PATH + 'add'
})
}
window.power = function (obj) {
layer.open({
type: 2,
title: '授权',
shade: 0.1,
area: ['320px', '400px'],
content: MODULE_PATH + 'power/' + obj.data['id']
})
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['500px', '500px'],
content: MODULE_PATH + 'edit/' + obj.data['id']
})
}
window.remove = function (obj) {
layer.confirm('确定要删除该角色', { icon: 3, title: '提示' }, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'remove/' + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
obj.del()
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
})
}
window.batchRemove = function (obj) {
let data = table.checkStatus(obj.config.id).data
if (data.length === 0) {
layer.msg('未选中数据', {
icon: 3,
time: 1000
})
return false
}
var ids = []
var hasCheck = table.checkStatus('role-table')
var hasCheckData = hasCheck.data
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
console.log(ids)
layer.confirm('确定要删除选中角色', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'batchRemove',
data: { ids: ids },
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
table.reload('role-table')
})
} else {
popup.failure(result.msg)
}
}
})
})
}
window.refresh = function () {
table.reload('role-table')
}
})
</script>
</html>
+45 -45
View File
@@ -27,53 +27,53 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['dtree', 'form', 'jquery'], function () {
let dtree = layui.dtree;
let form = layui.form;
let $ = layui.jquery;
dtree.render({
elem: "#role-power",
method: "get",
url: "/admin/role/getRolePower/" + {{id}},
dataFormat: "list",
checkbar: true,
skin: "layui",
initLevel: "1",
checkbarType: "self",
response: {treeId: "powerId", parentId: "parentId", title: "powerName"},
});
form.on('submit(power-save)', function (data) {
let param = dtree.getCheckbarNodesParam("role-power");
let ids = '';
for (let i = 0; i < param.length; i++) {
let id = param[i].nodeId;
ids += id + ',';
}
ids = ids.substr(0, ids.length - 1);
data.field.roleId = {{id}};
data.field.powerIds = ids;
$.ajax({
url: '/admin/role/saveRolePower',
data: data.field,
dataType: 'json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
})
return false;
});
layui.use(['dtree', 'form', 'jquery'], function () {
let dtree = layui.dtree
let form = layui.form
let $ = layui.jquery
dtree.render({
elem: '#role-power',
method: 'get',
url: '/admin/role/getRolePower/' + {{id}},
dataFormat: 'list',
checkbar: true,
skin: 'layui',
initLevel: '1',
checkbarType: 'self',
response: { treeId: 'powerId', parentId: 'parentId', title: 'powerName' },
})
form.on('submit(power-save)', function (data) {
let param = dtree.getCheckbarNodesParam('role-power')
let ids = ''
for (let i = 0; i < param.length; i++) {
let id = param[i].nodeId
ids += id + ','
}
ids = ids.substr(0, ids.length - 1)
data.field.roleId = {{id}};
data.field.powerIds = ids
$.ajax({
url: '/admin/role/saveRolePower',
data: data.field,
dataType: 'json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
</body>
</html>
+33 -33
View File
@@ -35,10 +35,10 @@
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
{% for role in roles %}
<input
value="{{role.id}}" title="{{role.name}}" type="checkbox"
name="roleIds" lay-skin="primary">
{% for role in roles %}
<input
value="{{ role.id }}" title="{{ role.name }}" type="checkbox"
name="roleIds" lay-skin="primary">
{% endfor %}
</div>
@@ -61,37 +61,37 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery'], function () {
let form = layui.form;
let $ = layui.jquery;
form.on('submit(user-save)', function (data) {
let roleIds = "";
$('input[type=checkbox]:checked').each(function () {
roleIds += $(this).val() + ",";
});
roleIds = roleIds.substr(0, roleIds.length - 1);
data.field.roleIds = roleIds;
layui.use(['form', 'jquery'], function () {
let form = layui.form
let $ = layui.jquery
form.on('submit(user-save)', function (data) {
let roleIds = ''
$('input[type=checkbox]:checked').each(function () {
roleIds += $(this).val() + ','
})
roleIds = roleIds.substr(0, roleIds.length - 1)
data.field.roleIds = roleIds
$.ajax({
url: '/admin/user/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("user-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
$.ajax({
url: '/admin/user/save',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('user-table')
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
<script>
</script>
+76 -60
View File
@@ -4,15 +4,17 @@
<title>个人中心</title>
{% include 'admin/common/header.html' %}
<style>
.layui-form-item{
margin-top: 17px!important;
margin-bottom: 17px!important;
.layui-form-item {
margin-top: 17px !important;
margin-bottom: 17px !important;
}
</style>
</head>
<body class="pear-container">
<div class="layui-row layui-col-space10">
{# 左侧栏 #}
<div class="layui-col-md3">
{# 个人信息卡片 #}
<div class="layui-card">
<div class="layui-card-body" style="padding: 25px;">
<div class="text-center layui-text">
@@ -27,6 +29,7 @@
<span>{{ user_info.remark }}</span>
</div>
</div>
{# 登录信息卡片 #}
<div class="layui-card">
<div class="layui-card-header">
登录记录
@@ -34,13 +37,18 @@
<div class="layui-card-body">
<ul class="list">
{% for log in user_logs %}
<li class="list-item"><span class="title" >{{ log.url }}</span><span class="footer">{{ log.create_time }}</span></li>
<li class="list-item">
<span class="title">{{ log.url }}</span>
<span class="footer">{{ log.create_time }}</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{# 右侧栏 #}
<div class="layui-col-md9">
{# 个人信息卡片 #}
<div class="layui-card">
<div class="layui-card-header">个人信息</div>
<div class="layui-card-body">
@@ -51,27 +59,32 @@
<div class="layui-form-item">
<label class="layui-form-label">账号</label>
<div class="layui-input-block">
<input value="{{user_info.username}}" type="text" readonly name="username" lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
<input value="{{ user_info.username }}" type="text" readonly name="username"
lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">姓名</label>
<div class="layui-input-block">
<input value="{{user_info.realname}}" type="text" name="realName" lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
<input value="{{ user_info.realname }}" type="text" name="realName"
lay-verify="title"
autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<textarea placeholder="请输入描述" name="details" class="layui-textarea">{{user_info.remark}}</textarea>
<textarea placeholder="请输入描述" name="details"
class="layui-textarea">{{ user_info.remark }}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-submit lay-filter="user-update">修改资料</button>
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-submit
lay-filter="user-update">修改资料
</button>
<button class="pear-btn pear-btn-sm edit-password">更改密码</button>
</div>
</div>
@@ -81,6 +94,7 @@
</div>
</div>
</div>
{# 个人文章记录 #}
<div class="layui-card">
<div class="layui-card-header">
我的文章
@@ -106,7 +120,8 @@
</div>
<div class="layui-row layui-col-space10" style="margin: 15px;">
<div class="layui-col-md1">
<img src="{{ url_for('static', filename='admin/admin/images/act.jpg') }}" style="width: 100%;height: 100%;border-radius: 5px;"/>
<img src="{{ url_for('static', filename='admin/admin/images/act.jpg') }}"
style="width: 100%;height: 100%;border-radius: 5px;"/>
</div>
<div class="layui-col-md11" style="height: 80px;">
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
@@ -156,56 +171,57 @@
</div>
</div>
{% include 'admin/common/footer.html' %}
<script >
layui.use(['element', 'jquery', 'layer','form'], function () {
let $ = layui.jquery;
let layer = layui.layer;
let form = layui.form;
$(".edit-password").click(function () {
layer.open({
type: 2,
title: '修改密码',
shade: 0.1,
area: ['550px', '280px'],
content: '/admin/user/editPassword'
});
return false;
});
$("#avatar").click(function () {
layer.open({
type: 2,
title: '更换图片',
shade: 0.1,
area: ["900px", "500px"],
content: '/admin/user/profile',
btn: ['确定', '取消'],
yes: function (index, layero) {
window['layui-layer-iframe' + index].submitForm();
}
});
});
form.on('submit(user-update)', function (data) {
$.ajax({
url: '/admin/user/updateInfo',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg("修改成功", {icon: 1, time: 1000});
} else {
layer.msg("修改失败", {icon: 2, time: 1000});
}
}
});
return false;
});
<script>
layui.use(['element', 'jquery', 'layer', 'form'], function () {
let $ = layui.jquery
let layer = layui.layer
let form = layui.form
// 修改密码页面
$('.edit-password').click(function () {
layer.open({
type: 2,
title: '修改密码',
shade: 0.1,
area: ['550px', '280px'],
content: '/admin/user/editPassword'
})
return false
})
// 修改头像
$('#avatar').click(function () {
layer.open({
type: 2,
title: '更换图片',
shade: 0.1,
area: ['900px', '500px'],
content: '/admin/user/profile',
btn: ['确定', '取消'],
yes: function (index, layero) {
window['layui-layer-iframe' + index].submitForm()
}
})
})
// 表单提交更改个人信息数据
form.on('submit(user-update)', function (data) {
$.ajax({
url: '/admin/user/updateInfo',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg('修改成功', { icon: 1, time: 1000 })
} else {
layer.msg('修改失败', { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
</body>
</html>
+49 -48
View File
@@ -24,14 +24,15 @@
autocomplete="off" placeholder="请输入标题" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label">姓名</label>
<div class="layui-input-block">
<input type="text" value="{{ user.realname }}" name="realName" lay-verify="title" autocomplete="off" placeholder="请输入标题"
<input type="text" value="{{ user.realname }}" name="realName" lay-verify="title"
autocomplete="off" placeholder="请输入标题"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label">部门</label>
<div class="layui-input-block">
<ul id="selectParent" name="deptId" class="dtree" data-id="0"></ul>
@@ -43,11 +44,11 @@
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
{% for role in roles %}
<input{% if role.id in checked_roles %}
checked
{% endif %}
value="{{role.id}}" title="{{role.name}}" type="checkbox"
name="roleIds" lay-skin="primary">
<input{% if role.id in checked_roles %}
checked
{% endif %}
value="{{ role.id }}" title="{{ role.name }}" type="checkbox"
name="roleIds" lay-skin="primary">
{% endfor %}
</div>
</div>
@@ -70,48 +71,48 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery','dtree'], function () {
let form = layui.form;
let $ = layui.jquery;
let dtree = layui.dtree;
layui.use(['form', 'jquery', 'dtree'], function () {
let form = layui.form
let $ = layui.jquery
let dtree = layui.dtree
dtree.renderSelect({
elem: "#selectParent",
url: "/admin/dept/tree",
method: 'get',
selectInputName: {nodeId: "deptId", context: "deptName"},
skin: "layui",
dataFormat: "list",
response: {treeId: "deptId", parentId: "parentId", title: "deptName"},
selectInitVal: "{{ user.dept_id }}"
});
form.on('submit(user-update)', function (data) {
let roleIds = "";
$('input[type=checkbox]:checked').each(function () {
roleIds += $(this).val() + ",";
});
roleIds = roleIds.substr(0, roleIds.length - 1);
data.field.roleIds = roleIds;
$.ajax({
url: '/admin/user/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
parent.layui.table.reload("user-table");
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
}
});
return false;
});
dtree.renderSelect({
elem: '#selectParent',
url: '/admin/dept/tree',
method: 'get',
selectInputName: { nodeId: 'deptId', context: 'deptName' },
skin: 'layui',
dataFormat: 'list',
response: { treeId: 'deptId', parentId: 'parentId', title: 'deptName' },
selectInitVal: "{{ user.dept_id }}"
})
form.on('submit(user-update)', function (data) {
let roleIds = ''
$('input[type=checkbox]:checked').each(function () {
roleIds += $(this).val() + ','
})
roleIds = roleIds.substr(0, roleIds.length - 1)
data.field.roleIds = roleIds
$.ajax({
url: '/admin/user/update',
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
if (result.success) {
layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
parent.layui.table.reload('user-table')
})
} else {
layer.msg(result.msg, { icon: 2, time: 1000 })
}
}
})
return false
})
})
</script>
</body>
</html>
@@ -35,7 +35,8 @@
</div>
<div class="bottom">
<div class="button-container">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="edit-password">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
lay-filter="edit-password">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
@@ -48,32 +49,33 @@
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery','popup'], function () {
let form = layui.form;
let $ = layui.jquery;
let popup = layui.popup;
form.on('submit(edit-password)', function (data) {
$.ajax({
url: '/admin/user/editPassword',
data: JSON.stringify(data.field),
contentType: 'application/json',
dataType: 'json',
type: 'put',
success: function (result) {
if (result.success) {
popup.success(result.msg,function(){
parent.layer.close(parent.layer.getFrameIndex(window.name));
});
} else {
popup.failure(result.msg);
}
}
});
return false;
});
layui.use(['form', 'jquery', 'popup'], function () {
let form = layui.form
let $ = layui.jquery
let popup = layui.popup
// 修改密码提交
form.on('submit(edit-password)', function (data) {
$.ajax({
url: '/admin/user/editPassword',
data: JSON.stringify(data.field),
contentType: 'application/json',
dataType: 'json',
type: 'put',
success: function (result) {
if (result.success) {
popup.success(result.msg, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name))
})
} else {
popup.failure(result.msg)
}
}
})
return false
})
})
</script>
</body>
</html>
+265 -253
View File
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>用户管理</title>
{% include 'admin/common/header.html' %}
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/user.css') }}" />
<title>用户管理</title>
{% include 'admin/common/header.html' %}
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/user.css') }}"/>
</head>
<body class="pear-container">
{# 查询表单 #}
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="" lay-filter="user-query-form">
@@ -30,38 +31,39 @@
</form>
</div>
</div>
<div class="user-left user-collasped">
<div class="layui-card">
<div class="layui-card-body">
<div class="button button-primary user-group" user-group=""> 全 部 用 户 </div>
<div class="button button-default user-group" user-group="-1"> 默 认 分 组 </div>
<div style="overflow: auto">
<ul id="dept-tree" class="dept-tree" data-id="0"></ul>
</div>
<div class="user-left user-collasped">
<div class="layui-card">
<div class="layui-card-body">
<div class="button button-primary user-group" user-group=""> 全 部 用 户</div>
<div class="button button-default user-group" user-group="-1"> 默 认 分 组</div>
<div style="overflow: auto">
<ul id="dept-tree" class="dept-tree" data-id="0"></ul>
</div>
</div>
</div>
<div class="user-main user-collasped">
<div class="layui-card">
<div class="layui-card-body">
<table id="user-table" lay-filter="user-table"></table>
</div>
</div>
{# 用户表格 #}
<div class="user-main user-collasped">
<div class="layui-card">
<div class="layui-card-body">
<table id="user-table" lay-filter="user-table"></table>
</div>
</div>
</div>
</body>
{# 表格操作 #}
<script type="text/html" id="user-toolbar">
{% if authorize("admin:user:add") %}
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="pear-icon pear-icon-add"></i>
新增
</button>
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="pear-icon pear-icon-add"></i>
新增
</button>
{% endif %}
{% if authorize("admin:user:remove") %}
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="pear-icon pear-icon-ashbin"></i>
删除
</button>
{% if authorize("admin:user:remove") %}
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
<i class="pear-icon pear-icon-ashbin"></i>
删除
</button>
{% endif %}
<button class="pear-btn pear-btn-md" lay-event="collasped">
<i class="pear-icon pear-icon-modular"></i>
@@ -69,247 +71,257 @@
</button>
</script>
{# 用户修改操作 #}
<script type="text/html" id="user-bar">
{% if authorize("admin:user:edit") %}
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="pear-icon pear-icon-edit"></i>
</button>
{% endif %}
{% if authorize("admin:user:remove") %}
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="pear-icon pear-icon-ashbin"></i>
</button>
{% endif %}
{% if authorize("admin:user:edit") %}
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="pear-icon pear-icon-edit"></i>
</button>
{% endif %}
{% if authorize("admin:user:remove") %}
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
class="pear-icon pear-icon-ashbin"></i>
</button>
{% endif %}
</script>
{# 启动与禁用 #}
<script type="text/html" id="user-enable">
<input type="checkbox" name="enable" value="{{"{{ d.id }}"}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="user-enable"
{{"{{# if(d.enable==1){ }} checked {{# } }}"}} />
<input type="checkbox" name="enable" value="{{ "{{ d.id }}" }}" lay-skin="switch" lay-text="启用|禁用"
lay-filter="user-enable"
{{ "{{# if(d.enable==1){ }} checked {{# } }}" }} />
</script>
{# 用户注册时间 #}
<script type="text/html" id="user-createTime">
{{' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe}}}
{{ ' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
</script>
{# 用户更新时间 #}
<script type="text/html" id="user-updateTime">
{{' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe}}}
{{ ' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
</script>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['table', 'dtree','form', 'jquery','popup','common'], function () {
let table = layui.table;
let form = layui.form;
let $ = layui.jquery;
let dtree = layui.dtree;
let popup = layui.popup;
let common = layui.common;
let MODULE_PATH = "/admin/user/";
layui.use(['table', 'dtree', 'form', 'jquery', 'popup', 'common'], function () {
let table = layui.table
let form = layui.form
let $ = layui.jquery
let dtree = layui.dtree
let popup = layui.popup
let common = layui.common
let MODULE_PATH = '/admin/user/'
let cols = [
[
{% if authorize("admin:user:remove") %}
{type: 'checkbox'},
{% endif %}
{title: '姓名', field: 'realname', align: 'center', width: 110},
{title: '账号', field: 'username', align: 'center'},
{title: '部门', field: 'dept', align: 'center'},
{title: '启用', field: 'enable', align: 'center', templet: '#user-enable',width: 120},
{title: '注册时间', field: 'create_at', templet: '#user-createTime', align: 'center'},
{title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center'},
{title: '操作', toolbar: '#user-bar', align: 'center', width: 130}
]
];
// 表格数据
let cols = [
[
{% if authorize("admin:user:remove") %}
{ type: 'checkbox' },
{% endif %}
{ title: '姓名', field: 'realname', align: 'center', width: 110 },
{ title: '账号', field: 'username', align: 'center' },
{ title: '部门', field: 'dept', align: 'center' },
{ title: '启用', field: 'enable', align: 'center', templet: '#user-enable', width: 120 },
{ title: '注册时间', field: 'create_at', templet: '#user-createTime', align: 'center' },
{ title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center' },
{ title: '操作', toolbar: '#user-bar', align: 'center', width: 130 }
]
]
table.render({
elem: '#user-table',
url: MODULE_PATH + 'data',
page: true,
cols: cols,
skin: 'line',
height: 'full-148',
toolbar: '#user-toolbar',
text: {none: '暂无人员信息'},
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports']
});
dtree.render({
elem: "#dept-tree",
method: "get",
url: "/admin/dept/tree",
dataFormat: "list",
line: true,
skin: "laySimple",
icon: "-1",
response: {treeId: "deptId", parentId: "parentId", title: "deptName"},
});
dtree.on("node('dept-tree')" ,function(obj){
let field = form.val("user-query-form");
field.deptId = obj.param.nodeId;
window.refresh(field);
});
$(".user-group").click(function(){
let group = $(this).attr("user-group");
let field = form.val("user-query-form");
if(group==="-1"){
field.deptId = group;
$(this).removeClass("button-default");
$(this).prev().removeClass("button-primary");
$(this).prev().addClass("button-default");
$(this).addClass("button-primary");
}else{
field.deptId = group;
$(this).removeClass("button-default");
$(this).next().removeClass("button-primary");
$(this).next().addClass("button-default");
$(this).addClass("button-primary");
}
window.refresh(field);
})
table.on('tool(user-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'edit') {
window.edit(obj);
}
});
table.on('toolbar(user-table)', function (obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
} else if(obj.event === 'collasped'){
$(".user-left").toggleClass("user-collasped");
$(".user-main").toggleClass("user-collasped");
table.resize();
}
});
form.on('submit(user-query)', function (data) {
window.refresh(data.field);
return false;
});
form.on('switch(user-enable)', function (obj) {
let operate;
if (obj.elem.checked) {
operate = "enable";
} else {
operate = "disable";
}
let loading = layer.load();
$.ajax({
url: '/admin/user/' + operate,
data: JSON.stringify({userId: this.value}),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg);
} else {
popup.failure(result.msg);
}
}
})
});
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['550px', '550px'],
content: MODULE_PATH + 'add'
});
};
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['550px', '500px'],
content: MODULE_PATH + 'edit/' + obj.data['id']
});
};
window.remove = function (obj) {
layer.confirm('确定要删除该用户', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "remove/" + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg,function(){
obj.del();
});
} else {
popup.failure(result.msg);
}
}
})
});
};
window.batchRemove = function(obj) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
layer.msg("未选中数据", {
icon: 3,
time: 1000
});
return false;
}
var ids = [];
var hasCheck = table.checkStatus('user-table');
var hasCheckData = hasCheck.data;
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
{#console.log(ids);#}
layer.confirm('确定要删除选中角色', {
icon: 3,
title: '提示'
}, function(index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: MODULE_PATH + "batchRemove",
data: {ids:ids},
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading);
if (result.success) {
popup.success(result.msg, function () {
table.reload('role-table');
});
} else {
popup.failure(result.msg);
}
}
})
});
};
window.refresh = function (param) {
table.reload('user-table', {where: param});
}
// 渲染表格数据
table.render({
elem: '#user-table',
url: MODULE_PATH + 'data',
page: true,
cols: cols,
skin: 'line',
height: 'full-148',
toolbar: '#user-toolbar', /*工具栏*/
text: { none: '暂无人员信息' },
defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'] /*默认工具栏*/
})
// 公司部门树状图菜单
dtree.render({
elem: '#dept-tree',
method: 'get',
url: '/admin/dept/tree',
dataFormat: 'list',
line: true,
skin: 'laySimple',
icon: '-1',
response: { treeId: 'deptId', parentId: 'parentId', title: 'deptName' },
})
// 菜单栏渲染
dtree.on('node(\'dept-tree\')', function (obj) {
let field = form.val('user-query-form') /*用户账号查询*/
field.deptId = obj.param.nodeId
window.refresh(field)
})
//
$('.user-group').click(function () {
let group = $(this).attr('user-group')
let field = form.val('user-query-form')
if (group === '-1') {
field.deptId = group
$(this).removeClass('button-default')
$(this).prev().removeClass('button-primary')
$(this).prev().addClass('button-default')
$(this).addClass('button-primary')
} else {
field.deptId = group
$(this).removeClass('button-default')
$(this).next().removeClass('button-primary')
$(this).next().addClass('button-default')
$(this).addClass('button-primary')
}
window.refresh(field)
})
table.on('tool(user-table)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj)
} else if (obj.event === 'edit') {
window.edit(obj)
}
})
table.on('toolbar(user-table)', function (obj) {
if (obj.event === 'add') {
window.add()
} else if (obj.event === 'refresh') {
window.refresh()
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj)
} else if (obj.event === 'collasped') {
$('.user-left').toggleClass('user-collasped')
$('.user-main').toggleClass('user-collasped')
table.resize()
}
})
form.on('submit(user-query)', function (data) {
window.refresh(data.field)
return false
})
form.on('switch(user-enable)', function (obj) {
let operate
if (obj.elem.checked) {
operate = 'enable'
} else {
operate = 'disable'
}
let loading = layer.load()
$.ajax({
url: '/admin/user/' + operate,
data: JSON.stringify({ userId: this.value }),
dataType: 'json',
contentType: 'application/json',
type: 'put',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg)
} else {
popup.failure(result.msg)
}
}
})
})
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['550px', '550px'],
content: MODULE_PATH + 'add'
})
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['550px', '500px'],
content: MODULE_PATH + 'edit/' + obj.data['id']
})
}
window.remove = function (obj) {
layer.confirm('确定要删除该用户', { icon: 3, title: '提示' }, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'remove/' + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
obj.del()
})
} else {
popup.failure(result.msg)
}
}
})
})
}
window.batchRemove = function (obj) {
let data = table.checkStatus(obj.config.id).data
if (data.length === 0) {
layer.msg('未选中数据', {
icon: 3,
time: 1000
})
return false
}
var ids = []
var hasCheck = table.checkStatus('user-table')
var hasCheckData = hasCheck.data
if (hasCheckData.length > 0) {
$.each(hasCheckData, function (index, element) {
ids.push(element.id)
})
}
{#console.log(ids);#}
layer.confirm('确定要删除选中角色', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index)
let loading = layer.load()
$.ajax({
url: MODULE_PATH + 'batchRemove',
data: { ids: ids },
dataType: 'json',
type: 'delete',
success: function (result) {
layer.close(loading)
if (result.success) {
popup.success(result.msg, function () {
table.reload('role-table')
})
} else {
popup.failure(result.msg)
}
}
})
})
}
window.refresh = function (param) {
table.reload('user-table', { where: param })
}
})
</script>
</html>
+93 -88
View File
@@ -12,17 +12,22 @@
</div>
</div>
<div class="layui-col-xs3" style="padding-left:0px;">
<div id="previewImage" style="width:210px;height:210px;border: 1px solid rgb(200, 200, 200);border-radius: 50%;overflow:hidden;">
<div id="previewImage"
style="width:210px;height:210px;border: 1px solid rgb(200, 200, 200);border-radius: 50%;overflow:hidden;">
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-input-inline layui-btn-container" style="width: auto;vertical-align:top;">
<button class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-left" cropper-event="rotate" data-option="-15" title="左旋15°"></button>
<button class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-right" cropper-event="rotate" data-option="15" title="旋15°"></button>
<button class="pear-btn pear-btn-sm pear-btn-danger layui-icon layui-icon-refresh" cropper-event="reset" title="重置"></button>
<label for="uploadPicture" class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-upload" title="选择图片"></label>
<button class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-left" cropper-event="rotate"
data-option="-15" title="旋15°"></button>
<button class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-right" cropper-event="rotate"
data-option="15" title="右旋15°"></button>
<button class="pear-btn pear-btn-sm pear-btn-danger layui-icon layui-icon-refresh" cropper-event="reset"
title="重置"></button>
<label for="uploadPicture" class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-upload"
title="选择图片"></label>
<input class="layui-upload-file" id="uploadPicture" type="file" value="选择图片">
</div>
<div class="layui-form-mid layui-word-aux">建议:图片的尺寸宽高比为1:1,大小在5m以内。</div>
@@ -31,91 +36,91 @@
</body>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['jquery','layer','cropper','popup'], function () {
let $ = layui.jquery;
let layer = layui.layer;
let cropper = layui.cropper;
let popup = layui.popup;
layui.use(['jquery', 'layer', 'cropper', 'popup'], function () {
let $ = layui.jquery
let layer = layui.layer
let cropper = layui.cropper
let popup = layui.popup
let options = {
aspectRatio: 1 / 1, // 裁剪框比例
preview: '#previewImage', // 预览div
viewmode: 1
};
let options = {
aspectRatio: 1 / 1, // 裁剪框比例
preview: '#previewImage', // 预览div
viewmode: 1
}
$("#sourceImage").attr("src", parent.layui.$("#avatar").attr("src"));
$("#sourceImage").cropper(options);
$('#sourceImage').attr('src', parent.layui.$('#avatar').attr('src'))
$('#sourceImage').cropper(options)
window.submitForm = function () {
$("#sourceImage").crossOrigin = 'anonymous';//解决跨域图片问题
$("#sourceImage").cropper("getCroppedCanvas", {
width: 280,
height: 140
}).toBlob(function (blob) {
let timeStamp = Date.parse(new Date());
let fileName = timeStamp + '.jpg';
let formData = new FormData();
formData.append('file', blob, fileName);
formData.append('fileName', fileName);
formData.append('fileToken', timeStamp);
$.ajax({
method: "post",
url: "/admin/file/upload", //用于文件上传的服务器端请求地址
data: formData,
processData: false,
contentType: false,
success: function (result) {
if(result.success){
// 修改 avatar 字段
$.ajax({
method:"put",
url: "/admin/user/updateAvatar",
data: JSON.stringify({avatar:result.data}),
dataType: "json",
contentType: 'application/json',
success:function(resu){
if(resu.success){
// 关闭当前弹层
parent.layui.$("#avatar").attr("src", result.data.src);
top.layui.$("#avatar").attr("src", result.data.src);
parent.layer.close(parent.layer.getFrameIndex(window.name));
}else{
popup.failure("上传失败")
}
}
})
}else{
popup.failure("上传失败")
}
}
});
});
};
$(".pear-btn").on('click', function () {
let event = $(this).attr("cropper-event");
if (event === 'rotate') {
let option = $(this).attr('data-option');
$("#sourceImage").cropper('rotate', option);
} else if (event === 'reset') {
$("#sourceImage").cropper('reset');
}
$("#uploadPicture").change(function () {
let r = new FileReader();
let f = this.files[0];
let uploadFileSize = f.size / 1024;
if (uploadFileSize > 5120) {
parent.layer.msg("上传文件不得超过5m", { icon: 5 });
return false;
window.submitForm = function () {
$('#sourceImage').crossOrigin = 'anonymous'//解决跨域图片问题
$('#sourceImage').cropper('getCroppedCanvas', {
width: 280,
height: 140
}).toBlob(function (blob) {
let timeStamp = Date.parse(new Date())
let fileName = timeStamp + '.jpg'
let formData = new FormData()
formData.append('file', blob, fileName)
formData.append('fileName', fileName)
formData.append('fileToken', timeStamp)
$.ajax({
method: 'post',
url: '/admin/file/upload', //用于文件上传的服务器端请求地址
data: formData,
processData: false,
contentType: false,
success: function (result) {
if (result.success) {
// 修改 avatar 字段
$.ajax({
method: 'put',
url: '/admin/user/updateAvatar',
data: JSON.stringify({ avatar: result.data }),
dataType: 'json',
contentType: 'application/json',
success: function (res) {
if (res.success) {
// 关闭当前弹层
parent.layui.$('#avatar').attr('src', result.data.src)
top.layui.$('#avatar').attr('src', result.data.src)
parent.layer.close(parent.layer.getFrameIndex(window.name))
} else {
popup.failure('上传失败')
}
}
r.readAsDataURL(f);
r.onload = function (e) {
$("#sourceImage")
.cropper('destroy')
.attr('src', this.result)
.cropper(options);
};
});
});
});
})
} else {
popup.failure('上传失败')
}
}
})
})
}
$('.pear-btn').on('click', function () {
let event = $(this).attr('cropper-event')
if (event === 'rotate') {
let option = $(this).attr('data-option')
$('#sourceImage').cropper('rotate', option)
} else if (event === 'reset') {
$('#sourceImage').cropper('reset')
}
$('#uploadPicture').change(function () {
let r = new FileReader()
let f = this.files[0]
let uploadFileSize = f.size / 1024
if (uploadFileSize > 5120) {
parent.layer.msg('上传文件不得超过5m', { icon: 5 })
return false
}
r.readAsDataURL(f)
r.onload = function (e) {
$('#sourceImage')
.cropper('destroy')
.attr('src', this.result)
.cropper(options)
}
})
})
})
</script>
+16 -16
View File
@@ -1,19 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link href="{{ url_for('static', filename='admin/component/pear/css/pear.css') }}" rel="stylesheet" />
<link href="{{ url_for('static', filename='admin/admin/css/other/error.css') }}" rel="stylesheet" />
</head>
<body>
<div class="content">
<img src="{{ url_for('static', filename='admin/admin/images/403.svg') }}" alt="">
<div class="content-r">
<h1>403</h1>
<p>抱歉,你无权访问该页面</p>
<button class="pear-btn pear-btn-primary">返回首页</button>
</div>
</div>
</body>
<head>
<meta charset="utf-8">
<title></title>
<link href="{{ url_for('static', filename='admin/component/pear/css/pear.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='admin/admin/css/other/error.css') }}" rel="stylesheet"/>
</head>
<body>
<div class="content">
<img src="{{ url_for('static', filename='admin/admin/images/403.svg') }}" alt="">
<div class="content-r">
<h1>403</h1>
<p>抱歉,你无权访问该页面</p>
<button class="pear-btn pear-btn-primary">返回首页</button>
</div>
</div>
</body>
</html>
+16 -16
View File
@@ -1,19 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link href="{{ url_for('static', filename='admin/component/pear/css/pear.css') }}" rel="stylesheet" />
<link href="{{ url_for('static', filename='admin/admin/css/other/error.css') }}" rel="stylesheet" />
</head>
<body>
<div class="content">
<img src="{{ url_for('static', filename='admin/admin/images/404.svg') }}" alt="">
<div class="content-r">
<h1>404</h1>
<p>抱歉,你访问的页面不存在或仍在开发中</p>
<button class="pear-btn pear-btn-primary">返回首页</button>
</div>
</div>
</body>
<head>
<meta charset="utf-8">
<title></title>
<link href="{{ url_for('static', filename='admin/component/pear/css/pear.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='admin/admin/css/other/error.css') }}" rel="stylesheet"/>
</head>
<body>
<div class="content">
<img src="{{ url_for('static', filename='admin/admin/images/404.svg') }}" alt="">
<div class="content-r">
<h1>404</h1>
<p>抱歉,你访问的页面不存在或仍在开发中</p>
<button class="pear-btn pear-btn-primary">返回首页</button>
</div>
</div>
</body>
</html>
+16 -16
View File
@@ -1,19 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link href="{{ url_for('static', filename='admin/component/pear/css/pear.css') }}" rel="stylesheet" />
<link href="{{ url_for('static', filename='admin/admin/css/other/error.css') }}" rel="stylesheet" />
</head>
<body>admin/
<div class="content">
<img src="{{ url_for('static', filename='admin/admin/images/500.svg') }}" alt="">
<div class="content-r">
<h1>500</h1>
<p>抱歉,服务器出错了</p>
<button class="pear-btn pear-btn-primary">返回首页</button>
</div>
</div>
</body>
<head>
<meta charset="utf-8">
<title></title>
<link href="{{ url_for('static', filename='admin/component/pear/css/pear.css') }}" rel="stylesheet"/>
<link href="{{ url_for('static', filename='admin/admin/css/other/error.css') }}" rel="stylesheet"/>
</head>
<body>admin/
<div class="content">
<img src="{{ url_for('static', filename='admin/admin/images/500.svg') }}" alt="">
<div class="content-r">
<h1>500</h1>
<p>抱歉,服务器出错了</p>
<button class="pear-btn pear-btn-primary">返回首页</button>
</div>
</div>
</body>
</html>
+151 -137
View File
@@ -1,147 +1,161 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>pear-admin-flask</title>
<meta name="description" content="pear-admin-flask">
<meta name="keyword" content="pear-admin-flask">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="{{ url_for('static', filename='/index/layui/css/layui.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='/index/css/main.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='/index/css/load.css') }}" />
<style>
.layui-nav .layui-this:after{
display: none;
}
.layui-nav .layui-nav-bar{
display: none;
}
</style>
</head>
<body>
<!-- header -->
<div class="ew-header">
<img class="layui-logo" src="{{ url_for('static', filename='/index/images/un28.svg') }}" style="height:50px;padding: 10px;" />
<div class="ew-nav-group">
<div class="nav-toggle"><i class="layui-icon layui-icon-more-vertical"></i></div>
<ul class="layui-nav" lay-filter="ew-header-nav">
<li class="layui-nav-item">
<a lay-href="/">首页</a>
</li>
<li class="layui-nav-item">
<a href="/admin" target="_blank">后台</a>
</li>
</ul>
</div>
</div>
<!-- banner -->
<div class="ew-banner" style="box-shadow: 0 0 8px rgba(0,0,0,.101562);">
<div class="layui-container">
<div class="layui-row layui-col-space25" style="margin-top: 10px;">
<div class="layui-col-md6 layui-col-xs12">
<img style="margin-top: 0px;margin-bottom: 40px;width: 80%;" src="{{ url_for('static', filename='/index/images/pear.png') }}"></h1>
<img style="width: 25%;position: absolute;left: 38%;margin-top: 5px;" src="{{ url_for('static', filename='/index/images/admin.png') }}"></h1>
<p style="font-size: 13.8px;font-weight: 500;margin-top: 10px;">💐 致 力 于 让 " Web " 开 发 变 得 简 单 优 雅 </p>
<div class="ew-banner-btngroup" style="margin-top: 50px;margin-bottom: 50px;">
<ul class="layui-nav" style="background-color: white;" lay-filter="ew-header-nav">
<li class="layui-nav-item">
<a target="_blank" href="http://pearadmin.com/" class="layui-btn layui-btn-primary" nav-scroll="pricing">
<svg data-v-796d512c="" style="width:20px;position: relative;top: 5px;margin-right: 5px;" aria-hidden="true"
focusable="false" data-prefix="fad" data-icon="meteor" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"
class="svg-inline--fa fa-meteor fa-w-16 h-5 -mb-1 mr-1">
<g data-v-796d512c="" class="fa-group">
<path data-v-796d512c="" fill="currentColor" d="M491.14.7C452.44 12.3 379.34 35 303.44 62c-2.1-7-4-13.5-5.6-18.6a16.06 16.06 0 0 0-20-10.69 16.6 16.6 0 0 0-2.86 1.19C232.54 56 122.14 116.5 60.54 176.4c-1.1 1-2.5 2-3.5 3C-19 255.5-19 378.87 57.09 455s199.48 76 275.55-.1c1-1 2-2.4 3-3.5C395.44 389.8 456 279.3 478.14 237a16.05 16.05 0 0 0-6.64-21.72 15.52 15.52 0 0 0-2.86-1.18c-5.2-1.6-11.6-3.5-18.6-5.6 27-76 49.7-149 61.3-187.7A16.17 16.17 0 0 0 491.14.7zM191.94 448a128 128 0 1 1 128-128 128 128 0 0 1-128 128z"
opacity="0.4" class="fa-secondary"></path>
<path data-v-796d512c="" fill="currentColor" d="M191.94 192a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm-32 128a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm48 64a16 16 0 1 1 16-16 16 16 0 0 1-16 16z"
class="fa-primary"></path>
</g>
</svg>
官方网站</a>
</li>
</ul>
</div>
</div>
<div class="layui-col-md6 layui-col-xs12">
<div class="ew-banner-right">
<img class="show" style="width: 92%;" style="margin-top: 0px!important;" src="{{ url_for('static', filename='/index/images/un26.svg') }}">
</div>
</div>
</div>
</div>
<br />
<br />
</div>
<div class="section">
</div>
<head>
<meta charset="UTF-8">
<title>pear-admin-flask</title>
<meta name="description" content="pear-admin-flask">
<meta name="keyword" content="pear-admin-flask">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="{{ url_for('static', filename='/index/layui/css/layui.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='/index/css/main.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='/index/css/load.css') }}"/>
<style>
.layui-nav .layui-this:after {
display: none;
}
.layui-nav .layui-nav-bar {
display: none;
}
</style>
</head>
<body>
<!-- header -->
<div class="ew-header">
<img class="layui-logo" src="{{ url_for('static', filename='/index/images/un28.svg') }}"
style="height:50px;padding: 10px;"/>
<div class="ew-nav-group">
<div class="nav-toggle"><i class="layui-icon layui-icon-more-vertical"></i></div>
<ul class="layui-nav" lay-filter="ew-header-nav">
<li class="layui-nav-item">
<a lay-href="/">首页</a>
</li>
<li class="layui-nav-item">
<a href="/admin" target="_blank">后台</a>
</li>
</ul>
</div>
</div>
<!-- banner -->
<div class="ew-banner" style="box-shadow: 0 0 8px rgba(0,0,0,.101562);">
<div class="layui-container">
<div class="layui-row layui-col-space25" style="margin-top: 10px;">
<div class="layui-col-md6 layui-col-xs12">
<img style="margin-top: 0px;margin-bottom: 40px;width: 80%;"
src="{{ url_for('static', filename='/index/images/pear.png') }}"></h1>
<img style="width: 25%;position: absolute;left: 38%;margin-top: 5px;"
src="{{ url_for('static', filename='/index/images/admin.png') }}"></h1>
<p style="font-size: 13.8px;font-weight: 500;margin-top: 10px;">💐 致 力 于 让 " Web " 开 发 变 得 简 单 优 雅 </p>
<div class="ew-banner-btngroup" style="margin-top: 50px;margin-bottom: 50px;">
<ul class="layui-nav" style="background-color: white;" lay-filter="ew-header-nav">
<li class="layui-nav-item">
<a target="_blank" href="http://pearadmin.com/" class="layui-btn layui-btn-primary"
nav-scroll="pricing">
<svg data-v-796d512c=""
style="width:20px;position: relative;top: 5px;margin-right: 5px;"
aria-hidden="true"
focusable="false" data-prefix="fad" data-icon="meteor" role="img"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"
class="svg-inline--fa fa-meteor fa-w-16 h-5 -mb-1 mr-1">
<g data-v-796d512c="" class="fa-group">
<path data-v-796d512c="" fill="currentColor"
d="M491.14.7C452.44 12.3 379.34 35 303.44 62c-2.1-7-4-13.5-5.6-18.6a16.06 16.06 0 0 0-20-10.69 16.6 16.6 0 0 0-2.86 1.19C232.54 56 122.14 116.5 60.54 176.4c-1.1 1-2.5 2-3.5 3C-19 255.5-19 378.87 57.09 455s199.48 76 275.55-.1c1-1 2-2.4 3-3.5C395.44 389.8 456 279.3 478.14 237a16.05 16.05 0 0 0-6.64-21.72 15.52 15.52 0 0 0-2.86-1.18c-5.2-1.6-11.6-3.5-18.6-5.6 27-76 49.7-149 61.3-187.7A16.17 16.17 0 0 0 491.14.7zM191.94 448a128 128 0 1 1 128-128 128 128 0 0 1-128 128z"
opacity="0.4" class="fa-secondary"></path>
<path data-v-796d512c="" fill="currentColor"
d="M191.94 192a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm-32 128a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm48 64a16 16 0 1 1 16-16 16 16 0 0 1-16 16z"
class="fa-primary"></path>
</g>
</svg>
官方网站</a>
</li>
</ul>
</div>
</div>
<div class="layui-col-md6 layui-col-xs12">
<div class="ew-banner-right">
<img class="show" style="width: 92%;" style="margin-top: 0px!important;"
src="{{ url_for('static', filename='/index/images/un26.svg') }}">
</div>
</div>
</div>
</div>
<br/>
<br/>
</div>
<div class="section">
</div>
<div class="section" nav-id="product">
<div class="section-title" style="font-size: 20px;font-weight:500;">
用法演示
</div>
<div class="layui-container" style="padding-bottom: 60px;">
<div class="layui-row layui-col-space30">
<div class="section" nav-id="product">
<div class="section-title" style="font-size: 20px;font-weight:500;">
用法演示
</div>
<div class="layui-container" style="padding-bottom: 60px;">
<div class="layui-row layui-col-space30">
</div>
</div>
</div>
<!-- contact -->
<div class="section">
<div class="section-title">
<h2 style="font-size: 20px;font-weight:500;">合作伙伴</h2>
<p>Sponsorship and cooperation</p>
</div>
<div class="layui-container">
<div class="layui-row layui-col-space30" style="margin-top: 10px;">
</div>
</div>
</div>
<!-- contact -->
<div class="section">
<div class="section-title">
<h2 style="font-size: 20px;font-weight:500;">合作伙伴</h2>
<p>Sponsorship and cooperation</p>
</div>
<div class="layui-container">
<div class="layui-row layui-col-space30" style="margin-top: 10px;">
</div>
<br>
<br>
</div>
</div>
<div class="ew-footer">
<div class="layui-container">
<div class="layui-row layui-col-space30">
<div class="layui-col-md6">
<h2 style="font-size: 17px;" class="footer-item-title">技术交流</h2>
<p class="img-group" style="height: 105px;font-size: 15.5px;">
<img src="{{ url_for('static', filename='/index/images/code2.png') }}" style="border-radius: 2px;height: 100px;width: 100px;">
扫码免费加入前后端分离技术交流QQ群,与各位大佬一起交流技术、讨论问题。
</p>
</div>
<div class="layui-col-md4">
<h2 style="font-size: 17px;" class="footer-item-title">联系我们</h2>
<p>
<i class="layui-icon layui-icon-dialogue"></i>
<a href="http://www.pearadmin.com">官网 : www.pearadmin.com</a>
</p>
<p style="margin-top: 2px;">
<i class="layui-icon layui-icon-website"></i>
<a href="http://forum.pearadmin.com">社区 : forum.pearadmin.com</a>
</p>
</div>
<div class="layui-col-md2">
<h2 style="font-size: 17px;" class="footer-item-title">友情链接</h2>
<p><i class="layui-icon layui-icon-website"></i><a href="https://monksoul.gitee.io/furion/" target="_blank">Furion</a></p>
<p style="margin-top: 10px;"><i class="layui-icon layui-icon-website"></i><a href="http://mrdoc.zmister.com/" target="_blank">MrDoc</a></p>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
</div>
</div>
<div class="ew-footer">
<div class="layui-container">
<div class="layui-row layui-col-space30">
<div class="layui-col-md6">
<h2 style="font-size: 17px;" class="footer-item-title">技术交流</h2>
<p class="img-group" style="height: 105px;font-size: 15.5px;">
<img src="{{ url_for('static', filename='/index/images/code2.png') }}"
style="border-radius: 2px;height: 100px;width: 100px;">
扫码免费加入前后端分离技术交流QQ群,与各位大佬一起交流技术、讨论问题。
</p>
</div>
<div class="layui-col-md4">
<h2 style="font-size: 17px;" class="footer-item-title">联系我们</h2>
<p>
<i class="layui-icon layui-icon-dialogue"></i>
<a href="http://www.pearadmin.com">官网 : www.pearadmin.com</a>
</p>
<p style="margin-top: 2px;">
<i class="layui-icon layui-icon-website"></i>
<a href="http://forum.pearadmin.com">社区 : forum.pearadmin.com</a>
</p>
</div>
<div class="layui-col-md2">
<h2 style="font-size: 17px;" class="footer-item-title">友情链接</h2>
<p><i class="layui-icon layui-icon-website"></i><a href="https://monksoul.gitee.io/furion/"
target="_blank">Furion</a></p>
<p style="margin-top: 10px;"><i class="layui-icon layui-icon-website"></i><a
href="http://mrdoc.zmister.com/" target="_blank">MrDoc</a></p>
</div>
</div>
</div>
</div>
<!-- js部分 -->
<script src="{{ url_for('static', filename='/admin/component/layui/layui.js') }}"></script>
<script src="{{ url_for('static', filename='/admin/component/pear/pear.js') }}"></script>
<!-- js部分 -->
<script src="{{ url_for('static', filename='/admin/component/layui/layui.js') }}"></script>
<script src="{{ url_for('static', filename='/admin/component/pear/pear.js') }}"></script>
<script>
layui.use(['layer', 'form', 'jquery'], function() {
var $ = layui.jquery;
var layer = layui.layer;
var form = layui.form;
var jquery = layui.jquery;
});
</script>
</body>
<script>
layui.use(['layer', 'form', 'jquery'], function () {
var $ = layui.jquery
var layer = layui.layer
var form = layui.form
var jquery = layui.jquery
})
</script>
</body>
</html>
+1 -8
View File
@@ -1,14 +1,7 @@
from flask import Flask, redirect
from applications.view.admin import init_admin_views
from applications.view.index import init_index_views
def init_view(app: Flask):
def init_view(app):
init_admin_views(app)
init_index_views(app)
# 重定向到后台管理首页
@app.route('/')
def redirect_index():
return redirect('/admin/login')
+2
View File
@@ -2,6 +2,8 @@ from flask import Blueprint
index_bp = Blueprint('Index', __name__, url_prefix='/')
from . import index
def init_index_views(app):
"""