fix: 登录页面
This commit is contained in:
@ -244,12 +244,25 @@ class LoginHttp {
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
if (res.data['data']['status'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} 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;
|
||||
Timer? validTimer;
|
||||
late String qrcodeKey;
|
||||
RxBool passwordVisible = false.obs;
|
||||
|
||||
// 监听pageView切换
|
||||
void onPageChange(int index) {
|
||||
@ -128,7 +129,14 @@ class LoginPageController extends GetxController {
|
||||
if (res['status']) {
|
||||
await LoginUtils.confirmLogin('', null);
|
||||
} 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 {
|
||||
SmartDialog.showToast(webKeyRes['msg']);
|
||||
|
@ -269,25 +269,46 @@ class _LoginPageState extends State<LoginPage> {
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 38, bottom: 15),
|
||||
child: TextFormField(
|
||||
controller: _loginPageCtr.passwordTextController,
|
||||
focusNode: _loginPageCtr.passwordTextFieldNode,
|
||||
child: Obx(() => TextFormField(
|
||||
controller:
|
||||
_loginPageCtr.passwordTextController,
|
||||
focusNode:
|
||||
_loginPageCtr.passwordTextFieldNode,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
obscureText:
|
||||
_loginPageCtr.passwordVisible.value,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelText: '输入密码',
|
||||
border: OutlineInputBorder(
|
||||
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) {
|
||||
return v!.trim().isNotEmpty ? null : "密码不能为空";
|
||||
return v!.trim().isNotEmpty
|
||||
? null
|
||||
: "密码不能为空";
|
||||
},
|
||||
onSaved: (val) {
|
||||
print(val);
|
||||
},
|
||||
),
|
||||
)),
|
||||
),
|
||||
const Spacer(),
|
||||
Row(
|
||||
|
Reference in New Issue
Block a user