个人视频详情和删除视频

This commit is contained in:
Seven Tsui 2025-09-15 17:18:10 +08:00
parent ec30eb2456
commit 81e386b038
4 changed files with 51 additions and 28 deletions

View File

@ -23,4 +23,7 @@ class VideoApi {
static const String changeVlogStatus = '/app/vlog/changeVlogStatus'; //
static const String changeToPublic = '/app/vlog/changeToPublic'; //
static const String changeToPrivate = '/app/vlog/changeToPrivate'; //
static const String deleteVideo = '/app/vlog/delete'; //
static const String getVideoListByMemberId = '/app/vlog/page'; //
}

View File

@ -176,7 +176,7 @@ class SystemState extends State<System> {
"socialCode": value
});
if(res != null && res['code'] == 200){
MyDialog.toast('推广码绑定失败', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.green.withAlpha(200)));
MyDialog.toast('推广码绑定成功', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.green.withAlpha(200)));
Get.toNamed('/vloger', arguments: {'memberId':value});
}
} catch (e) {

View File

@ -246,6 +246,22 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
}
}
//
void deletePersonalVideo(videoId) async {
logger.i('删除视频${videoId}');
try {
final res = await Http.post('${VideoApi.deleteVideo}', data: {
'vlogerId':videoId
});
logger.i('删除成功响应${res}');
if(res != null && res['code'] == 200){
MyDialog.toast('删除成功', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.green.withAlpha(200)));
loadData(0);
}
} catch (e) {
}
}
//
void qrcodeAlertDialog(BuildContext context) {
showDialog(
@ -525,7 +541,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
borderRadius: BorderRadius.circular(10.0),
),
alignment: Alignment.center,
child: _buildVdCard(listToShow[index]),
child: _buildVdCard(listToShow[index],tabIndex),
);
},
childCount: listToShow.length,
@ -551,14 +567,15 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
});
}
Widget _buildVdCard(item) {
Widget _buildVdCard(item,tabIndex) {
return InkWell(
onTap: () {
//
Get.toNamed('/videoDetail', arguments: {'videoId': item['id']});
},
onLongPress: () {
showModalBottomSheet(
if(tabIndex == 0){ //
showModalBottomSheet(
context: Get.context!,
backgroundColor: Colors.white,
shape: const RoundedRectangleBorder(
@ -588,7 +605,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
);
if (confirmed == true) {
Get.back();
// TODO:
deletePersonalVideo(item['id']);
}
},
),
@ -597,6 +614,8 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
);
},
);
}
},
child: Container(
decoration: BoxDecoration(

View File

@ -4,7 +4,9 @@ import 'package:get/get.dart';
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
import 'package:loopin/IM/controller/chat_controller.dart';
import 'package:loopin/IM/im_service.dart';
import 'package:loopin/service/http.dart';
import 'package:loopin/components/custom_sticky_header.dart';
import 'package:loopin/api/video_api.dart';
import 'package:loopin/components/network_or_asset_image.dart';
import 'package:loopin/components/only_down_scroll_physics.dart';
import 'package:loopin/styles/index.dart';
@ -124,29 +126,28 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
final index = tabIndex ?? currentTabIndex.value;
if (index == 0) {
if (itemsParams.isLoading || !itemsParams.hasMore) return;
itemsParams.isLoading = true;
await Future.delayed(const Duration(seconds: 1));
//
List<String> newItems = List.generate(
itemsParams.pageSize,
(i) => '作品 ${(itemsParams.page - 1) * itemsParams.pageSize + i + 1}',
);
//
if (itemsParams.page >= 2) {
itemsParams.hasMore = false;
}
//
items.addAll(newItems);
//
itemsParams.page++;
itemsParams.isLoading = false;
itemsParams.isLoading = true;
final res = await Http.post(VideoApi.getVideoListByMemberId, data: {
"memberId": args['memberId'],
"current": itemsParams.page,
"size": itemsParams.pageSize,
});
final obj = res['data'];
final total = obj['total'];
final row = obj['records'] ?? [];
logger.i(res['data']);
//
logger.e(items.length);
//
items.addAll(row);
logger.e(obj);
if (items.length >= total) {
itemsParams.hasMore = false;
}
//
itemsParams.page++;
//
itemsParams.isLoading = false;
}
}