mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: report panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -5,21 +5,26 @@ Widget radioWidget<T>({
|
||||
T? groupValue,
|
||||
required ValueChanged onChanged,
|
||||
required String title,
|
||||
double? paddingStart,
|
||||
EdgeInsetsGeometry? padding,
|
||||
}) {
|
||||
Widget child() => Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
onChanged: onChanged,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
Text(title),
|
||||
],
|
||||
);
|
||||
return InkWell(
|
||||
onTap: () => onChanged(value),
|
||||
child: Row(
|
||||
children: [
|
||||
if (paddingStart != null) SizedBox(width: paddingStart),
|
||||
Radio(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
onChanged: onChanged,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
Text(title),
|
||||
],
|
||||
),
|
||||
child: padding != null
|
||||
? Padding(
|
||||
padding: padding,
|
||||
child: child(),
|
||||
)
|
||||
: child(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ void autoWrapReportDialog(
|
||||
padding: const EdgeInsets.only(left: 22),
|
||||
child: Text(
|
||||
title.key,
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -59,6 +61,7 @@ void autoWrapReportDialog(
|
||||
value: opt.key,
|
||||
groupValue: reasonType,
|
||||
title: opt.value,
|
||||
padding: const EdgeInsets.only(right: 10),
|
||||
onChanged: (value) {
|
||||
reasonType = value;
|
||||
if (context.mounted) {
|
||||
@@ -105,21 +108,36 @@ void autoWrapReportDialog(
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12, top: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: banUid,
|
||||
onChanged: (v) {
|
||||
banUid = v ?? false;
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
},
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
const Text('拉黑该用户'),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
banUid = !banUid;
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18, top: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
size: 22,
|
||||
banUid
|
||||
? Icons.check_box_outlined
|
||||
: Icons.check_box_outline_blank,
|
||||
color: banUid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
Text(
|
||||
' 拉黑该用户',
|
||||
style: TextStyle(
|
||||
color: banUid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -145,6 +163,7 @@ void autoWrapReportDialog(
|
||||
SmartDialog.showLoading();
|
||||
try {
|
||||
final data = await onSuccess(reasonType!, reasonDesc, banUid);
|
||||
SmartDialog.dismiss();
|
||||
if (data['code'] == 0) {
|
||||
Get.back();
|
||||
SmartDialog.showToast('举报成功');
|
||||
@@ -152,9 +171,8 @@ void autoWrapReportDialog(
|
||||
SmartDialog.showToast(data['message']);
|
||||
}
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('提交失败:$e');
|
||||
} finally {
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast('提交失败:$e');
|
||||
}
|
||||
},
|
||||
child: const Text('确定'),
|
||||
@@ -167,34 +185,34 @@ void autoWrapReportDialog(
|
||||
|
||||
class ReportOptions {
|
||||
// from https://s1.hdslb.com/bfs/seed/jinkela/comment-h5/static/js/605.chunks.js
|
||||
static const Map<String, Map<int, String>> commentReport = {
|
||||
'违反法律法规': {9: '违法违规', 2: '色情', 10: '低俗', 12: '赌博诈骗', 23: '违法信息外链'},
|
||||
'谣言类不实信息': {19: '涉政谣言', 22: '虚假不实信息', 20: '涉社会事件谣言'},
|
||||
'侵犯个人权益': {7: '人身攻击', 15: '侵犯隐私'},
|
||||
'有害社区环境': {
|
||||
1: '垃圾广告',
|
||||
4: '引战',
|
||||
5: '剧透',
|
||||
3: '刷屏',
|
||||
8: '视频不相关',
|
||||
18: '违规抽奖',
|
||||
17: '青少年不良信息',
|
||||
},
|
||||
'其他': {0: '其他'},
|
||||
};
|
||||
static Map<String, Map<int, String>> get commentReport => {
|
||||
'违反法律法规': {9: '违法违规', 2: '色情', 10: '低俗', 12: '赌博诈骗', 23: '违法信息外链'},
|
||||
'谣言类不实信息': {19: '涉政谣言', 22: '虚假不实信息', 20: '涉社会事件谣言'},
|
||||
'侵犯个人权益': {7: '人身攻击', 15: '侵犯隐私'},
|
||||
'有害社区环境': {
|
||||
1: '垃圾广告',
|
||||
4: '引战',
|
||||
5: '剧透',
|
||||
3: '刷屏',
|
||||
8: '视频不相关',
|
||||
18: '违规抽奖',
|
||||
17: '青少年不良信息',
|
||||
},
|
||||
'其他': {0: '其他'},
|
||||
};
|
||||
|
||||
static const Map<String, Map<int, String>> dynamicReport = {
|
||||
'': {
|
||||
4: '垃圾广告',
|
||||
8: '引战',
|
||||
1: '色情',
|
||||
5: '人身攻击',
|
||||
3: '违法信息',
|
||||
9: '涉政谣言',
|
||||
10: '涉社会事件谣言',
|
||||
12: '虚假不实信息',
|
||||
13: '违法信息外链',
|
||||
0: '其他',
|
||||
},
|
||||
};
|
||||
static Map<String, Map<int, String>> get dynamicReport => {
|
||||
'': {
|
||||
4: '垃圾广告',
|
||||
8: '引战',
|
||||
1: '色情',
|
||||
5: '人身攻击',
|
||||
3: '违法信息',
|
||||
9: '涉政谣言',
|
||||
10: '涉社会事件谣言',
|
||||
12: '虚假不实信息',
|
||||
13: '违法信息外链',
|
||||
0: '其他',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -327,32 +327,35 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
autoWrapReportDialog(context, ReportOptions.dynamicReport,
|
||||
(reasonType, reasonDesc, banUid) async {
|
||||
if (banUid) {
|
||||
VideoHttp.relationMod(
|
||||
mid: item.modules.moduleAuthor.mid,
|
||||
act: 5,
|
||||
reSrc: 11,
|
||||
autoWrapReportDialog(
|
||||
context,
|
||||
ReportOptions.dynamicReport,
|
||||
(reasonType, reasonDesc, banUid) async {
|
||||
if (banUid) {
|
||||
VideoHttp.relationMod(
|
||||
mid: item.modules.moduleAuthor.mid,
|
||||
act: 5,
|
||||
reSrc: 11,
|
||||
);
|
||||
}
|
||||
final res = await Request().post(
|
||||
'/x/dynamic/feed/dynamic_report/add',
|
||||
queryParameters: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
data: {
|
||||
"accused_uid": item.modules.moduleAuthor.mid,
|
||||
"dynamic_id": item.idStr,
|
||||
"reason_type": reasonType,
|
||||
"reason_desc": reasonType == 0 ? reasonDesc : null,
|
||||
},
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
}
|
||||
final res = await Request().post(
|
||||
'/x/dynamic/feed/dynamic_report/add',
|
||||
queryParameters: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
data: {
|
||||
"accused_uid": item.modules.moduleAuthor.mid,
|
||||
"dynamic_id": item.idStr,
|
||||
"reason_type": reasonType,
|
||||
"reason_desc": reasonType == 0 ? reasonDesc : null,
|
||||
},
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
return res.data as Map;
|
||||
});
|
||||
return res.data as Map;
|
||||
},
|
||||
);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
|
||||
@@ -1037,24 +1037,32 @@ class MorePanel extends StatelessWidget {
|
||||
switch (type) {
|
||||
case 'report':
|
||||
Get.back();
|
||||
autoWrapReportDialog(Get.context!, ReportOptions.commentReport,
|
||||
(reasonType, reasonDesc, banUid) async {
|
||||
final res = await Request().post('/x/v2/reply/report',
|
||||
autoWrapReportDialog(
|
||||
Get.context!,
|
||||
ReportOptions.commentReport,
|
||||
(reasonType, reasonDesc, banUid) async {
|
||||
final res = await Request().post(
|
||||
'/x/v2/reply/report',
|
||||
data: {
|
||||
'add_blacklist': banUid.toString(),
|
||||
'add_blacklist': banUid,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'gaia_source': 'main_h5',
|
||||
'oid': item.oid.toString(),
|
||||
'oid': item.oid,
|
||||
'platform': 'android',
|
||||
'reason': reasonType.toString(),
|
||||
'rpid': item.rpid.toString(),
|
||||
'reason': reasonType,
|
||||
'rpid': item.rpid,
|
||||
'scene': 'main',
|
||||
'type': '1',
|
||||
'type': 1,
|
||||
if (reasonType == 0) 'content': reasonDesc!
|
||||
},
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType));
|
||||
return res.data as Map;
|
||||
});
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
onDelete?.call(item.rpid);
|
||||
}
|
||||
return res.data as Map;
|
||||
},
|
||||
);
|
||||
break;
|
||||
case 'copyAll':
|
||||
Get.back();
|
||||
|
||||
@@ -1069,7 +1069,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
|
||||
Widget morePanel({
|
||||
required BuildContext context,
|
||||
required dynamic item,
|
||||
required ReplyInfo item,
|
||||
required onDelete,
|
||||
}) {
|
||||
Future<dynamic> menuActionHandler(String type) async {
|
||||
@@ -1077,25 +1077,33 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
switch (type) {
|
||||
case 'report':
|
||||
Get.back();
|
||||
autoWrapReportDialog(context, ReportOptions.commentReport,
|
||||
(reasonType, reasonDesc, banUid) async {
|
||||
final res = await Request().post('/x/v2/reply/report',
|
||||
autoWrapReportDialog(
|
||||
context,
|
||||
ReportOptions.commentReport,
|
||||
(reasonType, reasonDesc, banUid) async {
|
||||
final res = await Request().post(
|
||||
'/x/v2/reply/report',
|
||||
data: {
|
||||
'add_blacklist': banUid.toString(),
|
||||
'add_blacklist': banUid,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'gaia_source': 'main_h5',
|
||||
'oid': item.oid.toString(),
|
||||
'oid': item.oid,
|
||||
'platform': 'android',
|
||||
'reason': reasonType.toString(),
|
||||
'rpid': item.id.toString(),
|
||||
'reason': reasonType,
|
||||
'rpid': item.id,
|
||||
'scene': 'main',
|
||||
'type': '1',
|
||||
'type': 1,
|
||||
if (reasonType == 0) 'content': reasonDesc!
|
||||
},
|
||||
options:
|
||||
Options(contentType: Headers.formUrlEncodedContentType));
|
||||
return res.data as Map;
|
||||
});
|
||||
Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
onDelete?.call(item.id.toInt());
|
||||
}
|
||||
return res.data as Map;
|
||||
},
|
||||
);
|
||||
break;
|
||||
case 'copyAll':
|
||||
Get.back();
|
||||
|
||||
@@ -327,7 +327,7 @@ class Utils {
|
||||
builder: (context) => Column(
|
||||
children: List.generate(list.length, (index) {
|
||||
return radioWidget(
|
||||
paddingStart: 14,
|
||||
padding: const EdgeInsets.only(left: 14),
|
||||
title: list[index].title ?? '',
|
||||
groupValue: checkedId,
|
||||
value: list[index].id,
|
||||
|
||||
Reference in New Issue
Block a user