shaogen1995 1 год назад
Родитель
Сommit
30225b19ce

+ 5 - 3
src/components/ZRichTexts/index.tsx

@@ -223,8 +223,10 @@ function ZRichTexts({ check, dirCode, isLook, myUrl }: Props, ref: any) {
   // 章节音频删除
   const delSectionFu = useCallback(
     (index: number) => {
+      console.log("ppppppppp", index);
+
       const arr = [...sectionArr];
-      arr[index].fileInfo = {} as ZupAudioType;
+      arr[index].fileInfo = { fileName: "", filePath: "" };
       setSectionArr(arr);
     },
     [sectionArr]
@@ -361,8 +363,8 @@ function ZRichTexts({ check, dirCode, isLook, myUrl }: Props, ref: any) {
               <div className="zztxtRow1_2">
                 <ZupAudio
                   fileInfo={item.fileInfo}
-                  upDataFu={(info, index) => upSectionFu(info, index)}
-                  delFu={(index) => delSectionFu(index)}
+                  upDataFu={(info) => upSectionFu(info, index)}
+                  delFu={() => delSectionFu(index)}
                   dirCode={dirCode}
                   myUrl="cms/event/upload"
                   isLook={isLook}

+ 5 - 7
src/components/ZupAudio/index.tsx

@@ -14,17 +14,15 @@ export type ZupAudioType = {
 
 type Props = {
   fileInfo: ZupAudioType;
-  upDataFu: (info: ZupAudioType, index: number) => void;
-  delFu: (index: number) => void;
+  upDataFu: (info: ZupAudioType) => void;
+  delFu: () => void;
   dirCode: string;
   myUrl: string;
-  index?: number;
   size?: number;
   isLook?: boolean;
 };
 
 function ZupAudio({
-  index = 0,
   size = 10,
   isLook = false,
   fileInfo,
@@ -66,7 +64,7 @@ function ZupAudio({
           if (res.code === 0) {
             MessageFu.success("上传成功!");
             // console.log(res);
-            upDataFu(res.data, index);
+            upDataFu(res.data);
           }
           fileDomInitialFu();
         } catch (error) {
@@ -74,7 +72,7 @@ function ZupAudio({
         }
       }
     },
-    [dirCode, index, myUrl, size, upDataFu]
+    [dirCode, myUrl, size, upDataFu]
   );
 
   // 上传附近的ref
@@ -112,7 +110,7 @@ function ZupAudio({
               &nbsp;
               <MyPopconfirm
                 txtK="删除"
-                onConfirm={() => delFu(index)}
+                onConfirm={delFu}
                 Dom={
                   <DeleteOutlined
                     title="删除"

+ 12 - 1
src/components/ZupTypes/index.module.scss

@@ -175,7 +175,18 @@
 
 // 查看情况
 .ZupTypesLook {
-  :global {}
+  :global {
+    .ZTbox1ImgRowName{
+      cursor: default !important;
+      color: #fff !important;
+    }
+    .ZTbox1ImgRow{
+      cursor: default !important;
+    }
+    .ZTbox1ImgRowX{
+      display: none !important;
+    }
+  }
 }
 
 // 修改图片名字的弹窗

+ 10 - 4
src/components/ZupTypes/index.tsx

@@ -224,13 +224,16 @@ function ZupTypes(
 
   const handleDragOver = useCallback(
     (e: React.DragEvent<HTMLDivElement>, item: FileListType) => {
+      if (isLook) return;
       e.dataTransfer.dropEffect = "move";
     },
-    []
+    [isLook]
   );
 
   const handleDragEnter = useCallback(
     (e: React.DragEvent<HTMLDivElement>, item: FileListType) => {
+      if (isLook) return;
+
       e.dataTransfer.effectAllowed = "move";
       if (item === dragImg) return;
       const newItems = [...fileList.img]; //拷贝一份数据进行交换操作。
@@ -239,7 +242,7 @@ function ZupTypes(
       newItems.splice(dst, 0, ...newItems.splice(src, 1)); //交换位置
       setFileList({ ...fileList, img: newItems });
     },
-    [dragImg, fileList]
+    [dragImg, fileList, isLook]
   );
 
   // 删除某一张图片
@@ -463,7 +466,10 @@ function ZupTypes(
             style={{ width: isTypeShow ? "100%" : "" }}
           >
             <div
-              hidden={!!fileList.img.length && fileList.img.length >= imgLength}
+              hidden={
+                (!!fileList.img.length && fileList.img.length >= imgLength) ||
+                isLook
+              }
               className="ZTbox1ImgIcon"
               onClick={() => upFileFu("img")}
             >
@@ -534,7 +540,7 @@ function ZupTypes(
           </div>
         </div>
 
-        <div className="ZTboxTit">
+        <div className="ZTboxTit" hidden={isLook}>
           {fileList.img.length && fileList.img.length >= 2 ? (
             <>
               按住鼠标可拖动图片调整顺序。

+ 3 - 3
src/pages/A1event/A1add/index.tsx

@@ -15,7 +15,7 @@ import { A1_APIgetInfo, A1_APIsave } from "@/store/action/A1event";
 import dayjs from "dayjs";
 import { MessageFu } from "@/utils/message";
 import MyPopconfirm from "@/components/MyPopconfirm";
-import ZupAudio, { ZupAudioType } from "@/components/ZupAudio";
+import ZupAudio from "@/components/ZupAudio";
 import ZupOne from "@/components/ZupOne";
 import ZRichTexts from "@/components/ZRichTexts";
 import classNames from "classnames";
@@ -214,7 +214,7 @@ function A1add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
               <ZupAudio
                 fileInfo={nameAudio}
                 upDataFu={(info) => setNameAudio(info)}
-                delFu={() => setNameAudio({} as ZupAudioType)}
+                delFu={() => setNameAudio({ fileName: "", filePath: "" })}
                 dirCode={dirCode}
                 myUrl="cms/event/upload"
                 isLook={editInfo.txt === "查看"}
@@ -313,7 +313,7 @@ function A1add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
                 placeholder="请输入"
               />
             </Form.Item>
-            <div className="A1_6Frow">
+            <div className="A1_6Frow" hidden={editInfo.txt === "查看"}>
               请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
             </div>
           </div>

+ 3 - 0
src/pages/A2exhibition/A2add/index.module.scss

@@ -118,6 +118,9 @@
       .ant-select {
         pointer-events: none;
       }
+      .ant-radio-wrapper{
+        pointer-events: none;
+      }
     }
   }
 }

+ 7 - 4
src/pages/A2exhibition/A2add/index.tsx

@@ -15,7 +15,7 @@ import { A2_APIgetInfo, A2_APIsave } from "@/store/action/A2exhibition";
 import dayjs from "dayjs";
 import { MessageFu } from "@/utils/message";
 import classNames from "classnames";
-import ZupAudio, { ZupAudioType } from "@/components/ZupAudio";
+import ZupAudio from "@/components/ZupAudio";
 import ZupOne from "@/components/ZupOne";
 import MyPopconfirm from "@/components/MyPopconfirm";
 import ZRichTexts from "@/components/ZRichTexts";
@@ -304,7 +304,7 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
               <ZupAudio
                 fileInfo={nameAudio}
                 upDataFu={(info) => setNameAudio(info)}
-                delFu={() => setNameAudio({} as ZupAudioType)}
+                delFu={() => setNameAudio({ fileName: "", filePath: "" })}
                 dirCode={dirCode}
                 myUrl="cms/exhibition/upload"
                 isLook={editInfo.txt === "查看"}
@@ -358,8 +358,10 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
             </div>
           </div>
 
+          {editInfo.txt === "查看"?<br/>:null}
+
           <Form.Item label="摘要" name="digest">
-            <TextArea placeholder="请输入内容" maxLength={200} showCount />
+            <TextArea readOnly={editInfo.txt === "查看"} placeholder="请输入内容" maxLength={200} showCount />
           </Form.Item>
 
           {/* 时间 */}
@@ -431,6 +433,7 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
                 ))}
                 &emsp;
                 <Input
+                  readOnly={editInfo.txt === "查看"}
                   style={{ width: 536, marginLeft: 14 }}
                   maxLength={50}
                   showCount
@@ -529,7 +532,7 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
                 placeholder="请输入"
               />
             </Form.Item>
-            <div className="A2_6Frow">
+            <div className="A2_6Frow" hidden={editInfo.txt === "查看"}>
               请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
             </div>
           </div>

+ 16 - 13
src/pages/Layout/index.module.scss

@@ -43,9 +43,9 @@
             cursor: pointer;
 
             font-size: 16px;
-            height: 40px;
-            line-height: 40px;
-            margin-bottom: 25px;
+            height: 50px;
+            line-height: 50px;
+            margin-bottom: 20px;
 
             &:hover {
               background-color: var(--themeColor);
@@ -79,14 +79,19 @@
           height: 100%;
           display: flex;
           align-items: center;
-          cursor: pointer;
-          background: url('../../assets/img/user.png') no-repeat left center;
-          background-size: 40px 40px;
-          padding-left: 45px;
           font-size: 16px;
           color: black;
           transition: all .3s;
 
+          .userNameBox {
+            cursor: pointer;
+            background: url('../../assets/img/user.png') no-repeat left center;
+            background-size: 40px 40px;
+            padding-left: 46px;
+            height: 60px;
+            display: flex;
+            align-items: center;
+          }
 
           .userInco {
             margin-left: 10px;
@@ -113,6 +118,7 @@
 
 
               &>span {
+                cursor: pointer;
                 background-color: #fff;
                 display: block;
                 width: 100%;
@@ -125,14 +131,11 @@
                 }
               }
             }
-
           }
+        }
 
-          &:hover {
-     
-            right: 20px;
-
-          }
+        .userShow {
+          right: 20px;
         }
       }
 

+ 16 - 9
src/pages/Layout/index.tsx

@@ -150,6 +150,9 @@ function Layout() {
     history.push("/login");
   };
 
+  // 点击用户 出来 退出登录 修改密码
+  const [isUserBtnShow, setIsUserBtnShow] = useState(false);
+
   return (
     <div className={styles.Layout}>
       {/* 左边 */}
@@ -187,16 +190,20 @@ function Layout() {
       <div className="layoutRight">
         <div className="layoutRightTop">
           {/* 用户相关 */}
-          <div className="user">
-            {getTokenInfo().user.realName ||
-              getTokenInfo().user.userName ||
-              "匿名"}
-            {/* <div className="userInco userInco1">
-              <CaretLeftOutlined />
-            </div> */}
-            <div className="userInco userInco2">
-              <CaretRightOutlined />
+          <div
+            className={classNames("user", isUserBtnShow ? "userShow" : "")}
+            onMouseLeave={() => setIsUserBtnShow(false)}
+          >
+            <div className="userNameBox" onClick={() => setIsUserBtnShow(true)}>
+              {getTokenInfo().user.realName ||
+                getTokenInfo().user.userName ||
+                "匿名"}
+
+              <div className="userInco userInco2">
+                <CaretRightOutlined />
+              </div>
             </div>
+
             <div className="userSet">
               <div>
                 <span onClick={() => setOpen(true)}>修改密码</span>