diff --git a/applications/common/admin/index_curd.py b/applications/common/admin/index_curd.py index 92761b0..f43a151 100644 --- a/applications/common/admin/index_curd.py +++ b/applications/common/admin/index_curd.py @@ -28,21 +28,27 @@ def make_menu_tree(): # power1 = Power.query.filter( # Power.type == 1 # ).all() + # 获取当前用户的角色 role = current_user.role power0 = [] power1 = [] for i in role: + # 如果角色没有被启用就直接跳过 if i.enable == 0: continue + # 变量角色用户的权限 for p in i.power: + # 如果权限关闭了就直接跳过 if p.enable == 0: continue + # 一级菜单 if int(p.type) == 0: power0.append(p) + # 二级菜单 else: power1.append(p) - power_schema = PowerSchema(many=True) # 用已继承ma.ModelSchema类的自定制类生成序列化类 + power_schema = PowerSchema(many=True) # 用已继承 ma.ModelSchema 类的自定制类生成序列化类 power0_dict = power_schema.dump(power0) # 生成可序列化对象 power1_dict = power_schema.dump(power1) # 生成可序列化对象 power0_dict = sorted(power0_dict, key=lambda i: i['sort']) @@ -84,7 +90,7 @@ def get_render_config(): # 菜单配置 }, menu={ # 菜单数据来源 - "data": "/admin/menu", + "data": "/rights/menu", "collaspe": True, # 是否同时只打开一个菜单目录 "accordion": True, diff --git a/applications/common/utils/http.py b/applications/common/utils/http.py index 09d7e9f..75f4cd8 100644 --- a/applications/common/utils/http.py +++ b/applications/common/utils/http.py @@ -14,7 +14,7 @@ def fail_api(msg: str = "失败"): def table_api(msg: str = "", count=0, data=None, limit=10): """ 动态表格渲染响应 """ res = { - 'message': msg, + 'msg': msg, 'code': 0, 'data': data, 'count': count, diff --git a/applications/configs/config.py b/applications/configs/config.py index bc40b96..b40fb10 100644 --- a/applications/configs/config.py +++ b/applications/configs/config.py @@ -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}" # 默认日志等级 diff --git a/applications/extensions/__init__.py b/applications/extensions/__init__.py index bb47071..67f315c 100644 --- a/applications/extensions/__init__.py +++ b/applications/extensions/__init__.py @@ -8,7 +8,7 @@ from .init_error_views import init_error_views def init_plugs(app: Flask) -> None: - init_debug_tool(app) + # init_debug_tool(app) init_login_manager(app) init_databases(app) init_template_directives(app) diff --git a/applications/extensions/init_login.py b/applications/extensions/init_login.py index c4bf90a..5047912 100644 --- a/applications/extensions/init_login.py +++ b/applications/extensions/init_login.py @@ -5,7 +5,7 @@ def init_login_manager(app): login_manager = LoginManager() login_manager.init_app(app) - login_manager.login_view = 'adminIndex.login' + login_manager.login_view = 'passport.login' login_manager.login_message = u'请登录以访问此页面' @login_manager.user_loader diff --git a/applications/templates/admin/admin_log/main.html b/applications/templates/admin/admin_log/main.html index 4958ab3..cf5a1a8 100644 --- a/applications/templates/admin/admin_log/main.html +++ b/applications/templates/admin/admin_log/main.html @@ -40,74 +40,74 @@ {% include 'admin/common/footer.html' %} \ No newline at end of file diff --git a/applications/templates/admin/common/header.html b/applications/templates/admin/common/header.html index 50bee36..61721d1 100644 --- a/applications/templates/admin/common/header.html +++ b/applications/templates/admin/common/header.html @@ -2,4 +2,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/applications/templates/admin/console/console.html b/applications/templates/admin/console/console.html index 78b99d3..e266b68 100644 --- a/applications/templates/admin/console/console.html +++ b/applications/templates/admin/console/console.html @@ -1,356 +1,413 @@ - - 首页 - {% include 'admin/common/header.html' %} - + + 首页 + {% include 'admin/common/header.html' %} + - - - - -
-
-
-
-
今日访问
-
-
-
- 0 -
-
- - - - - - - - - -
-
-
-
-
-
-
-
提交次数
-
-
-
- 0 -
-
- - - - - - - - - - - - - -
-
-
-
-
-
-
-
下载数量
-
-
-
- 0 -
-
- - - - - - - - - - -
-
-
-
-
-
-
-
流量统计
-
-
-
- 0 -
-
- - - - - - - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
动态
-
-
-
-
-
-

七彩枫叶 在 Pear Admin 专区 回答问题

- 几秒前 -
-
-
-
-
-

