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