feat: WiFi/vCard/Email/电话/SMS 全模式表单

This commit is contained in:
2026-06-17 00:24:38 +08:00
parent 1a4af38bac
commit 3c56fc45d3
6 changed files with 158 additions and 5 deletions
+24
View File
@@ -0,0 +1,24 @@
import { useQrState } from '../store/qrContext';
import { useQrEncode } from '../hooks/useQrEncode';
export default function SmsMode() {
const { state, dispatch } = useQrState();
const { encode } = useQrEncode();
const update = (field: string, value: string) => {
const data = { ...state.formData, [field]: value };
dispatch({ type: 'SET_FORM_DATA', payload: data });
encode(`smsto:${data.number || ''}:${data.message || ''}`);
};
return (
<div className="flex gap-2 items-center h-full px-4">
<input placeholder="电话号码" type="tel" value={state.formData.number || ''}
onChange={e => update('number', e.target.value)}
className="flex-1 px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-sm bg-transparent outline-none focus:ring-2 focus:ring-blue-500/30" />
<input placeholder="短信内容" value={state.formData.message || ''}
onChange={e => update('message', e.target.value)}
className="flex-[2] px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-sm bg-transparent outline-none focus:ring-2 focus:ring-blue-500/30" />
</div>
);
}