简 在 Pear Admin 专区 进行了 提问

- 2天前 -
-
-
-
-
-

恒宇少年 将 Pear Admin 更新至 2.3.0 版本

- 7天前 -
-
-
-
-
-

如花 在 Pear Admin 社区 发布了 建议

- 7天前 -
-
-
-
-
-

就眠仪式 在 Pear Admin 社区 发布了 建议

- 8天前 -
-
-
-
-
-

贤心 在 Pear Admin 专区 进行了 提问

- 8天前 -
-
-
-
-
-
-
-
-
最近更新
-
-
    -
  • 优化代码格式2020-06-04 11:28
  • -
  • 新增消息组件2020-06-01 04:23
  • -
  • 移动端兼容2020-05-22 21:38
  • -
  • 系统布局优化2020-05-15 14:26
  • -
  • 兼容多系统菜单模式2020-05-13 16:32
  • -
  • 兼容多标签页切换2019-12-9 14:58
  • -
  • 扩展下拉组件2019-12-7 9:06
  • -
  • 扩展卡片样式2019-12-1 10:26
  • -
-
-
-
-
- 链接 -
-
- 官 网 -
- 下 载 -
- 后 端 -
-
-
-
-
- - {% include 'admin/common/footer.html' %} - - + }) + + \ No newline at end of file diff --git a/applications/templates/admin/dept/add.html b/applications/templates/admin/dept/add.html index 3941ee5..94ab947 100644 --- a/applications/templates/admin/dept/add.html +++ b/applications/templates/admin/dept/add.html @@ -81,43 +81,43 @@ {% include 'admin/common/footer.html' %} diff --git a/applications/templates/admin/dept/edit.html b/applications/templates/admin/dept/edit.html index b003e0f..eabbe84 100644 --- a/applications/templates/admin/dept/edit.html +++ b/applications/templates/admin/dept/edit.html @@ -26,21 +26,24 @@
-
-
-
@@ -48,16 +51,19 @@
- + - +
-
@@ -87,31 +93,31 @@ {% include 'admin/common/footer.html' %} diff --git a/applications/templates/admin/dept/main.html b/applications/templates/admin/dept/main.html index 58aa086..f073316 100644 --- a/applications/templates/admin/dept/main.html +++ b/applications/templates/admin/dept/main.html @@ -34,33 +34,36 @@ @@ -68,158 +71,159 @@ {% include 'admin/common/footer.html' %} \ No newline at end of file diff --git a/applications/templates/admin/dict/add.html b/applications/templates/admin/dict/add.html index a3d6d9e..4722d80 100644 --- a/applications/templates/admin/dict/add.html +++ b/applications/templates/admin/dict/add.html @@ -55,31 +55,31 @@ {% include 'admin/common/footer.html' %} diff --git a/applications/templates/admin/dict/data/add.html b/applications/templates/admin/dict/data/add.html index ff9911e..794c441 100644 --- a/applications/templates/admin/dict/data/add.html +++ b/applications/templates/admin/dict/data/add.html @@ -26,7 +26,8 @@
-
@@ -62,31 +63,31 @@ {% include 'admin/common/footer.html' %} diff --git a/applications/templates/admin/dict/data/edit.html b/applications/templates/admin/dict/data/edit.html index a652618..a822fc3 100644 --- a/applications/templates/admin/dict/data/edit.html +++ b/applications/templates/admin/dict/data/edit.html @@ -32,7 +32,7 @@
-
@@ -48,7 +48,7 @@
-
@@ -71,31 +71,31 @@ {% include 'admin/common/footer.html' %} diff --git a/applications/templates/admin/dict/edit.html b/applications/templates/admin/dict/edit.html index 45f202c..5e9c9dc 100644 --- a/applications/templates/admin/dict/edit.html +++ b/applications/templates/admin/dict/edit.html @@ -12,21 +12,21 @@
-
-
-
@@ -42,8 +42,8 @@
- +
@@ -63,33 +63,33 @@ - {% include 'admin/common/footer.html' %} +{% include 'admin/common/footer.html' %} diff --git a/applications/templates/admin/dict/main.html b/applications/templates/admin/dict/main.html index b86e530..bfe2f32 100644 --- a/applications/templates/admin/dict/main.html +++ b/applications/templates/admin/dict/main.html @@ -38,7 +38,29 @@
- + + + + + + + + + + + + + + + +
@@ -70,8 +92,8 @@ {% include 'admin/common/footer.html' %} \ No newline at end of file diff --git a/applications/templates/admin/index.html b/applications/templates/admin/index.html index 0b9280e..6fd29d2 100644 --- a/applications/templates/admin/index.html +++ b/applications/templates/admin/index.html @@ -24,10 +24,12 @@