Browse Source

日常开发

林旭祥 3 days ago
parent
commit
617ec4178d
98 changed files with 127 additions and 66 deletions
  1. 98 45
      App.tsx
  2. 18 0
      package-lock.json
  3. 1 0
      package.json
  4. 2 4
      src/pages/Data/index.tsx
  5. 2 4
      src/pages/Match/index.tsx
  6. 2 4
      src/pages/Me/index.tsx
  7. 2 4
      src/pages/Play/index.tsx
  8. 2 4
      src/pages/Team/index.tsx
  9. BIN
      src/static/images/analysis/badminton.png
  10. BIN
      src/static/images/analysis/basketball.png
  11. BIN
      src/static/images/analysis/close.png
  12. BIN
      src/static/images/analysis/football.png
  13. BIN
      src/static/images/analysis/grade1.png
  14. BIN
      src/static/images/analysis/grade2.png
  15. BIN
      src/static/images/analysis/grade3.png
  16. BIN
      src/static/images/analysis/grade4.png
  17. BIN
      src/static/images/analysis/gymnastics.png
  18. BIN
      src/static/images/analysis/headPortrait.png
  19. BIN
      src/static/images/analysis/highknees.png
  20. BIN
      src/static/images/analysis/jump.png
  21. BIN
      src/static/images/analysis/jumpingjack.png
  22. BIN
      src/static/images/analysis/jumprope.png
  23. BIN
      src/static/images/analysis/lockClose.png
  24. BIN
      src/static/images/analysis/lockOpen.png
  25. BIN
      src/static/images/analysis/longjump.png
  26. BIN
      src/static/images/analysis/pingpong.png
  27. BIN
      src/static/images/analysis/pullUp.png
  28. BIN
      src/static/images/analysis/rankingIcon.png
  29. BIN
      src/static/images/analysis/resultIcon.png
  30. BIN
      src/static/images/analysis/run1000.png
  31. BIN
      src/static/images/analysis/run800.png
  32. BIN
      src/static/images/analysis/shotput.png
  33. BIN
      src/static/images/analysis/sidepullup.png
  34. BIN
      src/static/images/analysis/sitUp.png
  35. BIN
      src/static/images/analysis/skiprope.png
  36. BIN
      src/static/images/analysis/solidBall.png
  37. BIN
      src/static/images/analysis/swim.png
  38. BIN
      src/static/images/analysis/tennis.png
  39. BIN
      src/static/images/analysis/trijump.png
  40. BIN
      src/static/images/analysis/trops.png
  41. BIN
      src/static/images/analysis/verticaljump.png
  42. BIN
      src/static/images/analysis/volleyball.png
  43. BIN
      src/static/images/analysis/wushu.png
  44. BIN
      src/static/images/common/close.png
  45. 0 0
      src/static/images/common/data.png
  46. BIN
      src/static/images/common/data_active.png
  47. BIN
      src/static/images/common/loading.png
  48. BIN
      src/static/images/common/match.png
  49. BIN
      src/static/images/common/match_active.png
  50. BIN
      src/static/images/common/me.png
  51. BIN
      src/static/images/common/me_active.png
  52. BIN
      src/static/images/common/play.png
  53. BIN
      src/static/images/common/play_active.png
  54. BIN
      src/static/images/common/shine.png
  55. BIN
      src/static/images/common/team.png
  56. BIN
      src/static/images/common/team_active.png
  57. BIN
      src/static/images/home/back.png
  58. BIN
      src/static/images/home/btnbg1.png
  59. BIN
      src/static/images/home/btnbg1a.png
  60. BIN
      src/static/images/home/btnbg2.png
  61. BIN
      src/static/images/home/btnbg3.png
  62. BIN
      src/static/images/home/course.png
  63. BIN
      src/static/images/home/enter.png
  64. BIN
      src/static/images/home/pe.png
  65. BIN
      src/static/images/home/ranking.png
  66. BIN
      src/static/images/home/score.png
  67. BIN
      src/static/images/home/setbg.png
  68. BIN
      src/static/images/home/test.png
  69. BIN
      src/static/images/home/train.png
  70. BIN
      src/static/images/login/bg.png
  71. BIN
      src/static/images/login/btn.png
  72. BIN
      src/static/images/login/logo.png
  73. BIN
      src/static/images/login/xian.png
  74. BIN
      src/static/images/ranking/arrow.png
  75. BIN
      src/static/images/ranking/logo.png
  76. BIN
      src/static/images/ranking/mao1.png
  77. BIN
      src/static/images/ranking/mao2.png
  78. BIN
      src/static/images/ranking/mao3.png
  79. BIN
      src/static/images/ranking/noData.png
  80. BIN
      src/static/images/ranking/rankingBg.png
  81. BIN
      src/static/images/set/bug.png
  82. BIN
      src/static/images/set/camera.png
  83. BIN
      src/static/images/set/face.png
  84. BIN
      src/static/images/set/guanbi.png
  85. BIN
      src/static/images/set/guding.png
  86. BIN
      src/static/images/set/tuichu.png
  87. BIN
      src/static/images/set/zhuan.png
  88. BIN
      src/static/images/train/areabg1.png
  89. BIN
      src/static/images/train/areabg2.png
  90. BIN
      src/static/images/train/arrow.png
  91. BIN
      src/static/images/train/close.png
  92. BIN
      src/static/images/train/exitbg.png
  93. BIN
      src/static/images/train/greenbg.png
  94. BIN
      src/static/images/train/headbg.png
  95. BIN
      src/static/images/train/noImg.png
  96. BIN
      src/static/images/train/select.png
  97. BIN
      src/static/images/train/tanhao.png
  98. 0 1
      src/utils/index.ts

