feat: 移除单个稍后再看
This commit is contained in:
@ -179,14 +179,16 @@ class UserHttp {
|
||||
}
|
||||
|
||||
// 移除已观看
|
||||
static Future toViewDel() async {
|
||||
static Future toViewDel({int? aid}) async {
|
||||
final Map<String, dynamic> params = {
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
};
|
||||
|
||||
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
||||
var res = await Request().post(
|
||||
Api.toViewDel,
|
||||
queryParameters: {
|
||||
'jsonp': 'jsonp',
|
||||
'viewed': true,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
queryParameters: params,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!成功移除'};
|
||||
|
@ -23,29 +23,38 @@ class LaterController extends GetxController {
|
||||
return res;
|
||||
}
|
||||
|
||||
Future toViewDel() async {
|
||||
Future toViewDel({int? aid}) async {
|
||||
SmartDialog.show(
|
||||
useSystem: true,
|
||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: const Text('即将删除所有已观看视频,此操作不可恢复。确定是否删除?'),
|
||||
content: Text(
|
||||
aid != null ? '即将移除该视频,确定是否移除' : '即将删除所有已观看视频,此操作不可恢复。确定是否删除?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: const Text('取消')),
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var res = await UserHttp.toViewDel();
|
||||
var res = await UserHttp.toViewDel(aid: aid);
|
||||
if (res['status']) {
|
||||
if (aid != null) {
|
||||
laterList.removeWhere((e) => e.aid == aid);
|
||||
} else {
|
||||
laterList.clear();
|
||||
queryLaterList();
|
||||
}
|
||||
}
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
child: const Text('确认删除'),
|
||||
child: Text(aid != null ? '确认移除' : '确认删除'),
|
||||
)
|
||||
],
|
||||
);
|
||||
@ -65,7 +74,11 @@ class LaterController extends GetxController {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: const Text('取消')),
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var res = await UserHttp.toViewClear();
|
||||
|
@ -80,10 +80,12 @@ class _LaterPageState extends State<LaterPage> {
|
||||
? SliverList(
|
||||
delegate:
|
||||
SliverChildBuilderDelegate((context, index) {
|
||||
var videoItem = _laterController.laterList[index];
|
||||
return VideoCardH(
|
||||
videoItem: _laterController.laterList[index],
|
||||
videoItem: videoItem,
|
||||
source: 'later',
|
||||
);
|
||||
longPress: () => _laterController.toViewDel(
|
||||
aid: videoItem.aid));
|
||||
}, childCount: _laterController.laterList.length),
|
||||
)
|
||||
: _laterController.isLoading.value
|
||||
|
Reference in New Issue
Block a user