diff --git a/spug_web/src/pages/host/Form.js b/spug_web/src/pages/host/Form.js index 36b77fc8..01c9851b 100644 --- a/spug_web/src/pages/host/Form.js +++ b/spug_web/src/pages/host/Form.js @@ -14,7 +14,6 @@ export default observer(function () { const [form] = Form.useForm(); const [loading, setLoading] = useState(false); const [uploading, setUploading] = useState(false); - const [password, setPassword] = useState(); const [fileList, setFileList] = useState([]); useEffect(() => { @@ -36,10 +35,11 @@ export default observer(function () { if (formData.pkey) { message.error('独立密钥认证失败') } else { + const onChange = v => formData.password = v; Modal.confirm({ icon: , title: '首次验证请输入密码', - content: , + content: , onOk: () => handleConfirm(formData), }) } @@ -53,8 +53,7 @@ export default observer(function () { } function handleConfirm(formData) { - if (password) { - formData['password'] = password; + if (formData.password) { return http.post('/api/host/', formData).then(res => { message.success('验证成功'); store.formVisible = false; @@ -79,7 +78,7 @@ export default observer(function () { const ConfirmForm = (props) => (
- setPassword(e.target.value)}/> + props.onChange(e.target.value)}/>
)