+ 98 - 45
App.tsx

@@ -1,6 +1,10 @@
 import React from 'react';
+import { Image } from 'react-native';
 import { NavigationContainer } from '@react-navigation/native';
 import { createNativeStackNavigator } from '@react-navigation/native-stack';
+import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
+
+// 页面组件
 import LoginScreen from './src/pages/Login';
 import TeamScreen from './src/pages/Team';
 import DataScreen from './src/pages/Data';
@@ -8,66 +12,114 @@ import PlayScreen from './src/pages/Play';
 import MatchScreen from './src/pages/Match';
 import MeScreen from './src/pages/Me';
 
+// 导入自定义图片(请替换为你的实际图片路径)
+import TeamIcon from './src/static/images/common/team.png';
+import TeamIconActive from './src/static/images/common/team_active.png';
+import DataIcon from './src/static/images/common/data.png';
+import DataIconActive from './src/static/images/common/data_active.png';
+import PlayIcon from './src/static/images/common/play.png';
+import PlayIconActive from './src/static/images/common/play_active.png';
+import MatchIcon from './src/static/images/common/match.png';
+import MatchIconActive from './src/static/images/common/match_active.png';
+import MeIcon from './src/static/images/common/me.png';
+import MeIconActive from './src/static/images/common/me_active.png';
+
 const Stack = createNativeStackNavigator();
