更新登录对接
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.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/login/login_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
|
||||
class OtherLoginPage extends StatefulWidget {
|
||||
const OtherLoginPage({super.key});
|
||||
@@ -57,7 +64,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent, // 容器背景色
|
||||
highlightColor: Colors.green, // 点击时的背景色
|
||||
highlightColor:
|
||||
themeController.currentColor.sc21, // 点击时的背景色
|
||||
padding:
|
||||
EdgeInsets.zero, // 这里去掉外部的 padding,避免影响点击范围
|
||||
onTap: () {
|
||||
@@ -70,7 +78,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
'assets/img/icon/arrow_left.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
|
||||
color: Colors.white, // 这里设置了颜色
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -99,8 +107,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 48.rpx,
|
||||
letterSpacing: 0.0,
|
||||
//todo 颜色
|
||||
color: stringToColor("#FFFFFF"),
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -125,8 +133,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
//todo 颜色
|
||||
color: stringToColor("#FFFFFF"),
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -147,7 +155,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
AppConstants()
|
||||
.button_container_radius),
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
color: themeController.currentColor.sc3,
|
||||
width: 1.rpx,
|
||||
),
|
||||
),
|
||||
@@ -168,6 +176,10 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
alignment:
|
||||
AlignmentDirectional(-1, 0),
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginController
|
||||
.model.phone = value;
|
||||
},
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
@@ -285,7 +297,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
AppConstants()
|
||||
.button_container_radius),
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
color: themeController.currentColor.sc3,
|
||||
width: 1.rpx,
|
||||
),
|
||||
),
|
||||
@@ -306,6 +318,10 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
alignment:
|
||||
AlignmentDirectional(-1, 0),
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginController.model.code =
|
||||
value;
|
||||
},
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
@@ -418,21 +434,6 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
.currentColor.sc7,
|
||||
),
|
||||
),
|
||||
// Text(
|
||||
// countdownController.countdown
|
||||
// .value ==
|
||||
// 0
|
||||
// ? '其他手机登录页.获取验证码'.tr
|
||||
// : '${countdownController.countdown.value}秒',
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController
|
||||
// .currentColor.sc7,
|
||||
// fontSize: AppConstants()
|
||||
// .title_text_fontSize,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
Obx(() {
|
||||
final CountdownController
|
||||
countdownController =
|
||||
@@ -440,28 +441,70 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
CountdownController>();
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
if (countdownController
|
||||
.countdown
|
||||
.value !=
|
||||
0) {
|
||||
return;
|
||||
try {
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"点击获取验证码");
|
||||
if (countdownController
|
||||
.countdown
|
||||
.value !=
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
ApiResponse
|
||||
apiResponse =
|
||||
await loginController
|
||||
.getCode(
|
||||
context);
|
||||
if (apiResponse.code !=
|
||||
HttpStatusCodes.ok) {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: apiResponse
|
||||
.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9,
|
||||
);
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码成功,${apiResponse}");
|
||||
return;
|
||||
} else {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: apiResponse
|
||||
.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc2,
|
||||
);
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码失败,${apiResponse}");
|
||||
}
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? countdownController
|
||||
.startCountdown(
|
||||
AppConstants
|
||||
.code_time)
|
||||
: null;
|
||||
} catch (e) {
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码异常,${e}");
|
||||
edm.EasyDartModule
|
||||
.logger
|
||||
.info(
|
||||
"获取验证码异常:${e}");
|
||||
}
|
||||
|
||||
String msg =
|
||||
await loginController
|
||||
.getCode(context);
|
||||
if (msg.isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? countdownController
|
||||
.startCountdown(
|
||||
AppConstants
|
||||
.code_time)
|
||||
: null;
|
||||
},
|
||||
child: Container(
|
||||
alignment:
|
||||
@@ -475,13 +518,14 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? '获取验证码'
|
||||
: '${countdownController.countdown.value}秒',
|
||||
? '其他手机登录页.获取验证码'.tr
|
||||
: '${countdownController.countdown.value}' +
|
||||
"其他手机登录页.秒".tr,
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color:
|
||||
Color(0xFF333333),
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0,
|
||||
@@ -505,25 +549,53 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants()
|
||||
.button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
bool agree =
|
||||
loginController.model.register_agree!;
|
||||
if (!agree) {
|
||||
print('未授权 ...');
|
||||
} else {
|
||||
print('已授权 ...');
|
||||
onTap: () async {
|
||||
try {
|
||||
await DailyLogUtils.writeLog("点击登录");
|
||||
bool agree =
|
||||
loginController.model.register_agree!;
|
||||
if (!agree) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "登录页.未同意协议".tr,
|
||||
textColor:
|
||||
themeController.currentColor.sc9,
|
||||
);
|
||||
} else {
|
||||
ApiResponse apiResponse =
|
||||
await loginController
|
||||
.login(context);
|
||||
if (apiResponse.code != HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: themeController
|
||||
.currentColor.sc9,
|
||||
);
|
||||
} else {
|
||||
// 登录成功,跳转到主页面
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "其他手机登录页.登录成功".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc2,
|
||||
);
|
||||
Get.offAllNamed('/homePage');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
await DailyLogUtils.writeLog("登录失败,${e}");
|
||||
edm.EasyDartModule.logger
|
||||
.info("登录失败:${e}");
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
//todo 颜色
|
||||
stringToColor("45D989"),
|
||||
stringToColor("00C1AA")
|
||||
], // 渐变色是同一个色,也可以根据需要调整
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
|
||||
child: Container(
|
||||
width:
|
||||
// MediaQuery.sizeOf(context).width * 0.66,
|
||||
bodysize.maxWidth,
|
||||
width: bodysize.maxWidth,
|
||||
height: MediaQuery.sizeOf(context).height *
|
||||
0.055,
|
||||
constraints: BoxConstraints(
|
||||
@@ -540,8 +612,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
//todo 颜色
|
||||
color: Colors.white,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
@@ -604,7 +676,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
.secondaryText,
|
||||
),
|
||||
activeColor:
|
||||
stringToColor("#FF9F66"),
|
||||
stringToColor("#FF9F66"), //固定
|
||||
checkColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.info,
|
||||
@@ -633,8 +705,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
fontSize: 26.rpx,
|
||||
color: Colors
|
||||
.white, // 可以调整为你想要的颜色
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
@@ -659,8 +731,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
fontSize: 26.rpx,
|
||||
color: Colors
|
||||
.white, // 可以调整为你想要的颜色
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
@@ -685,8 +757,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
fontSize: 26.rpx,
|
||||
color: Colors
|
||||
.white, // 可以调整为你想要的颜色
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
@@ -737,8 +809,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
//todo 颜色
|
||||
color: stringToColor("#FFFFFF"),
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user