From 1c6576371d0e5161de6e5cfe2fc53886ab2ab5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=B2=AB=E8=8A=B1=E7=81=ABzzz=F0=9F=8C=99?= Date: Wed, 25 Dec 2024 22:49:30 +0800 Subject: [PATCH 1/3] [*] Add app access management page --- src/api/v2/auth/oauth/authorized/all.api.ts | 12 ++ src/api/v2/auth/oauth/authorized/app.api.ts | 13 ++ src/api/v2/auth/oauth/authorized/index.ts | 10 +- src/api/v2/auth/oauth/authorized/root.api.ts | 0 .../v2/auth/oauth/authorized/session.api.ts | 14 ++ src/api/v2/auth/oauth/index.ts | 4 +- src/views/apps/AccessManagementView.vue | 182 +++++++++++++++++- 7 files changed, 229 insertions(+), 6 deletions(-) delete mode 100644 src/api/v2/auth/oauth/authorized/root.api.ts diff --git a/src/api/v2/auth/oauth/authorized/all.api.ts b/src/api/v2/auth/oauth/authorized/all.api.ts index e69de29..6b248e5 100644 --- a/src/api/v2/auth/oauth/authorized/all.api.ts +++ b/src/api/v2/auth/oauth/authorized/all.api.ts @@ -0,0 +1,12 @@ +//@ts-ignore +import { get } from '@/utils/request' +import base from '@/api/base' + +const all = async (user_id: number) => { + const rs = get(`${base.api_v2_url}/auth/oauth/authorized/all`, { + user_id: user_id + }) + return base.buildResponse(await rs) +} + +export default all diff --git a/src/api/v2/auth/oauth/authorized/app.api.ts b/src/api/v2/auth/oauth/authorized/app.api.ts index e69de29..77d551a 100644 --- a/src/api/v2/auth/oauth/authorized/app.api.ts +++ b/src/api/v2/auth/oauth/authorized/app.api.ts @@ -0,0 +1,13 @@ +//@ts-ignore +import { deleteReq } from '@/utils/request' +import base from '@/api/base' + +const app = async (user_id: number, app_id: number | undefined) => { + const rs = deleteReq(`${base.api_v2_url}/auth/oauth/authorized/app`, { + user_id: user_id, + app_id: app_id + }) + return base.buildResponse(await rs) +} + +export default app diff --git a/src/api/v2/auth/oauth/authorized/index.ts b/src/api/v2/auth/oauth/authorized/index.ts index 5c933b1..261eba9 100644 --- a/src/api/v2/auth/oauth/authorized/index.ts +++ b/src/api/v2/auth/oauth/authorized/index.ts @@ -1,3 +1,9 @@ -export default { +import all from './all.api' +import app from './app.api' +import session from './session.api' -} \ No newline at end of file +export default { + all: all, + app: app, + session: session +} diff --git a/src/api/v2/auth/oauth/authorized/root.api.ts b/src/api/v2/auth/oauth/authorized/root.api.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/api/v2/auth/oauth/authorized/session.api.ts b/src/api/v2/auth/oauth/authorized/session.api.ts index e69de29..673b923 100644 --- a/src/api/v2/auth/oauth/authorized/session.api.ts +++ b/src/api/v2/auth/oauth/authorized/session.api.ts @@ -0,0 +1,14 @@ +//@ts-ignore +import { deleteReq } from '@/utils/request' +import base from '@/api/base' + +const session = async (user_id: number, app_id: number, session_id: number | undefined) => { + const rs = deleteReq(`${base.api_v2_url}/auth/oauth/authorized/session`, { + user_id: user_id, + app_id: app_id, + session_id: session_id + }) + return base.buildResponse(await rs) +} + +export default session diff --git a/src/api/v2/auth/oauth/index.ts b/src/api/v2/auth/oauth/index.ts index de12ff9..94ba253 100644 --- a/src/api/v2/auth/oauth/index.ts +++ b/src/api/v2/auth/oauth/index.ts @@ -1,9 +1,11 @@ import qq from './qq' import permission from './permission' import authorize from './authorize.api' +import authorized from './authorized' export default { qq: qq, permission: permission, - authorize: authorize + authorize: authorize, + authorized: authorized } diff --git a/src/views/apps/AccessManagementView.vue b/src/views/apps/AccessManagementView.vue index 449a96f..a8a4c71 100644 --- a/src/views/apps/AccessManagementView.vue +++ b/src/views/apps/AccessManagementView.vue @@ -3,7 +3,183 @@ 授权管理 - 此页面仍在开发中🔧 - + + + + + 应用介绍: {{ app.description }} + + + + 活动会话数: {{ app.sessions.length }} +
+ 已授予的权限:  + + {{ permissionList.filter((it) => it.id == permissionId)[0]['node'] + }}{{ [...app.authorizedPermissions].reverse()[0] != permissionId ? ', ' : '' }} + +
+ + + + 会话 ID: {{ session.id }} +
+ 授权时间: {{ new Date(session.authorizeTime) }} + +
+
+
+
+ +
+
- + From 96595ce2caa09896cb5f26b79b292ab064e10ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=B2=AB=E8=8A=B1=E7=81=ABzzz=F0=9F=8C=99?= Date: Wed, 25 Dec 2024 22:50:44 +0800 Subject: [PATCH 2/3] [*] Fix enter 2 login --- src/views/auth/LoginView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/auth/LoginView.vue b/src/views/auth/LoginView.vue index 4d431f1..a0651e3 100644 --- a/src/views/auth/LoginView.vue +++ b/src/views/auth/LoginView.vue @@ -15,7 +15,7 @@ type="text" v-model:value="model.username" placeholder="用户名" - @keyup.enter="login" + @keyup.enter="showTurnstile = true" /> @@ -23,7 +23,7 @@ type="password" v-model:value="model.password" placeholder="密码" - @keyup.enter="login" + @keyup.enter="showTurnstile = true" />
From 2e3b9fc12e16716a412a8eb59614373179954f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=B2=AB=E8=8A=B1=E7=81=ABzzz=F0=9F=8C=99?= Date: Wed, 25 Dec 2024 23:00:23 +0800 Subject: [PATCH 3/3] [*] Add Turnstile error tip --- src/views/auth/LoginView.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/views/auth/LoginView.vue b/src/views/auth/LoginView.vue index a0651e3..154944f 100644 --- a/src/views/auth/LoginView.vue +++ b/src/views/auth/LoginView.vue @@ -57,8 +57,18 @@ v-model="token" @error=" (code) => { - showTurnstile = false - message.error(`验证码加载失败,错误代码: ${code}`) + if (code.startsWith(200)) { + message.error(`验证失败,状态异常,错误代码: ${code}`) + } else if (code.startsWith(300)) { + message.error(`验证失败,当前环境异常,错误代码: ${code}`) + } else if (code.startsWith(600)) { + message.error(`验证失败,错误代码: ${code}`) + } else { + message.error(`验证错误,错误代码: ${code}`) + } + setTimeout(() => { + showTurnstile = false + }, 3000) } " @unsupported="