diff --git a/frontend/src/pages/PostDetailPage.tsx b/frontend/src/pages/PostDetailPage.tsx
index 9fced16..8af4081 100644
--- a/frontend/src/pages/PostDetailPage.tsx
+++ b/frontend/src/pages/PostDetailPage.tsx
@@ -2,7 +2,6 @@ import { useState, useEffect, useLayoutEffect, useRef, useCallback } from 'react
import { useParams, useNavigate, useOutletContext, useLocation } from 'react-router-dom';
import { ArrowLeft, ThumbsUp, Star, Pencil, Pin, History, Lock, MessageSquare, Trash2, Sparkles, Flag, Ban, CircleCheck, CircleHelp, MoreHorizontal } from 'lucide-react';
import FeaturedIcon from '@/components/FeaturedIcon';
-import PinnedIcon from '@/components/PinnedIcon';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import BoardBadge from '@/components/BoardBadge';
@@ -600,9 +599,7 @@ export default function PostDetailPage() {
{post.pinned && (
-
-
-
+ 置顶
)}
{post.featured && }
{post.status === 'pending' && 审核中}
diff --git a/frontend/src/pages/ProfilePage.tsx b/frontend/src/pages/ProfilePage.tsx
index fba0b77..932471f 100644
--- a/frontend/src/pages/ProfilePage.tsx
+++ b/frontend/src/pages/ProfilePage.tsx
@@ -7,6 +7,7 @@ import {
ArrowLeft,
Camera,
Check,
+ Coins,
Copy,
FileText,
Hash,
@@ -22,7 +23,7 @@ import {
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
-import { Badge } from '@/components/ui/badge';
+import { Label } from '@/components/ui/label';
import UserBadges from '../components/UserBadges';
import PointsWalletPanel from '../components/PointsWalletPanel';
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
@@ -63,10 +64,10 @@ const pwdSchema = (minLen: number) => z.object({
type NickValues = z.infer;
type SigValues = z.infer>;
type PwdValues = z.infer>;
-type ProfileTab = 'posts' | 'settings' | 'security';
+type ProfileTab = 'posts' | 'points' | 'settings' | 'security';
function parseTab(raw: string | null): ProfileTab {
- if (raw === 'settings' || raw === 'security' || raw === 'posts') return raw;
+ if (raw === 'settings' || raw === 'security' || raw === 'points' || raw === 'posts') return raw;
return 'posts';
}
@@ -96,6 +97,8 @@ export default function ProfilePage() {
const fileRef = useRef(null);
const dragCounter = useRef(0);
const copyTimer = useRef>();
+ const sigSectionRef = useRef(null);
+ const pendingFocusSig = useRef(false);
const { limits } = useForumLimits();
const pageSize = limits.page_size_default > 0 ? limits.page_size_default : 20;
@@ -124,6 +127,38 @@ export default function ProfilePage() {
setParams(nextParams, { replace: true });
};
+ const focusSignatureField = useCallback(() => {
+ sigSectionRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ window.setTimeout(() => {
+ sigSectionRef.current?.querySelector('textarea')?.focus();
+ }, 80);
+ }, []);
+
+ /** 顶部签名 /「编辑资料」:跳到资料 Tab 并聚焦签名框 */
+ const goEditSignature = () => {
+ if (tab !== 'settings') {
+ pendingFocusSig.current = true;
+ setTab('settings');
+ return;
+ }
+ focusSignatureField();
+ };
+
+ const goEditProfile = () => {
+ if (tab !== 'settings') {
+ setTab('settings');
+ return;
+ }
+ window.scrollTo({ top: 0, behavior: 'smooth' });
+ };
+
+ useEffect(() => {
+ if (tab !== 'settings' || !pendingFocusSig.current) return;
+ pendingFocusSig.current = false;
+ const t = window.setTimeout(focusSignatureField, 40);
+ return () => window.clearTimeout(t);
+ }, [tab, focusSignatureField]);
+
useEffect(() => {
if (!authLoading && !user) {
nav(loginPath('/profile'));
@@ -334,8 +369,9 @@ export default function ProfilePage() {
const tabs: { key: ProfileTab; label: string; count?: number }[] = [
{ key: 'posts', label: '我的帖子', count: stats?.post_count },
- { key: 'settings', label: '资料设置' },
- { key: 'security', label: '安全设置' },
+ { key: 'points', label: '积分' },
+ { key: 'settings', label: '资料' },
+ { key: 'security', label: '安全' },
];
return (
@@ -415,29 +451,38 @@ export default function ProfilePage() {
>
公开主页
+
{user.signature?.trim() ? (
-
{user.signature}
+
) : (
-
尚未设置签名
+
)}
-
-
-
- 用户名
- - {user.username}
-
-
-
- 邮箱
- - {user.email || '未设置'}
-
- {joinedAt && (
-
-
- 注册时间
- - {joinedAt}
-
- )}
-
-
点击头像选择图片,或拖拽到此处更换
@@ -491,22 +536,19 @@ export default function ProfilePage() {
onConfirm={onCropConfirm}
/>
-
-
{user.role === 'admin' && (
-
-
站长入口
-
- 管理板块、用户、帖子及系统设置
-
-
-
)}
+ {tab === 'points' && (
+
+ )}
+
{tab === 'settings' && (
-
基本资料
+
展示资料
+
+ 昵称与个性签名会显示在公开主页和帖子旁
+