Просмотр исходного кода

UP资讯管理新闻新增和编辑封面图改为 非必填

shaogen1995 2 лет назад
Родитель
Сommit
11eb8738bf

+ 4 - 6
houtai/src/pages/A2News/NewsAdd/index.tsx

@@ -195,10 +195,10 @@ function NewsAdd({
   // 附件信息的校验
   const fileCheckFu = useMemo(() => {
     let flag = false;
-    if (tableType === "news" && imgList.length === 0) flag = true;
     if (tableType !== "news" && !fileOne.filePath) flag = true;
+    if (tableType === "news") flag = false;
     return flag;
-  }, [fileOne.filePath, imgList.length, tableType]);
+  }, [fileOne.filePath, tableType]);
 
   // 没有通过校验
   const onFinishFailed = useCallback(() => {
@@ -214,7 +214,7 @@ function NewsAdd({
       if (fileCheckFu) return;
 
       let thumb = "";
-      if (tableType === "news") thumb = imgList[0].filePath;
+      if (tableType === "news") thumb = imgList[0] ? imgList[0].filePath : "";
       else thumb = fileOne.filePath;
       const obj = {
         ...values,
@@ -319,9 +319,7 @@ function NewsAdd({
 
               {/* 上传附件图片 */}
               <div className="myformBox">
-                <div className="label">
-                  <span>*</span> 图片:
-                </div>
+                <div className="label">图片:</div>
                 <>
                   <div className="fileBoxRow_r">
                     <div className="upImgBox">

+ 3 - 1
houtai/src/pages/A2News/NewsTable/index.tsx

@@ -86,7 +86,9 @@ function NewsTable({ tableType, editInfoFu, delInfoFu }: Porps) {
           } else if (tableType === "video") {
             return (
               <div className="tableImgAuto">
-                <VideoLook src={item.thumb} width={60} height={60} />
+                {item.thumb ? (
+                  <VideoLook src={item.thumb} width={60} height={60} />
+                ) : null}
               </div>
             );
           } else {