opt: reply del
This commit is contained in:
@ -125,6 +125,7 @@ class ReplyControl {
|
|||||||
this.upLike,
|
this.upLike,
|
||||||
this.isShow,
|
this.isShow,
|
||||||
this.entryText,
|
this.entryText,
|
||||||
|
this.entryTextNum,
|
||||||
this.titleText,
|
this.titleText,
|
||||||
this.time,
|
this.time,
|
||||||
this.location,
|
this.location,
|
||||||
@ -135,6 +136,7 @@ class ReplyControl {
|
|||||||
bool? upLike;
|
bool? upLike;
|
||||||
bool? isShow;
|
bool? isShow;
|
||||||
String? entryText;
|
String? entryText;
|
||||||
|
int? entryTextNum;
|
||||||
String? titleText;
|
String? titleText;
|
||||||
String? time;
|
String? time;
|
||||||
String? location;
|
String? location;
|
||||||
@ -155,6 +157,10 @@ class ReplyControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entryText = json['sub_reply_entry_text'];
|
entryText = json['sub_reply_entry_text'];
|
||||||
|
// 正则匹配
|
||||||
|
entryTextNum = json['sub_reply_entry_text'] != null
|
||||||
|
? int.parse(RegExp(r"\d+").stringMatch(json['sub_reply_entry_text']!)!)
|
||||||
|
: 0;
|
||||||
titleText = json['sub_reply_title_text'];
|
titleText = json['sub_reply_title_text'];
|
||||||
time = json['time_desc'];
|
time = json['time_desc'];
|
||||||
location = json['location'] != null ? json['location'].split(':')[1] : '';
|
location = json['location'] != null ? json['location'].split(':')[1] : '';
|
||||||
|
|||||||
@ -123,4 +123,15 @@ class DynamicDetailController extends GetxController {
|
|||||||
Future onLoad() async {
|
Future onLoad() async {
|
||||||
queryReplyList(reqType: 'onLoad');
|
queryReplyList(reqType: 'onLoad');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future removeReply(int? rpid, int? frpid) async {
|
||||||
|
// 移除一楼评论
|
||||||
|
if (rpid != null) {
|
||||||
|
replyList.removeWhere((item) {
|
||||||
|
return item.rpid == rpid;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO 移除二楼评论
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -335,6 +335,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
.replies!
|
.replies!
|
||||||
.add(replyItem);
|
.add(replyItem);
|
||||||
},
|
},
|
||||||
|
onDelete:
|
||||||
|
_dynamicDetailController.removeReply,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -145,7 +145,15 @@ class VideoReplyController extends GetxController {
|
|||||||
if (frpid != 0 && frpid != null) {
|
if (frpid != 0 && frpid != null) {
|
||||||
replyList.value = replyList.map((item) {
|
replyList.value = replyList.map((item) {
|
||||||
if (item.rpid! == frpid) {
|
if (item.rpid! == frpid) {
|
||||||
return item..replies!.removeWhere((reply) => reply.rpid == rpid);
|
item.replies!.removeWhere((reply) => reply.rpid == rpid);
|
||||||
|
// 【共xx条回复】
|
||||||
|
if (item.replyControl != null &&
|
||||||
|
item.replyControl!.entryTextNum! >= 1) {
|
||||||
|
item.replyControl!.entryTextNum =
|
||||||
|
item.replyControl!.entryTextNum! - 1;
|
||||||
|
item.rcount = item.replyControl!.entryTextNum;
|
||||||
|
}
|
||||||
|
return item;
|
||||||
} else {
|
} else {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -503,7 +503,7 @@ class ReplyItemRow extends StatelessWidget {
|
|||||||
if (replyControl!.upReply!)
|
if (replyControl!.upReply!)
|
||||||
const TextSpan(text: 'up主等人 '),
|
const TextSpan(text: 'up主等人 '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: replyControl!.entryText!,
|
text: '查看${replyControl!.entryTextNum}条回复',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: colorScheme.primary,
|
color: colorScheme.primary,
|
||||||
),
|
),
|
||||||
@ -1089,16 +1089,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
print('item.rpid: ${item.rpid}');
|
|
||||||
onDelete?.call(item.rpid!, item.root);
|
|
||||||
return;
|
|
||||||
var result = await ReplyHttp.replyDel(
|
var result = await ReplyHttp.replyDel(
|
||||||
type: item.type!,
|
type: item.type!,
|
||||||
oid: item.oid!,
|
oid: item.oid!,
|
||||||
rpid: item.rpid!,
|
rpid: item.rpid!,
|
||||||
);
|
);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
// SmartDialog.showToast('评论删除成功,需手动刷新');
|
|
||||||
onDelete?.call(item.rpid!, item.root);
|
onDelete?.call(item.rpid!, item.root);
|
||||||
Get.back();
|
Get.back();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user