mod: 评论删除逻辑
This commit is contained in:
@ -1081,7 +1081,7 @@ class MorePanel extends StatelessWidget {
|
||||
// break;
|
||||
case 'delete':
|
||||
// 删除评论提示
|
||||
bool? isConfirm = await showDialog(
|
||||
await showDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
@ -1089,15 +1089,25 @@ class MorePanel extends StatelessWidget {
|
||||
content: const Text('删除评论后,评论下所有回复将被删除,确定删除吗?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: false),
|
||||
onPressed: () => Get.back(),
|
||||
child: Text('取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back(result: true);
|
||||
SmartDialog.showToast('删除成功');
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
var result = await ReplyHttp.replyDel(
|
||||
type: item.type!,
|
||||
oid: item.oid!,
|
||||
rpid: item.rpid!,
|
||||
);
|
||||
if (result['status']) {
|
||||
SmartDialog.showToast('评论删除成功,需手动刷新');
|
||||
Get.back();
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
@ -1105,18 +1115,6 @@ class MorePanel extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
if (isConfirm == null || !isConfirm) {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading(msg: '删除中...');
|
||||
var result = await ReplyHttp.replyDel(
|
||||
type: item.type!,
|
||||
oid: item.oid!,
|
||||
rpid: item.rpid!,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(result["msg"]);
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
Reference in New Issue
Block a user