refactor(components): 优化多个组件的样式和功能
-调整 AdminPanel 组件的样式,移除 max-h-[70vh] 类 - 更新 Header组件的参数类型 - 在 QRLoginButton 组件中添加日志输出 - 重构 qr-login 页面的导航栏,目前已被注释掉
This commit is contained in:
@@ -1,89 +0,0 @@
|
|||||||
.admin-panel {
|
|
||||||
/* 面板动画 */
|
|
||||||
.admin-panel-content {
|
|
||||||
animation: slideUp 0.3s ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 网格布局优化 */
|
|
||||||
.admin-feature-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
gap: 12px;
|
|
||||||
|
|
||||||
@media (max-width: 375px) {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 功能卡片样式 */
|
|
||||||
.admin-feature-card {
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
transform: scale(0.95);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 图标容器 */
|
|
||||||
.admin-feature-icon {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 8px;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 模式切换按钮动画 */
|
|
||||||
.mode-toggle-btn {
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
transform: scale(0.95);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 管理面板按钮 */
|
|
||||||
.admin-panel-btn {
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
transform: scale(0.95);
|
|
||||||
background-color: rgba(59, 130, 246, 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 滑入动画 */
|
|
||||||
@keyframes slideUp {
|
|
||||||
from {
|
|
||||||
transform: translateY(100%);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: translateY(0);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 遮罩层动画 */
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-panel-overlay {
|
|
||||||
animation: fadeIn 0.3s ease-out;
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ import { View, Text } from '@tarojs/components';
|
|||||||
import { Button } from '@nutui/nutui-react-taro';
|
import { Button } from '@nutui/nutui-react-taro';
|
||||||
import { Scan, Setting, User, Shop } from '@nutui/icons-react-taro';
|
import { Scan, Setting, User, Shop } from '@nutui/icons-react-taro';
|
||||||
import navTo from '@/utils/common';
|
import navTo from '@/utils/common';
|
||||||
import './AdminPanel.scss';
|
|
||||||
|
|
||||||
export interface AdminPanelProps {
|
export interface AdminPanelProps {
|
||||||
/** 是否显示面板 */
|
/** 是否显示面板 */
|
||||||
@@ -95,7 +94,7 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 面板内容 */}
|
{/* 面板内容 */}
|
||||||
<View className="fixed bottom-0 left-0 right-0 bg-white rounded-t-3xl z-50 max-h-[70vh] overflow-hidden">
|
<View className="fixed bottom-0 left-0 right-0 bg-white rounded-t-3xl z-50 overflow-hidden">
|
||||||
{/* 面板头部 */}
|
{/* 面板头部 */}
|
||||||
<View className="flex items-center justify-between p-4 border-b border-gray-100">
|
<View className="flex items-center justify-between p-4 border-b border-gray-100">
|
||||||
<View className="flex items-center">
|
<View className="flex items-center">
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
filter: grayscale(0.3);
|
/* filter: grayscale(0.3); 小程序不支持filter属性 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.coupon-left {
|
.coupon-left {
|
||||||
@@ -199,11 +199,7 @@
|
|||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
letter-spacing: -0.5px;
|
letter-spacing: -0.5px;
|
||||||
|
|
||||||
/* 添加文字渐变效果 */
|
/* 文字渐变效果在小程序中不支持,使用纯色替代 */
|
||||||
background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
-webkit-text-fill-color: transparent;
|
|
||||||
background-clip: text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.coupon-validity {
|
.coupon-validity {
|
||||||
@@ -309,7 +305,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
backdrop-filter: blur(2px);
|
/* backdrop-filter: blur(2px); 小程序不支持backdrop-filter属性 */
|
||||||
|
|
||||||
.status-badge {
|
.status-badge {
|
||||||
background: rgba(0, 0, 0, 0.7);
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {NavBar} from '@nutui/nutui-react-taro'
|
|||||||
import {ArrowLeft} from '@nutui/icons-react-taro'
|
import {ArrowLeft} from '@nutui/icons-react-taro'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
function Header(props) {
|
function Header(props: any) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar
|
<NavBar
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text } from '@tarojs/components';
|
|
||||||
import { Button } from '@nutui/nutui-react-taro';
|
import { Button } from '@nutui/nutui-react-taro';
|
||||||
import { Scan } from '@nutui/icons-react-taro';
|
import { Scan } from '@nutui/icons-react-taro';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
@@ -65,6 +64,7 @@ const QRLoginButton: React.FC<QRLoginButtonProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(onSuccess,'onSuccess')
|
||||||
const disabled = !canScan() || isLoading;
|
const disabled = !canScan() || isLoading;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import BestSellers from './BestSellers';
|
import BestSellers from './BestSellers';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
|
import { View, Text } from '@tarojs/components';
|
||||||
import {useShareAppMessage} from "@tarojs/taro"
|
import {useShareAppMessage} from "@tarojs/taro"
|
||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {getShopInfo, loginByOpenId} from "@/api/layout";
|
import {getShopInfo, loginByOpenId} from "@/api/layout";
|
||||||
@@ -242,32 +243,32 @@ function Home() {
|
|||||||
// 如果还在加载中,显示加载页面
|
// 如果还在加载中,显示加载页面
|
||||||
if (pageLoading) {
|
if (pageLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50 p-4">
|
<View className="flex flex-col items-center justify-center min-h-screen bg-gray-50 p-4">
|
||||||
<div className="text-center">
|
<View className="text-center">
|
||||||
<div className="mb-6">
|
<View className="mb-6">
|
||||||
<div className="animate-spin rounded-full h-16 w-16 border-b-2 border-blue-500 mx-auto"></div>
|
<View className="animate-spin rounded-full h-16 w-16 border-b-2 border-blue-500 mx-auto"></View>
|
||||||
</div>
|
</View>
|
||||||
<div className="text-lg text-gray-700 mb-4">加载中...</div>
|
<View className="text-lg text-gray-700 mb-4">加载中...</View>
|
||||||
<div className="text-sm text-gray-500 mb-6 space-y-1">
|
<View className="text-sm text-gray-500 mb-6 space-y-1">
|
||||||
<div>站点信息: {initStatus.shopInfo ? '✅ 完成' : '⏳ 加载中'}</div>
|
<Text>站点信息: {initStatus.shopInfo ? '✅ 完成' : '⏳ 加载中'}</Text>
|
||||||
<div>用户授权: {initStatus.userAuth ? '✅ 完成' : '⏳ 检查中'}</div>
|
<Text>用户授权: {initStatus.userAuth ? '✅ 完成' : '⏳ 检查中'}</Text>
|
||||||
<div>用户登录: {initStatus.userLogin ? '✅ 完成' : '⏳ 登录中'}</div>
|
<Text>用户登录: {initStatus.userLogin ? '✅ 完成' : '⏳ 登录中'}</Text>
|
||||||
</div>
|
</View>
|
||||||
|
|
||||||
{/* 如果加载时间过长,显示帮助按钮 */}
|
{/* 如果加载时间过长,显示帮助按钮 */}
|
||||||
<div className="space-y-3">
|
<View className="space-y-3">
|
||||||
<button
|
<View
|
||||||
className="px-4 py-2 bg-blue-500 text-white rounded-lg text-sm"
|
className="px-4 py-2 bg-blue-500 text-white rounded-lg text-sm"
|
||||||
onClick={() => showNetworkDiagnosis(BaseUrl)}
|
onClick={() => showNetworkDiagnosis(BaseUrl)}
|
||||||
>
|
>
|
||||||
网络诊断
|
网络诊断
|
||||||
</button>
|
</View>
|
||||||
<div className="text-xs text-gray-400">
|
<View className="text-xs text-gray-400">
|
||||||
如果长时间无响应,请点击网络诊断
|
如果长时间无响应,请点击网络诊断
|
||||||
</div>
|
</View>
|
||||||
</div>
|
</View>
|
||||||
</div>
|
</View>
|
||||||
</div>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { View, Text } from '@tarojs/components';
|
import { View, Text } from '@tarojs/components';
|
||||||
import { NavBar, Card, Divider, Button } from '@nutui/nutui-react-taro';
|
import { Card, Divider, Button } from '@nutui/nutui-react-taro';
|
||||||
import { ArrowLeft, Scan, Success, Failure, Tips } from '@nutui/icons-react-taro';
|
import { Scan, Success, Failure, Tips } from '@nutui/icons-react-taro';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import QRLoginScanner from '@/components/QRLoginScanner';
|
import QRLoginScanner from '@/components/QRLoginScanner';
|
||||||
import { useUser } from '@/hooks/useUser';
|
import { useUser } from '@/hooks/useUser';
|
||||||
@@ -49,9 +49,9 @@ const QRLoginPage: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
const handleBack = () => {
|
// const handleBack = () => {
|
||||||
Taro.navigateBack();
|
// Taro.navigateBack();
|
||||||
};
|
// };
|
||||||
|
|
||||||
// 清除历史记录
|
// 清除历史记录
|
||||||
const clearHistory = () => {
|
const clearHistory = () => {
|
||||||
@@ -65,16 +65,16 @@ const QRLoginPage: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<View className="qr-login-page min-h-screen bg-gray-50">
|
<View className="qr-login-page min-h-screen bg-gray-50">
|
||||||
{/* 导航栏 */}
|
{/* 导航栏 */}
|
||||||
<NavBar
|
{/*<NavBar*/}
|
||||||
title="扫码登录"
|
{/* title="扫码登录"*/}
|
||||||
leftShow
|
{/* leftShow*/}
|
||||||
onBackClick={handleBack}
|
{/* onBackClick={handleBack}*/}
|
||||||
leftText={<ArrowLeft />}
|
{/* leftText={<ArrowLeft />}*/}
|
||||||
className="bg-white"
|
{/* className="bg-white"*/}
|
||||||
/>
|
{/*/>*/}
|
||||||
|
|
||||||
{/* 主要内容 */}
|
{/* 主要内容 */}
|
||||||
<View className="p-4 space-y-4">
|
<View className="p-4">
|
||||||
{/* 用户信息卡片 */}
|
{/* 用户信息卡片 */}
|
||||||
<Card className="bg-white rounded-lg shadow-sm">
|
<Card className="bg-white rounded-lg shadow-sm">
|
||||||
<View className="p-4">
|
<View className="p-4">
|
||||||
@@ -109,7 +109,7 @@ const QRLoginPage: React.FC = () => {
|
|||||||
<Tips className="text-orange-500 mr-2" />
|
<Tips className="text-orange-500 mr-2" />
|
||||||
<Text className="font-medium text-gray-800">使用说明</Text>
|
<Text className="font-medium text-gray-800">使用说明</Text>
|
||||||
</View>
|
</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">1. 在电脑或其他设备上打开网页端登录页面</Text>
|
||||||
<Text className="block">2. 点击"扫码登录"按钮,显示登录二维码</Text>
|
<Text className="block">2. 点击"扫码登录"按钮,显示登录二维码</Text>
|
||||||
<Text className="block">3. 使用此功能扫描二维码即可快速登录</Text>
|
<Text className="block">3. 使用此功能扫描二维码即可快速登录</Text>
|
||||||
@@ -134,7 +134,7 @@ const QRLoginPage: React.FC = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="space-y-3">
|
<View>
|
||||||
{loginHistory.map((record, index) => (
|
{loginHistory.map((record, index) => (
|
||||||
<View key={record.id}>
|
<View key={record.id}>
|
||||||
<View className="flex items-center justify-between">
|
<View className="flex items-center justify-between">
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import {Button} from '@nutui/nutui-react-taro'
|
import {Button} from '@nutui/nutui-react-taro'
|
||||||
import {Avatar, Tag} from '@nutui/nutui-react-taro'
|
import {Avatar, Tag} from '@nutui/nutui-react-taro'
|
||||||
import {View, Text} from '@tarojs/components'
|
import {View, Text} from '@tarojs/components'
|
||||||
import {Scan} from '@nutui/icons-react-taro';
|
|
||||||
import {getUserInfo, getWxOpenId} from '@/api/layout';
|
import {getUserInfo, getWxOpenId} from '@/api/layout';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import {useEffect, useState, forwardRef, useImperativeHandle} from "react";
|
import {useEffect, useState, forwardRef, useImperativeHandle} from "react";
|
||||||
@@ -26,6 +25,7 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
|||||||
|
|
||||||
// 扫码登录Hook
|
// 扫码登录Hook
|
||||||
const { startScan, isLoading: isScanLoading } = useQRLogin();
|
const { startScan, isLoading: isScanLoading } = useQRLogin();
|
||||||
|
console.log(isScanLoading,'>isScanLoading>>>>')
|
||||||
|
|
||||||
// 管理员模式Hook
|
// 管理员模式Hook
|
||||||
const { isAdminMode, toggleAdminMode } = useAdminMode();
|
const { isAdminMode, toggleAdminMode } = useAdminMode();
|
||||||
@@ -189,6 +189,8 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(handleQRLogin,'handleQRLogin()')
|
||||||
|
|
||||||
// 打开管理员面板
|
// 打开管理员面板
|
||||||
const handleOpenAdminPanel = () => {
|
const handleOpenAdminPanel = () => {
|
||||||
setShowAdminPanel(true);
|
setShowAdminPanel(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user