mcy_new #1

Merged
wangyang merged 179 commits from mcy_new into master 2025-08-28 10:10:45 +08:00
4 changed files with 51 additions and 28 deletions
Showing only changes of commit 072814972e - Show all commits

View File

@ -5,7 +5,9 @@ enum AppStorageKey {
xToken(value: 'XTOKEN', label: "登录用户的Xtoken刷新token信息"),
userMobile(value: 'USERMOBILE', label: "用户输入过的手机号码"),
userInfo(value: 'USERINFO', label: "登录用户的基本信息 及 token过期时间"),
userDetailInfo(value: 'USERDETAILINFO', label: "用户的详细信息");
userDetailInfo(value: 'USERDETAILINFO', label: "用户的详细信息"),
account(value: 'ACCOUNT', label: "用户名"),
pwd(value: 'PWD', label: "密码");
final String label;
final String value;

View File

@ -8,6 +8,8 @@ import 'package:making_school_asignment_app/common/utils/storage.dart';
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
import 'package:making_school_asignment_app/common/utils/utils.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart';
import 'package:making_school_asignment_app/common/utils/storage.dart';
import 'package:making_school_asignment_app/common/store/app_storage_key.dart';
import 'login_state.dart';
@ -23,8 +25,19 @@ class LoginLogic extends GetxController with RequestToolMixin {
@override
void onInit() {
super.onInit();
state.userNameController = TextEditingController()..addListener(userNameListener);
state.passwordController = TextEditingController();
/* state.userNameController = TextEditingController()
..addListener(userNameListener);
state.passwordController = TextEditingController();*/
String account = StorageService.to.read(AppStorageKey.account.value)?? '';
String pwd = StorageService.to.read(AppStorageKey.pwd.value) ?? '';
if (account != '' && pwd != '') {
state.userNameController.text = account;
state.passwordController.text = pwd;
state.keepPwd.value = true;
}
state.pwdFocus = FocusNode();
state.theFocus = FocusNode();
}
@ -77,6 +90,12 @@ class LoginLogic extends GetxController with RequestToolMixin {
}
UserStore.to.setUserDetailInfo(data);
EasyLoading.dismiss();
if (state.keepPwd.value) {
StorageService.to.write(AppStorageKey.account.value, userName);
StorageService.to.write(AppStorageKey.pwd.value, userPwd);
}
Get.offAllNamed(Routes.startPage);
// if (resultData.code != 200 || userData?.accessToken == null || userData?.accessToken == '') {
// return toMsg(resultData.message ?? '登录失败,请重试');

View File

@ -9,8 +9,8 @@ class LoginState {
late final FocusNode pwdFocus; //
late final FocusNode theFocus;
//
late final TextEditingController userNameController;
late final TextEditingController passwordController;
late TextEditingController userNameController = TextEditingController();
late TextEditingController passwordController = TextEditingController();
bool hasNameVal = false;
late RxBool isShowPwd = true.obs;
late RxBool keepPwd = false.obs;

View File

@ -190,49 +190,51 @@ class _LoginPageState extends State<LoginPage> {
SizedBox(
height: 22.h,
),
/* Row(
Row(
children: [
Container(
width: 30.w,
padding: EdgeInsets.only(right: 10.w),
width: 25.w,
padding: EdgeInsets.only(right: 0.w),
child: Obx(() {
return Checkbox(
activeColor: Theme.of(context).primaryColor,
checkColor: Colors.white,
value: state.keepPwd.value,
onChanged: (value) {
Get.focusScope?.nextFocus();
*/ /* FocusScope.of(context).requestFocus(
state.pwdFocus);
FocusScope.of(context).requestFocus(
state.theFocus);*/ /*
state.keepPwd.value = value ?? false;
},
return Transform.scale(
scale: 1.2,
child: Checkbox(
activeColor: Theme.of(context).primaryColor,
checkColor: Colors.white,
value: state.keepPwd.value,
onChanged: (value) {
Get.focusScope?.nextFocus();
FocusScope.of(context).requestFocus(
state.pwdFocus);
FocusScope.of(context).requestFocus(
state.theFocus);
state.keepPwd.value = value ?? false;
},
),
);
}),
),
InkWell(
onTap: () {
Utils.hideKeyboard();
*/ /*Get.focusScope?.nextFocus();
Get.focusScope?.nextFocus();*/ /*
*/ /* FocusScope.of(context).requestFocus(
Get.focusScope?.nextFocus();
Get.focusScope?.nextFocus();
FocusScope.of(context).requestFocus(
state.pwdFocus);
FocusScope.of(context).requestFocus(
state.theFocus);*/ /*
state.theFocus);
state.keepPwd.value = !state.keepPwd.value;
},
child: Text(
'记住密码',
style: TextStyle(
fontSize: 14.sp,
fontSize: 11.sp,
color: Colors.white,
),
),
),
],
),*/
),
InkWell(
onTap: () {
logic.toLogin();
@ -293,7 +295,7 @@ class _LoginPageState extends State<LoginPage> {
onTap: () {
Get.toNamed(Routes.agreementPage, arguments: {"type": AGREEMENT_KEY.USER_AGREEMENT.name});
},
child: quickText('请仔细阅读', size: 11.sp),
child: quickText('请仔细阅读', size: 11.sp,),
),
InkWell(
onTap: () {