mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 密码登录接口显示更多错误信息
This commit is contained in:
@@ -46,7 +46,6 @@ class LoginPageController extends GetxController
|
|||||||
Timer? qrCodeTimer;
|
Timer? qrCodeTimer;
|
||||||
Timer? smsSendCooldownTimer;
|
Timer? smsSendCooldownTimer;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -113,6 +112,7 @@ class LoginPageController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future afterLoginByApp(Map<String, dynamic> token_info, cookie_info) async {
|
Future afterLoginByApp(Map<String, dynamic> token_info, cookie_info) async {
|
||||||
|
try {
|
||||||
Box localCache = GStorage.localCache;
|
Box localCache = GStorage.localCache;
|
||||||
localCache.put(LocalCacheKey.accessKey, {
|
localCache.put(LocalCacheKey.accessKey, {
|
||||||
'mid': token_info['mid'],
|
'mid': token_info['mid'],
|
||||||
@@ -143,10 +143,9 @@ class LoginPageController extends GetxController
|
|||||||
.loadForRequest(Uri.parse(HttpString.apiBaseUrl)));
|
.loadForRequest(Uri.parse(HttpString.apiBaseUrl)));
|
||||||
Request.dio.options.headers['cookie'] = cookieStrings;
|
Request.dio.options.headers['cookie'] = cookieStrings;
|
||||||
print(Request.dio.options);
|
print(Request.dio.options);
|
||||||
try {
|
|
||||||
await WebviewCookieManager().setCookies(cookies);
|
await WebviewCookieManager().setCookies(cookies);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
SmartDialog.showToast('webview设置cookie失败,$e');
|
SmartDialog.showToast('设置登录态失败,$e');
|
||||||
}
|
}
|
||||||
final result = await UserHttp.userInfo();
|
final result = await UserHttp.userInfo();
|
||||||
if (result['status'] && result['data'].isLogin) {
|
if (result['status'] && result['data'].isLogin) {
|
||||||
@@ -294,11 +293,23 @@ class LoginPageController extends GetxController
|
|||||||
);
|
);
|
||||||
print(res);
|
print(res);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('登录成功');
|
|
||||||
var data = res['data'];
|
var data = res['data'];
|
||||||
for (var key in data.keys) {
|
for (var key in data.keys) {
|
||||||
print('$key: ${data[key]}');
|
print('$key: ${data[key]}');
|
||||||
}
|
}
|
||||||
|
if (data == null) {
|
||||||
|
SmartDialog.showToast('登录异常,接口未返回数据:${res["msg"]}');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data['token_info'] == null) {
|
||||||
|
SmartDialog.showToast('登录异常,接口未返回token信息,${res["msg"]},\n $data');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data['cookie_info'] == null) {
|
||||||
|
SmartDialog.showToast('登录异常,接口未返回cookie信息,${res["msg"]},\n $data');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SmartDialog.showToast('正在保存身份信息');
|
||||||
await afterLoginByApp(data['token_info'], data['cookie_info']);
|
await afterLoginByApp(data['token_info'], data['cookie_info']);
|
||||||
Get.back();
|
Get.back();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user