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