daxu0403 %!s(int64=7) %!d(string=hai) anos
pai
achega
5e40053244

BIN=BIN
android/.gradle/4.10.2/fileHashes/fileHashes.bin


BIN=BIN
android/.gradle/4.10.2/fileHashes/fileHashes.lock


BIN=BIN
android/.gradle/4.10.2/taskHistory/taskHistory.bin


BIN=BIN
android/.gradle/4.10.2/taskHistory/taskHistory.lock


BIN=BIN
android/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 1 - 1
lib/login_page.dart

@@ -57,7 +57,6 @@ class _LoginPageState extends State < LoginPage > {
                         setState(() {
                           phone = value;
                         });
-                        print(phone);
                       },
                     ),
                   ),
@@ -114,6 +113,7 @@ class _LoginPageState extends State < LoginPage > {
                           setKey('token', resp.data.token);
                           setKey('phone',phone);
                           setKey('password',password);
+                          setKey('nickName',resp.data.nickName);
                           Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
                             return HomePage();
                           }));

+ 32 - 8
lib/pages/my_page.dart

@@ -2,9 +2,11 @@ import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'my_page/revise_password_page.dart';
 import 'package:flutter_picker/flutter_picker.dart';
-import 'dart:convert';
 import '../showDialog.dart';
 import '../login_page.dart';
+import '../util/api.dart';
+import '../util/models.dart';
+import '../util/session.dart';
 
 class MyPage extends StatefulWidget {
   final Widget child;
@@ -20,15 +22,38 @@ class MyPage extends StatefulWidget {
 class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
 
   bool check = false;
+  String _siteName = "请选择站点";
+  List<String> stationList = [];
+  Station stationObj;
+  String name='物流';
   @override
   bool get wantKeepAlive => true;
-  String _siteName = "请选择站点";
-
+  
   @override
   void initState() {
     // TODO: implement initState
     super.initState();
+    getStationList().then((resp){
+      if(resp.success && resp.code==1){
+        stationObj = resp;
+        List<String> tempList = [];
+        for(int i=0;i<stationObj.data.length;i++){
+          tempList.add(stationObj.data[i].name.toString());
+        }
+        getKey('nickName').then((value){
+          setState(() {
+            stationList = tempList;
+            name = value;
+        });
+        });
+        setState(() {
+            stationList = tempList;
+        });
+      }else{
 
+      }
+      
+    });
   }
 
   @override
@@ -75,7 +100,7 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
 
             )
           ),
-          Center(child: Text('Alisa Lin', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(255, 255, 255, 1)), ), )
+          Center(child: Text(name, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(255, 255, 255, 1)), ), )
         ],
       ),
     );
@@ -158,7 +183,7 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
   }
   showPickerModal(BuildContext context) {
     new Picker(
-      adapter: PickerDataAdapter < String > (pickerdata: new JsonDecoder().convert('["回龙观","草桥","丰台"]')),
+      adapter: PickerDataAdapter < String > (pickerdata: stationList),
       height: ScreenUtil.getInstance().setHeight(450),
       confirmText: '确定',
       confirmTextStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(64, 98, 254, 1)),
@@ -170,11 +195,10 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
       changeToFirst: true,
       hideHeader: false,
       onConfirm: (Picker picker, List value) {
-        print(value.toString());
-        print(picker.adapter);
         setState(() {
-          _siteName = picker.adapter.text + '站点';
+          _siteName = stationObj.data[value[0]].name;
         });
+        setKey('stationId', stationObj.data[value[0]].id.toString());
       }
     ).showModal(this.context); //_scaffoldKey.currentState);
   }

+ 3 - 1
lib/pages/my_page/revise_password_page.dart

@@ -69,7 +69,9 @@ class _RevisePasswordPageState extends State < RevisePasswordPage > {
                    getKey('phone').then((value){
                        print(value);
                    });
-                 
+                    getKey('s').then((value){
+                      print(value);
+                    });
                   },
                   )
                   

+ 4 - 0
lib/pages/order_taking_page.dart

@@ -4,6 +4,7 @@ import 'package:url_launcher/url_launcher.dart';
 import '../util/api.dart';
 import '../util/models.dart';
 import '../showDialog.dart';
