diff --git a/lib/login/login/starLock_login_logic.dart b/lib/login/login/starLock_login_logic.dart index 999ae9d6..e94a50eb 100755 --- a/lib/login/login/starLock_login_logic.dart +++ b/lib/login/login/starLock_login_logic.dart @@ -52,6 +52,13 @@ class StarLockLoginLogic extends BaseGetXController { Future login() async { FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘 + + // 添加邮箱格式验证 + if (!GetUtils.isEmail(state.emailOrPhone.value)) { + showToast('请输入有效的邮箱地址'); + return; + } + final LoginEntity entity = await ApiRepository.to.login( loginType: '1', password: state.pwd.value, diff --git a/lib/login/login/starLock_login_page.dart b/lib/login/login/starLock_login_page.dart index bda5300e..c5d6593e 100755 --- a/lib/login/login/starLock_login_page.dart +++ b/lib/login/login/starLock_login_page.dart @@ -90,28 +90,29 @@ class _StarLockLoginPageState extends State { padding: EdgeInsets.all(10.w), child: Center(child: Image.asset('images/icon_main_drlock_1024.png', width: 110.w, height: 110.w))), SizedBox(height: 50.w), - Obx(() => CommonItem( - leftTitel: '你所在的国家/地区'.tr, - rightTitle: '', - isHaveLine: true, - isPadding: false, - isHaveRightWidget: true, - isHaveDirection: true, - rightWidget: Text( - '${state.countryName} +${state.countryCode.value}', - textAlign: TextAlign.end, - style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), - ), - action: () async { - final result = await Get.toNamed(Routers.selectCountryRegionPage); - if (result != null) { - result as Map; - state.countryCode.value = result['code']; - state.countryKey.value = result['countryName']; - logic.checkIpAction(); - } - }, - )), + // Obx(() => + // CommonItem( + // leftTitel: '你所在的国家/地区'.tr, + // rightTitle: '', + // isHaveLine: true, + // isPadding: false, + // isHaveRightWidget: true, + // isHaveDirection: true, + // rightWidget: Text( + // '${state.countryName} +${state.countryCode.value}', + // textAlign: TextAlign.end, + // style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), + // ), + // action: () async { + // final result = await Get.toNamed(Routers.selectCountryRegionPage); + // if (result != null) { + // result as Map; + // state.countryCode.value = result['code']; + // state.countryKey.value = result['countryName']; + // logic.checkIpAction(); + // } + // }, + // )), LoginInput( focusNode: logic.state.emailOrPhoneFocusNode, controller: state.emailOrPhoneController, diff --git a/lib/login/login/starLock_login_state.dart b/lib/login/login/starLock_login_state.dart index b623b61d..9be031b9 100755 --- a/lib/login/login/starLock_login_state.dart +++ b/lib/login/login/starLock_login_state.dart @@ -30,7 +30,8 @@ class StarLockLoginState { RxString emailOrPhone = ''.obs; RxString pwd = ''.obs; RxBool canNext = false.obs; - bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty; + // bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty; + bool get isEmailOrPhone => GetUtils.isEmail(emailOrPhone.value); bool get pwdIsOK => pwd.value.isNotEmpty; TextEditingController emailOrPhoneController = TextEditingController(); diff --git a/lib/login/register/starLock_register_page.dart b/lib/login/register/starLock_register_page.dart index 18fe0ce3..f8ee70bd 100755 --- a/lib/login/register/starLock_register_page.dart +++ b/lib/login/register/starLock_register_page.dart @@ -41,7 +41,7 @@ class _StarLockRegisterPageState extends State { child: ListView( padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), children: [ - topSelectCountryAndRegionWidget(), + // topSelectCountryAndRegionWidget(), middleTFWidget(), Obx(() { return SubmitBtn( @@ -75,73 +75,73 @@ class _StarLockRegisterPageState extends State { Widget topSelectCountryAndRegionWidget() { return Column( children: [ - // SizedBox(height: 50.h), - // Row( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Container( - // width: 340.w, - // height: 60.h, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.all(Radius.circular(30.h)), - // border: Border.all(width: 1.0, color: AppColors.greyLineColor)), - // child: Row( - // children: [ - // GestureDetector( - // onTap: () { - // state.isIphoneType.value = true; - // }, - // child: Obx( - // () => Container( - // width: 170.w, - // height: 60.h, - // decoration: state.isIphoneType.value - // ? BoxDecoration( - // color: AppColors.mainColor, - // borderRadius: BorderRadius.all(Radius.circular(30.h)), - // border: Border.all(width: 1.0, color: AppColors.greyLineColor)) - // : null, - // child: Center( - // child: Text( - // '手机'.tr, - // style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black), - // ), - // ), - // ), - // ), - // ), - // Expanded( - // child: GestureDetector( - // onTap: () { - // state.isIphoneType.value = false; - // }, - // child: Obx( - // () => Container( - // height: 60.h, - // decoration: !state.isIphoneType.value - // ? BoxDecoration( - // color: AppColors.mainColor, - // borderRadius: BorderRadius.all(Radius.circular(30.h)), - // border: Border.all(width: 1.0, color: AppColors.greyLineColor)) - // : null, - // child: Center( - // child: Text( - // '邮箱'.tr, - // style: TextStyle( - // color: !state.isIphoneType.value ? Colors.white : Colors.black, - // ), - // ), - // ), - // ), - // ), - // ), - // ), - // ], - // ), - // ), - // ], - // ), - // SizedBox(height: 60.h), + SizedBox(height: 50.h), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 340.w, + height: 60.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(30.h)), + border: Border.all(width: 1.0, color: AppColors.greyLineColor)), + child: Row( + children: [ + GestureDetector( + onTap: () { + state.isIphoneType.value = true; + }, + child: Obx( + () => Container( + width: 170.w, + height: 60.h, + decoration: state.isIphoneType.value + ? BoxDecoration( + color: AppColors.mainColor, + borderRadius: BorderRadius.all(Radius.circular(30.h)), + border: Border.all(width: 1.0, color: AppColors.greyLineColor)) + : null, + child: Center( + child: Text( + '手机'.tr, + style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black), + ), + ), + ), + ), + ), + Expanded( + child: GestureDetector( + onTap: () { + state.isIphoneType.value = false; + }, + child: Obx( + () => Container( + height: 60.h, + decoration: !state.isIphoneType.value + ? BoxDecoration( + color: AppColors.mainColor, + borderRadius: BorderRadius.all(Radius.circular(30.h)), + border: Border.all(width: 1.0, color: AppColors.greyLineColor)) + : null, + child: Center( + child: Text( + '邮箱'.tr, + style: TextStyle( + color: !state.isIphoneType.value ? Colors.white : Colors.black, + ), + ), + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + SizedBox(height: 60.h), GestureDetector( onTap: () async { final result = await Get.toNamed(Routers.selectCountryRegionPage); diff --git a/lib/main/lockMian/lockMain/lockMain_page.dart b/lib/main/lockMian/lockMain/lockMain_page.dart index e7834fbe..b623309a 100755 --- a/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/lib/main/lockMian/lockMain/lockMain_page.dart @@ -23,9 +23,11 @@ import 'package:star_lock/tools/submitBtn.dart'; import '../../../appRouters.dart'; import '../../../baseWidget.dart'; import '../../../flavors.dart'; +import '../../../mine/addLock/selectLockType/selectLockType_logic.dart'; import '../../../mine/message/messageList/messageList_page.dart'; import '../../../mine/mine/starLockMine_page.dart'; import '../../../tools/EasyRefreshTool.dart'; +import '../../../tools/commonDataManage.dart'; import '../../../tools/eventBusEventManage.dart'; import '../../../tools/storage.dart'; import '../../../tools/titleAppBar.dart'; @@ -48,6 +50,8 @@ class _StarLockMainPageState extends State final LockMainLogic logic = Get.put(LockMainLogic()); final LockMainState state = Get.find().state; + final SelectLockTypeLogic logicType = Get.put(SelectLockTypeLogic()); + Future getHttpData({bool clearScanDevices = false, bool isUnShowLoading = false}) async { LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData(); if (lockListInfoGroupEntity != null) { @@ -161,37 +165,45 @@ class _StarLockMainPageState extends State switch (type) { case 0: // 显示无数据模式 - returnWidget = unHaveData(); + returnWidget = MainBg(child: unHaveData()); break; case 1: // 只有一条数据 Storage.setBool(ifIsDemoModeOrNot, false); - returnWidget = LockDetailPage( + returnWidget = MainBg(child: LockDetailPage( isOnlyOneData: true, - lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]); + lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0])); break; case 2: // 有多条数据 Storage.setBool(ifIsDemoModeOrNot, false); returnWidget = F.sw( - skyCall: () => LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value), - xhjCall: () => LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)); + skyCall: () => MainBg(child: LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)), + xhjCall: () => MainBg(child: LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value))); break; default: - returnWidget = NoData(); + returnWidget = MainBg(child: NoData()); break; } } else if (state.selectedIndex.value == 1) { - returnWidget = MessageListPage(); + returnWidget = MainBg(child: MessageListPage()); } else { - returnWidget = StarLockMinePage(); + returnWidget = MainBg(child: StarLockMinePage()); } return returnWidget; } - //鑫泓佳背景 - Widget XHJBg({required Widget child}) { - return Container(); + //背景 + Widget MainBg({required Widget child}) { + return Container( + child: child, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('images/lockMain_bg.jpg'), + fit: BoxFit.cover, + ), + ), + ); } Widget unHaveData() { @@ -223,10 +235,14 @@ class _StarLockMainPageState extends State IconButton( onPressed: () { //实现回调函数 - Navigator.pushNamed( - context, - Routers.selectLockTypePage, - ); + // Navigator.pushNamed( + // context, + // Routers.selectLockTypePage, + // ); + + // 跳转到扫描设备页 + CommonDataManage().seletLockType = 0; + logicType.getNearByLimits(); }, icon: Icon( Icons.add_circle_outline_rounded, @@ -257,10 +273,14 @@ class _StarLockMainPageState extends State ), onTap: () { //实现回调函数 - Navigator.pushNamed( - context, - Routers.selectLockTypePage, - ); + // Navigator.pushNamed( + // context, + // Routers.selectLockTypePage, + // ); + + // 跳转到扫描设备页 + CommonDataManage().seletLockType = 0; + logicType.getNearByLimits(); }, )), ], diff --git a/lib/mine/mine/starLockMine_page.dart b/lib/mine/mine/starLockMine_page.dart index 3e885c9f..3a483051 100755 --- a/lib/mine/mine/starLockMine_page.dart +++ b/lib/mine/mine/starLockMine_page.dart @@ -55,6 +55,9 @@ class StarLockMinePageState extends State with BaseWidget { logicSet.userSettingsInfoRequest(); logic.getUserInfoRequest(); + + // 初始化时检查推送权限状态 + _checkNotificationPermission(); } @override @@ -245,11 +248,11 @@ class StarLockMinePageState extends State with BaseWidget { padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w), child: Column( children: [ - mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () { - Get.back(); - Get.toNamed(Routers.mineSetPage); - }), - SizedBox(height: 20.h), + // mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () { + // Get.back(); + // Get.toNamed(Routers.mineSetPage); + // }), + // SizedBox(height: 20.h), mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () async { final bool? isVip = await Storage.getBool(saveIsVip); if (isVip == null || !isVip) { @@ -289,7 +292,7 @@ class StarLockMinePageState extends State with BaseWidget { SizedBox(width: 15.w), Text( lockTypeTitle, - style: TextStyle(fontSize: 22.sp), + style: TextStyle(fontSize: 28.sp), ), const Spacer(), Icon( @@ -345,7 +348,7 @@ class StarLockMinePageState extends State with BaseWidget { rightWidget: SizedBox( width: 60.w, height: 50.h, - child: Obx(() => _isPushNotificationSwitch()) + child: Obx(_isPushNotificationSwitch) )), // if (F.appFlavor == Flavor.sky) Visibility( @@ -596,14 +599,20 @@ class StarLockMinePageState extends State with BaseWidget { trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: stateSet.isPushNotification.value, - onChanged: (bool value) { + onChanged: (bool value) async { // stateSet.isPushNotification.value = !stateSet.isPushNotification.value; - stateSet.isPushNotification.value = value; openAppSettings(); + final PermissionStatus newStatus = await Permission.notification.status; + stateSet.isPushNotification.value = newStatus.isGranted; }, ); } + Future _checkNotificationPermission() async { + final PermissionStatus status = await Permission.notification.status; + stateSet.isPushNotification.value = status.isGranted; + } + Widget otherItem( {String? leftTitle, bool? isHaveLine, @@ -669,8 +678,10 @@ class StarLockMinePageState extends State with BaseWidget { onClick: () { //退出登录 ShowTipView().showIosTipWithContentDialog( - '确定要退出吗?'.tr, logic.userLogoutRequest); - // showLoginOutAlertTipDialog(); + '确定要退出吗?'.tr, () async { + await logicSet.userLogoutRequest(); + // showLoginOutAlertTipDialog(); + }); }), Container( padding: EdgeInsets.only(left: 30.w, top: 30.h), diff --git a/lib/tools/commonItem.dart b/lib/tools/commonItem.dart index b67615c4..91a70bbc 100755 --- a/lib/tools/commonItem.dart +++ b/lib/tools/commonItem.dart @@ -67,7 +67,7 @@ class CommonItem extends StatelessWidget { ), child: Text( leftTitel!, - style: leftTitleStyle ?? TextStyle(fontSize: 22.sp), + style: leftTitleStyle ?? TextStyle(fontSize: 28.sp), overflow: TextOverflow.ellipsis, // 超出部分显示省略号 maxLines: 3, // 最多显示2行 ),