个人视频详情和删除视频
This commit is contained in:
parent
ec30eb2456
commit
81e386b038
@ -23,4 +23,7 @@ class VideoApi {
|
|||||||
static const String changeVlogStatus = '/app/vlog/changeVlogStatus'; //修改我的视频状态(删除视频)
|
static const String changeVlogStatus = '/app/vlog/changeVlogStatus'; //修改我的视频状态(删除视频)
|
||||||
static const String changeToPublic = '/app/vlog/changeToPublic'; //将视频改为公开状态
|
static const String changeToPublic = '/app/vlog/changeToPublic'; //将视频改为公开状态
|
||||||
static const String changeToPrivate = '/app/vlog/changeToPrivate'; //将视频改为私密状态
|
static const String changeToPrivate = '/app/vlog/changeToPrivate'; //将视频改为私密状态
|
||||||
|
|
||||||
|
static const String deleteVideo = '/app/vlog/delete'; //删除当前用户的视频
|
||||||
|
static const String getVideoListByMemberId = '/app/vlog/page'; //查询某人的作品
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ class SystemState extends State<System> {
|
|||||||
"socialCode": value
|
"socialCode": value
|
||||||
});
|
});
|
||||||
if(res != null && res['code'] == 200){
|
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});
|
Get.toNamed('/vloger', arguments: {'memberId':value});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -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) {
|
void qrcodeAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -525,7 +541,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: _buildVdCard(listToShow[index]),
|
child: _buildVdCard(listToShow[index],tabIndex),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: listToShow.length,
|
childCount: listToShow.length,
|
||||||
@ -551,14 +567,15 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildVdCard(item) {
|
Widget _buildVdCard(item,tabIndex) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
//去视频详情
|
//去视频详情
|
||||||
Get.toNamed('/videoDetail', arguments: {'videoId': item['id']});
|
Get.toNamed('/videoDetail', arguments: {'videoId': item['id']});
|
||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
showModalBottomSheet(
|
if(tabIndex == 0){ // 个人发布作品可以长按删除
|
||||||
|
showModalBottomSheet(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
@ -588,7 +605,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
if (confirmed == true) {
|
if (confirmed == true) {
|
||||||
Get.back();
|
Get.back();
|
||||||
// TODO: 删除逻辑
|
deletePersonalVideo(item['id']);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -597,6 +614,8 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
@ -4,7 +4,9 @@ import 'package:get/get.dart';
|
|||||||
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
||||||
import 'package:loopin/IM/controller/chat_controller.dart';
|
import 'package:loopin/IM/controller/chat_controller.dart';
|
||||||
import 'package:loopin/IM/im_service.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/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/network_or_asset_image.dart';
|
||||||
import 'package:loopin/components/only_down_scroll_physics.dart';
|
import 'package:loopin/components/only_down_scroll_physics.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
@ -124,29 +126,28 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
final index = tabIndex ?? currentTabIndex.value;
|
final index = tabIndex ?? currentTabIndex.value;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (itemsParams.isLoading || !itemsParams.hasMore) return;
|
if (itemsParams.isLoading || !itemsParams.hasMore) return;
|
||||||
|
itemsParams.isLoading = true;
|
||||||
itemsParams.isLoading = true;
|
final res = await Http.post(VideoApi.getVideoListByMemberId, data: {
|
||||||
|
"memberId": args['memberId'],
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
"current": itemsParams.page,
|
||||||
|
"size": itemsParams.pageSize,
|
||||||
// 模拟生成新数据
|
});
|
||||||
List<String> newItems = List.generate(
|
final obj = res['data'];
|
||||||
itemsParams.pageSize,
|
final total = obj['total'];
|
||||||
(i) => '作品 ${(itemsParams.page - 1) * itemsParams.pageSize + i + 1}',
|
final row = obj['records'] ?? [];
|
||||||
);
|
logger.i(res['data']);
|
||||||
|
// 判断是否还有更多数据
|
||||||
// 模拟判断是否还有更多数据
|
logger.e(items.length);
|
||||||
if (itemsParams.page >= 2) {
|
// 添加新数据,触发响应式更新
|
||||||
itemsParams.hasMore = false;
|
items.addAll(row);
|
||||||
}
|
logger.e(obj);
|
||||||
|
if (items.length >= total) {
|
||||||
// 添加新数据,触发响应式更新
|
itemsParams.hasMore = false;
|
||||||
items.addAll(newItems);
|
}
|
||||||
|
// 页码加一
|
||||||
// 页码加一
|
itemsParams.page++;
|
||||||
itemsParams.page++;
|
//
|
||||||
|
itemsParams.isLoading = false;
|
||||||
itemsParams.isLoading = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user