+import '../util/session.dart';
 
 class OrderTakingPage extends StatefulWidget {
 
@@ -266,6 +267,9 @@ class _OrderCardContainerState extends State < OrderCardContainer > with SingleT
               ),
             ),
             onTap: () {
+              getKey('stationId').then((value){
+                print(value);
+              });
               showDialog < Null > (
                 context: context, //BuildContext对象
                 barrierDismissible: false,

+ 75 - 65
lib/util/api.dart

@@ -1,72 +1,82 @@
 import 'request.dart';
 import 'models.dart';
 
-
-Future login(phone,passwrod) async{
-  var response =await Http().post('app/uzer/logistics/phone_login',data:{"phone":phone,"password":passwrod});
-  var loginResp =Login.fromJson(response);
+//登录接口
+Future login(phone, passwrod) async {
+  var response = await Http().post('app/uzer/logistics/phone_login', data: {
+    "phone": phone,
+    "password": passwrod
+  });
+  var loginResp = Login.fromJson(response);
   return loginResp;
 }
 
-Future getOrderList()async{
+//获取接单列表
+Future getOrderList() async {
   //var response = await Http().get("query",data: {"name":"haha"});
-    var resp= {
-      "items":[
-        {
-          "id":1,
-          "orderNo":1111,
-          "createTime":"2019/02/11 14:23",
-          "startAddress":"朝阳门大阳汽贸",
-          "endAddress":"香河汽修厂",
-          "itemName":"汽车轮胎",
-          "itemNo":3,
-          "sendPhone":"010-8788 6890",
-          "sendAddress":"北京市朝阳区朝阳门外大街28号",
-          "getPhone":"010-6734 3426",
-          "getAddress":"河北省廊坊市香河县东大街29号院18栋"
-        },
-       {
-          "id":2,
-          "orderNo":2222,
-          "createTime":"2019/02/11 14:23",
-          "startAddress":"香河汽修厂",
-          "endAddress":"朝阳门大阳汽贸",
-          "itemName":"汽车零件",
-          "itemNo":99,
-          "sendPhone":"010-8788 6890",
-          "sendAddress":"河北省廊坊市香河县东大街29号院18栋",
-          "getPhone":"010-6734 3426",
-          "getAddress":"北京市朝阳区朝阳门外大街28号"
-        },
-       {
-          "id":2,
-          "orderNo":2222,
-          "createTime":"2019/02/11 14:23",
-          "startAddress":"香河汽修厂",
-          "endAddress":"朝阳门大阳汽贸",
-          "itemName":"汽车零件",
-          "itemNo":99,
-          "sendPhone":"010-8788 6890",
-          "sendAddress":"河北省廊坊市香河县东大街29号院18栋",
-          "getPhone":"010-6734 3426",
-          "getAddress":"北京市朝阳区朝阳门外大街28号"
-        },{
-          "id":2,
-          "orderNo":2222,
-          "createTime":"2019/02/11 14:23",
-          "startAddress":"香河汽修厂",
-          "endAddress":"朝阳门大阳汽贸",
-          "itemName":"汽车零件",
-          "itemNo":99,
-          "sendPhone":"010-8788 6890",
-          "sendAddress":"河北省廊坊市香河县东大街29号院18栋",
-          "getPhone":"010-6734 3426",
-          "getAddress":"北京市朝阳区朝阳门外大街28号"
-        },
-        ],
-      "hasNextPage":true
-      };
-    var orderList =OrderListObj.fromJson(resp);
-    print("获取了OrderList");
-    return orderList;
-  }
+  var resp = {
+    "items": [{
+        "id": 1,
+        "orderNo": 1111,
+        "createTime": "2019/02/11 14:23",
+        "startAddress": "朝阳门大阳汽贸",
+        "endAddress": "香河汽修厂",
+        "itemName": "汽车轮胎",
+        "itemNo": 3,
+        "sendPhone": "010-8788 6890",
+        "sendAddress": "北京市朝阳区朝阳门外大街28号",
+        "getPhone": "010-6734 3426",
+        "getAddress": "河北省廊坊市香河县东大街29号院18栋"
+      },
+      {
+        "id": 2,
+        "orderNo": 2222,
+        "createTime": "2019/02/11 14:23",
+        "startAddress": "香河汽修厂",
+        "endAddress": "朝阳门大阳汽贸",
+        "itemName": "汽车零件",
+        "itemNo": 99,
+        "sendPhone": "010-8788 6890",
+        "sendAddress": "河北省廊坊市香河县东大街29号院18栋",
+        "getPhone": "010-6734 3426",
+        "getAddress": "北京市朝阳区朝阳门外大街28号"
+      },
+      {
+        "id": 2,
+        "orderNo": 2222,
+        "createTime": "2019/02/11 14:23",
+        "startAddress": "香河汽修厂",
+        "endAddress": "朝阳门大阳汽贸",
+        "itemName": "汽车零件",
+        "itemNo": 99,
+        "sendPhone": "010-8788 6890",
+        "sendAddress": "河北省廊坊市香河县东大街29号院18栋",
+        "getPhone": "010-6734 3426",
+        "getAddress": "北京市朝阳区朝阳门外大街28号"
+      }, {
+        "id": 2,
+        "orderNo": 2222,
+        "createTime": "2019/02/11 14:23",
+        "startAddress": "香河汽修厂",
+        "endAddress": "朝阳门大阳汽贸",
+        "itemName": "汽车零件",
+        "itemNo": 99,
+        "sendPhone": "010-8788 6890",
+        "sendAddress": "河北省廊坊市香河县东大街29号院18栋",
+        "getPhone": "010-6734 3426",
+        "getAddress": "北京市朝阳区朝阳门外大街28号"
+      },
+    ],
+    "hasNextPage": true
+  };
+  var orderList = OrderListObj.fromJson(resp);
+  print("获取了OrderList");
+  return orderList;
+}
+
+//获取所以站点
+Future getStationList() async{
+  var response = await Http().get('app/station/station_list');
+  var stationList = Station.fromJson(response);
+  return stationList;
+}

+ 1 - 1
lib/util/config.dart

@@ -1,5 +1,5 @@
 class Config{
-  String baseUrl = "http://39.105.182.68:8866/";
+  String baseUrl = "https://logistics.5fire.tech/";
   int connectTimeout = 5000;
   int receiveTimeout = 5000;
 }

+ 45 - 1
lib/util/models.dart

@@ -1,3 +1,4 @@
+//登录
 class Login{
   bool success;
   int code;
@@ -46,6 +47,7 @@ class LoginMap {
   }
 }
 
+//接单页列表
 class OrderListObj {
   List < OrderList > orderList;
   bool hasNextPage;
@@ -65,7 +67,6 @@ class OrderListObj {
   }
 
 }
-
 class OrderList {
   int id;
   int orderNo;
@@ -108,4 +109,47 @@ class OrderList {
       getAddress: json['getAddress']
     );
   }
+}
+
+//获取站点
+class Station{
+  bool success;
+  int code;
+  String msg;
+  List<StationList> data;
+
+  Station({this.success,this.code,this.msg,this.data});
+
+  factory Station.fromJson(Map<String,dynamic> json){
+    List list = json['data'] as List;
+    print(list);
+    List<StationList> tempList = list.map((i)=>StationList.fromJson(i)).toList();
+    print(tempList);
+    return Station(
+      success: json['success'],
+      code:json['code'],
+      msg:json['msg'],
+      data:tempList
+    );
+  }
+}
+
+class StationList{
+  String code;
+  int id;
+  String name;
+  int stationStatus;
+  int status;
+
+  StationList({this.code,this.id,this.name,this.stationStatus,this.status});
+
+  factory StationList.fromJson(Map<String,dynamic> json){
+    return StationList(
+      code:json['code'],
+      id:json['id'],
+      name:json['name'],
+      stationStatus: json['stationStatus'],
+      status: json['status']
+    );
+  }
 }

+ 13 - 4
lib/util/request.dart

@@ -1,6 +1,7 @@
 import 'package:dio/dio.dart';
 
 import 'config.dart'; //用于配置公用常量
+import 'session.dart';
 
 class Http {
   static Http instance;
@@ -22,17 +23,23 @@ class Http {
       baseUrl: _config.baseUrl,
       connectTimeout: _config.connectTimeout,
       receiveTimeout: _config.receiveTimeout,
-      headers: {}
+      headers: {
+        
+      }
     );
 
     _dio = new Dio(_options);
     // //发送请求拦截处理,例如:添加token使用
     _dio.interceptors.add(InterceptorsWrapper(
       onRequest: (RequestOptions options) {
-        // options.headers = {
-        //   token:'123'
-        // };
+        getKey('token').then((value){
+          if(value!=null){
+            options.headers = {
+              "token":value
+            };
+          }
         return options; //continue  
+        });
       },
       onResponse: (Response response) {
        return response;
@@ -68,6 +75,7 @@ class Http {
         print('get请求发生错误:$e');
       }
     }
+    print(response);
     return response.data;
   }
 
@@ -95,6 +103,7 @@ class Http {
         print('post请求发生错误:$e');
       }
     }
+    print(response);
     return response.data;
   }
 }