|
|
@@ -14,8 +14,9 @@ import {
|
|
|
RadioChangeEvent,
|
|
|
Tooltip,
|
|
|
Tag,
|
|
|
+ Flex,
|
|
|
} from 'antd';
|
|
|
-import { CheckCircleFilled, CaretRightFilled, QuestionCircleOutlined } from '@ant-design/icons';
|
|
|
+import { CheckCircleFilled, CaretRightFilled, QuestionCircleOutlined, StarOutlined, StarFilled } from '@ant-design/icons';
|
|
|
import { VideoItem, VideoListResponse } from '@src/views/publishContent/weGZH/components/types';
|
|
|
import http from '@src/http';
|
|
|
import { getVideoContentListApi, getUploadVideoContentListApi } from '@src/http/api';
|
|
|
@@ -249,6 +250,15 @@ const playVideo = (video: VideoItem) => {
|
|
|
getVideoList({pageNum: 1, _tags: newTags});
|
|
|
}
|
|
|
|
|
|
+ const handleCollectVideo = (videoId: number) => {
|
|
|
+ console.log('handleCollectVideo', videoId);
|
|
|
+ const video = videoList.find(v => v.videoId === videoId);
|
|
|
+ if (video) {
|
|
|
+ setVideoList(prev => prev.map(v => v.videoId === videoId ? {...v, isCollected: !v.isCollected} : v));
|
|
|
+ message.success(video.isCollected ? '取消收藏' : '收藏成功');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<Drawer
|
|
|
@@ -362,7 +372,7 @@ const playVideo = (video: VideoItem) => {
|
|
|
return (
|
|
|
<Card
|
|
|
key={video.videoId}
|
|
|
- className={`relative ${isDisabled ? 'opacity-50' : 'cursor-pointer'} ${isSelected ? 'border-blue-500 border-2 bg-blue-50 shadow-md' : 'hover:shadow-sm'}`}
|
|
|
+ className={`relative ${isDisabled ? 'opacity-50' : 'cursor-pointer'} ${isSelected ? 'border-2 !bg-blue-50 shadow-md' : 'hover:shadow-sm'}`}
|
|
|
styles={{ body: { padding: 0 } }}
|
|
|
onClick={() => !isDisabled && handleSelectVideo(video.videoId)}
|
|
|
>
|
|
|
@@ -386,11 +396,33 @@ const playVideo = (video: VideoItem) => {
|
|
|
<Text type="secondary" className="text-xs">推荐标签: {'tags' in video && video.tags && video.tags.length > 0 ?
|
|
|
video.tags.map(tag => <Tag key={tag} className="text-xs">{getTagLabel(tag as TagType)}</Tag>) : '无'}</Text>
|
|
|
</div>
|
|
|
- {isSelected ? (
|
|
|
- <CheckCircleFilled className="text-green-500 text-xl" />
|
|
|
- ) : (
|
|
|
- <div className={`w-5 h-5 border-2 ${isDisabled ? 'border-gray-200 bg-gray-100' : 'border-gray-300' } rounded-full`}></div>
|
|
|
- )}
|
|
|
+ <div className="flex flex-col items-center gap-2">
|
|
|
+ {
|
|
|
+ video.isCollected ? (
|
|
|
+ <Flex gap={4} onClick={(e) => { e.stopPropagation(); handleCollectVideo(video.videoId); }}>
|
|
|
+ <StarFilled className="text-xl !text-[#1890ff]" />
|
|
|
+ <Text>收藏</Text>
|
|
|
+ </Flex>
|
|
|
+ ) : (
|
|
|
+ <Flex gap={4} onClick={(e) => { e.stopPropagation(); handleCollectVideo(video.videoId); }}>
|
|
|
+ <StarOutlined className="text-xl !text-black/50" />
|
|
|
+ <Text className="!text-black/70">收藏</Text>
|
|
|
+ </Flex>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ {isSelected ? (
|
|
|
+ <Flex gap={4}>
|
|
|
+ <CheckCircleFilled className="text-base !text-[#1890ff]" />
|
|
|
+ <Text className="!text-black/70">已选</Text>
|
|
|
+ </Flex>
|
|
|
+ ) : (
|
|
|
+ <Flex gap={4} className="items-center">
|
|
|
+ <div className={`w-4 h-4 border-2 ${isDisabled ? 'border-gray-200 bg-gray-100' : 'border-black/50' } rounded-full`}></div>
|
|
|
+ <Text className="!text-black/70">选择</Text>
|
|
|
+ </Flex>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
{/* {isSelected && (
|
|
|
<div className="p-3 flex justify-between items-center relative z-10">
|