feat: 修复登陆和注册

This commit is contained in:
zdl
2025-10-15 23:52:35 +08:00
parent d6ab01b39d
commit 4d0e40c733
3 changed files with 14 additions and 14 deletions

View File

@@ -42,7 +42,6 @@
"match-sorter": "6.3.0", "match-sorter": "6.3.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"nouislider": "15.0.0", "nouislider": "15.0.0",
"qrcode.react": "^4.2.0",
"react": "18.3.1", "react": "18.3.1",
"react-apexcharts": "^1.3.9", "react-apexcharts": "^1.3.9",
"react-big-calendar": "^0.33.2", "react-big-calendar": "^0.33.2",

View File

@@ -239,12 +239,10 @@ export default function AuthFormContent() {
credential: phone, credential: phone,
verification_code: verificationCode, verification_code: verificationCode,
login_type: 'phone', login_type: 'phone',
type: 'phone',
purpose: config.api.purpose, // 使用配置中的purpose
}; };
// 调用API根据模式选择不同的endpoint // 调用API根据模式选择不同的endpoint
const response = await fetch(`${API_BASE_URL}${config.api.endpoint}`, { const response = await fetch(`${API_BASE_URL}/api/auth/login-with-code`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -10,7 +10,6 @@ import {
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { FaQrcode } from "react-icons/fa"; import { FaQrcode } from "react-icons/fa";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { QRCodeSVG } from "qrcode.react";
import { authService, WECHAT_STATUS, STATUS_MESSAGES } from "../../services/authService"; import { authService, WECHAT_STATUS, STATUS_MESSAGES } from "../../services/authService";
// 配置常量 // 配置常量
@@ -195,8 +194,6 @@ export default function WechatRegister() {
const response = await authService.getWechatQRCode(); const response = await authService.getWechatQRCode();
console.log(`zdl getWechatQRCode ${JSON.stringify(response)}`)
// 检查组件是否已卸载 // 检查组件是否已卸载
if (!isMountedRef.current) return; if (!isMountedRef.current) return;
@@ -268,17 +265,23 @@ export default function WechatRegister() {
justifyContent="center" justifyContent="center"
> >
{/* 灰色二维码底图 - 始终显示 */} {/* 灰色二维码底图 - 始终显示 */}
{/* 根据 wechatStatus 渲染不同的内容 */}
{wechatStatus === WECHAT_STATUS.WAITING ? ( {wechatStatus === WECHAT_STATUS.WAITING ? (
<QRCodeSVG <Box position="relative" width="100%" height="100%">
value={wechatAuthUrl} <iframe
size={200} src={wechatAuthUrl}
level="M" // width="100%"
// height="100%"
w={40} h={40}
style={{ borderRadius: '8px' }}
/> />
</Box>
) : ( ) : (
<Icon as={FaQrcode} w={24} h={24} color="gray.300" /> <Icon as={FaQrcode} w={24} h={24} color="gray.300" />
)} )}
<Icon as={FaQrcode} w={24} h={24} color="gray.300" />
{/* 加载动画 */} {/* 加载动画 */}
{isLoading && ( {isLoading && (
<Box <Box