From efa8d14913f5f7ba5f36bdc15ada78a6c671085a Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Wed, 3 Jul 2024 14:02:31 +0800 Subject: [PATCH] no message --- .../lib/page/login_page/login_logic.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/making_school_asignment_app/lib/page/login_page/login_logic.dart b/making_school_asignment_app/lib/page/login_page/login_logic.dart index aaf07ee..4fb79a5 100644 --- a/making_school_asignment_app/lib/page/login_page/login_logic.dart +++ b/making_school_asignment_app/lib/page/login_page/login_logic.dart @@ -1,3 +1,4 @@ +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; @@ -22,8 +23,8 @@ class LoginLogic extends GetxController with RequestToolMixin { @override void onInit() { super.onInit(); - state.userNameController = TextEditingController(text: 'longyunfei')..addListener(userNameListener); - state.passwordController = TextEditingController(text: '123@abc'); + state.userNameController = TextEditingController()..addListener(userNameListener); + state.passwordController = TextEditingController(); state.pwdFocus = FocusNode(); state.theFocus = FocusNode(); } @@ -114,6 +115,12 @@ class LoginLogic extends GetxController with RequestToolMixin { StorageService.to.erase(); if (e is Exception) { try { + if (e is DioException && e.response?.data != null) { + Map? msg = e.response?.data['error']; + if (msg != null && msg["message"] != null) { + return toMsg(msg["message"]); + } + } toMsg(e.toString().split(":")[1]); return; // ignore: empty_catches