refactor(dealer): 移除未使用的导入和代码
- 移除了未使用的 Button 组件导入 - 移除了未使用的 gradientUtils 导入 - 移除了未使用的 error 和 refresh 变量 - 注释掉了
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, {useState, useEffect} from 'react'
|
import React, {useState, useEffect} from 'react'
|
||||||
import {View, Text} from '@tarojs/components'
|
import {View, Text} from '@tarojs/components'
|
||||||
import {ConfigProvider, Button, Grid, Avatar} from '@nutui/nutui-react-taro'
|
import {ConfigProvider, Grid, Avatar} from '@nutui/nutui-react-taro'
|
||||||
import {
|
import {
|
||||||
User,
|
User,
|
||||||
Shopping,
|
Shopping,
|
||||||
@@ -11,16 +11,14 @@ import {
|
|||||||
} from '@nutui/icons-react-taro'
|
} from '@nutui/icons-react-taro'
|
||||||
import {useDealerUser} from '@/hooks/useDealerUser'
|
import {useDealerUser} from '@/hooks/useDealerUser'
|
||||||
import {useThemeStyles} from '@/hooks/useTheme'
|
import {useThemeStyles} from '@/hooks/useTheme'
|
||||||
import {businessGradients, cardGradients, gradientUtils} from '@/styles/gradients'
|
import {businessGradients, cardGradients} from '@/styles/gradients'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import {getShopDealerRefereeByUserId} from "@/api/shop/shopDealerReferee";
|
import {getShopDealerRefereeByUserId} from "@/api/shop/shopDealerReferee";
|
||||||
import {ShopDealerUser} from "@/api/shop/shopDealerUser/model";
|
import {ShopDealerUser} from "@/api/shop/shopDealerUser/model";
|
||||||
|
|
||||||
const DealerIndex: React.FC = () => {
|
const DealerIndex: React.FC = () => {
|
||||||
const {
|
const {
|
||||||
dealerUser,
|
dealerUser
|
||||||
error,
|
|
||||||
refresh,
|
|
||||||
} = useDealerUser()
|
} = useDealerUser()
|
||||||
const [dealer, setDealer] = useState<ShopDealerUser>()
|
const [dealer, setDealer] = useState<ShopDealerUser>()
|
||||||
|
|
||||||
@@ -45,16 +43,16 @@ const DealerIndex: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户主题
|
// 获取用户主题
|
||||||
const userTheme = gradientUtils.getThemeByUserId(dealerUser?.userId)
|
// const userTheme = gradientUtils.getThemeByUserId(dealerUser?.userId)
|
||||||
|
|
||||||
// 获取渐变背景
|
// 获取渐变背景
|
||||||
const getGradientBackground = (themeColor?: string) => {
|
// const getGradientBackground = (themeColor?: string) => {
|
||||||
if (themeColor) {
|
// if (themeColor) {
|
||||||
const darkerColor = gradientUtils.adjustColorBrightness(themeColor, -30)
|
// const darkerColor = gradientUtils.adjustColorBrightness(themeColor, -30)
|
||||||
return gradientUtils.createGradient(themeColor, darkerColor)
|
// return gradientUtils.createGradient(themeColor, darkerColor)
|
||||||
}
|
// }
|
||||||
return userTheme.background
|
// return userTheme.background
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// 初始化当前用户名称
|
// 初始化当前用户名称
|
||||||
@@ -65,20 +63,20 @@ const DealerIndex: React.FC = () => {
|
|||||||
}, [dealerUser])
|
}, [dealerUser])
|
||||||
|
|
||||||
|
|
||||||
console.log(getGradientBackground(), 'getGradientBackground()')
|
// console.log(getGradientBackground(), 'getGradientBackground()')
|
||||||
|
//
|
||||||
if (error) {
|
// if (error) {
|
||||||
return (
|
// return (
|
||||||
<View className="p-4">
|
// <View className="p-4">
|
||||||
<View className="bg-red-50 border border-red-200 rounded-lg p-4 mb-4">
|
// <View className="bg-red-50 border border-red-200 rounded-lg p-4 mb-4">
|
||||||
<Text className="text-red-600">{error}</Text>
|
// <Text className="text-red-600">{error}</Text>
|
||||||
</View>
|
// </View>
|
||||||
<Button type="primary" onClick={refresh}>
|
// <Button type="primary" onClick={refresh}>
|
||||||
重试
|
// 重试
|
||||||
</Button>
|
// </Button>
|
||||||
</View>
|
// </View>
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="bg-gray-100 min-h-screen">
|
<View className="bg-gray-100 min-h-screen">
|
||||||
|
|||||||
Reference in New Issue
Block a user