1.取消用手机号码登陆

2.添加设备页直接跳到扫描设备页
This commit is contained in:
sky_min 2025-10-31 13:42:25 +08:00
parent 4fa076565f
commit b0506a8910
7 changed files with 162 additions and 122 deletions

View File

@ -52,6 +52,13 @@ class StarLockLoginLogic extends BaseGetXController {
Future<void> login() async { Future<void> login() async {
FocusScope.of(Get.context!).requestFocus(FocusNode()); // FocusScope.of(Get.context!).requestFocus(FocusNode()); //
//
if (!GetUtils.isEmail(state.emailOrPhone.value)) {
showToast('请输入有效的邮箱地址');
return;
}
final LoginEntity entity = await ApiRepository.to.login( final LoginEntity entity = await ApiRepository.to.login(
loginType: '1', loginType: '1',
password: state.pwd.value, password: state.pwd.value,

View File

@ -90,28 +90,29 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
child: Center(child: Image.asset('images/icon_main_drlock_1024.png', width: 110.w, height: 110.w))), child: Center(child: Image.asset('images/icon_main_drlock_1024.png', width: 110.w, height: 110.w))),
SizedBox(height: 50.w), SizedBox(height: 50.w),
Obx(() => CommonItem( // Obx(() =>
leftTitel: '你所在的国家/地区'.tr, // CommonItem(
rightTitle: '', // leftTitel: '你所在的国家/地区'.tr,
isHaveLine: true, // rightTitle: '',
isPadding: false, // isHaveLine: true,
isHaveRightWidget: true, // isPadding: false,
isHaveDirection: true, // isHaveRightWidget: true,
rightWidget: Text( // isHaveDirection: true,
'${state.countryName} +${state.countryCode.value}', // rightWidget: Text(
textAlign: TextAlign.end, // '${state.countryName} +${state.countryCode.value}',
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), // textAlign: TextAlign.end,
), // style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
action: () async { // ),
final result = await Get.toNamed(Routers.selectCountryRegionPage); // action: () async {
if (result != null) { // final result = await Get.toNamed(Routers.selectCountryRegionPage);
result as Map<String, dynamic>; // if (result != null) {
state.countryCode.value = result['code']; // result as Map<String, dynamic>;
state.countryKey.value = result['countryName']; // state.countryCode.value = result['code'];
logic.checkIpAction(); // state.countryKey.value = result['countryName'];
} // logic.checkIpAction();
}, // }
)), // },
// )),
LoginInput( LoginInput(
focusNode: logic.state.emailOrPhoneFocusNode, focusNode: logic.state.emailOrPhoneFocusNode,
controller: state.emailOrPhoneController, controller: state.emailOrPhoneController,

View File

@ -30,7 +30,8 @@ class StarLockLoginState {
RxString emailOrPhone = ''.obs; RxString emailOrPhone = ''.obs;
RxString pwd = ''.obs; RxString pwd = ''.obs;
RxBool canNext = false.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; bool get pwdIsOK => pwd.value.isNotEmpty;
TextEditingController emailOrPhoneController = TextEditingController(); TextEditingController emailOrPhoneController = TextEditingController();

View File

@ -41,7 +41,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: ListView( child: ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: <Widget>[ children: <Widget>[
topSelectCountryAndRegionWidget(), // topSelectCountryAndRegionWidget(),
middleTFWidget(), middleTFWidget(),
Obx(() { Obx(() {
return SubmitBtn( return SubmitBtn(
@ -75,73 +75,73 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Widget topSelectCountryAndRegionWidget() { Widget topSelectCountryAndRegionWidget() {
return Column( return Column(
children: <Widget>[ children: <Widget>[
// SizedBox(height: 50.h), SizedBox(height: 50.h),
// Row( Row(
// mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[ children: <Widget>[
// Container( Container(
// width: 340.w, width: 340.w,
// height: 60.h, height: 60.h,
// decoration: BoxDecoration( decoration: BoxDecoration(
// borderRadius: BorderRadius.all(Radius.circular(30.h)), borderRadius: BorderRadius.all(Radius.circular(30.h)),
// border: Border.all(width: 1.0, color: AppColors.greyLineColor)), border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
// child: Row( child: Row(
// children: <Widget>[ children: <Widget>[
// GestureDetector( GestureDetector(
// onTap: () { onTap: () {
// state.isIphoneType.value = true; state.isIphoneType.value = true;
// }, },
// child: Obx( child: Obx(
// () => Container( () => Container(
// width: 170.w, width: 170.w,
// height: 60.h, height: 60.h,
// decoration: state.isIphoneType.value decoration: state.isIphoneType.value
// ? BoxDecoration( ? BoxDecoration(
// color: AppColors.mainColor, color: AppColors.mainColor,
// borderRadius: BorderRadius.all(Radius.circular(30.h)), borderRadius: BorderRadius.all(Radius.circular(30.h)),
// border: Border.all(width: 1.0, color: AppColors.greyLineColor)) border: Border.all(width: 1.0, color: AppColors.greyLineColor))
// : null, : null,
// child: Center( child: Center(
// child: Text( child: Text(
// '手机'.tr, '手机'.tr,
// style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black), style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
// ), ),
// ), ),
// ), ),
// ), ),
// ), ),
// Expanded( Expanded(
// child: GestureDetector( child: GestureDetector(
// onTap: () { onTap: () {
// state.isIphoneType.value = false; state.isIphoneType.value = false;
// }, },
// child: Obx( child: Obx(
// () => Container( () => Container(
// height: 60.h, height: 60.h,
// decoration: !state.isIphoneType.value decoration: !state.isIphoneType.value
// ? BoxDecoration( ? BoxDecoration(
// color: AppColors.mainColor, color: AppColors.mainColor,
// borderRadius: BorderRadius.all(Radius.circular(30.h)), borderRadius: BorderRadius.all(Radius.circular(30.h)),
// border: Border.all(width: 1.0, color: AppColors.greyLineColor)) border: Border.all(width: 1.0, color: AppColors.greyLineColor))
// : null, : null,
// child: Center( child: Center(
// child: Text( child: Text(
// '邮箱'.tr, '邮箱'.tr,
// style: TextStyle( style: TextStyle(
// color: !state.isIphoneType.value ? Colors.white : Colors.black, color: !state.isIphoneType.value ? Colors.white : Colors.black,
// ), ),
// ), ),
// ), ),
// ), ),
// ), ),
// ), ),
// ), ),
// ], ],
// ), ),
// ), ),
// ], ],
// ), ),
// SizedBox(height: 60.h), SizedBox(height: 60.h),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
final result = await Get.toNamed(Routers.selectCountryRegionPage); final result = await Get.toNamed(Routers.selectCountryRegionPage);

View File

@ -23,9 +23,11 @@ import 'package:star_lock/tools/submitBtn.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../baseWidget.dart'; import '../../../baseWidget.dart';
import '../../../flavors.dart'; import '../../../flavors.dart';
import '../../../mine/addLock/selectLockType/selectLockType_logic.dart';
import '../../../mine/message/messageList/messageList_page.dart'; import '../../../mine/message/messageList/messageList_page.dart';
import '../../../mine/mine/starLockMine_page.dart'; import '../../../mine/mine/starLockMine_page.dart';
import '../../../tools/EasyRefreshTool.dart'; import '../../../tools/EasyRefreshTool.dart';
import '../../../tools/commonDataManage.dart';
import '../../../tools/eventBusEventManage.dart'; import '../../../tools/eventBusEventManage.dart';
import '../../../tools/storage.dart'; import '../../../tools/storage.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
@ -48,6 +50,8 @@ class _StarLockMainPageState extends State<StarLockMainPage>
final LockMainLogic logic = Get.put(LockMainLogic()); final LockMainLogic logic = Get.put(LockMainLogic());
final LockMainState state = Get.find<LockMainLogic>().state; final LockMainState state = Get.find<LockMainLogic>().state;
final SelectLockTypeLogic logicType = Get.put(SelectLockTypeLogic());
Future<void> getHttpData({bool clearScanDevices = false, bool isUnShowLoading = false}) async { Future<void> getHttpData({bool clearScanDevices = false, bool isUnShowLoading = false}) async {
LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData(); LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) { if (lockListInfoGroupEntity != null) {
@ -161,37 +165,45 @@ class _StarLockMainPageState extends State<StarLockMainPage>
switch (type) { switch (type) {
case 0: case 0:
// //
returnWidget = unHaveData(); returnWidget = MainBg(child: unHaveData());
break; break;
case 1: case 1:
// //
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = LockDetailPage( returnWidget = MainBg(child: LockDetailPage(
isOnlyOneData: true, isOnlyOneData: true,
lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]); lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]));
break; break;
case 2: case 2:
// //
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = F.sw( returnWidget = F.sw(
skyCall: () => LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value), skyCall: () => MainBg(child: LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)),
xhjCall: () => LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)); xhjCall: () => MainBg(child: LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)));
break; break;
default: default:
returnWidget = NoData(); returnWidget = MainBg(child: NoData());
break; break;
} }
} else if (state.selectedIndex.value == 1) { } else if (state.selectedIndex.value == 1) {
returnWidget = MessageListPage(); returnWidget = MainBg(child: MessageListPage());
} else { } else {
returnWidget = StarLockMinePage(); returnWidget = MainBg(child: StarLockMinePage());
} }
return returnWidget; return returnWidget;
} }
// //
Widget XHJBg({required Widget child}) { Widget MainBg({required Widget child}) {
return Container(); return Container(
child: child,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('images/lockMain_bg.jpg'),
fit: BoxFit.cover,
),
),
);
} }
Widget unHaveData() { Widget unHaveData() {
@ -223,10 +235,14 @@ class _StarLockMainPageState extends State<StarLockMainPage>
IconButton( IconButton(
onPressed: () { onPressed: () {
// //
Navigator.pushNamed( // Navigator.pushNamed(
context, // context,
Routers.selectLockTypePage, // Routers.selectLockTypePage,
); // );
//
CommonDataManage().seletLockType = 0;
logicType.getNearByLimits();
}, },
icon: Icon( icon: Icon(
Icons.add_circle_outline_rounded, Icons.add_circle_outline_rounded,
@ -257,10 +273,14 @@ class _StarLockMainPageState extends State<StarLockMainPage>
), ),
onTap: () { onTap: () {
// //
Navigator.pushNamed( // Navigator.pushNamed(
context, // context,
Routers.selectLockTypePage, // Routers.selectLockTypePage,
); // );
//
CommonDataManage().seletLockType = 0;
logicType.getNearByLimits();
}, },
)), )),
], ],

View File

@ -55,6 +55,9 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
logicSet.userSettingsInfoRequest(); logicSet.userSettingsInfoRequest();
logic.getUserInfoRequest(); logic.getUserInfoRequest();
//
_checkNotificationPermission();
} }
@override @override
@ -245,11 +248,11 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w), padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
child: Column( child: Column(
children: [ children: [
mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () { // mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
Get.back(); // Get.back();
Get.toNamed(Routers.mineSetPage); // Get.toNamed(Routers.mineSetPage);
}), // }),
SizedBox(height: 20.h), // SizedBox(height: 20.h),
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () async { mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () async {
final bool? isVip = await Storage.getBool(saveIsVip); final bool? isVip = await Storage.getBool(saveIsVip);
if (isVip == null || !isVip) { if (isVip == null || !isVip) {
@ -289,7 +292,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
SizedBox(width: 15.w), SizedBox(width: 15.w),
Text( Text(
lockTypeTitle, lockTypeTitle,
style: TextStyle(fontSize: 22.sp), style: TextStyle(fontSize: 28.sp),
), ),
const Spacer(), const Spacer(),
Icon( Icon(
@ -345,7 +348,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
rightWidget: SizedBox( rightWidget: SizedBox(
width: 60.w, width: 60.w,
height: 50.h, height: 50.h,
child: Obx(() => _isPushNotificationSwitch()) child: Obx(_isPushNotificationSwitch)
)), )),
// if (F.appFlavor == Flavor.sky) // if (F.appFlavor == Flavor.sky)
Visibility( Visibility(
@ -596,14 +599,20 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: stateSet.isPushNotification.value, value: stateSet.isPushNotification.value,
onChanged: (bool value) { onChanged: (bool value) async {
// stateSet.isPushNotification.value = !stateSet.isPushNotification.value; // stateSet.isPushNotification.value = !stateSet.isPushNotification.value;
stateSet.isPushNotification.value = value;
openAppSettings(); openAppSettings();
final PermissionStatus newStatus = await Permission.notification.status;
stateSet.isPushNotification.value = newStatus.isGranted;
}, },
); );
} }
Future<void> _checkNotificationPermission() async {
final PermissionStatus status = await Permission.notification.status;
stateSet.isPushNotification.value = status.isGranted;
}
Widget otherItem( Widget otherItem(
{String? leftTitle, {String? leftTitle,
bool? isHaveLine, bool? isHaveLine,
@ -669,8 +678,10 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
onClick: () { onClick: () {
//退 //退
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog(
'确定要退出吗?'.tr, logic.userLogoutRequest); '确定要退出吗?'.tr, () async {
// showLoginOutAlertTipDialog(); await logicSet.userLogoutRequest();
// showLoginOutAlertTipDialog();
});
}), }),
Container( Container(
padding: EdgeInsets.only(left: 30.w, top: 30.h), padding: EdgeInsets.only(left: 30.w, top: 30.h),

View File

@ -67,7 +67,7 @@ class CommonItem extends StatelessWidget {
), ),
child: Text( child: Text(
leftTitel!, leftTitel!,
style: leftTitleStyle ?? TextStyle(fontSize: 22.sp), style: leftTitleStyle ?? TextStyle(fontSize: 28.sp),
overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis, //
maxLines: 3, // 2 maxLines: 3, // 2
), ),