|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Text,Image } from '@tarojs/components'
|
|
|
|
|
|
|
+import { View, Text, Image } from '@tarojs/components'
|
|
|
import './TabBar.scss'
|
|
import './TabBar.scss'
|
|
|
import Taro from '@tarojs/taro';
|
|
import Taro from '@tarojs/taro';
|
|
|
import { useState } from 'react';
|
|
import { useState } from 'react';
|
|
@@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
export default function Component(props: { index: number }) {
|
|
export default function Component(props: { index: number }) {
|
|
|
const common = useSelector((state: any) => state.common);
|
|
const common = useSelector((state: any) => state.common);
|
|
|
const [selIndex] = useState(props.index)
|
|
const [selIndex] = useState(props.index)
|
|
|
- const {t} = useTranslation()
|
|
|
|
|
|
|
+ const { t } = useTranslation()
|
|
|
function switchTab(index: number) {
|
|
function switchTab(index: number) {
|
|
|
switch (index) {
|
|
switch (index) {
|
|
|
case 0:
|
|
case 0:
|
|
@@ -43,27 +43,31 @@ export default function Component(props: { index: number }) {
|
|
|
break;
|
|
break;
|
|
|
case 4:
|
|
case 4:
|
|
|
Taro.switchTab({
|
|
Taro.switchTab({
|
|
|
- url: '/pages/food/Food'
|
|
|
|
|
|
|
+ url: '/pages/friend/friend'
|
|
|
})
|
|
})
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return <View className='tabbar'>
|
|
return <View className='tabbar'>
|
|
|
- <View style={{position:'absolute',left:0,top:0,width:rpxToPx(750)}}>
|
|
|
|
|
- <View className='border_footer_line'/>
|
|
|
|
|
|
|
+ <View style={{ position: 'absolute', left: 0, top: 0, width: rpxToPx(750) }}>
|
|
|
|
|
+ <View className='border_footer_line' />
|
|
|
</View>
|
|
</View>
|
|
|
<View className={selIndex == 0 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(0)}>
|
|
<View className={selIndex == 0 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(0)}>
|
|
|
- <Image className='tabbar-icon' src={selIndex == 0 ?require('@assets/_health/home_sel.png'):require('@assets/_health/home.png')}/>
|
|
|
|
|
- <View className={selIndex==0?'tabbar-item-text-sel':'tabbar-item-text'}>{t('health.today')}</View>
|
|
|
|
|
|
|
+ <Image className='tabbar-icon' src={selIndex == 0 ? require('@assets/_health/home_sel.png') : require('@assets/_health/home.png')} />
|
|
|
|
|
+ <View className={selIndex == 0 ? 'tabbar-item-text-sel' : 'tabbar-item-text'}>{t('health.today')}</View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className={selIndex == 4 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(4)}>
|
|
|
|
|
+ <Image className='tabbar-icon' src={selIndex == 4 ? require('@assets/_health/user_sel.png') : require('@assets/_health/user.png')} />
|
|
|
|
|
+ <View className={selIndex == 4 ? 'tabbar-item-text-sel' : 'tabbar-item-text'}>{t('health.friends')}</View>
|
|
|
</View>
|
|
</View>
|
|
|
<View className={selIndex == 1 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(1)}>
|
|
<View className={selIndex == 1 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(1)}>
|
|
|
- <Image className='tabbar-icon' src={selIndex == 1 ?require('@assets/_health/compass_sel.png'):require('@assets/_health/compass.png')}/>
|
|
|
|
|
- <View className={selIndex==1?'tabbar-item-text-sel':'tabbar-item-text'}>{t('health.discover')}</View>
|
|
|
|
|
|
|
+ <Image className='tabbar-icon' src={selIndex == 1 ? require('@assets/_health/compass_sel.png') : require('@assets/_health/compass.png')} />
|
|
|
|
|
+ <View className={selIndex == 1 ? 'tabbar-item-text-sel' : 'tabbar-item-text'}>{t('health.discover')}</View>
|
|
|
</View>
|
|
</View>
|
|
|
<View className={selIndex == 3 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(3)}>
|
|
<View className={selIndex == 3 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(3)}>
|
|
|
- <Image className='tabbar-icon' src={selIndex == 3 ?require('@assets/_health/user_sel.png'):require('@assets/_health/user.png')}/>
|
|
|
|
|
- <View className={selIndex==3?'tabbar-item-text-sel':'tabbar-item-text'}>{t('health.me')}</View>
|
|
|
|
|
|
|
+ <Image className='tabbar-icon' src={selIndex == 3 ? require('@assets/_health/user_sel.png') : require('@assets/_health/user.png')} />
|
|
|
|
|
+ <View className={selIndex == 3 ? 'tabbar-item-text-sel' : 'tabbar-item-text'}>{t('health.me')}</View>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|