// WechatModal.js import PropTypes from 'prop-types'; import React from 'react'; import { Dialog, DialogTitle, DialogContent, TextField, Button, Typography, Grid } from '@mui/material'; import { Formik, Form, Field } from 'formik'; import { showError } from 'utils/common'; import * as Yup from 'yup'; const validationSchema = Yup.object().shape({ code: Yup.string().required('验证码不能为空') }); const WechatModal = ({ open, handleClose, wechatLogin, qrCode }) => { const handleSubmit = (values) => { const { success, message } = wechatLogin(values.code); if (success) { handleClose(); } else { showError(message || '未知错误'); } }; return ( 微信验证码登录 二维码 请使用微信扫描二维码关注公众号,输入「验证码」获取验证码(三分钟内有效) {({ errors, touched }) => (
)}
); }; export default WechatModal; WechatModal.propTypes = { open: PropTypes.bool, handleClose: PropTypes.func, wechatLogin: PropTypes.func, qrCode: PropTypes.string };