Skip to content

Let's use AI to Earn!

feat: UI优化中

gaoSire03f7ae9faf7
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
index 6f4dfa98..ffe6b5ab 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
@@ -41,6 +41,9 @@ import VideoPubSetModal_WxSph from '@/views/publish/children/videoPage/component
import { onVideoPublishProgress } from '@/icp/receiveMsg';
import PubProgressModule from '@/views/publish/components/PubProgressModule';
import { VideoPublishProgressRes } from '../../../../../../../electron/main/plat/pub/PubItemVideo';
+import VideoPubSetModalVideo, {
+ IVideoPubSetModalVideoRef,
+} from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo';
export interface IVideoPubSetModalRef {}
@@ -89,13 +92,13 @@ const VideoPubSetModal = memo(
);
const [loading, setLoading] = useState(false);
const [api, contextHolder] = notification.useNotification();
- const videoRef = useRef<HTMLVideoElement>(null);
const pubAccountDetModuleRef = useRef<IPubAccountDetModuleRef>(null);
// 主进程传过来的发布进度数据,key为用户id value为发布进度数据
const [pubProgressMap, setPubProgressMap] = useState<
Map<number, VideoPublishProgressRes>
>(new Map());
const [pubProgressModuleOpen, setPubProgressModuleOpen] = useState(false);
+ const videoPubSetModalVideoRef = useRef<IVideoPubSetModalVideoRef>(null);
useEffect(() => {
// 发布进度监听
@@ -206,7 +209,7 @@ const VideoPubSetModal = memo(
setLoading(false);
close();
setPubProgressModuleOpen(false);
- clear();
+ // clear();
// 成功数据
const successList = okRes.filter((v) => v.code === 1);
@@ -257,7 +260,7 @@ const VideoPubSetModal = memo(
const close = () => {
setVideoPubSetModalOpen(false);
- videoRef.current!.pause();
+ videoPubSetModalVideoRef.current!.pause();
};
return (
@@ -422,11 +425,13 @@ const VideoPubSetModal = memo(
})()}
</div>
<div className="videoPubSetModal_con-right">
- <video
- ref={videoRef}
- src={currChooseAccount?.video?.videoUrl}
- controls
- />
+ {currChooseAccount && (
+ <VideoPubSetModalVideo
+ ref={videoPubSetModalVideoRef}
+ chooseAccountItem={currChooseAccount}
+ key={currChooseAccount?.video?.videoUrl}
+ />
+ )}
</div>
</div>
</div>
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsx
new file mode 100644
index 00000000..838c67bf
--- /dev/null
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsx
@@ -0,0 +1,100 @@
+import {
+ ForwardedRef,
+ forwardRef,
+ memo,
+ useImperativeHandle,
+ useRef,
+ useState,
+} from 'react';
+import { IVideoChooseItem } from '@/views/publish/children/videoPage/videoPage';
+import { Avatar, Segmented } from 'antd';
+import { HeartFilled } from '@ant-design/icons';
+
+export interface IVideoPubSetModalVideoRef {
+ play: () => void;
+ pause: () => void;
+}
+
+export interface IVideoPubSetModalVideoProps {
+ chooseAccountItem: IVideoChooseItem;
+}
+
+const VideoPubSetModalVideo = memo(
+ forwardRef(
+ (
+ { chooseAccountItem }: IVideoPubSetModalVideoProps,
+ ref: ForwardedRef<IVideoPubSetModalVideoRef>,
+ ) => {
+ const videoRef = useRef<HTMLVideoElement>(null);
+ const [active, setActive] = useState(1);
+
+ const imperativeMethods: IVideoPubSetModalVideoRef = {
+ play: () => {
+ videoRef.current?.play();
+ },
+ pause: () => {
+ videoRef.current?.pause();
+ },
+ };
+ useImperativeHandle(ref, () => imperativeMethods, []);
+
+ return (
+ <div className="videoPubSetModalVideo">
+ <Segmented
+ value={active}
+ options={[
+ { label: '预览视频', value: 1 },
+ { label: '预览封面/标题', value: 2 },
+ ]}
+ defaultValue={1}
+ onChange={setActive}
+ />
+
+ <div className="videoPubSetModalVideo-video">
+ <div className="videoPubSetModalVideo-video-wrapper">
+ {active === 1 ? (
+ <>
+ <div className="videoPubSetModalVideo-video-top" />
+ <video
+ ref={videoRef}
+ src={chooseAccountItem?.video?.videoUrl}
+ controls
+ />
+ </>
+ ) : (
+ chooseAccountItem.account && (
+ <div className="videoPubSetModalVideo-coverPreview">
+ <div className="videoPubSetModalVideo-coverPreview-con">
+ <div className="videoPubSetModalVideo-coverPreview-box">
+ <div className="videoPubSetModalVideo-coverPreview-box-img"></div>
+ <div className="videoPubSetModalVideo-coverPreview-box-bottom">
+ <p>***********</p>
+ <ul className="videoPubSetModalVideo-coverPreview-box-info">
+ <li>
+ <Avatar
+ src={chooseAccountItem.account.avatar}
+ size="small"
+ />
+ <span>{chooseAccountItem.account.nickname}</span>
+ </li>
+ <li>
+ <span>0</span>
+ <HeartFilled />
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+ )}
+ </div>
+ </div>
+ </div>
+ );
+ },
+ ),
+);
+VideoPubSetModalVideo.displayName = 'VideoPubSetModalVideo';
+
+export default VideoPubSetModalVideo;
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss b/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss
index 0ce76231..f3747e70 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss
@@ -107,5 +107,78 @@
text-overflow: ellipsis;
}
}
+
+ .videoPubSetModalVideo {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ min-height: 500px;
+ .ant-segmented {
+ margin-bottom: 15px;
+ }
+
+ &-video {
+ background: black;
+ border-radius: 30px;
+ overflow: hidden;
+ box-sizing: border-box;
+ position: relative;
+ width: 100%;
+ height: 510px;
+ &-wrapper {
+ margin: 5px;
+ box-sizing: border-box;
+ height: 100%;
+ border-radius: 30px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ }
+ &-top {
+ position: absolute;
+ width: 50%;
+ height: 20px;
+ z-index: 10;
+ border-radius: 0 0 15px 15px;
+ top: 0;
+ left: 50%;
+ transform: translateX(-50%);
+ background: black;
+ }
+ video {
+ width: 100%;
+ max-height: 100%;
+ object-fit: cover;
+ border-radius: 0;
+ }
+ }
+
+ &-coverPreview {
+ display: flex;
+ justify-content: space-between;
+ &-con {
+ width: calc(50% - 5px);
+ }
+ &-box {
+ width: 100%;
+ margin-bottom: 5px;
+ border-radius: 10px;
+ overflow: hidden;
+ &-img {
+ background: rgb(196, 196, 196);
+ width: 100%;
+ height: 100px;
+ }
+ &-bottom {
+ background: rgb(188, 188, 188);
+ ul {
+ display: flex;
+ justify-content: space-between;
+ }
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file