fix: 恢复微信公众号扫码功能 (close #7)

This commit is contained in:
1808837298@qq.com 2024-03-06 16:53:21 +08:00
parent 3ab4f145db
commit 9de2d21e1a
2 changed files with 64 additions and 45 deletions

View File

@ -4,12 +4,13 @@ import { UserContext } from '../context/User';
import { API, getLogo, isMobile, showError, showInfo, showSuccess, showWarning } from '../helpers'; import { API, getLogo, isMobile, showError, showInfo, showSuccess, showWarning } from '../helpers';
import { onGitHubOAuthClicked } from './utils'; import { onGitHubOAuthClicked } from './utils';
import Turnstile from "react-turnstile"; import Turnstile from "react-turnstile";
import { Layout, Card, Image, Form, Button, Divider, Modal } from "@douyinfe/semi-ui"; import { Layout, Card, Image, Form, Button, Divider, Modal, Icon } from '@douyinfe/semi-ui';
import Title from "@douyinfe/semi-ui/lib/es/typography/title"; import Title from "@douyinfe/semi-ui/lib/es/typography/title";
import Text from "@douyinfe/semi-ui/lib/es/typography/text"; import Text from "@douyinfe/semi-ui/lib/es/typography/text";
import TelegramLoginButton from 'react-telegram-login'; import TelegramLoginButton from 'react-telegram-login';
import { IconGithubLogo } from '@douyinfe/semi-icons'; import { IconGithubLogo } from '@douyinfe/semi-icons';
import WeChatIcon from './WeChatIcon';
const LoginForm = () => { const LoginForm = () => {
const [inputs, setInputs] = useState({ const [inputs, setInputs] = useState({
@ -179,16 +180,16 @@ const LoginForm = () => {
) : ( ) : (
<></> <></>
)} )}
{/*{status.wechat_login ? (*/} {status.wechat_login ? (
{/* <Button*/} <Button
{/* circular*/} type='primary'
{/* color='green'*/} style={{color: 'rgba(var(--semi-green-5), 1)'}}
{/* icon='wechat'*/} icon={<Icon svg={<WeChatIcon />} />}
{/* onClick={onWeChatLoginClicked}*/} onClick={onWeChatLoginClicked}
{/* />*/} />
{/*) : (*/} ) : (
{/* <></>*/} <></>
{/*)}*/} )}
{status.telegram_oauth ? ( {status.telegram_oauth ? (
<TelegramLoginButton dataOnauth={onTelegramLoginClicked} botName={status.telegram_bot_name} /> <TelegramLoginButton dataOnauth={onTelegramLoginClicked} botName={status.telegram_bot_name} />
@ -200,40 +201,34 @@ const LoginForm = () => {
) : ( ) : (
<></> <></>
)} )}
{/*<Modal*/} <Modal
{/* onClose={() => setShowWeChatLoginModal(false)}*/} title="微信扫码登录"
{/* onOpen={() => setShowWeChatLoginModal(true)}*/} visible={showWeChatLoginModal}
{/* open={showWeChatLoginModal}*/} maskClosable={true}
{/* size={'mini'}*/} onOk={onSubmitWeChatVerificationCode}
{/*>*/} onCancel={() => setShowWeChatLoginModal(false)}
{/* <Modal.Content>*/} okText={'登录'}
{/* <Modal.Description>*/} size={'small'}
{/* <Image src={status.wechat_qrcode} fluid/>*/} centered={true}
{/* <div style={{textAlign: 'center'}}>*/} >
{/* <p>*/} <div style={{ display: 'flex', alignItem: 'center', flexDirection: 'column' }}>
{/* 微信扫码关注公众号,输入「验证码」获取验证码(三分钟内有效)*/} <img src={status.wechat_qrcode}/>
{/* </p>*/} </div>
{/* </div>*/} <div style={{textAlign: 'center'}}>
{/* <Form size='large'>*/} <p>
{/* <Form.Input*/} 微信扫码关注公众号输入验证码获取验证码三分钟内有效
{/* field={'wechat_verification_code'}*/} </p>
{/* placeholder='验证码'*/} </div>
{/* name='wechat_verification_code'*/} <Form size='large'>
{/* value={inputs.wechat_verification_code}*/} <Form.Input
{/* onChange={handleChange}*/} field={'wechat_verification_code'}
{/* />*/} placeholder='验证码'
{/* <Button*/} label={'验证码'}
{/* color=''*/} value={inputs.wechat_verification_code}
{/* fluid*/} onChange={(value) => handleChange('wechat_verification_code', value)}
{/* size='large'*/} />
{/* onClick={onSubmitWeChatVerificationCode}*/} </Form>
{/* >*/} </Modal>
{/* 登录*/}
{/* </Button>*/}
{/* </Form>*/}
{/* </Modal.Description>*/}
{/* </Modal.Content>*/}
{/*</Modal>*/}
</Card> </Card>
{turnstileEnabled ? ( {turnstileEnabled ? (
<div style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}> <div style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}>

View File

@ -0,0 +1,24 @@
import React from 'react';
import { Icon } from '@douyinfe/semi-ui';
const WeChatIcon = () => {
function CustomIcon() {
return <svg t='1709714447384' className='icon' viewBox='0 0 1024 1024' version='1.1'
xmlns='http://www.w3.org/2000/svg' p-id='5091' width='16' height='16'>
<path
d='M690.1 377.4c5.9 0 11.8 0.2 17.6 0.5-24.4-128.7-158.3-227.1-319.9-227.1C209 150.8 64 271.4 64 420.2c0 81.1 43.6 154.2 111.9 203.6 5.5 3.9 9.1 10.3 9.1 17.6 0 2.4-0.5 4.6-1.1 6.9-5.5 20.3-14.2 52.8-14.6 54.3-0.7 2.6-1.7 5.2-1.7 7.9 0 5.9 4.8 10.8 10.8 10.8 2.3 0 4.2-0.9 6.2-2l70.9-40.9c5.3-3.1 11-5 17.2-5 3.2 0 6.4 0.5 9.5 1.4 33.1 9.5 68.8 14.8 105.7 14.8 6 0 11.9-0.1 17.8-0.4-7.1-21-10.9-43.1-10.9-66 0-135.8 132.2-245.8 295.3-245.8z m-194.3-86.5c23.8 0 43.2 19.3 43.2 43.1s-19.3 43.1-43.2 43.1c-23.8 0-43.2-19.3-43.2-43.1s19.4-43.1 43.2-43.1z m-215.9 86.2c-23.8 0-43.2-19.3-43.2-43.1s19.3-43.1 43.2-43.1 43.2 19.3 43.2 43.1-19.4 43.1-43.2 43.1z'
p-id='5092'></path>
<path
d='M866.7 792.7c56.9-41.2 93.2-102 93.2-169.7 0-124-120.8-224.5-269.9-224.5-149 0-269.9 100.5-269.9 224.5S540.9 847.5 690 847.5c30.8 0 60.6-4.4 88.1-12.3 2.6-0.8 5.2-1.2 7.9-1.2 5.2 0 9.9 1.6 14.3 4.1l59.1 34c1.7 1 3.3 1.7 5.2 1.7 2.4 0 4.7-0.9 6.4-2.6 1.7-1.7 2.6-4 2.6-6.4 0-2.2-0.9-4.4-1.4-6.6-0.3-1.2-7.6-28.3-12.2-45.3-0.5-1.9-0.9-3.8-0.9-5.7 0.1-5.9 3.1-11.2 7.6-14.5zM600.2 587.2c-19.9 0-36-16.1-36-35.9 0-19.8 16.1-35.9 36-35.9s36 16.1 36 35.9c0 19.8-16.2 35.9-36 35.9z m179.9 0c-19.9 0-36-16.1-36-35.9 0-19.8 16.1-35.9 36-35.9s36 16.1 36 35.9c-0.1 19.8-16.2 35.9-36 35.9z'
p-id='5093'></path>
</svg>;
}
return (
<div>
<Icon svg={<CustomIcon />} />
</div>
);
};
export default WeChatIcon;