forked from gxwebsoft/mp-10550
refactor(components): 优化多个组件的样式和功能
-调整 AdminPanel 组件的样式,移除 max-h-[70vh] 类 - 更新 Header组件的参数类型 - 在 QRLoginButton 组件中添加日志输出 - 重构 qr-login 页面的导航栏,目前已被注释掉
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Header from './Header';
|
||||
import BestSellers from './BestSellers';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import {useShareAppMessage} from "@tarojs/taro"
|
||||
import {useEffect, useState} from "react";
|
||||
import {getShopInfo, loginByOpenId} from "@/api/layout";
|
||||
@@ -242,32 +243,32 @@ function Home() {
|
||||
// 如果还在加载中,显示加载页面
|
||||
if (pageLoading) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50 p-4">
|
||||
<div className="text-center">
|
||||
<div className="mb-6">
|
||||
<div className="animate-spin rounded-full h-16 w-16 border-b-2 border-blue-500 mx-auto"></div>
|
||||
</div>
|
||||
<div className="text-lg text-gray-700 mb-4">加载中...</div>
|
||||
<div className="text-sm text-gray-500 mb-6 space-y-1">
|
||||
<div>站点信息: {initStatus.shopInfo ? '✅ 完成' : '⏳ 加载中'}</div>
|
||||
<div>用户授权: {initStatus.userAuth ? '✅ 完成' : '⏳ 检查中'}</div>
|
||||
<div>用户登录: {initStatus.userLogin ? '✅ 完成' : '⏳ 登录中'}</div>
|
||||
</div>
|
||||
<View className="flex flex-col items-center justify-center min-h-screen bg-gray-50 p-4">
|
||||
<View className="text-center">
|
||||
<View className="mb-6">
|
||||
<View className="animate-spin rounded-full h-16 w-16 border-b-2 border-blue-500 mx-auto"></View>
|
||||
</View>
|
||||
<View className="text-lg text-gray-700 mb-4">加载中...</View>
|
||||
<View className="text-sm text-gray-500 mb-6 space-y-1">
|
||||
<Text>站点信息: {initStatus.shopInfo ? '✅ 完成' : '⏳ 加载中'}</Text>
|
||||
<Text>用户授权: {initStatus.userAuth ? '✅ 完成' : '⏳ 检查中'}</Text>
|
||||
<Text>用户登录: {initStatus.userLogin ? '✅ 完成' : '⏳ 登录中'}</Text>
|
||||
</View>
|
||||
|
||||
{/* 如果加载时间过长,显示帮助按钮 */}
|
||||
<div className="space-y-3">
|
||||
<button
|
||||
<View className="space-y-3">
|
||||
<View
|
||||
className="px-4 py-2 bg-blue-500 text-white rounded-lg text-sm"
|
||||
onClick={() => showNetworkDiagnosis(BaseUrl)}
|
||||
>
|
||||
网络诊断
|
||||
</button>
|
||||
<div className="text-xs text-gray-400">
|
||||
</View>
|
||||
<View className="text-xs text-gray-400">
|
||||
如果长时间无响应,请点击网络诊断
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import { NavBar, Card, Divider, Button } from '@nutui/nutui-react-taro';
|
||||
import { ArrowLeft, Scan, Success, Failure, Tips } from '@nutui/icons-react-taro';
|
||||
import { Card, Divider, Button } from '@nutui/nutui-react-taro';
|
||||
import { Scan, Success, Failure, Tips } from '@nutui/icons-react-taro';
|
||||
import Taro from '@tarojs/taro';
|
||||
import QRLoginScanner from '@/components/QRLoginScanner';
|
||||
import { useUser } from '@/hooks/useUser';
|
||||
@@ -49,9 +49,9 @@ const QRLoginPage: React.FC = () => {
|
||||
};
|
||||
|
||||
// 返回上一页
|
||||
const handleBack = () => {
|
||||
Taro.navigateBack();
|
||||
};
|
||||
// const handleBack = () => {
|
||||
// Taro.navigateBack();
|
||||
// };
|
||||
|
||||
// 清除历史记录
|
||||
const clearHistory = () => {
|
||||
@@ -65,16 +65,16 @@ const QRLoginPage: React.FC = () => {
|
||||
return (
|
||||
<View className="qr-login-page min-h-screen bg-gray-50">
|
||||
{/* 导航栏 */}
|
||||
<NavBar
|
||||
title="扫码登录"
|
||||
leftShow
|
||||
onBackClick={handleBack}
|
||||
leftText={<ArrowLeft />}
|
||||
className="bg-white"
|
||||
/>
|
||||
{/*<NavBar*/}
|
||||
{/* title="扫码登录"*/}
|
||||
{/* leftShow*/}
|
||||
{/* onBackClick={handleBack}*/}
|
||||
{/* leftText={<ArrowLeft />}*/}
|
||||
{/* className="bg-white"*/}
|
||||
{/*/>*/}
|
||||
|
||||
{/* 主要内容 */}
|
||||
<View className="p-4 space-y-4">
|
||||
<View className="p-4">
|
||||
{/* 用户信息卡片 */}
|
||||
<Card className="bg-white rounded-lg shadow-sm">
|
||||
<View className="p-4">
|
||||
@@ -109,7 +109,7 @@ const QRLoginPage: React.FC = () => {
|
||||
<Tips className="text-orange-500 mr-2" />
|
||||
<Text className="font-medium text-gray-800">使用说明</Text>
|
||||
</View>
|
||||
<View className="space-y-2 text-sm text-gray-600">
|
||||
<View className="text-sm text-gray-600">
|
||||
<Text className="block">1. 在电脑或其他设备上打开网页端登录页面</Text>
|
||||
<Text className="block">2. 点击"扫码登录"按钮,显示登录二维码</Text>
|
||||
<Text className="block">3. 使用此功能扫描二维码即可快速登录</Text>
|
||||
@@ -134,7 +134,7 @@ const QRLoginPage: React.FC = () => {
|
||||
</Button>
|
||||
</View>
|
||||
|
||||
<View className="space-y-3">
|
||||
<View>
|
||||
{loginHistory.map((record, index) => (
|
||||
<View key={record.id}>
|
||||
<View className="flex items-center justify-between">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {Button} from '@nutui/nutui-react-taro'
|
||||
import {Avatar, Tag} from '@nutui/nutui-react-taro'
|
||||
import {View, Text} from '@tarojs/components'
|
||||
import {Scan} from '@nutui/icons-react-taro';
|
||||
import {getUserInfo, getWxOpenId} from '@/api/layout';
|
||||
import Taro from '@tarojs/taro';
|
||||
import {useEffect, useState, forwardRef, useImperativeHandle} from "react";
|
||||
@@ -26,6 +25,7 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
||||
|
||||
// 扫码登录Hook
|
||||
const { startScan, isLoading: isScanLoading } = useQRLogin();
|
||||
console.log(isScanLoading,'>isScanLoading>>>>')
|
||||
|
||||
// 管理员模式Hook
|
||||
const { isAdminMode, toggleAdminMode } = useAdminMode();
|
||||
@@ -189,6 +189,8 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
||||
}
|
||||
};
|
||||
|
||||
console.log(handleQRLogin,'handleQRLogin()')
|
||||
|
||||
// 打开管理员面板
|
||||
const handleOpenAdminPanel = () => {
|
||||
setShowAdminPanel(true);
|
||||
|
||||
Reference in New Issue
Block a user