From 5b8907cac1f5f94652eccded7d2e37dfee149926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8?= Date: Thu, 21 May 2026 17:52:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E9=80=BB=E8=BE=91=20-=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E9=9C=80=E5=AE=8C=E6=88=90=E5=AE=9E?= =?UTF-8?q?=E5=90=8D=E8=AE=A4=E8=AF=81=E6=89=8D=E8=83=BD=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/types/profile.d.ts | 5 +- src/api/types/user.d.ts | 12 ++--- src/router/index.ts | 23 +++++++-- src/views/agent/user/options.ts | 60 ++++++++++++++-------- src/views/capital/transfer/index.vue | 1 - src/views/profile/personalCenter/index.vue | 4 +- src/views/profile/user/options.ts | 4 +- src/views/user/ChangePassword.vue | 7 +-- src/views/user/ForgotPassword.vue | 7 +-- src/views/user/Register.vue | 2 +- src/views/user/bindEmail.vue | 1 - src/views/user/bindPhone.vue | 1 - 12 files changed, 71 insertions(+), 56 deletions(-) diff --git a/src/api/types/profile.d.ts b/src/api/types/profile.d.ts index 795e63d..f2ccce3 100644 --- a/src/api/types/profile.d.ts +++ b/src/api/types/profile.d.ts @@ -52,10 +52,7 @@ export interface EditUsernameParams { // 验证码修改密码参数类型 export interface UpdatePwdByCaptchaParams { - reg_type: number - email?: string - mobile?: string - mobile_area?: string + verify_type: number code: string login_password1: string login_password2: string diff --git a/src/api/types/user.d.ts b/src/api/types/user.d.ts index 01f18fa..3d196df 100644 --- a/src/api/types/user.d.ts +++ b/src/api/types/user.d.ts @@ -27,17 +27,14 @@ export interface RegisterParams { //忘记密码参数类型 export interface ForgotPasswordParams { mobile?: string // 手机号(可选) - email?: string // 邮箱(可选) - reg_type: number // 1-邮箱登录 2-手机登录 + email?: string // 邮箱(可选) code: string login_password1: string login_password2: string } // 修改密码参数类型 -export interface ChangePasswordParams { - mobile?: string // 手机号(可选) - email?: string // 邮箱(可选) - reg_type: number // 1-邮箱登录 2-手机登录 +export interface ChangePasswordParams { + verify_type: number // 1-邮箱登录 2-手机登录 code: string login_password1: string login_password2: string @@ -45,7 +42,6 @@ export interface ChangePasswordParams { // 发送验证码参数类型 export interface SendCodeParams { mobile?: string // 手机号(可选) - email?: string // 邮箱(可选) - reg_type: number // 1-邮箱登录 2-手机登录 + email?: string // 邮箱(可选) type: string // 验证码类型 } \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 6ab41a4..3ac9fd3 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -102,9 +102,11 @@ let dynamicRoutesReady = false router.beforeEach(async (to, _from) => { const userStore = useUserStore() const isLoggedIn = !!userStore.token + const isRealNameVerified = userStore.userInfo?.real_check === 3 - console.log('dynamicRoutesReady', dynamicRoutesReady) + console.log('dynamicRoutesReady', userStore.userInfo) console.log('isLoggedIn', isLoggedIn) + console.log('isRealNameVerified', isRealNameVerified) console.log('to.meta.requiresAuth', to.meta.requiresAuth) console.log('to.meta.isAuthPage', to.meta.isAuthPage) @@ -127,12 +129,27 @@ router.beforeEach(async (to, _from) => { } } - // 3. 已登录访问登录/注册页 → 首页 + // 3. 已登录但未完成实名认证 → 跳转到实名认证页面 + // 白名单:实名认证页面、活体认证页面、登录/注册页 + const authPages = ['/realName', '/livenessVerification', '/user/login', '/user/register', '/user/forgot-password'] + const isAuthPage = authPages.some(path => to.path.startsWith(path)) + + if (isLoggedIn && !isRealNameVerified && !isAuthPage) { + // 已登录但未认证,访问非认证页面时重定向到实名认证 + return '/realName' + } + + // 4. 已登录访问登录/注册页 → 首页(如果已认证)或实名认证页(如果未认证) if (isLoggedIn && to.meta.isAuthPage) { + return isRealNameVerified ? '/' : '/realName' + } + + // 5. 已完成认证的用户访问实名认证或活体认证页 → 首页 + if (isLoggedIn && isRealNameVerified && (to.path === '/realName' || to.path === '/livenessVerification')) { return '/' } - // 4. 其他情况正常放行 + // 6. 其他情况正常放行 return true }) diff --git a/src/views/agent/user/options.ts b/src/views/agent/user/options.ts index e1ad467..7016f18 100644 --- a/src/views/agent/user/options.ts +++ b/src/views/agent/user/options.ts @@ -3,21 +3,37 @@ export const search = [ { prop: 'accountName', label: '账号名称', type: 'input' as const, placeholder: '请输入账号名称', width: '150px' }, // 开始时间 { - prop: "startTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const,placeholder: '请选择注册开始时间', width: '270px', // 时间范围选择器 + prop: "startTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const, placeholder: '请选择注册开始时间', width: '270px', // 时间范围选择器 valueFormat: 'YYYY-MM-DD', }, // 结束时间 { - prop: "endTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const,placeholder: '请选择注册结束时间', width: '270px', // 时间范围选择器 + prop: "endTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const, placeholder: '请选择注册结束时间', width: '270px', // 时间范围选择器 valueFormat: 'YYYY-MM-DD', }, // 状态 - { prop: 'status', label: '状态', type: 'select' as const, placeholder: '请选择状态', width: 100}, + // { + // prop: 'status', + // label: '状态', + // type: 'select' as const, + // options: [ + // { + // label: '正常', + // value: '1' + // }, + // { + // label: '封禁', + // value: '2' + // }, + // ], + // placeholder: '请选择状态', + // width: '100px' + // }, ] export const tableColumns = [ // 账号名称 - { label: '账号名称', prop: 'accountName', }, + { label: '账号名称', prop: 'accountName', }, // 账号id { prop: 'userId', label: '账号id' }, // 状态 @@ -27,34 +43,34 @@ export const tableColumns = [ // 账号数量 { prop: 'accountQty', label: '账号数量', width: 100 }, // 点差分配比例 - { prop: 'marginRatio', label: '点差分配比例', slotName: 'marginRatio' , width: 140}, + { prop: 'marginRatio', label: '点差分配比例', slotName: 'marginRatio', width: 140 }, // 手续费分成比例 - { prop: 'commissionRatio', label: '手续费分成比例', slotName: 'commissionRatio' , width: 140}, + { prop: 'commissionRatio', label: '手续费分成比例', slotName: 'commissionRatio', width: 140 }, // 注册时间 - { prop: 'createTime', label: '注册时间', sortable: true , minWidth: 180}, + { prop: 'createTime', label: '注册时间', sortable: true, minWidth: 180 }, // 操作 - { label: '操作', slotName: 'action', width: 200} + { label: '操作', slotName: 'action', width: 200 } ] // 点差表格配置 export const marginRatioTableColumns = [ - // 品种名称 - { prop: 'varietyName', label: '名称', align: 'center' as const }, - // 品种编号 - { prop: 'varietyCode', label: '编号', align: 'center' as const }, - // 可分配点差 - { prop: 'pointDifference', label: '可分配点差', align: 'center' as const }, - // 已分配点差 - { - prop: 'assignedPointDifference', - label: '已分配点差', - align: 'center' as const, - slotName: 'assignedPointDiff', - }, + // 品种名称 + { prop: 'varietyName', label: '名称', align: 'center' as const }, + // 品种编号 + { prop: 'varietyCode', label: '编号', align: 'center' as const }, + // 可分配点差 + { prop: 'pointDifference', label: '可分配点差', align: 'center' as const }, + // 已分配点差 + { + prop: 'assignedPointDifference', + label: '已分配点差', + align: 'center' as const, + slotName: 'assignedPointDiff', + }, ] // 手续费分成比例form配置 export const commissionRatioFormItem = [ // 手续费分成比例 - { prop: 'commissionRatio', label: '手续费分成比例', type: 'input' as const, placeholder: '请输入手续费分成比例',labelWidth: '140px'}, + { prop: 'commissionRatio', label: '手续费分成比例', type: 'input' as const, placeholder: '请输入手续费分成比例', labelWidth: '140px' }, ] \ No newline at end of file diff --git a/src/views/capital/transfer/index.vue b/src/views/capital/transfer/index.vue index 70d9754..adbfd21 100644 --- a/src/views/capital/transfer/index.vue +++ b/src/views/capital/transfer/index.vue @@ -289,7 +289,6 @@ const sendCodeApi = async (receiver: string) => { // 发送验证码参数 const type = verifyForm.value.verifyType const params: any = { - reg_type: userStore.userInfo!.reg_type, type: 'transfer_code', } if (type === 'email') { diff --git a/src/views/profile/personalCenter/index.vue b/src/views/profile/personalCenter/index.vue index 6d276c1..bd08b84 100644 --- a/src/views/profile/personalCenter/index.vue +++ b/src/views/profile/personalCenter/index.vue @@ -524,9 +524,7 @@ const handlePasswordConfirm = async () => { await passwordFormRef.value.validate(); const params: UpdatePwdByCaptchaParams = { - reg_type: userStore.userInfo!.reg_type, - email: passwordForm.verifyType === 'email' ? userInfo.email : undefined, - mobile: passwordForm.verifyType === 'mobile' ? userInfo.mobile : undefined, + verify_type: passwordForm.verifyType === 'email'?1:2, code: passwordForm.code, login_password1: passwordForm.login_password1, login_password2: passwordForm.login_password2 diff --git a/src/views/profile/user/options.ts b/src/views/profile/user/options.ts index da61cbb..76925b4 100644 --- a/src/views/profile/user/options.ts +++ b/src/views/profile/user/options.ts @@ -22,7 +22,7 @@ export const clientSearch = [ dateType: 'date' as const, // 时间范围选择器 valueFormat: 'YYYY-MM-DD', // minWidth: '200px' - width: '180px', + width: '180', disabledDate }, { @@ -32,7 +32,7 @@ export const clientSearch = [ dateType: 'date' as const, // 时间范围选择器 valueFormat: 'YYYY-MM-DD', // minWidth: '200px' - width: '180px', + width: '180', disabledDate }, { diff --git a/src/views/user/ChangePassword.vue b/src/views/user/ChangePassword.vue index 511ddf8..8428572 100644 --- a/src/views/user/ChangePassword.vue +++ b/src/views/user/ChangePassword.vue @@ -145,7 +145,6 @@ const sendCodeApi = async () => { const sendParams = { email: changePasswordForm.value.email, mobile: changePasswordForm.value.phone, - reg_type: activeTab.value === 'email' ? 1 : 2, type:'resetPass_code' } return userStore.sendCode(sendParams) @@ -180,10 +179,8 @@ const handleChangePassword = async () => { await changePasswordFormRef.value.validate(); // 重置密码参数 - const changePasswordParams = { - mobile: changePasswordForm.value.phone, - email: changePasswordForm.value.email, - reg_type: activeTab.value === 'email' ? 1 : 2, + const changePasswordParams = { + verify_type: activeTab.value === 'email' ? 1 : 2, code: changePasswordForm.value.code, login_password1: md5Encrypt(changePasswordForm.value.password), login_password2: md5Encrypt(changePasswordForm.value.confirmPassword), diff --git a/src/views/user/ForgotPassword.vue b/src/views/user/ForgotPassword.vue index 7f3e31a..c54770f 100644 --- a/src/views/user/ForgotPassword.vue +++ b/src/views/user/ForgotPassword.vue @@ -160,7 +160,6 @@ const sendCodeApi = async () => { const sendParams = { email: forgotPasswordForm.value.email, mobile: forgotPasswordForm.value.phone, - reg_type: getStorage('forgotType', 'session') === 'email' ? 1 : 2, type:'transfer_code' } return userStore.sendCode(sendParams) @@ -273,12 +272,10 @@ const handleForgotPassword = async () => { // 校验密码+确认密码 await forgotPasswordFormRef.value.validateField(['password', 'confirmPassword']) - // 重置密码参数 - const getForgotType = getStorage('forgotType', 'session') || 'email' + // 重置密码参数 const forgotParams = { mobile: forgotPasswordForm.value.phone, - email: forgotPasswordForm.value.email, - reg_type: getForgotType === 'email' ? 1 : 2, + email: forgotPasswordForm.value.email, code: forgotPasswordForm.value.code, // login_password1: md5Encrypt(forgotPasswordForm.value.password), // login_password2: md5Encrypt(forgotPasswordForm.value.confirmPassword), diff --git a/src/views/user/Register.vue b/src/views/user/Register.vue index caf405b..5e7bc99 100644 --- a/src/views/user/Register.vue +++ b/src/views/user/Register.vue @@ -180,7 +180,6 @@ const sendCodeApi = async () => { email: registerForm.value.email, mobile: registerForm.value.countryCode + registerForm.value.phone, mobile_area: registerForm.value.countryCode, - reg_type: activeTab.value === 'email' ? 1 : 2, type: 'reg_code', } return userStore.sendCode(sendParams) @@ -225,6 +224,7 @@ const handleRegister = async () => { // 注册参数 const registerParams = { email: registerForm.value.email, + mobile_area: registerForm.value.countryCode, mobile: registerForm.value.countryCode + registerForm.value.phone, reg_type: activeTab.value === 'email' ? 1 : 2, invite_code: registerForm.value.inviteCode, diff --git a/src/views/user/bindEmail.vue b/src/views/user/bindEmail.vue index c941245..c3e0dac 100644 --- a/src/views/user/bindEmail.vue +++ b/src/views/user/bindEmail.vue @@ -89,7 +89,6 @@ const sendCodeApi = async () => { // 发送验证码参数 const sendParams = { email: bindEmailForm.value.email, - reg_type: 1, type:'resetPass_code' } return userStore.sendCode(sendParams) diff --git a/src/views/user/bindPhone.vue b/src/views/user/bindPhone.vue index 91e795c..8519b82 100644 --- a/src/views/user/bindPhone.vue +++ b/src/views/user/bindPhone.vue @@ -99,7 +99,6 @@ const sendCodeApi = async () => { // 发送验证码参数 const sendParams = { mobile: bindPhoneForm.value.phone, - reg_type: 2, type: 'resetPass_code' } return userStore.sendCode(sendParams)