fix: 登录页面
This commit is contained in:
@ -244,12 +244,25 @@ class LoginHttp {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
|
if (res.data['data']['status'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'data': res.data['data'],
|
'data': res.data['data'],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
return {
|
||||||
|
'status': false,
|
||||||
|
'code': 1,
|
||||||
|
'data': res.data['data'],
|
||||||
|
'msg': res.data['data']['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ class LoginPageController extends GetxController {
|
|||||||
RxInt validSeconds = 180.obs;
|
RxInt validSeconds = 180.obs;
|
||||||
Timer? validTimer;
|
Timer? validTimer;
|
||||||
late String qrcodeKey;
|
late String qrcodeKey;
|
||||||
|
RxBool passwordVisible = false.obs;
|
||||||
|
|
||||||
// 监听pageView切换
|
// 监听pageView切换
|
||||||
void onPageChange(int index) {
|
void onPageChange(int index) {
|
||||||
@ -128,7 +129,14 @@ class LoginPageController extends GetxController {
|
|||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
await LoginUtils.confirmLogin('', null);
|
await LoginUtils.confirmLogin('', null);
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
await SmartDialog.showToast(res['msg']);
|
||||||
|
if (res.containsKey('code') && res['code'] == 1) {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': res['data']['data']['url'],
|
||||||
|
'type': 'url',
|
||||||
|
'pageTitle': '登录验证',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(webKeyRes['msg']);
|
SmartDialog.showToast(webKeyRes['msg']);
|
||||||
|
@ -269,25 +269,46 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(top: 38, bottom: 15),
|
margin: const EdgeInsets.only(top: 38, bottom: 15),
|
||||||
child: TextFormField(
|
child: Obx(() => TextFormField(
|
||||||
controller: _loginPageCtr.passwordTextController,
|
controller:
|
||||||
focusNode: _loginPageCtr.passwordTextFieldNode,
|
_loginPageCtr.passwordTextController,
|
||||||
|
focusNode:
|
||||||
|
_loginPageCtr.passwordTextFieldNode,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
obscureText:
|
||||||
|
_loginPageCtr.passwordVisible.value,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
labelText: '输入密码',
|
labelText: '输入密码',
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(6.0),
|
borderRadius: BorderRadius.circular(6.0),
|
||||||
),
|
),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_loginPageCtr.passwordVisible.value
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
_loginPageCtr.passwordVisible.value =
|
||||||
|
!_loginPageCtr
|
||||||
|
.passwordVisible.value;
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
// 校验用户名
|
// 校验用户名
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
return v!.trim().isNotEmpty ? null : "密码不能为空";
|
return v!.trim().isNotEmpty
|
||||||
|
? null
|
||||||
|
: "密码不能为空";
|
||||||
},
|
},
|
||||||
onSaved: (val) {
|
onSaved: (val) {
|
||||||
print(val);
|
print(val);
|
||||||
},
|
},
|
||||||
),
|
)),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Row(
|
Row(
|
||||||
|
Reference in New Issue
Block a user