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 && (