mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 新增不感兴趣功能;优化access_key刷新反馈
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import '../../http/user.dart';
|
||||
import '../../http/video.dart';
|
||||
import '../../models/home/rcmd/result.dart';
|
||||
import '../../pages/mine/controller.dart';
|
||||
import '../../utils/storage.dart';
|
||||
|
||||
@@ -73,9 +74,157 @@ class VideoPopupMenu extends StatelessWidget {
|
||||
// 不感兴趣
|
||||
PopupMenuItem<String>(
|
||||
onTap: () async {
|
||||
// var res = await VideoHttp.dislike(bvid: videoItem.bvid as String);
|
||||
// SmartDialog.showToast(res['msg']);
|
||||
SmartDialog.showToast("暂未实现");
|
||||
String? accessKey = GStrorage.localCache
|
||||
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
|
||||
if (accessKey == null || accessKey == "") {
|
||||
SmartDialog.showToast("本操作使用app端接口,请前往【隐私设置】刷新access_key");
|
||||
return;
|
||||
}
|
||||
if (videoItem is RecVideoItemAppModel) {
|
||||
RecVideoItemAppModel v = videoItem as RecVideoItemAppModel;
|
||||
ThreePoint? tp = v.threePoint;
|
||||
if (tp == null) {
|
||||
SmartDialog.showToast("未能获取threePoint");
|
||||
return;
|
||||
}
|
||||
if (tp.dislikeReasons == null && tp.feedbacks == null) {
|
||||
SmartDialog.showToast("未能获取dislikeReasons或feedbacks");
|
||||
return;
|
||||
}
|
||||
Widget actionButton(DislikeReason? r, FeedbackReason? f) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0, vertical: 0.0),
|
||||
),
|
||||
onPressed: () async {
|
||||
SmartDialog.showLoading(msg: '正在提交');
|
||||
var res = await VideoHttp.feedDislike(
|
||||
reasonId: r?.id,
|
||||
feedbackId: f?.id,
|
||||
id: v.param!,
|
||||
goto: v.goto!,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(
|
||||
res['status'] ? (r?.toast ?? f?.toast) : res['msg']);
|
||||
Get.back();
|
||||
},
|
||||
child: Text(r?.name ?? f?.name ?? '未知'),
|
||||
);
|
||||
}
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('请选择'),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
if (tp.dislikeReasons != null)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text('我不想看'),
|
||||
),
|
||||
if (tp.dislikeReasons != null)
|
||||
Wrap(
|
||||
spacing: 5.0,
|
||||
runSpacing: 2.0,
|
||||
children: tp.dislikeReasons!.map((item) {
|
||||
return actionButton(item, null);
|
||||
}).toList(),
|
||||
),
|
||||
if (tp.feedbacks != null)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text('反馈'),
|
||||
),
|
||||
if (tp.feedbacks != null)
|
||||
Wrap(
|
||||
spacing: 5.0,
|
||||
runSpacing: 2.0,
|
||||
children: tp.feedbacks!.map((item) {
|
||||
return actionButton(null, item);
|
||||
}).toList(),
|
||||
),
|
||||
//分割线
|
||||
const Divider(),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
SmartDialog.showLoading(msg: '正在提交');
|
||||
var res = await VideoHttp.feedDislikeCancel(
|
||||
// reasonId: r?.id,
|
||||
// feedbackId: f?.id,
|
||||
id: v.param!,
|
||||
goto: v.goto!,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(
|
||||
res['status'] ? "成功" : res['msg']);
|
||||
Get.back();
|
||||
},
|
||||
child: const Text("撤销"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('点踩该视频?'),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 5),
|
||||
const Text("web端暂不支持精细选择"),
|
||||
const SizedBox(height: 5),
|
||||
Wrap(
|
||||
spacing: 5.0,
|
||||
runSpacing: 2.0,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
SmartDialog.showLoading(msg: '正在提交');
|
||||
var res = await VideoHttp.dislikeVideo(
|
||||
bvid: videoItem.bvid as String,
|
||||
type: true);
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(res['status']
|
||||
? "点踩成功"
|
||||
: res['msg']);
|
||||
Get.back();
|
||||
},
|
||||
child: const Text("点踩"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
SmartDialog.showLoading(msg: '正在提交');
|
||||
var res = await VideoHttp.dislikeVideo(
|
||||
bvid: videoItem.bvid as String,
|
||||
type: false);
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(res['status']
|
||||
? "取消踩"
|
||||
: res['msg']);
|
||||
Get.back();
|
||||
},
|
||||
child: const Text("撤销"),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
value: 'dislike',
|
||||
height: menuItemHeight,
|
||||
|
||||
Reference in New Issue
Block a user