mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: delete sys msg
This commit is contained in:
@@ -50,6 +50,7 @@ class SysMsgController extends GetxController {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future onLoad() async {
|
||||
if (isEnd) return;
|
||||
queryMsgFeedSysMsg();
|
||||
@@ -60,4 +61,14 @@ class SysMsgController extends GetxController {
|
||||
cursorTime = -1;
|
||||
queryMsgFeedSysMsg();
|
||||
}
|
||||
|
||||
Future onRemove(int index) async {
|
||||
var res = await MsgHttp.removeSysMsg(msgFeedSysMsgList[index].id);
|
||||
if (res['status']) {
|
||||
msgFeedSysMsgList.removeAt(index);
|
||||
SmartDialog.showToast('删除成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,33 @@ class _SysMsgPageState extends State<SysMsgPage> {
|
||||
}
|
||||
return ListTile(
|
||||
onTap: () {},
|
||||
onLongPress: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('确定删除该消息?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
_sysMsgController.onRemove(i);
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
));
|
||||
},
|
||||
title: Text(
|
||||
"${_sysMsgController.msgFeedSysMsgList[i].title}",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
|
||||
Reference in New Issue
Block a user