```
feat(components): 调整 QRLoginButton 默认属性并优化用户卡片布局 - 修改 QRLoginButton 组件的默认 type 为 'default',size为 'small' - 在 UserCard 组件中注释掉 QRLoginButton 的引入和使用- 使用 Space 组件优化用户卡片中的按钮布局 - 替换原有条件渲染逻辑,统一使用按钮展示“扫码核销”功能 - 样式微调与代码格式化```
This commit is contained in:
@@ -28,8 +28,8 @@ export interface QRLoginButtonProps {
|
|||||||
* 扫码登录按钮组件
|
* 扫码登录按钮组件
|
||||||
*/
|
*/
|
||||||
const QRLoginButton: React.FC<QRLoginButtonProps> = ({
|
const QRLoginButton: React.FC<QRLoginButtonProps> = ({
|
||||||
type = 'primary',
|
type = 'default',
|
||||||
size = 'normal',
|
size = 'small',
|
||||||
text = '扫码登录',
|
text = '扫码登录',
|
||||||
showIcon = true,
|
showIcon = true,
|
||||||
onSuccess,
|
onSuccess,
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ const Header = (props: any) => {
|
|||||||
<TriangleDown className={'text-white'} size={9}/>
|
<TriangleDown className={'text-white'} size={9}/>
|
||||||
</View>
|
</View>
|
||||||
)}>
|
)}>
|
||||||
|
{/*<QRLoginButton />*/}
|
||||||
</NavBar>
|
</NavBar>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
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, Space} from '@nutui/nutui-react-taro'
|
||||||
import {View, Text, Image} from '@tarojs/components'
|
import {View, Text, Image} from '@tarojs/components'
|
||||||
import {Scan} from '@nutui/icons-react-taro';
|
|
||||||
import {getUserInfo, getWxOpenId} from '@/api/layout';
|
import {getUserInfo, getWxOpenId} from '@/api/layout';
|
||||||
|
import {Scan} from '@nutui/icons-react-taro';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import {useEffect, useState, forwardRef, useImperativeHandle} from "react";
|
import {useEffect, useState, forwardRef, useImperativeHandle} from "react";
|
||||||
import {User} from "@/api/system/user/model";
|
import {User} from "@/api/system/user/model";
|
||||||
@@ -11,7 +11,7 @@ import {TenantId} from "@/config/app";
|
|||||||
import {useUser} from "@/hooks/useUser";
|
import {useUser} from "@/hooks/useUser";
|
||||||
import {useUserData} from "@/hooks/useUserData";
|
import {useUserData} from "@/hooks/useUserData";
|
||||||
import {getStoredInviteParams} from "@/utils/invite";
|
import {getStoredInviteParams} from "@/utils/invite";
|
||||||
import QRLoginButton from "@/components/QRLoginButton";
|
// import QRLoginButton from "@/components/QRLoginButton";
|
||||||
|
|
||||||
const UserCard = forwardRef<any, any>((_, ref) => {
|
const UserCard = forwardRef<any, any>((_, ref) => {
|
||||||
const {
|
const {
|
||||||
@@ -185,10 +185,14 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
|||||||
<View className={'flex items-center mx-4'}>
|
<View className={'flex items-center mx-4'}>
|
||||||
{
|
{
|
||||||
IsLogin ? (
|
IsLogin ? (
|
||||||
<Avatar size="large" src={userInfo?.avatar || 'https://oss.wsdns.cn/20250623/62f830b85edb4a7293b8948c25e6f987.jpeg'} shape="round"/>
|
<Avatar size="large"
|
||||||
|
src={userInfo?.avatar || 'https://oss.wsdns.cn/20250623/62f830b85edb4a7293b8948c25e6f987.jpeg'}
|
||||||
|
shape="round"/>
|
||||||
) : (
|
) : (
|
||||||
<Button className={'text-black'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
|
<Button className={'text-black'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
|
||||||
<Avatar size="large" src={userInfo?.avatar || 'https://oss.wsdns.cn/20250623/62f830b85edb4a7293b8948c25e6f987.jpeg'} shape="round"/>
|
<Avatar size="large"
|
||||||
|
src={userInfo?.avatar || 'https://oss.wsdns.cn/20250623/62f830b85edb4a7293b8948c25e6f987.jpeg'}
|
||||||
|
shape="round"/>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -205,11 +209,25 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
|||||||
) : ''}
|
) : ''}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{userInfo?.userId === 33738 &&
|
<Space style={{
|
||||||
<QRLoginButton />
|
marginTop: '30px',
|
||||||
}
|
marginRight: '10px'
|
||||||
{isAdmin() &&
|
}}>
|
||||||
<Scan className={'text-gray-900'} size={24} onClick={() => navTo('/user/store/verification', true)}/>}
|
{/*{userInfo?.userId === 33738 &&*/}
|
||||||
|
{/* <QRLoginButton/>*/}
|
||||||
|
{/*}*/}
|
||||||
|
{!isAdmin() &&
|
||||||
|
<Button
|
||||||
|
size={'small'}
|
||||||
|
onClick={() => navTo('/user/store/verification', true)}
|
||||||
|
>
|
||||||
|
<View className="flex items-center justify-center">
|
||||||
|
<Scan className="mr-1" />
|
||||||
|
扫码核销
|
||||||
|
</View>
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
</Space>
|
||||||
</View>
|
</View>
|
||||||
<View className={'flex justify-around mt-1'}>
|
<View className={'flex justify-around mt-1'}>
|
||||||
<View className={'item flex justify-center flex-col items-center'}
|
<View className={'item flex justify-center flex-col items-center'}
|
||||||
@@ -238,14 +256,14 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
|||||||
<View
|
<View
|
||||||
className="absolute top-0 right-0 overflow-hidden"
|
className="absolute top-0 right-0 overflow-hidden"
|
||||||
style={{
|
style={{
|
||||||
borderRadius:"0 0.75rem 0 0"
|
borderRadius: "0 0.75rem 0 0"
|
||||||
}}
|
}}
|
||||||
onClick={() => navTo('/user/profile/profile', true)}
|
onClick={() => navTo('/user/profile/profile', true)}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
src="https://oss.wsdns.cn/20250913/7c3de38b377344b89131aba40214f63f.png"
|
src="https://oss.wsdns.cn/20250913/7c3de38b377344b89131aba40214f63f.png"
|
||||||
style={{
|
style={{
|
||||||
width:"200rpx"
|
width: "200rpx"
|
||||||
}}
|
}}
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import {
|
|||||||
People,
|
People,
|
||||||
AfterSaleService,
|
AfterSaleService,
|
||||||
Logout,
|
Logout,
|
||||||
ShoppingAdd, ShoppingRemove, Service
|
ShoppingAdd,
|
||||||
|
Service
|
||||||
} from '@nutui/icons-react-taro'
|
} from '@nutui/icons-react-taro'
|
||||||
import {useUser} from "@/hooks/useUser";
|
import {useUser} from "@/hooks/useUser";
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ const UserCell = () => {
|
|||||||
</View>
|
</View>
|
||||||
</Grid.Item>
|
</Grid.Item>
|
||||||
|
|
||||||
<Grid.Item text={'管理中心'} onClick={() => navTo('/admin/index', true)}>
|
<Grid.Item text={'扫码登录'} onClick={() => navTo('/admin/index', true)}>
|
||||||
<View className="text-center">
|
<View className="text-center">
|
||||||
<View className="w-12 h-12 bg-red-50 rounded-xl flex items-center justify-center mx-auto mb-2">
|
<View className="w-12 h-12 bg-red-50 rounded-xl flex items-center justify-center mx-auto mb-2">
|
||||||
<AfterSaleService className={'text-red-500'} size="20"/>
|
<AfterSaleService className={'text-red-500'} size="20"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user