From 90b34b681ecd26b3de24678f1b311e35ef81cbd3 Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 30 Apr 2026 14:14:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(feedback):=20=E7=A7=BB=E9=99=A4=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E6=96=B9=E5=BC=8F=E6=AD=A5=E9=AA=A4=EF=BC=8C=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=80=81=E7=94=A8=E6=88=B7=E8=BA=AB=E4=BB=BD=E5=B7=B2?= =?UTF-8?q?=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前第三步要求填写微信/钉钉等联系方式,但用户已登录,后端已经 记录 user_id / user_name(与水印取的同一份),可以直接通过内部 渠道触达,无需再问。 流程从 4 步收紧为 3 步: 1) 选类型 2) 写内容 + 截图 + 板块 3) 成功页 提交概览页一并删除(信息不变就直接提交,少一次点击)。 Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/FeedbackFab.tsx | 63 ++++++++-------------------------- 1 file changed, 15 insertions(+), 48 deletions(-) diff --git a/src/components/FeedbackFab.tsx b/src/components/FeedbackFab.tsx index b9f3c07..b3eb92f 100644 --- a/src/components/FeedbackFab.tsx +++ b/src/components/FeedbackFab.tsx @@ -71,11 +71,10 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) { const [open, setOpen] = useState(false); const [historyOpen, setHistoryOpen] = useState(false); const [menuOpen, setMenuOpen] = useState(false); - const [step, setStep] = useState<1 | 2 | 3 | 4>(1); + const [step, setStep] = useState<1 | 2 | 3>(1); // 1=选类型, 2=写内容, 3=成功页 const [type, setType] = useState(null); const [mod, setMod] = useState(''); const [content, setContent] = useState(''); - const [contact, setContact] = useState(''); const [shots, setShots] = useState([]); const [uploading, setUploading] = useState(false); const [submitting, setSubmitting] = useState(false); @@ -125,7 +124,6 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) { setStep(1); setType(null); setContent(''); - setContact(''); setShots([]); setError(null); }; @@ -147,12 +145,11 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) { type, module: mod || null, content: content.trim(), - contact: contact.trim() || null, screenshots: shots.map(s => s.url), userAgent: navigator.userAgent.slice(0, 500), }), }); - setStep(4); + setStep(3); } catch (e) { setError(e instanceof Error ? e.message : String(e)); } finally { @@ -162,21 +159,17 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) { const next = () => { if (step === 1 && !type) return; - if (step === 2 && !content.trim()) { - taRef.current?.focus(); - return; - } - if (step === 3) { + if (step === 2) { + if (!content.trim()) { taRef.current?.focus(); return; } submit(); return; } - setStep((step + 1) as typeof step); }; const back = () => setStep((Math.max(1, step - 1)) as typeof step); const canNext = step === 1 ? !!type : step === 2 ? content.trim().length > 0 : true; - const progress = ((step === 4 ? 4 : step) / 4) * 100; + const progress = step >= 3 ? 100 : (step / 2) * 100; return ( <> @@ -265,13 +258,12 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) {
- {step === 4 ? '收到啦~' : '提个建议'} + {step === 3 ? '收到啦~' : '提个建议'}
- {step === 1 && '第一步 / 共 3 步'} - {step === 2 && '第二步 / 共 3 步'} - {step === 3 && '第三步 / 共 3 步'} - {step === 4 && '感谢你的反馈'} + {step === 1 && '第一步 / 共 2 步'} + {step === 2 && '第二步 / 共 2 步'} + {step === 3 && '感谢你的反馈'}
@@ -411,32 +403,7 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) { )} {step === 3 && ( - -

方便留个联系方式吗?

-

非必填。留下我们可以跟进进展,没留也不影响提交~

- setContact(e.target.value)} - autoFocus - maxLength={120} - placeholder="微信 / 钉钉 / 邮箱 / 手机号 都行" - className="w-full bg-slate-50 border-none rounded-xl p-3 text-[12px] text-slate-700 outline-none focus:ring-2 focus:ring-blue-500/20" - /> -
-
提交概览
-
-
类型:{TYPE_OPTIONS.find(t => t.key === type)?.label}
-
板块:{MODULE_LABELS[mod] || '通用'}
-
内容:{content}
-
-
- {error &&
{error}
} -
- )} - - {step === 4 && ( - +
谢谢你的反馈 ❤️
-
产品同学会认真看每一条
有进展会通过你留的联系方式同步
+
产品同学会认真看每一条
有进展可以在「我的反馈」里查看
)} {/* Footer */} - {step < 4 && ( + {step < 3 && (
{step > 1 && (
)} - {step === 4 && ( + {step === 3 && (