From 635dcc1dac80487bb87c6ef10ed21f5b28153025 Mon Sep 17 00:00:00 2001 From: zhengxinonly Date: Tue, 27 Jul 2021 03:34:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor(api):=E8=B0=83=E6=95=B4=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/view/users.py | 7 --- static/api/http.js | 10 ++++ templates/users/add.html | 100 ------------------------------------- templates/users/main.html | 99 ++++++++++++++++++++++++++++++++++-- 4 files changed, 106 insertions(+), 110 deletions(-) delete mode 100644 templates/users/add.html diff --git a/applications/view/users.py b/applications/view/users.py index 561bfdb..67a14ee 100644 --- a/applications/view/users.py +++ b/applications/view/users.py @@ -23,13 +23,6 @@ def users_center(): return render_template('users/profile.html', user_info=current_user, user_logs=user_logs) -@index_bp.get('/users/add') -@authorize("admin:user:add", log=True) -def users_get_user(): - roles = Role.query.all() - return render_template('users/add.html', roles=roles) - - @index_bp.get('/users/') @authorize("admin:user:edit", log=True) def users_user_id_view(user_id): diff --git a/static/api/http.js b/static/api/http.js index 619183d..ff514d0 100644 --- a/static/api/http.js +++ b/static/api/http.js @@ -40,6 +40,16 @@ class Role { 'ROLE_POWER': (role_id) => `${this.ROLE_PATH}/role_power/${role_id}` } } + + async get_roles () { + return fetch(this.ROLE_API.ROLES()) + .then(function (response) { + return response.json() + }) + .then(function (myJson) { + return myJson + }) + } } class Users { diff --git a/templates/users/add.html b/templates/users/add.html deleted file mode 100644 index 5110bba..0000000 --- a/templates/users/add.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - 用户管理 - {% include 'common/header.html' %} - - -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- -
- -
- - {% for role in roles %} - - {% endfor %} - -
-
-
-
-
-
- - -
-
-
-{% include 'common/footer.html' %} - - - - \ No newline at end of file diff --git a/templates/users/main.html b/templates/users/main.html index 99b1cd4..ed8d2c7 100644 --- a/templates/users/main.html +++ b/templates/users/main.html @@ -95,8 +95,55 @@ {% include 'common/footer.html' %} + +