首次登录设置密码

master
戴余标 2 years ago
parent bd61a99d53
commit ec5abdf5db

@ -8,6 +8,7 @@ class UserInfoModel extends Equatable {
final int id;
final String name;
final String phone;
final int havePwd;
final int isVip;
final int isTrial;
final String tag;
@ -26,6 +27,7 @@ class UserInfoModel extends Equatable {
id: 0,
name: '',
phone: '',
havePwd: 0,
isVip: 0,
isTrial: 0,
tag: '',
@ -40,6 +42,7 @@ class UserInfoModel extends Equatable {
required this.id,
required this.name,
required this.phone,
required this.havePwd,
required this.isVip,
required this.isTrial,
required this.tag,
@ -55,6 +58,7 @@ class UserInfoModel extends Equatable {
id,
name,
phone,
havePwd,
isVip,
isTrial,
tag,

@ -11,6 +11,7 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
id: json['id'] as int,
name: json['name'] as String,
phone: json['phone'] as String,
havePwd: json['havePwd'] as int,
isVip: json['is_vip'] as int,
isTrial: json['is_trial'] as int,
tag: json['tag'] as String,
@ -30,6 +31,7 @@ Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) =>
'id': instance.id,
'name': instance.name,
'phone': instance.phone,
'havePwd': instance.havePwd,
'is_vip': instance.isVip,
'is_trial': instance.isTrial,
'tag': instance.tag,

@ -7,13 +7,17 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:project_telephony/ui/login/login_psd_page.dart';
import 'package:project_telephony/ui/user/set_password_page.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.dart';
import '../../constants/api.dart';
import '../../constants/environment/environment.dart';
import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart';
import '../tab_navigator.dart';
@ -40,8 +44,8 @@ class _LoginPageState extends State<LoginPage> {
int _countDownNum = 59;
late TextEditingController _phoneController;
late TextEditingController _smsCodeController;
late TextEditingController _pwdCodeController;
late FocusNode _phoneFocusNode;
late FocusNode _smsCodeFocusNode;
bool _cantSelected = false;
DateTime? _lastTap;
@ -53,7 +57,7 @@ class _LoginPageState extends State<LoginPage> {
_smsCodeFocusNode = FocusNode();
_phoneController = TextEditingController();
_smsCodeController = TextEditingController();
// final userProvider = Provider.of<UserProvider>(context, listen: false);
_pwdCodeController = TextEditingController();
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) {
print('env :$env');
@ -70,11 +74,13 @@ class _LoginPageState extends State<LoginPage> {
_smsCodeFocusNode.unfocus();
_phoneController.dispose();
_smsCodeController.dispose();
_pwdCodeController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return CloudScaffold(
systemStyle: const SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark,
@ -162,6 +168,9 @@ class _LoginPageState extends State<LoginPage> {
if (base.code == 0) {
await UserTool.userProvider.setToken(base.data['token']);
Get.offAll(const TabNavigator());
if (UserTool.userProvider.userInfo.havePwd == 0) {
Get.to(()=>const SetPasswordPage());
}
} else {
CloudToast.show(base.msg);
}
@ -355,7 +364,13 @@ class LoginBoxWidget extends StatelessWidget {
final String text;
final int fontSize;
final Widget plone;
const LoginBoxWidget({Key? key, required this.text, required this.fontSize, required this.plone}) : super(key: key);
const LoginBoxWidget(
{Key? key,
required this.text,
required this.fontSize,
required this.plone})
: super(key: key);
@override
Widget build(BuildContext context) {
@ -391,4 +406,3 @@ class LoginBoxWidget extends StatelessWidget {
);
}
}

@ -52,6 +52,7 @@ class _LoginPsdPageState extends State<LoginPsdPage> {
@override
Widget build(BuildContext context) {
return CloudScaffold(
systemStyle: const SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark,
@ -139,6 +140,7 @@ class _LoginPsdPageState extends State<LoginPsdPage> {
Get.offAll(const TabNavigator());
} else {
CloudToast.show(base.msg);
}
}
},
@ -178,15 +180,6 @@ class _LoginPsdPageState extends State<LoginPsdPage> {
style:
TextStyle(color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
children: [
// TextSpan(
// text: '《用户服务协议》',
// style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
// recognizer: _recognizer(context, 2)),
// TextSpan(
// text: "",
// style: TextStyle(
// color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
// ),
TextSpan(
text: '《短信帮手隐私协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),

@ -76,6 +76,7 @@ class _SetPasswordPageState extends State<SetPasswordPage> {
child: Padding(
padding: EdgeInsets.only(left: 10.w),
child: TextField(
maxLength: 16,
onChanged: (value){
_psdController.text=value;
_psdController.value = TextEditingValue(
@ -91,6 +92,7 @@ class _SetPasswordPageState extends State<SetPasswordPage> {
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[A-Za-z0-9_]'))],
controller: _psdController,
decoration: const InputDecoration(
counterText: '',
hintText: '填写新密码',
hintStyle: TextStyle(
color: Colors.black38,

Loading…
Cancel
Save