panhui %!s(int64=5) %!d(string=hai) anos
pai
achega
dddfccbecf
Modificáronse 3 ficheiros con 56 adicións e 46 borrados
  1. 35 29
      app.json
  2. 2 2
      navigation/BottomTabNavigator.js
  3. 19 15
      screens/HomeScreen.js

+ 35 - 29
app.json

@@ -1,31 +1,37 @@
 {
 {
-    "expo": {
-        "name": "叮咚外卖协作平台",
-        "slug": "dingdongHelp",
-        "platforms": ["ios", "android", "web"],
-        "version": "1.0.0",
-        "orientation": "portrait",
-        "icon": "./assets/images/icon.png",
-        "scheme": "myapp",
-        "splash": {
-            "image": "./assets/images/splash.png",
-            "resizeMode": "contain",
-            "backgroundColor": "#ffffff"
-        },
-        "updates": {
-            "fallbackToCacheTimeout": 0
-        },
-        "assetBundlePatterns": ["**/*"],
-        "ios": {
-            "supportsTablet": true
-        },
-        "web": {
-            "favicon": "./assets/images/favicon.png"
-        },
-        "android": {
-            "package": "com.izouma.izouma",
-            "versionCode": 1
-        },
-        "description": ""
-    }
+  "expo": {
+    "name": "叮咚外卖协作平台",
+    "slug": "dingdongHelp",
+    "platforms": [
+      "ios",
+      "android",
+      "web"
+    ],
+    "version": "1.0.0",
+    "orientation": "portrait",
+    "icon": "./assets/images/icon.png",
+    "scheme": "myapp",
+    "splash": {
+      "image": "./assets/images/splash.png",
+      "resizeMode": "contain",
+      "backgroundColor": "#ffffff"
+    },
+    "updates": {
+      "fallbackToCacheTimeout": 0
+    },
+    "assetBundlePatterns": [
+      "**/*"
+    ],
+    "ios": {
+      "supportsTablet": true
+    },
+    "web": {
+      "favicon": "./assets/images/favicon.png"
+    },
+    "android": {
+      "package": "com.izouma.izouma",
+      "versionCode": 1
+    },
+    "description": ""
+  }
 }
 }

+ 2 - 2
navigation/BottomTabNavigator.js

