From 56a955ae81995f0a27731cab84c8214c7730f534 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Mon, 5 Jan 2026 03:04:09 -0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...mail Settings Tabs Visibility and Logic.md | 16 ++++++++++++++++ .../forms/email-settings-form.tsx | 17 +++++++++-------- apps/admin/app/dashboard/user/page.tsx | 19 +++++++++++++++++++ scripts/prepare.sh | 10 ++-------- 4 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 .trae/documents/Fix Email Settings Tabs Visibility and Logic.md diff --git a/.trae/documents/Fix Email Settings Tabs Visibility and Logic.md b/.trae/documents/Fix Email Settings Tabs Visibility and Logic.md new file mode 100644 index 0000000..78e6a33 --- /dev/null +++ b/.trae/documents/Fix Email Settings Tabs Visibility and Logic.md @@ -0,0 +1,16 @@ +我已找到导致页面显示异常的两个主要原因: + +1. **标签值重复**:“到期通知”的内容区域错误地使用了 `value='verify'`(与“验证邮件”重复),导致点击标签时无法正确匹配。 +2. **强制渲染属性**:部分标签页使用了 `forceMount` 属性,导致内容即使未被选中也保留在页面上。由于表单已配置 `shouldUnregister: false`,我们可以安全地移除该属性,让未选中的标签页自动隐藏。 + +**修改计划:** + +编辑 `apps/admin/app/dashboard/auth-control/forms/email-settings-form.tsx` 文件: + +1. **修正标签关联**:将第 474 行的 `value='verify'` 修改为 `value='expiration'`。 +2. **优化显示逻辑**:移除以下位置的 `forceMount` 属性,确保只有当前选中的标签页才会显示: + - SMTP 设置 (第 260 行) + - 到期通知 (第 474 行) + - 维护通知 (第 519 行) + +这样修改后,点击对应的标签将只显示对应的内容,且“全部显示”的问题将得到解决。 diff --git a/apps/admin/app/dashboard/auth-control/forms/email-settings-form.tsx b/apps/admin/app/dashboard/auth-control/forms/email-settings-form.tsx index 6cd57f7..172ef89 100644 --- a/apps/admin/app/dashboard/auth-control/forms/email-settings-form.tsx +++ b/apps/admin/app/dashboard/auth-control/forms/email-settings-form.tsx @@ -87,6 +87,7 @@ export default function EmailSettingsForm() { const form = useForm({ resolver: zodResolver(emailSettingsSchema), + shouldUnregister: false, defaultValues: { id: 0, method: 'email', @@ -416,8 +417,8 @@ export default function EmailSettingsForm() {
@@ -480,8 +481,8 @@ export default function EmailSettingsForm() {
@@ -525,8 +526,8 @@ export default function EmailSettingsForm() {
@@ -580,8 +581,8 @@ export default function EmailSettingsForm() {
diff --git a/apps/admin/app/dashboard/user/page.tsx b/apps/admin/app/dashboard/user/page.tsx index 3a76de8..e083549 100644 --- a/apps/admin/app/dashboard/user/page.tsx +++ b/apps/admin/app/dashboard/user/page.tsx @@ -302,6 +302,25 @@ export default function Page() { header: t('inviteCode'), cell: ({ row }) => row.getValue('refer_code') || '--', }, + { + accessorKey: 'last_login_time', + header: '最后登录时间', + cell: ({ row }) => { + const v = (row.original as any)?.last_login_time; + if (!v) return '---'; + const ts = Number(v); + const ms = ts < 1e12 ? ts * 1000 : ts; + return formatDate(ms) as any; + }, + }, + { + accessorKey: 'member_status', + header: '会员状态', + cell: ({ row }) => { + const v = (row.original as any)?.member_status; + return {v ?? '---'}; + }, + }, { accessorKey: 'referer_id', header: t('referer'), diff --git a/scripts/prepare.sh b/scripts/prepare.sh index 1a7d294..513498d 100755 --- a/scripts/prepare.sh +++ b/scripts/prepare.sh @@ -35,16 +35,10 @@ else fi # Set up pre-commit hook -setup_husky_hook "pre-commit" "#!/bin/sh -. \"\$(dirname \"\$0\")/_/husky.sh\" - -npx --no-install lint-staged" +setup_husky_hook "pre-commit" "npx --no-install lint-staged" # Set up commit-msg hook -setup_husky_hook "commit-msg" "#!/bin/sh -. \"\$(dirname \"\$0\")/_/husky.sh\" - -npx --no-install commitlint --edit \"\$1\"" +setup_husky_hook "commit-msg" "npx --no-install commitlint --edit \"\$1\"" # Function to globally install an npm package if not installed install_global_package() {