Browse Source

safety

master
fmk 3 years ago
parent
commit
6201ef03a4
  1. 11
      lib/login/login_page.dart
  2. 6
      lib/retrofit/min_api.dart
  3. 5
      lib/retrofit/retrofit_api.dart
  4. 9
      lib/store/store_order.dart

11
lib/login/login_page.dart

@ -83,6 +83,7 @@ class _MyLoginPageState extends State<LoginPage> 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<LoginPage> with TickerProviderStateMixin {
if ((width / screenWidth) < rota) {
rota = (screenWidth * 1.04) / width;
}
if (mounted)
setState(() {});
if (mounted) setState(() {});
}));
}
@ -308,8 +308,10 @@ class _MyLoginPageState extends State<LoginPage> 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,7 +381,6 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
try {
buildImageInfo(this.context);
} catch (ex) {}

6
lib/retrofit/min_api.dart

@ -97,16 +97,12 @@ abstract class MinApiService {
}
static void p(String msg) {
//String的length是字符数量不是字节数量所以为了防止中文字符过多
// 4*1024MAX字节打印长度改为1000字符数
int maxStrLength = 900;
//1000
while (msg.length > maxStrLength) {
debugPrint(msg.substring(0, maxStrLength));
msg = msg.substring(maxStrLength);
}
//
print(msg);
debugPrint(msg);
}
}

5
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();

9
lib/store/store_order.dart

@ -65,13 +65,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
),
];
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<StoreOrderPage>
});
}
///
queryStoreInfo() async {
final SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@ -95,6 +95,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
context: context,
token: value.getString('token'),
);
minLogin();
BaseData baseData = await apiService
.queryStoreInfo(widget.arguments["id"])
.catchError((error) {

Loading…
Cancel
Save