From 2fd6f073c35b1acc5ea36b0fab9b839bd1024625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sat, 11 Apr 2026 08:30:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(qr-confirm):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E7=A1=AE=E8=AE=A4=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除未使用的组件和图标导入,减少包大小 - 注释掉登录卡片相关样式和元素,隐藏界面内容 - 删除手动确认登录函数及相关按钮渲染逻辑 - 去除状态图标、标题、描述和用户信息的渲染函数 - 删除所有操作按钮和安全提示组件渲染 - 取消整体页面布局,仅直接渲染授权页面部分 - 修改品牌文本首字母小写,统一风格 --- src/passport/qr-confirm/index.tsx | 353 +++++------------------------- 1 file changed, 50 insertions(+), 303 deletions(-) diff --git a/src/passport/qr-confirm/index.tsx b/src/passport/qr-confirm/index.tsx index bbfa8bc..3564add 100644 --- a/src/passport/qr-confirm/index.tsx +++ b/src/passport/qr-confirm/index.tsx @@ -1,7 +1,6 @@ import React, { useState, useEffect } from 'react'; import { View, Text } from '@tarojs/components'; -import { Loading, Card, Button } from '@nutui/nutui-react-taro'; -import { Success, Failure, Tips, User } from '@nutui/icons-react-taro'; +import { Button } from '@nutui/nutui-react-taro'; import Taro, { useRouter } from '@tarojs/taro'; import { confirmQRLogin } from '@/api/passport/qr-login'; import { loginByOpenId } from '@/api/passport/wx-login'; @@ -321,13 +320,6 @@ const QRConfirmPage: React.FC = () => { } }; - /** - * 手动确认登录(主动扫码场景) - */ - const handleManualConfirm = () => { - handleConfirmLogin(); - }; - /** * 取消登录 */ @@ -545,7 +537,7 @@ const QRConfirmPage: React.FC = () => { WebkitTextFillColor: 'transparent', backgroundClip: 'text', marginBottom: '8px', - }}>WebSopy + }}>websopy {/* 标语 */} { {/* 登录卡片 */} - - {/* 提示图标 */} - - - 📱 - - + {/**/} + {/* /!* 提示图标 *!/*/} + {/* */} + {/* */} + {/* 📱*/} + {/* */} + {/* */} - {/* 标题 */} - 授权登录 + {/* /!* 标题 *!/*/} + {/* 授权登录*/} - {/* 描述 */} - 点击下方按钮,使用微信手机号快速登录 - + {/* /!* 描述 *!/*/} + {/* 点击下方按钮,使用微信手机号快速登录*/} + {/**/} {/* 主按钮 - 渐变发光按钮 */} { ); }; - // 渲染状态图标 - const renderStatusIcon = () => { - if (loading || authLoading) return ( - - - - - - ); - - if (confirmed) return ( - - - - - - ); - - if (error && !needAuth) return ( - - - - - - ); - - if (needAuth) { - // 需要授权时显示授权页面 - return renderAuthPage(); - } - - return ( - - - - - - ); - }; - - // 获取标题 - const getTitle = () => { - if (loading || authLoading) return '正在处理...'; - if (confirmed) return '登录确认成功'; - if (needAuth) return ''; // 授权页面有自己的标题 - if (error) return '登录确认失败'; - return loginMethod === 'url' ? '扫码登录确认' : '确认登录'; - }; - - // 获取描述 - const getDescription = () => { - if (loading) return '请稍候,正在为您确认登录'; - if (authLoading) return '正在授权登录...'; - if (confirmed) return '您已成功确认登录,网页端将自动登录'; - if (needAuth) return ''; // 授权页面有自己的描述 - if (error) return error; - if (loginMethod === 'url') { - return '检测到登录请求,是否确认登录?'; - } - const displayName = userInfo?.nickname || userInfo?.username || '当前用户'; - return `确认使用 ${displayName} 登录网页端?`; - }; - - // 渲染操作按钮 - const renderActions = () => { - // 需要授权登录时,按钮在授权页面内部渲染 - if (needAuth) { - return null; - } - - if (loading) { - return ( - - 确认中... - - ); - } - - if (confirmed) { - return ( - - 完成 - - ); - } - - if (error) { - return ( - - - 重试 - - - 扫码其他二维码 - - - 取消 - - - ); - } - - if (loginMethod === 'scan') { - return ( - - - 确认登录 - - - 取消 - - - ); - } - - return ( - - 确认登录 - - ); - }; // 如果是授权页面,直接返回授权页面 - if (needAuth) { - return renderAuthPage(); - } + return renderAuthPage(); - return ( - - - {/* Logo/品牌区域 */} - - - 🔐 - - WebSoft Platform - - - {/* 主要内容卡片 */} - - - {/* 状态图标 */} - {renderStatusIcon()} - - {/* 标题 */} - {getTitle() && ( - - {getTitle()} - - )} - - {/* 描述 */} - {getDescription() && ( - - {getDescription()} - - )} - - {/* 用户信息 */} - {!loading && !confirmed && !error && !needAuth && userInfo && ( - - - {userInfo.avatar ? ( - - ) : ( - - - - )} - - - {userInfo.nickname || userInfo.username || '用户'} - - - ID: {userInfo.userId} - - - - - )} - - {/* Token 信息 */} - {token && !loading && !confirmed && !needAuth && ( - - - 登录令牌:{token.substring(0, 20)}...{token.substring(token.length - 10)} - - - )} - - {/* 操作按钮 */} - {renderActions()} - - - - {/* 安全提示 */} - {!needAuth && ( - - - - - - - 安全提示 - - - 请确认这是您本人的登录操作。如果不是,请点击取消并检查账户安全。 - - - - - - )} - - {/* 底部说明 */} - - - 如有问题,请联系管理员 - - - - - ); }; export default QRConfirmPage;