import React from "react"; import Taro from "@tarojs/taro"; import { View } from "@tarojs/components"; import { Form, FormItem, Field, Button } from "@antmjs/vantui"; import { useModel } from "@/store"; import user from "@/assets/image/user.png"; import password from "@/assets/image/password.png"; import { warn } from "@/utils/message"; import "./form.less"; export default (props) => { const { onSuccess } = props; const { signin } = useModel("user"); const form = Form.useForm(); const [accErr, setAccErr] = React.useState(); const [pwdErr, setPwdErr] = React.useState(); const [loading, setLoading] = React.useState(false); const onFinish = (errs, res) => { console.log(11111111); if (!res.account) { setAccErr("账户不能为空"); return; } else { setAccErr(); } if (!res.password) { setPwdErr("密码不能为空"); return; } else { setPwdErr(); } setLoading(true); signin(res) .then(() => { onSuccess(); setLoading(false); }) .catch((err) => { setLoading(false); }); }; const onForgetPwd = () => { // Taro.navigateTo({ // url: '/pages/reset-password/index' // }); warn(true, "请联系管理人员"); }; const handleClick = () => { form.validateFields((err, res) => { if (!res.account) { setAccErr("账户不能为空"); return; } else { setAccErr(); } if (!res.password) { setPwdErr("密码不能为空"); return; } else { setPwdErr(); } setLoading(true); signin(res) .then(() => { onSuccess(); setLoading(false); }) .catch((err) => { setLoading(false); }); }); console.log(11111); }; return ( {/* onFinish={onFinish} */}
e.detail}> e.detail}> 忘记密码?
); };