From 46fa0a766868b98bd60259886be296c627a2d7fc Mon Sep 17 00:00:00 2001 From: Kunagisa <1549184870@qq.com> Date: Sun, 13 Jul 2025 21:40:32 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AF=86=E7=A0=81=F0=9F=90=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.js | 15 + src/components/ChangePasswordDialog.vue | 207 ++++++++++ src/components/ErrorDialog.vue | 2 +- src/components/forget_module.vue | 498 ++++++++++++++++++++++++ src/components/index.vue | 11 - src/components/login_module.vue | 7 +- src/router/index.js | 5 + src/views/ResetPassword.vue | 435 +++++++++++++++++++++ src/views/backend/Login.vue | 25 +- src/views/index.vue | 41 +- 10 files changed, 1226 insertions(+), 20 deletions(-) create mode 100644 src/components/ChangePasswordDialog.vue create mode 100644 src/components/forget_module.vue delete mode 100644 src/components/index.vue create mode 100644 src/views/ResetPassword.vue diff --git a/src/api/login.js b/src/api/login.js index 388017b..50effd7 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -182,3 +182,18 @@ export const resetPassword = async (token, password) => { } } +/** + * 忘记密码 + * @param {string} qq - QQ号 + * @param {string} new_password - 新密码 + * @param {string} token - 验证码token + * @param {string} captcha - 用户输入的验证码 + */ +export const forgetPassword = async (qq, new_password, token, captcha) => { + try { + + } catch (error) { + throw error; + } +} + diff --git a/src/components/ChangePasswordDialog.vue b/src/components/ChangePasswordDialog.vue new file mode 100644 index 0000000..cade203 --- /dev/null +++ b/src/components/ChangePasswordDialog.vue @@ -0,0 +1,207 @@ + + + + + \ No newline at end of file diff --git a/src/components/ErrorDialog.vue b/src/components/ErrorDialog.vue index e40a908..171e56a 100644 --- a/src/components/ErrorDialog.vue +++ b/src/components/ErrorDialog.vue @@ -47,7 +47,7 @@ const handleClose = () => { display: flex; justify-content: center; align-items: center; - z-index: 1000; + z-index: 2000; } .error-dialog { diff --git a/src/components/forget_module.vue b/src/components/forget_module.vue new file mode 100644 index 0000000..7266250 --- /dev/null +++ b/src/components/forget_module.vue @@ -0,0 +1,498 @@ + + + + + \ No newline at end of file diff --git a/src/components/index.vue b/src/components/index.vue deleted file mode 100644 index 96c0baf..0000000 --- a/src/components/index.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/login_module.vue b/src/components/login_module.vue index db58145..1619919 100644 --- a/src/components/login_module.vue +++ b/src/components/login_module.vue @@ -47,7 +47,10 @@
+
+
@@ -296,8 +299,9 @@ onMounted(() => { } .register-link { + display: flex; + justify-content: space-between; margin-top: 12px; - text-align: right; } .register-link a { @@ -313,6 +317,7 @@ onMounted(() => { text-decoration: underline; } + /* VAPTCHA 相关样式 */ .VAPTCHA-init-main { display: table; diff --git a/src/router/index.js b/src/router/index.js index 6cb9bc8..b6ac7f5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -119,6 +119,11 @@ const routes = [ meta: { requiresAuth: true } } ] + }, + { + path: '/user/resetpassword/:token', + name: 'ResetPassword', + component: () => import('@/views/ResetPassword.vue') } ] diff --git a/src/views/ResetPassword.vue b/src/views/ResetPassword.vue new file mode 100644 index 0000000..4313019 --- /dev/null +++ b/src/views/ResetPassword.vue @@ -0,0 +1,435 @@ + + + + + \ No newline at end of file diff --git a/src/views/backend/Login.vue b/src/views/backend/Login.vue index 1d6f582..5dd6fd9 100644 --- a/src/views/backend/Login.vue +++ b/src/views/backend/Login.vue @@ -11,8 +11,20 @@ 返回主界面
- - + + +
@@ -25,6 +37,7 @@ import { hasValidToken } from '@/utils/jwt' import loginBg from '@/assets/login_1.jpg' import loginBg1 from '@/assets/login_2.jpg' import loginBg3 from '@/assets/login_3.jpg' +import ForgetModule from "@/components/forget_module.vue"; import LoginModule from '@/components/login_module.vue' import RegisterModule from '@/components/register_module.vue' @@ -34,6 +47,7 @@ const bgImg = ref(images[randomIndex]) const router = useRouter() const showRegister = ref(false) +const showForget = ref(false) const loginModuleRef = ref(null) const handleBack = () => { @@ -43,6 +57,7 @@ const handleBack = () => { // 处理从注册模块切换到登录模块 const handleSwitchToLogin = () => { showRegister.value = false + showForget.value = false // 在下一个tick中重置登录表单,确保组件已经渲染 setTimeout(() => { if (loginModuleRef.value) { @@ -51,6 +66,12 @@ const handleSwitchToLogin = () => { }, 0) } +// 处理切换到忘记密码页面 +const handleSwitchToForget = () => { + showForget.value = true + showRegister.value = false +} + // 检查登录状态,如果已登录则跳转到首页 onMounted(() => { if (hasValidToken()) { diff --git a/src/views/index.vue b/src/views/index.vue index 302beda..7abcdd0 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -9,6 +9,7 @@ const PrivilegeRequestDialog = defineAsyncComponent(() => import('@/components/P const SuccessDialog = defineAsyncComponent(() => import('@/components/SuccessDialog.vue')) const ErrorDialog = defineAsyncComponent(() => import('@/components/ErrorDialog.vue')) const ChangeUsernameDialog = defineAsyncComponent(() => import('@/components/ChangeUsernameDialog.vue')) +const ChangePasswordDialog = defineAsyncComponent(() => import('@/components/ChangePasswordDialog.vue')) const isLoggedIn = computed(() => { return !!localStorage.getItem('access_token') && !!currentUserData.value @@ -210,6 +211,7 @@ const privilegeDialogName = ref('') const privilegeDialogKey = ref('') const successDialog = ref({ visible: false, message: '' }) const changeUsernameDialogVisible = ref(false) +const changePasswordDialogVisible = ref(false) const privilegeDisplayNames = { 'lv-admin': '管理员', @@ -284,6 +286,12 @@ function showChangeUsernameDialog() { showDropdown.value = false } +// 显示修改密码对话框 +function showChangePasswordDialog() { + changePasswordDialogVisible.value = true + showDropdown.value = false +} + // 处理修改用户名成功 function handleUsernameChangeSuccess(newUsername) { if (currentUserData.value) { @@ -297,6 +305,19 @@ function handleUsernameChangeError(errorMessage) { errorDialogMessage.value = errorMessage errorDialogVisible.value = true } + +// 处理修改密码成功 +function handlePasswordChangeSuccess(message) { + successDialog.value = { visible: true, message: message } +} + +// 处理修改密码错误 +function handlePasswordChangeError(errorMessage) { + errorDialogMessage.value = errorMessage + errorDialogVisible.value = true + // 关闭修改密码弹窗 + changePasswordDialogVisible.value = false +} From ba077c8e9c8d3490ce9dd641e0d2e483a17cc40f Mon Sep 17 00:00:00 2001 From: Kunagisa <1549184870@qq.com> Date: Fri, 18 Jul 2025 01:29:24 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E5=AF=86=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=A1=EF=BC=88=EF=BC=8C=E5=8F=A6=E5=A4=96?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=AA=E5=9C=A8=E7=BC=96=E8=AF=91=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BC=9A=E5=8E=BB=E6=8E=89log=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=83=BD=E7=BC=96=E8=AF=91=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/axiosConfig.js | 4 +- src/api/login.js | 6 +- src/components/ChangePasswordDialog.vue | 5 +- src/components/forget_module.vue | 164 ++++++++++++++++-------- vite.config.js | 10 +- 5 files changed, 127 insertions(+), 62 deletions(-) diff --git a/src/api/axiosConfig.js b/src/api/axiosConfig.js index c92bf30..3964457 100644 --- a/src/api/axiosConfig.js +++ b/src/api/axiosConfig.js @@ -1,8 +1,8 @@ import axios from 'axios'; import { logoutUser } from '../utils/jwt'; // logoutUser会处理清除存储和重定向 -const API_BASE_URL = 'https://api.zybdatasupport.online'; -//const API_BASE_URL = 'http://hk.zybdatasupport.online:8000/'; +//const API_BASE_URL = 'https://api.zybdatasupport.online'; +const API_BASE_URL = 'http://hk.zybdatasupport.online:8000/'; const axiosInstance = axios.create({ baseURL: API_BASE_URL, diff --git a/src/api/login.js b/src/api/login.js index 50effd7..a53f4aa 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -154,12 +154,12 @@ export const changeUserName = async (name) => { * 用户请求修改密码(发送重置请求) * 路由: /user/resetpassword * 方法: POST - * 需要登录 + * @param {string} uuid - 要修改的用户的uuid * @returns {Promise} 无返回值,成功即为请求成功 */ -export const requestResetPassword = async () => { +export const requestResetPassword = async (uuid) => { try { - await axiosInstance.post('/user/resetpassword'); + await axiosInstance.post('/user/resetpassword', null, { params: { uuid } }); } catch (error) { throw error; } diff --git a/src/components/ChangePasswordDialog.vue b/src/components/ChangePasswordDialog.vue index cade203..83fd9df 100644 --- a/src/components/ChangePasswordDialog.vue +++ b/src/components/ChangePasswordDialog.vue @@ -26,6 +26,7 @@ diff --git a/vite.config.js b/vite.config.js index 577c427..c4599ca 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,6 +4,14 @@ import path from 'path' export default defineConfig({ plugins: [vue()], + build: { + terserOptions:{ + compress:{ + drop_console:true, + drop_debugger:true, + } + } + }, resolve: { alias: { '@': path.resolve(__dirname, './src') @@ -13,4 +21,4 @@ export default defineConfig({ port: 80, open: true } -}) \ No newline at end of file +}) From cf0713bb80edc10b925b2a55386d58313091a662 Mon Sep 17 00:00:00 2001 From: Kunagisa <1549184870@qq.com> Date: Fri, 18 Jul 2025 01:29:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E5=AF=86=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=A1=EF=BC=88=EF=BC=8C=E5=8F=A6=E5=A4=96?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=AA=E5=9C=A8=E7=BC=96=E8=AF=91=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BC=9A=E5=8E=BB=E6=8E=89log=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=83=BD=E7=BC=96=E8=AF=91=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/axiosConfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/axiosConfig.js b/src/api/axiosConfig.js index 3964457..c92bf30 100644 --- a/src/api/axiosConfig.js +++ b/src/api/axiosConfig.js @@ -1,8 +1,8 @@ import axios from 'axios'; import { logoutUser } from '../utils/jwt'; // logoutUser会处理清除存储和重定向 -//const API_BASE_URL = 'https://api.zybdatasupport.online'; -const API_BASE_URL = 'http://hk.zybdatasupport.online:8000/'; +const API_BASE_URL = 'https://api.zybdatasupport.online'; +//const API_BASE_URL = 'http://hk.zybdatasupport.online:8000/'; const axiosInstance = axios.create({ baseURL: API_BASE_URL, From 247cfbd0a9c5d7f5948c9bc09200c2cb65e26cc7 Mon Sep 17 00:00:00 2001 From: Kunagisa <1549184870@qq.com> Date: Fri, 18 Jul 2025 01:43:37 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E5=AF=86=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=A1=EF=BC=88=EF=BC=8C=E5=8F=A6=E5=A4=96?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=AA=E5=9C=A8=E7=BC=96=E8=AF=91=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BC=9A=E5=8E=BB=E6=8E=89log=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=83=BD=E7=BC=96=E8=AF=91=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/forget_module.vue | 38 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/components/forget_module.vue b/src/components/forget_module.vue index 651ff5c..54e494b 100644 --- a/src/components/forget_module.vue +++ b/src/components/forget_module.vue @@ -65,14 +65,25 @@
+ + + + + + + + +
- + + {{ usernameError }}