更新登录
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import 'package:EasyDartModule/EasyDartModule.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:fluwx/fluwx.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/user_data.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
|
||||
|
||||
part 'mht_login_controller.g.dart';
|
||||
@@ -16,7 +23,7 @@ class LoginModel {
|
||||
|
||||
String? account = '17649984946'; //账户
|
||||
// String? account = '13953240733'; //账户
|
||||
String? password = 'wyf123,.'; //密码
|
||||
String? password = 'wyf123..'; //密码
|
||||
// String? account = '15255134931'; //账户
|
||||
// String? password = 'mht123,.'; //密码
|
||||
|
||||
@@ -120,6 +127,39 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
|
||||
showToast(message);
|
||||
return message;
|
||||
}
|
||||
var data = {
|
||||
"type": model.loginStyle == 1 ? 3 : 2,
|
||||
"userName": model.account,
|
||||
"password": model.password,
|
||||
};
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.login;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
await requestWithLog(
|
||||
logTitle: "用户登录",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
res.rawResponse;
|
||||
CountdownController countdownController = Get.find();
|
||||
countdownController.countdown.value = 0;
|
||||
UserInfoController userInfoController = Get.find();
|
||||
userInfoController.model.login = 1;
|
||||
userInfoController.model.user = UserModel.fromJson(res.data);
|
||||
String token = res.rawResponse.headers['token']!.first;
|
||||
EasyDartModule.dio.token = token;
|
||||
final box = GetStorage();
|
||||
box.write('token', token); // 存储 token
|
||||
box.write('user', userInfoController.model.user!.toJson()); // 存储用户信息
|
||||
},
|
||||
onFailure: (res) {
|
||||
message = res.msg!;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
},
|
||||
);
|
||||
model.forceLogin = 0;
|
||||
return message;
|
||||
}
|
||||
@@ -141,7 +181,7 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
|
||||
message = '请输入正确的手机号'.tr;
|
||||
showToast(message);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
|
||||
part 'mht_register_controller.g.dart';
|
||||
@@ -102,14 +104,31 @@ class MHTRegisterController extends GetControllerEx<RegisterModel> {
|
||||
text: message, textColor: stringToColor("#FF7159"));
|
||||
return message;
|
||||
}
|
||||
// message = await repository.createUser(
|
||||
// model.register_pd!, model.register_phone!, model.register_code!);
|
||||
// if (message.isNotEmpty) {
|
||||
// showToast(message);
|
||||
// return message;
|
||||
// }
|
||||
|
||||
return "";
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_register;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
var data = {
|
||||
"type": 1,
|
||||
"userName": model.register_phone!,
|
||||
"password": model.register_pd!,
|
||||
"verify": model.register_code!
|
||||
};
|
||||
await requestWithLog(
|
||||
logTitle: "用户注册",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context, text: "注册成功".tr);
|
||||
},
|
||||
onFailure: (res) {
|
||||
message = res.msg!;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
},
|
||||
);
|
||||
return message;
|
||||
}
|
||||
|
||||
Future<String> getCode(BuildContext context) async {
|
||||
@@ -125,7 +144,32 @@ class MHTRegisterController extends GetControllerEx<RegisterModel> {
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: stringToColor("#FF7159"));
|
||||
return message;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.send_code;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
var data = {
|
||||
"userName": model.register_phone!,
|
||||
'type':4,
|
||||
};
|
||||
await requestWithLog(
|
||||
logTitle: "获取验证码",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context, text: '发送验证码成功'.tr);
|
||||
},
|
||||
onFailure: (res) {
|
||||
message = res.msg!;
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: message.tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
369
lib/pages/mh_page/user/page/edit_userinfo_page.dart
Normal file
369
lib/pages/mh_page/user/page/edit_userinfo_page.dart
Normal file
@@ -0,0 +1,369 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/person/person_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
|
||||
class EditUserPage extends StatefulWidget {
|
||||
EditUserPage({super.key});
|
||||
|
||||
@override
|
||||
State<EditUserPage> createState() => _UpdateUserPageState();
|
||||
}
|
||||
|
||||
class _UpdateUserPageState extends State<EditUserPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
PersonController personController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
userInfoController.model.user!.tmpHead =
|
||||
userInfoController.model.user!.avatar;
|
||||
userInfoController.model.user!.tmpNickName =
|
||||
userInfoController.model.user!.nick_name;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int login = userInfoController.model.login!;
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/images/new_background.png'),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'编辑资料'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 10.rpx,
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
stringToColor("FCFCFC"),
|
||||
stringToColor("CEECE3"),
|
||||
],
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0.rpx, 16.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'保存'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: stringToColor("#011D33"),
|
||||
letterSpacing: 0.0,
|
||||
fontSize: AppConstants().normal_text_fontSize),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
60.rpx, 0.rpx, 60.rpx, 0.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.213,
|
||||
height: MediaQuery.sizeOf(context).height * 0.098,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 160.rpx,
|
||||
minHeight: 160.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() {
|
||||
return getImageWidget(context);
|
||||
})),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc2,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 44.rpx, 0.rpx, 44.rpx),
|
||||
borderRadius: 0,
|
||||
onTap: () async {
|
||||
edm.EasyDartModule.logger
|
||||
.info("${userInfoController.model.user!}点击上传头像");
|
||||
DailyLogUtils.writeLog(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.uploadImg();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Text(
|
||||
'点击更换头像'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#85F5FF"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 79.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: TextFormField(
|
||||
initialValue: userInfoController
|
||||
.model.user!.nick_name,
|
||||
onChanged: (value) {
|
||||
userInfoController.model.user!
|
||||
.tmpNickName = value;
|
||||
},
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelStyle:
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
hintText: '未命名'.tr,
|
||||
hintStyle:
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(
|
||||
context)
|
||||
.error,
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(
|
||||
context)
|
||||
.error,
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
filled: false,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 27.rpx)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getImageWidget(BuildContext context) {
|
||||
try {
|
||||
UserInfoController controller = Get.find();
|
||||
var head = controller.model.user!.tmpHead;
|
||||
return Container(
|
||||
width: 200.rpx,
|
||||
height: 200.rpx,
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: head == null || head.isEmpty
|
||||
? Image.asset(
|
||||
'assets/img/avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.network(
|
||||
head,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:fluwx/fluwx.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/appFontsize.dart';
|
||||
import 'package:vbvs_app/common/util/CheckNetwork.dart';
|
||||
@@ -13,6 +14,7 @@ import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
|
||||
@@ -84,7 +86,9 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
//首次未注册的用户引导去手机号填写页面
|
||||
//已注册的用户直接跳转首页
|
||||
if (CommonVariables.isNetWorkOn == false) {
|
||||
showToast("网络未连接,请开启设备网络后重试");
|
||||
TopSlideNotification.show(Get.context!,
|
||||
text: "网络未连接,请开启设备网络后重试".tr,
|
||||
textColor: themeController.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
String msg = await controller.loginByWechatCode(code);
|
||||
@@ -98,9 +102,11 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
||||
// fluwxCancelable?.cancel();
|
||||
} else if (errCode == -4) {
|
||||
showToast("用户拒绝授权");
|
||||
TopSlideNotification.show(Get.context!,
|
||||
text: "用户拒绝授权".tr, textColor: themeController.currentColor.sc9);
|
||||
} else if (errCode == -2) {
|
||||
showToast("用户取消授权");
|
||||
TopSlideNotification.show(Get.context!,
|
||||
text: "用户取消授权".tr, textColor: themeController.currentColor.sc9);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -907,8 +913,15 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
if (CommonVariables
|
||||
.isNetWorkOn ==
|
||||
false) {
|
||||
showToast(
|
||||
"网络未连接,请开启设备网络后重试");
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text:
|
||||
"网络未连接,请开启设备网络后重试"
|
||||
.tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
return;
|
||||
}
|
||||
String msg =
|
||||
@@ -935,7 +948,8 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
.value ==
|
||||
0
|
||||
? '获取验证码'
|
||||
: '${countdownController.countdown.value}' + '秒'.tr,
|
||||
: '${countdownController.countdown.value}' +
|
||||
'秒'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
@@ -1191,8 +1205,15 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
if (CommonVariables
|
||||
.isNetWorkOn ==
|
||||
false) {
|
||||
showToast(
|
||||
"网络未连接,请开启设备网络后重试");
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text:
|
||||
"网络未连接,请开启设备网络后重试"
|
||||
.tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
return;
|
||||
}
|
||||
String msg =
|
||||
@@ -1218,7 +1239,8 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
.value ==
|
||||
0
|
||||
? '获取验证码'
|
||||
: '${countdownController.countdown.value}' + '秒'.tr,
|
||||
: '${countdownController.countdown.value}' +
|
||||
'秒'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
@@ -1254,7 +1276,10 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
onTap: () async {
|
||||
if (CommonVariables.isNetWorkOn ==
|
||||
false) {
|
||||
showToast("网络未连接,请开启设备网络后重试");
|
||||
TopSlideNotification.show(context,
|
||||
text: "网络未连接,请开启设备网络后重试".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
String msg =
|
||||
@@ -1286,8 +1311,6 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
|
||||
Get.offAndToNamed(
|
||||
"/mianPageBottomChange");
|
||||
} else {
|
||||
showToast(msg);
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
@@ -2142,7 +2165,10 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
if (_lastBackPressedTime == null ||
|
||||
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
|
||||
_lastBackPressedTime = currentTime;
|
||||
showToast("再按一次退出程序", color: color_warning, closeTime: 2);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "再按一次退出程序".tr,
|
||||
);
|
||||
return false; // 阻止退出程序
|
||||
} else {
|
||||
return true; // 允许退出程序
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/register_controller.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
|
||||
|
||||
class RegisterPage extends GetView<RegisterController> {
|
||||
class RegisterPage extends GetView<MHTRegisterController> {
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
BoxConstraints? bodysize;
|
||||
|
||||
@@ -16,7 +19,6 @@ class RegisterPage extends GetView<RegisterController> {
|
||||
RegisterPage() {
|
||||
controller.model.pdshow = true;
|
||||
controller.model.cpdshow = true;
|
||||
Get.put(RegisterController());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -442,33 +444,34 @@ class RegisterPage extends GetView<RegisterController> {
|
||||
CountdownController>();
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
// if (countdownController
|
||||
// .countdown.value !=
|
||||
// 0) {
|
||||
// return;
|
||||
// }
|
||||
// if (CommonVariables
|
||||
// .isNetWorkOn ==
|
||||
// false) {
|
||||
// showToast(
|
||||
// "网络未连接,请开启设备网络后重试");
|
||||
// return;
|
||||
// }
|
||||
// String msg =
|
||||
// await controller
|
||||
// .getCode(context);
|
||||
// if (msg.isNotEmpty) {
|
||||
// return;
|
||||
// }
|
||||
// countdownController
|
||||
// .countdown
|
||||
// .value ==
|
||||
// 0
|
||||
// ? countdownController
|
||||
// .startCountdown(
|
||||
// AppConstants
|
||||
// .code_time)
|
||||
// : null;
|
||||
if (countdownController
|
||||
.countdown.value !=
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
if (CommonVariables
|
||||
.isNetWorkOn ==
|
||||
false) {
|
||||
showToast(
|
||||
"网络未连接,请开启设备网络后重试"
|
||||
.tr);
|
||||
return;
|
||||
}
|
||||
String msg =
|
||||
await controller
|
||||
.getCode(context);
|
||||
if (msg.isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? countdownController
|
||||
.startCountdown(
|
||||
AppConstants
|
||||
.code_time)
|
||||
: null;
|
||||
},
|
||||
child: Text(
|
||||
countdownController
|
||||
@@ -741,17 +744,20 @@ class RegisterPage extends GetView<RegisterController> {
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection:
|
||||
GradientDirection.vertical,
|
||||
onTap: () {
|
||||
// if (CommonVariables.isNetWorkOn ==
|
||||
// false) {
|
||||
// showToast("网络未连接,请开启设备网络后重试");
|
||||
// return;
|
||||
// }
|
||||
// String msg = await controller
|
||||
// .registerUser(context);
|
||||
// if (msg == null || msg.isEmpty) {
|
||||
// Get.toNamed("/loginPage");
|
||||
// }
|
||||
onTap: () async {
|
||||
if (CommonVariables.isNetWorkOn ==
|
||||
false) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "网络未连接,请开启设备网络后重试".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
String msg = await controller
|
||||
.registerUser(context);
|
||||
if (msg == null || msg.isEmpty) {
|
||||
Get.toNamed("/loginPage");
|
||||
}
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
@@ -769,7 +775,7 @@ class RegisterPage extends GetView<RegisterController> {
|
||||
BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Text(
|
||||
"提交",
|
||||
"提交".tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
|
||||
Reference in New Issue
Block a user