站点增加消息入口
This commit is contained in:
@@ -151,7 +151,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
renderData();
|
||||
|
||||
msgNotice();
|
||||
startAutoRefresh();
|
||||
}
|
||||
|
||||
@@ -167,6 +167,27 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
searchController.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
bool isNotice = false;
|
||||
Future<void> msgNotice() async {
|
||||
final Map<String, dynamic> requestData = {
|
||||
'appFlag': 1,
|
||||
'isRead': 1,
|
||||
'pageNum': 1,
|
||||
'pageSize': 5,
|
||||
};
|
||||
final response = await HttpService.to.get(
|
||||
'appointment/unread_notice/page',
|
||||
params: requestData,
|
||||
);
|
||||
if (response != null) {
|
||||
final result = BaseModel.fromJson(response.data);
|
||||
if (result.code == 0 && result.data != null) {
|
||||
String total = result.data["total"].toString();
|
||||
isNotice = int.parse(total) > 0;
|
||||
updateUi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void startAutoRefresh() {
|
||||
// 先停止已存在的定时器,防止重复启动
|
||||
|
||||
Reference in New Issue
Block a user