diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 63c291b1..10072fce 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -83,6 +83,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { double offsetBtn = 0; double rota = 1.04; Image image; + buildImageInfo(BuildContext context) async { image = Image.asset("assets/image/laoban.png"); double screenWidth = MediaQuery.of(this.context).size.width; @@ -94,8 +95,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { if ((width / screenWidth) < rota) { rota = (screenWidth * 1.04) / width; } - if (mounted) - setState(() {}); + if (mounted) setState(() {}); })); } @@ -129,9 +129,9 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { changeAlpha = (changeAlpha > 255 ? 255 : changeAlpha); changeAlpha = (changeAlpha < 0 ? 0 : changeAlpha); alpha = (initAlpha + - scrollController.offset / - (height - chaHeight) * - (255 - initAlpha)) + scrollController.offset / + (height - chaHeight) * + (255 - initAlpha)) .toInt(); alpha = (alpha > 255 ? 255 : alpha); alpha = (alpha < 0 ? 0 : alpha); @@ -308,8 +308,10 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { saveUserJson(value.data); eventBus.fire(EventType(3)); - Navigator.of(context) - .pushNamedAndRemoveUntil('/router/main_page', (route) => false); + Navigator.of(context).pushNamedAndRemoveUntil( + '/router/main_page', + (route) => false, + ); } else { SmartDialog.showToast("${value.msg}", alignment: Alignment.center); } @@ -379,10 +381,9 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { - try { buildImageInfo(this.context); - } catch(ex) {} + } catch (ex) {} if (animatedContainer != null && !animatedContainer.isAnimating) { animatedContainer.forward(); diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index d062a919..64514542 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -97,16 +97,12 @@ abstract class MinApiService { } static void p(String msg) { - //因为String的length是字符数量不是字节数量所以为了防止中文字符过多, - // 把4*1024的MAX字节打印长度改为1000字符数 int maxStrLength = 900; - //大于1000时 while (msg.length > maxStrLength) { debugPrint(msg.substring(0, maxStrLength)); msg = msg.substring(maxStrLength); } - //剩余部分 - print(msg); + debugPrint(msg); } - + } \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 24a4ee97..47280305 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -89,7 +89,10 @@ abstract class ApiService { EasyLoading.dismiss(); } debugPrint("code = ${response.statusCode}"); - p(jsonEncode(response.data)); + // p(jsonEncode(response.data)); + + debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length); + Map map = response.data; if (map["code"] != 0) { EasyLoading.dismiss(); diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index c5dd59d4..bbe9a348 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -65,13 +65,12 @@ class _StoreOrderPage extends State ), ]; - minLogin(); - queryStoreInfo(); } + /// 小程序登录 minLogin() { - apiService.minLogin(storeInfo.id) + apiService.minLogin(widget.arguments["id"]) .catchError((onError){}).then((baseData) { if (baseData != null && baseData.isSuccess) { UserEntity userEntity = UserEntity.fromJson(baseData.data); @@ -88,6 +87,7 @@ class _StoreOrderPage extends State }); } + /// 查询店铺信息 queryStoreInfo() async { final SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -95,6 +95,9 @@ class _StoreOrderPage extends State context: context, token: value.getString('token'), ); + + minLogin(); + BaseData baseData = await apiService .queryStoreInfo(widget.arguments["id"]) .catchError((error) {