Browse Source

修复一系列问题

iOS_cz 4 years ago
parent
commit
81ee499a59

+ 18 - 2
lib/internal/bbs/page/bbs_page.dart

@@ -105,8 +105,7 @@ class BbsPageState extends BasePageState<BbsPage, NewsListPresenter>
 
   getLocation() async {
     var helper = LocationHelper();
-
-    helper.getLocation((lat, lng, cityName, {provinceName}) {
+    helper.getLocation((lat, lng, cityName, {address, provinceName}) {
       if (cityName != null) {
         setState(() {
           _cityName = cityName;
@@ -122,6 +121,23 @@ class BbsPageState extends BasePageState<BbsPage, NewsListPresenter>
         isDelayAddress();
       }
     });
+
+    // helper.getLocation((lat, lng, cityName, { provinceName,a}}) {
+    //   if (cityName != null) {
+    //     setState(() {
+    //       _cityName = cityName;
+    //       _provinceName = provinceName;
+    //     });
+    //     helper.stopGettingLocation();
+    //   }
+
+    //   latitude = lat;
+    //   longitude = lng;
+
+    //   if (FlutterStars.SpUtil.getString(Constant.userId) != "-1") {
+    //     isDelayAddress();
+    //   }
+    // });
   }
 
   _initFluwx() async {

+ 1 - 1
lib/internal/bbs/page/hospital_page.dart

@@ -47,7 +47,7 @@ class HospitalPageState
 
     var helper = LocationHelper();
 
-    helper.getLocation((lat, lng, cityName, {provinceName}) {
+    helper.getLocation((lat, lng, cityName, {address, provinceName}) {
       if (cityName != null) {
         setState(() {
           _cityName = cityName;

+ 66 - 82
lib/internal/bbs/page/map_choicePoint.dart

@@ -62,13 +62,13 @@ class _MapChoicePointState extends State<MyHomePage>
   setlatlng() {
     var helper = LocationHelper();
 
-    helper
-        .getLocation((String lat, String lng, String cityName, {provinceName}) {
+    helper.getLocation((lat, lng, cityName, {address, provinceName}) {
       if (lat != null && lng != null) {
         helper.stopGettingLocation();
       }
       var latLng = LatLng(double.parse(lat), double.parse(lng));
       _amapController?.setCenterCoordinate(latLng);
+      showTost(latLng);
       // setState(() {});
       // NavigatorUtils.goBackWithParams(context, "$lng,$lat");
     });
@@ -287,86 +287,7 @@ class _MapChoicePointState extends State<MyHomePage>
                 print("//////////////");
                 print(coord.latitude);
                 print(coord.longitude);
-                String address;
-                String addressM;
-
-                /// 逆地理编码(坐标转地址)
-                ReGeocode reGeocodeList = await AmapSearch.searchReGeocode(
-                  coord,
-                );
-
-                // print(await reGeocodeList.toFutureString());
-                // print(await reGeocodeList.provinceName);
-
-                // print(await reGeocodeList.cityName);
-                // print(await reGeocodeList.districtName);
-
-                print("reGeocodeList.provinceName=================");
-                addressM = (await reGeocodeList.provinceName) +
-                    (await reGeocodeList.cityName) +
-                    (await reGeocodeList.districtName);
-                address = await reGeocodeList.formatAddress;
-                print(address);
-                print(address +
-                    "," +
-                    coord.latitude.toString() +
-                    "," +
-                    coord.longitude.toString());
-                if (_amapController != null) {
-                  //移除原来的点
-                  if (_markerSelect != null) {
-                    _markerSelect.remove();
-                  }
-                  if (_markerSeached != null) {
-                    _markerSeached.remove();
-                  }
-                  _markerSeached = await _amapController.addMarker(MarkerOption(
-                    latLng: coord,
-                  ));
-                  //画上新的点
-                  // _markerSelect = await _amapController.addMarker(MarkerOption(
-                  //     latLng: coord,
-                  //     iconUri: _imgUri,
-                  //     imageConfig: createLocalImageConfiguration(context),
-                  //     width: 64,
-                  //     height: 64,
-                  //     anchorV: 0.7,
-                  //     anchorU: 0.5));
-                  // widget.onChoicePoint(coord);
-                  showAlert(
-                    navigatorKey.currentState.overlay.context,
-                    "提示",
-                    "出诊地址为: $address",
-                    "确定",
-                    () {
-                      Navigator.of(navigatorKey.currentState.overlay.context)
-                        ..pop();
-                      if (context != null) {
-                        Navigator.of(navigatorKey.currentState.overlay.context)
-                          ..pop();
-                      }
-
-                      // setExtAddress(address+","+coord.latitude.toString()+","+coord.longitude.toString());
-                      String setAddress = address +
-                          "," +
-                          coord.latitude.toString() +
-                          "," +
-                          coord.longitude.toString();
-                      String setAddressMaster = addressM;
-                      if (widget.type == "1") {
-                        FastNotification.push("set_address", setAddress);
-                      } else if (widget.type == "2") {
-                        FastNotification.push(
-                            "set_address_master", setAddressMaster);
-                      }
-                    },
-                    txt2: "取消",
-                    onPre2: () {
-                      Navigator.of(navigatorKey.currentState.overlay.context)
-                        ..pop();
-                    },
-                  );
-                }
+                showTost(coord);
               },
               onMapMoveStart: (MapMove move) {},
               // 地图创建完成回调 (可选)
@@ -418,6 +339,69 @@ class _MapChoicePointState extends State<MyHomePage>
         ));
   }
 
+  showTost(coord) async {
+    String address;
+    String addressM;
+
+    /// 逆地理编码(坐标转地址)
+    ReGeocode reGeocodeList = await AmapSearch.searchReGeocode(
+      coord,
+    );
+
+    print("reGeocodeList.provinceName=================");
+    addressM = (await reGeocodeList.provinceName) +
+        (await reGeocodeList.cityName) +
+        (await reGeocodeList.districtName);
+    address = await reGeocodeList.formatAddress;
+    print(address);
+    print(address +
+        "," +
+        coord.latitude.toString() +
+        "," +
+        coord.longitude.toString());
+    if (_amapController != null) {
+      //移除原来的点
+      if (_markerSelect != null) {
+        _markerSelect.remove();
+      }
+      if (_markerSeached != null) {
+        _markerSeached.remove();
+      }
+      _markerSeached = await _amapController.addMarker(MarkerOption(
+        latLng: coord,
+      ));
+
+      showAlert(
+        navigatorKey.currentState.overlay.context,
+        "提示",
+        "出诊地址为: $address",
+        "确定",
+        () {
+          Navigator.of(navigatorKey.currentState.overlay.context)..pop();
+          if (context != null) {
+            Navigator.of(navigatorKey.currentState.overlay.context)..pop();
+          }
+
+          // setExtAddress(address+","+coord.latitude.toString()+","+coord.longitude.toString());
+          String setAddress = address +
+              "," +
+              coord.latitude.toString() +
+              "," +
+              coord.longitude.toString();
+          String setAddressMaster = addressM;
+          if (widget.type == "1") {
+            FastNotification.push("set_address", setAddress);
+          } else if (widget.type == "2") {
+            FastNotification.push("set_address_master", setAddressMaster);
+          }
+        },
+        txt2: "取消",
+        onPre2: () {
+          Navigator.of(navigatorKey.currentState.overlay.context)..pop();
+        },
+      );
+    }
+  }
   // void setExtAddress (String str)async{
   //   SharedPreferences prefs = await SharedPreferences.getInstance();
   //   prefs.setString("extAddress",str);

+ 9 - 10
lib/internal/lift/page/lift_map_page.dart

@@ -55,8 +55,7 @@ class LiftMapPageState extends State<LiftMapPage> {
   setlatlng() {
     var helper = LocationHelper();
 
-    helper
-        .getLocation((String lat, String lng, String cityName, {provinceName}) {
+    helper.getLocation((lat, lng, cityName, {address, provinceName}) {
       if (lat != null && lng != null) {
         helper.stopGettingLocation();
       }
@@ -116,16 +115,16 @@ class LiftMapPageState extends State<LiftMapPage> {
   }
 
   saveLatLng() async {
-    var helper = LocationHelper();
+    // var helper = LocationHelper();
 
-    helper
-        .getLocation((String lat, String lng, String cityName, {provinceName}) {
-      if (lat != null && lng != null) {
-        helper.stopGettingLocation();
-      }
+    // helper.getLocation((lat, lng, cityName, {address, provinceName}) {
+    //   if (lat != null && lng != null) {
+    //     helper.stopGettingLocation();
+    //   }
+    // });
 
-      NavigatorUtils.goBackWithParams(context, "$lng,$lat");
-    });
+    NavigatorUtils.goBackWithParams(
+        context, "${latLng.longitude},${latLng.latitude}");
   }
 
   @override

+ 2 - 2
lib/internal/maintenance/page/maintenance_submit_page.dart

@@ -92,7 +92,7 @@ class MaintenanceSubmitPageState extends State<MaintenanceSubmitPage>
 
   ///选择图片
   void selectPicker() {
-    _getImage(1);
+    _getImage(2);
 //    showDialog(
 //        context: context,
 //        builder: (BuildContext context) {
@@ -598,7 +598,7 @@ class MaintenanceSubmitPageState extends State<MaintenanceSubmitPage>
                                     "${MaintenanceRouter.viewImage}?edit=1&img=" +
                                         Uri.encodeComponent(images[index].path),
                                     (res) {
-                                  if (res == true) {
+                                  if (res == '删除') {
                                     images.removeAt(index);
                                     setState(() {});
                                   }

+ 1 - 1
lib/internal/maintenance/page/view_image_page.dart

@@ -32,7 +32,7 @@ class ViewImagePageState extends State<ViewImagePage> {
         "确定",
         () {
           Navigator.pop(context);
-          Navigator.pop(context, true);
+          Navigator.pop(context, '删除');
         },
         txt2: "取消",
         onPre2: () {

+ 1 - 0
lib/internal/team/page/team_auth_page.dart

@@ -174,6 +174,7 @@ class TeamCardPageState extends State<TeamAuthPage> {
               textColor: Colours.tip_text_black,
               highlightColor: Colors.transparent,
               onPressed: () {
+                
 //                uploadAuthData();
                 NavigatorUtils.push(context, TeamRouter.teamAuthUploadPage);
               },

+ 24 - 1
lib/internal/wode/page/personal_page.dart

@@ -264,7 +264,30 @@ class PersonalPageState extends State<PersonalPage>
                         title: "我的团队",
                         content: "${provider.user?.companyName ?? ""}",
                         onTap: () {
-                          NavigatorUtils.push(context, TeamRouter.teamCardPage);
+                          if (FlutterStars.SpUtil.getString(Constant.companyId)
+                                  .length ==
+                              0) {
+                            showAlert(
+                                context,
+                                "提示",
+                                "尚未加入团队,是否立即加入?",
+                                "确定",
+                                () {
+                                  NavigatorUtils.goBack(context);
+                                  // goToPage(TeamRouter.teamListPage);
+                                  NavigatorUtils.pushResult(
+                                      context, TeamRouter.teamListPage, (res) {
+                                    // countDoing();
+                                  });
+                                },
+                                txt2: "取消",
+                                onPre2: () {
+                                  NavigatorUtils.goBack(context);
+                                });
+                          } else {
+                            NavigatorUtils.push(
+                                context, TeamRouter.teamCardPage);
+                          }
                         },
                       ),
                       ClickItem(

+ 2 - 1
lib/utils/location_helper.dart

@@ -41,7 +41,8 @@ class LocationHelper {
   }
 
   void getLocation(
-      Function(String lat, String lng, String cityName)
+      Function(String lat, String lng, String cityName,
+              {String provinceName, String address})
           onLocationChanged) async {
     if (await requestPermission()) {
       _locationPlugin.startLocation();