feat: reply with pics

This commit is contained in:
bggRGjQaUbCoE
2024-09-30 20:43:54 +08:00
parent 33b9a93620
commit 5b2412ae5b
4 changed files with 126 additions and 10 deletions

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:developer';
import 'package:PiliPalaX/http/loading_state.dart';
import 'package:dio/dio.dart';
@@ -515,18 +516,29 @@ class VideoHttp {
required String message,
int? root,
int? parent,
List? pictures,
}) async {
if (message == '') {
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
}
var res = await Request().post(Api.replyAdd, queryParameters: {
Map<String, dynamic> data = {
'type': type.index,
'oid': oid,
'root': root == null || root == 0 ? '' : root,
'parent': parent == null || parent == 0 ? '' : parent,
'message': message,
if (pictures != null) 'pictures': jsonEncode(pictures),
'csrf': await Request.getCsrf(),
});
};
var res = await Request().post(
Api.replyAdd,
data: FormData.fromMap(data),
options: Options(
headers: {
'Content-Type': Headers.formUrlEncodedContentType,
},
),
);
log(res.toString());
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};