|
@@ -10,6 +10,7 @@ import './index.less';
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
materialClaimJson: string;
|
|
materialClaimJson: string;
|
|
|
|
+ materialBeanList: TASKAPI.MaterialBean[];
|
|
value?: TASKAPI.MaterialBean;
|
|
value?: TASKAPI.MaterialBean;
|
|
onChange?: (value?: TASKAPI.MaterialBean) => void;
|
|
onChange?: (value?: TASKAPI.MaterialBean) => void;
|
|
}
|
|
}
|
|
@@ -17,7 +18,7 @@ interface Props {
|
|
* 视频上传
|
|
* 视频上传
|
|
* @returns
|
|
* @returns
|
|
*/
|
|
*/
|
|
-const Video: React.FC<Props> = ({ value, onChange, materialClaimJson }) => {
|
|
|
|
|
|
+const Video: React.FC<Props> = ({ value, onChange, materialClaimJson, materialBeanList = [] }) => {
|
|
/** 变量START */
|
|
/** 变量START */
|
|
const [videoFile, setVideoFile] = useState<TASKAPI.MaterialBean | undefined>(value);
|
|
const [videoFile, setVideoFile] = useState<TASKAPI.MaterialBean | undefined>(value);
|
|
const [loading, setLoading] = useState<boolean>(false);
|
|
const [loading, setLoading] = useState<boolean>(false);
|
|
@@ -43,7 +44,13 @@ const Video: React.FC<Props> = ({ value, onChange, materialClaimJson }) => {
|
|
if (!isWHCorrect) {
|
|
if (!isWHCorrect) {
|
|
message.error(`视频宽高必须${w} * ${h}!`);
|
|
message.error(`视频宽高必须${w} * ${h}!`);
|
|
}
|
|
}
|
|
- return isZipOrRar && isLt20M && isWHCorrect;
|
|
|
|
|
|
+ const md5 = await getMD5(file);
|
|
|
|
+ const isRepeat =
|
|
|
|
+ materialBeanList?.length > 0 ? !materialBeanList.some((item) => item.md5 === md5) : true;
|
|
|
|
+ if (!isRepeat) {
|
|
|
|
+ message.error(`请勿重复选择!`);
|
|
|
|
+ }
|
|
|
|
+ return isZipOrRar && isLt20M && isWHCorrect && isRepeat;
|
|
};
|
|
};
|
|
|
|
|
|
return (
|
|
return (
|