refactor(user): 优化用户权限检查和界面显示逻辑
- 移除邀请人ID表单项并注释相关代码 - 注释掉邀请信息检测成功提示弹窗功能 - 在开发、生产、测试环境中添加本地API调试配置选项 - 添加分销商角色权限检查,非分销商无法查看客户列表 - 使用useRef避免重复显示无权限提示 - 在客户列表页面添加权限验证和加载状态处理 - 移除用户卡片中的余额、积分、优惠券、礼品卡等显示组件 - 简化用户角色名称获取逻辑,优先使用用户角色数组第一个角色名称 - 优化用户信息加载和权限验证流程
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {Button} from '@nutui/nutui-react-taro'
|
||||
import {Avatar, Tag} from '@nutui/nutui-react-taro'
|
||||
import {View, Text} from '@tarojs/components'
|
||||
import {Avatar} from '@nutui/nutui-react-taro'
|
||||
import {View} from '@tarojs/components'
|
||||
import {Scan} from '@nutui/icons-react-taro';
|
||||
import {getWxOpenId} from '@/api/layout';
|
||||
import Taro from '@tarojs/taro';
|
||||
@@ -8,7 +8,6 @@ import {useEffect} from "react";
|
||||
import navTo from "@/utils/common";
|
||||
import {TenantId} from "@/config/app";
|
||||
import {useUser} from "@/hooks/useUser";
|
||||
import {useUserData} from "@/hooks/useUserData";
|
||||
|
||||
function UserCard() {
|
||||
const {
|
||||
@@ -17,10 +16,8 @@ function UserCard() {
|
||||
isLoggedIn,
|
||||
loginUser,
|
||||
fetchUserInfo,
|
||||
getDisplayName,
|
||||
getRoleName
|
||||
getDisplayName
|
||||
} = useUser();
|
||||
const {data} = useUserData();
|
||||
|
||||
useEffect(() => {
|
||||
// Taro.getSetting:获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。
|
||||
@@ -180,12 +177,10 @@ function UserCard() {
|
||||
<View className={'user-info flex flex-col px-2'}>
|
||||
<View className={'py-1 text-black font-bold max-w-28'}>{getDisplayName()}</View>
|
||||
{isLoggedIn ? (
|
||||
<View className={'grade text-xs py-1'}>
|
||||
<Tag type="success" round>
|
||||
<Text className={'p-1'}>
|
||||
{getRoleName()}
|
||||
</Text>
|
||||
</Tag>
|
||||
<View className={'grade text-xs py-0'}>
|
||||
{/*<Text className={'p-1'}>*/}
|
||||
{/* {getRoleName()}*/}
|
||||
{/*</Text>*/}
|
||||
</View>
|
||||
) : ''}
|
||||
</View>
|
||||
@@ -198,27 +193,6 @@ function UserCard() {
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
{/*<View className={'flex justify-around mt-1'}>*/}
|
||||
{/* <View className={'item flex justify-center flex-col items-center'}*/}
|
||||
{/* onClick={() => navTo('/user/wallet/wallet', true)}>*/}
|
||||
{/* <Text className={'text-sm text-gray-500'}>余额</Text>*/}
|
||||
{/* <Text className={'text-xl'}>{data?.balance || '0.00'}</Text>*/}
|
||||
{/* </View>*/}
|
||||
{/* <View className={'item flex justify-center flex-col items-center'}>*/}
|
||||
{/* <Text className={'text-sm text-gray-500'}>积分</Text>*/}
|
||||
{/* <Text className={'text-xl'}>{data?.points || 0}</Text>*/}
|
||||
{/* </View>*/}
|
||||
{/* <View className={'item flex justify-center flex-col items-center'}*/}
|
||||
{/* onClick={() => navTo('/user/coupon/index', true)}>*/}
|
||||
{/* <Text className={'text-sm text-gray-500'}>优惠券</Text>*/}
|
||||
{/* <Text className={'text-xl'}>{data?.coupons || 0}</Text>*/}
|
||||
{/* </View>*/}
|
||||
{/* <View className={'item flex justify-center flex-col items-center'}*/}
|
||||
{/* onClick={() => navTo('/user/gift/index', true)}>*/}
|
||||
{/* <Text className={'text-sm text-gray-500'}>礼品卡</Text>*/}
|
||||
{/* <Text className={'text-xl'}>{data?.giftCards || 0}</Text>*/}
|
||||
{/* </View>*/}
|
||||
{/*</View>*/}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user