+const Tab = createBottomTabNavigator();
+
+// 定义底部Tab导航
+function TabNavigator() {
+  return (
+    <Tab.Navigator
+      initialRouteName="Team"  // 设置默认显示Team页签
+      screenOptions={({ route }) => ({
+        tabBarIcon: ({ focused }) => {
+          if (route.name === 'Team') {
+            return (
+              <Image
+                source={focused ? TeamIconActive : TeamIcon}
+                style={{ width: 24, height: 24 }}
+                resizeMode="contain"
+              />
+            );
+          } else if (route.name === 'Data') {
+            return (
+              <Image
+                source={focused ? DataIconActive : DataIcon}
+                style={{ width: 24, height: 24 }}
+                resizeMode="contain"
+              />
+            );
+          } else if (route.name === 'Play') {
+            return (
+              <Image
+                source={focused ? PlayIconActive : PlayIcon}
+                style={{ width: 24, height: 24 }}
+                resizeMode="contain"
+              />
+            );
+          } else if (route.name === 'Match') {
+            return (
+              <Image
+                source={focused ? MatchIconActive : MatchIcon}
+                style={{ width: 24, height: 24 }}
+                resizeMode="contain"
+              />
+            );
+          } else if (route.name === 'Me') {
+            return (
+              <Image
+                source={focused ? MeIconActive : MeIcon}
+                style={{ width: 24, height: 24 }}
+                resizeMode="contain"
+              />
+            );
+          }
+          return null;
+        },
+        tabBarActiveTintColor: '#007AFF',
+        tabBarInactiveTintColor: '#999',
+        headerShown: false,
+        tabBarStyle: {
+          height: 58,
+          paddingBottom: 8,
+          paddingTop: 8,
+          backgroundColor: '#fff',
+          borderTopWidth: 0,
+          elevation: 5,
+          shadowColor: '#000',
+          shadowOffset: { width: 0, height: -2 },
+          shadowOpacity: 0.05,
+          shadowRadius: 5,
+        },
+      })}
+    >
+      <Tab.Screen name="Team" component={TeamScreen} options={{ title: '球队' }} />
+      <Tab.Screen name="Data" component={DataScreen} options={{ title: '数据' }} />
+      <Tab.Screen name="Play" component={PlayScreen} options={{ title: 'PLAY' }} />
+      <Tab.Screen name="Match" component={MatchScreen} options={{ title: '赛事' }} />
+      <Tab.Screen name="Me" component={MeScreen} options={{ title: '我的' }} />
+    </Tab.Navigator>
+  );
+}
 
 function App(): React.JSX.Element {
   return (
     <NavigationContainer>
-      <Stack.Navigator initialRouteName="Team">
+      <Stack.Navigator initialRouteName="MainTabs">
         <Stack.Screen
           name="Login"
           component={LoginScreen}
           options={{
-            title: '登录',
-            headerBackVisible: false,
-            headerShown: false,
-          }}
-        />
-        <Stack.Screen
-          name="Team"
-          component={TeamScreen}
-          options={{
-            title: '球队',
-            headerBackVisible: false,
-            headerShown: false,
-          }}
-        />
-
-        <Stack.Screen
-          name="Data"
-          component={DataScreen}
-          options={{
-            title: '数据',
-            headerBackVisible: false,
-            headerShown: false,
-          }}
-        />
-
-        <Stack.Screen
-          name="Play"
-          component={PlayScreen}
-          options={{
-            title: 'PLAY',
             headerBackVisible: false,
             headerShown: false,
           }}
         />
-
-        <Stack.Screen
-          name="Match"
-          component={MatchScreen}
-          options={{
-            title: '赛事',
-            headerBackVisible: false,
-            headerShown: false,
-          }}
-        />
-
+        
         <Stack.Screen
-          name="Me"
-          component={MeScreen}
+          name="MainTabs"
+          component={TabNavigator}
           options={{
-            title: '我的',
             headerBackVisible: false,
             headerShown: false,
           }}
@@ -78,3 +130,4 @@ function App(): React.JSX.Element {
 }
 
 export default App;
+    

+ 18 - 0
package-lock.json

@@ -9,6 +9,7 @@
       "version": "0.0.1",
       "dependencies": {
         "@react-native/new-app-screen": "0.81.0",
+        "@react-navigation/bottom-tabs": "^7.4.6",
         "@react-navigation/native": "^7.1.17",
         "@react-navigation/native-stack": "^7.3.25",
         "axios": "^1.11.0",
@@ -3217,6 +3218,23 @@
         }
       }
     },
