// @ts-nocheck // Segmented这个对象在antd里的声明是错误的 import React, { useEffect, useState } from 'react'; import { Button, Segmented, Divider, Space, Tooltip, Image } from 'antd'; import { MobileOutlined, QrcodeOutlined, DesktopOutlined, MailOutlined, ExclamationCircleOutlined, LinkOutlined, } from '@ant-design/icons'; import classNames from 'classnames'; import Style from './web.module.less'; import WeChatLoginQrCode from '../../common/weChatLoginQrCode'; import WechatLoginQrCodeForPublic from '../../wechatLogin/qrCode'; import WeChatLoginGrant from '../../common/weChatLoginGrant'; import SmsLogin from './sms'; import PasswordLogin from './password'; import EmailLogin from './email'; export default function Render(props) { const { data, methods } = props; const { width, loading, loginMode, appId, domain, isSupportWechatGrant, disabled, redirectUri, url, passportTypes, callback, inputOptions, scanOptions, smsDigit, emailDigit, pwdAllowMobile, pwdAllowEmail, pwdAllowLoginName, pwdMode, allowRegister, oauthOptions, goRegister, goOauthLogin, } = data; const { t, setLoginMode, } = methods; let redirectUri2 = redirectUri; if (!(redirectUri.startsWith('https') || redirectUri.startsWith('http'))) { const hostname = domain || window.location.hostname; const port = window.location.port ? `:${window.location.port}` : ''; const path = redirectUri.startsWith('/') ? redirectUri : `/${redirectUri}`; redirectUri2 = encodeURIComponent(`${window.location.protocol}//${hostname}${port}${path}`); } // 构建微信扫码所需state参数,url存在扫码后重定向url,否则返回上一页 let state = ''; if (url) { state = encodeURIComponent(decodeURIComponent(url)); } const [showInput, setShowInput] = useState(true); useEffect(() => { if (loginMode === 'sms' || loginMode === 'email' || loginMode === 'password') { setShowInput(true); } else { setShowInput(false); } }, [loginMode]); const InputMethods = inputOptions && inputOptions.length > 0 ? ( //