mod: 登录后状态

This commit is contained in:
guozhigq
2023-08-17 22:44:01 +08:00
parent adff2f2828
commit be1cc25d12
4 changed files with 36 additions and 5 deletions

View File

@ -145,7 +145,10 @@ class DynamicsController extends GetxController {
}
}
Future queryFollowUp() async {
Future queryFollowUp({type = 'init'}) async {
if (type == 'init') {
upData = FollowUpModel().obs;
}
var res = await DynamicsHttp.followUp();
if (res['status']) {
upData.value = res['data'];

View File

@ -224,7 +224,14 @@ class _DynamicsPageState extends State<DynamicsPage>
} else {
return HttpError(
errMsg: data['msg'],
fn: () => _dynamicsController.onRefresh(),
fn: () {
setState(() {
_futureBuilderFuture =
_dynamicsController.queryFollowDynamic();
_futureBuilderFutureUp =
_dynamicsController.queryFollowUp();
});
},
);
}
} else {

View File

@ -116,7 +116,11 @@ class _MediaPageState extends State<MediaPage>
),
),
trailing: IconButton(
onPressed: () => _futureBuilderFuture,
onPressed: () {
setState(() {
_futureBuilderFuture = mediaController.queryFavFolder();
});
},
icon: const Icon(
Icons.refresh,
size: 20,

View File

@ -1,5 +1,6 @@
// ignore_for_file: avoid_print
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
@ -86,12 +87,28 @@ class WebviewController extends GetxController {
Get.find<MineController>().userInfo.value = result['data'];
Get.find<MineController>().onInit();
Get.find<RcmdController>().queryRcmdFeed('onRefresh');
Get.find<DynamicsController>().queryFollowDynamic();
Get.find<DynamicsController>().onRefresh();
HomeController homeCtr = Get.find<HomeController>();
homeCtr.updateLoginStatus(true);
} catch (_) {}
} catch (err) {
SmartDialog.show(builder: (context) {
return AlertDialog(
title: const Text('登录遇到问题'),
content: Text(err.toString()),
actions: [
TextButton(
onPressed: () => controller.reload(),
child: const Text('确认'),
)
],
);
});
}
Get.back();
} else {
// 获取用户信息失败
SmartDialog.showToast(result.msg);
}
} catch (e) {
print(e);