+    "node_modules/@react-navigation/bottom-tabs": {
+      "version": "7.4.6",
+      "resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-7.4.6.tgz",
+      "integrity": "sha512-f4khxwcL70O5aKfZFbxyBo5RnzPFnBNSXmrrT7q9CRmvN4mHov9KFKGQ3H4xD5sLonsTBtyjvyvPfyEC4G7f+g==",
+      "license": "MIT",
+      "dependencies": {
+        "@react-navigation/elements": "^2.6.3",
+        "color": "^4.2.3"
+      },
+      "peerDependencies": {
+        "@react-navigation/native": "^7.1.17",
+        "react": ">= 18.2.0",
+        "react-native": "*",
+        "react-native-safe-area-context": ">= 4.0.0",
+        "react-native-screens": ">= 4.0.0"
+      }
+    },
     "node_modules/@react-navigation/core": {
       "version": "7.12.4",
       "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-7.12.4.tgz",

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
   },
   "dependencies": {
     "@react-native/new-app-screen": "0.81.0",
+    "@react-navigation/bottom-tabs": "^7.4.6",
     "@react-navigation/native": "^7.1.17",
     "@react-navigation/native-stack": "^7.3.25",
     "axios": "^1.11.0",

+ 2 - 4
src/pages/Data/index.tsx

@@ -1,7 +1,6 @@
 import React from 'react';
 import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
 import { useNavigation } from '@react-navigation/native';
-import TabScreen from '../../components/Tab';
 
 const DataScreen = () => {
   const navigation = useNavigation();
@@ -10,10 +9,9 @@ const DataScreen = () => {
   };
   return (
     <View style={styles.main}>
-      <View>
+      <Text>
 数据
-      </View>
-      <TabScreen></TabScreen>
+      </Text>
     </View>
   );
 };

+ 2 - 4
src/pages/Match/index.tsx

@@ -1,7 +1,6 @@
 import React from 'react';
 import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
 import { useNavigation } from '@react-navigation/native';
-import TabScreen from '../../components/Tab';
 
 const MatchScreen = () => {
   const navigation = useNavigation();
@@ -10,10 +9,9 @@ const MatchScreen = () => {
   };
   return (
     <View style={styles.main}>
-      <View>
+      <Text>
  赛事
-      </View>
-      <TabScreen></TabScreen>
+      </Text>
     </View>
   );
 };

+ 2 - 4
src/pages/Me/index.tsx

@@ -1,7 +1,6 @@
 import React from 'react';
 import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
 import { useNavigation } from '@react-navigation/native';
-import TabScreen from '../../components/Tab';
 
 const MeScreen = () => {
   const navigation = useNavigation();
@@ -10,10 +9,9 @@ const MeScreen = () => {
   };
   return (
     <View style={styles.main}>
-      <View>
+      <Text>
 我的
-      </View>
-      <TabScreen></TabScreen>
+      </Text>
     </View>
   );
 };

+ 2 - 4
src/pages/Play/index.tsx

@@ -1,7 +1,6 @@
 import React from 'react';
 import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
 import { useNavigation } from '@react-navigation/native';
-import TabScreen from '../../components/Tab';
 
 const PlayScreen = () => {
   const navigation = useNavigation();
@@ -10,10 +9,9 @@ const PlayScreen = () => {
   };
   return (
     <View style={styles.main}>
-      <View>
+      <Text>
 Play
-      </View>
-      <TabScreen></TabScreen>
+      </Text>
     </View>
   );
 };

+ 2 - 4
src/pages/Team/index.tsx

@@ -1,7 +1,6 @@
 import React from 'react';
 import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
 import { useNavigation } from '@react-navigation/native';
-import TabScreen from '../../components/Tab';
 
 const TeamScreen = () => {
   const navigation = useNavigation();
@@ -10,10 +9,9 @@ const TeamScreen = () => {
   };
   return (
     <View style={styles.main}>
-      <View>
+      <Text>
 球队
-      </View>
-      <TabScreen></TabScreen>
+      </Text>
     </View>
   );
 };

BIN
src/static/images/analysis/badminton.png


BIN
src/static/images/analysis/basketball.png


BIN
src/static/images/analysis/close.png


BIN
src/static/images/analysis/football.png


BIN
src/static/images/analysis/grade1.png


BIN
src/static/images/analysis/grade2.png


BIN
src/static/images/analysis/grade3.png


BIN
src/static/images/analysis/grade4.png


BIN
src/static/images/analysis/gymnastics.png


BIN
src/static/images/analysis/headPortrait.png


BIN
src/static/images/analysis/highknees.png


BIN
src/static/images/analysis/jump.png


BIN
src/static/images/analysis/jumpingjack.png


BIN
src/static/images/analysis/jumprope.png


BIN
src/static/images/analysis/lockClose.png


BIN
src/static/images/analysis/lockOpen.png


BIN
src/static/images/analysis/longjump.png


BIN
src/static/images/analysis/pingpong.png


BIN
src/static/images/analysis/pullUp.png


BIN
src/static/images/analysis/rankingIcon.png


BIN
src/static/images/analysis/resultIcon.png


BIN
src/static/images/analysis/run1000.png


BIN
src/static/images/analysis/run800.png


BIN
src/static/images/analysis/shotput.png


BIN
src/static/images/analysis/sidepullup.png


BIN
src/static/images/analysis/sitUp.png


BIN
src/static/images/analysis/skiprope.png


BIN
src/static/images/analysis/solidBall.png


BIN
src/static/images/analysis/swim.png


BIN
src/static/images/analysis/tennis.png


BIN
src/static/images/analysis/trijump.png


BIN
src/static/images/analysis/trops.png


BIN
src/static/images/analysis/verticaljump.png


BIN
src/static/images/analysis/volleyball.png


BIN
src/static/images/analysis/wushu.png


BIN
src/static/images/common/close.png


+ 0 - 0
src/static/images/common/icon.png → src/static/images/common/data.png


BIN
src/static/images/common/data_active.png


BIN
src/static/images/common/loading.png


BIN
src/static/images/common/match.png


BIN
src/static/images/common/match_active.png


BIN
src/static/images/common/me.png


BIN
src/static/images/common/me_active.png


BIN
src/static/images/common/play.png


BIN
src/static/images/common/play_active.png


BIN
src/static/images/common/shine.png


BIN
src/static/images/common/team.png


BIN
src/static/images/common/team_active.png


BIN
src/static/images/home/back.png


BIN
src/static/images/home/btnbg1.png


BIN
src/static/images/home/btnbg1a.png


BIN
src/static/images/home/btnbg2.png


BIN
src/static/images/home/btnbg3.png


BIN
src/static/images/home/course.png


BIN
src/static/images/home/enter.png


BIN
src/static/images/home/pe.png


BIN
src/static/images/home/ranking.png


BIN
src/static/images/home/score.png


BIN
src/static/images/home/setbg.png


BIN
src/static/images/home/test.png


BIN
src/static/images/home/train.png


BIN
src/static/images/login/bg.png


BIN
src/static/images/login/btn.png


BIN
src/static/images/login/logo.png


BIN
src/static/images/login/xian.png


BIN
src/static/images/ranking/arrow.png


BIN
src/static/images/ranking/logo.png


BIN
src/static/images/ranking/mao1.png


BIN
src/static/images/ranking/mao2.png


BIN
src/static/images/ranking/mao3.png


BIN
src/static/images/ranking/noData.png


BIN
src/static/images/ranking/rankingBg.png


BIN
src/static/images/set/bug.png


BIN
src/static/images/set/camera.png


BIN
src/static/images/set/face.png


BIN
src/static/images/set/guanbi.png


BIN
src/static/images/set/guding.png


BIN
src/static/images/set/tuichu.png


BIN
src/static/images/set/zhuan.png


BIN
src/static/images/train/areabg1.png


BIN
src/static/images/train/areabg2.png


BIN
src/static/images/train/arrow.png


BIN
src/static/images/train/close.png


BIN
src/static/images/train/exitbg.png


BIN
src/static/images/train/greenbg.png


BIN
src/static/images/train/headbg.png


BIN
src/static/images/train/noImg.png


BIN
src/static/images/train/select.png


BIN
src/static/images/train/tanhao.png


+ 0 - 1
src/utils/index.ts

@@ -1,5 +1,4 @@
 import dayjs from 'dayjs';
-import dataDictionary from './dataDictionary';
 
 let utils = {
   /**