@@ -20,7 +20,7 @@ export default function BottomTabNavigator({ navigation, route }) {
                 name='Home'
                 name='Home'
                 component={HomeScreen}
                 component={HomeScreen}
                 options={{
                 options={{
-                    title: "用户",
+                    title: "叮咚外卖协助平台用户协作",
                     tabBarIcon: ({ focused }) => (
                     tabBarIcon: ({ focused }) => (
                         <TabBarIcon focused={focused} name='md-code-working' />
                         <TabBarIcon focused={focused} name='md-code-working' />
                     ),
                     ),
@@ -30,7 +30,7 @@ export default function BottomTabNavigator({ navigation, route }) {
                 name='Links'
                 name='Links'
                 component={LinksScreen}
                 component={LinksScreen}
                 options={{
                 options={{
-                    title: "骑手",
+                    title: "叮咚外卖协助平台骑手协作",
                     tabBarIcon: ({ focused }) => (
                     tabBarIcon: ({ focused }) => (
                         <TabBarIcon focused={focused} name='md-book' />
                         <TabBarIcon focused={focused} name='md-book' />
                     ),
                     ),

+ 19 - 15
screens/HomeScreen.js

@@ -32,24 +32,24 @@ export default function HomeScreen() {
         });
         });
 
 
         axiosInstance.interceptors.request.use(
         axiosInstance.interceptors.request.use(
-            (config) => {
+            config => {
                 config.headers = config.headers || {};
                 config.headers = config.headers || {};
                 if (token) {
                 if (token) {
                     config.headers["Authorization"] = "Bearer " + token;
                     config.headers["Authorization"] = "Bearer " + token;
                 }
                 }
                 return config;
                 return config;
             },
             },
-            (error) => {
+            error => {
                 return Promise.reject(error);
                 return Promise.reject(error);
             }
             }
         );
         );
 
 
         axiosInstance.interceptors.response.use(
         axiosInstance.interceptors.response.use(
-            (response) => {
+            response => {
                 setError("");
                 setError("");
                 return response.data;
                 return response.data;
             },
             },
-            (error) => {
+            error => {
                 setError(error.response.data.error);
                 setError(error.response.data.error);
                 return Promise.reject(error.response.data);
                 return Promise.reject(error.response.data);
             }
             }
@@ -59,13 +59,13 @@ export default function HomeScreen() {
 
 
     const chooseGoods = React.useMemo(() => {
     const chooseGoods = React.useMemo(() => {
         if (selectGoodsId) {
         if (selectGoodsId) {
-            return goods.find((item) => {
+            return goods.find(item => {
                 return item.id == selectGoodsId;
                 return item.id == selectGoodsId;
             });
             });
         } else {
         } else {
             return {};
             return {};
         }
         }
-    }, [selectGoodsId]);
+    }, [selectGoodsId, goods]);
 
 
     useFocusEffect(
     useFocusEffect(
         React.useCallback(() => {
         React.useCallback(() => {
@@ -76,14 +76,14 @@ export default function HomeScreen() {
                 .post("/auth/login", data, {
                 .post("/auth/login", data, {
                     withCredentials: true,
                     withCredentials: true,
                 })
                 })
-                .then((res) => {
+                .then(res => {
                     setToken(res);
                     setToken(res);
                 });
                 });
         }, [])
         }, [])
     );
     );
 
 
     const GoodsInfos = () => {
     const GoodsInfos = () => {
-        return goods.map((item) => (
+        return goods.map(item => (
             <Picker.Item
             <Picker.Item
                 label={item.name + "-" + item.merchantId}
                 label={item.name + "-" + item.merchantId}
                 value={item.id}
                 value={item.id}
@@ -92,13 +92,17 @@ export default function HomeScreen() {
         ));
         ));
     };
     };
 
 
+     
+
     React.useEffect(() => {
     React.useEffect(() => {
         if (token) {
         if (token) {
             console.log(token);
             console.log(token);
-            axiosInstance.get("/goods/all").then((res) => {
-                console.log(res.content);
-                setGoods(res.content);
-            });
+            axiosInstance
+                .get("/goods/all?size=999&sort=id,desc")
+                .then(res => {
+                    console.log(res.content);
+                    setGoods(res.content);
+                });
         }
         }
     }, [token, check]);
     }, [token, check]);
 
 
@@ -128,7 +132,7 @@ export default function HomeScreen() {
                                     selectGoodsId +
                                     selectGoodsId +
                                     "&pass=true"
                                     "&pass=true"
                             )
                             )
-                            .then((res) => {
+                            .then(res => {
                                 changeCheck(!check);
                                 changeCheck(!check);
                             });
                             });
                     }}
                     }}
@@ -148,7 +152,7 @@ export default function HomeScreen() {
                             .post("/shoppingCart/cart", data, {
                             .post("/shoppingCart/cart", data, {
                                 withCredentials: true,
                                 withCredentials: true,
                             })
                             })
-                            .then((res) => {
+                            .then(res => {
                                 setCartId(res.id);
                                 setCartId(res.id);
                             });
                             });
                     }}
                     }}
@@ -166,7 +170,7 @@ export default function HomeScreen() {
                             .post("/orderInfo/order", data, {
                             .post("/orderInfo/order", data, {
                                 withCredentials: true,
                                 withCredentials: true,
                             })
                             })
-                            .then((res) => {
+                            .then(res => {
                                 setOrderId(res.id);
                                 setOrderId(res.id);
                             });
                             });
                     }}
                     }}