wjx 2 years ago
parent
commit
f02644f586
2 changed files with 108 additions and 28 deletions
  1. 97 21
      src/components/FileBoxAD/index.less
  2. 11 7
      src/components/FileBoxAD/index.tsx

+ 97 - 21
src/components/FileBoxAD/index.less

@@ -4,10 +4,12 @@
   overflow-y: auto;
   overflow-y: auto;
   position: relative;
   position: relative;
 }
 }
+
 .flex_box_img {
 .flex_box_img {
   width: 100px;
   width: 100px;
   cursor: pointer;
   cursor: pointer;
 }
 }
+
 .flex_box {
 .flex_box {
   width: 200px;
   width: 200px;
   height: 200px;
   height: 200px;
@@ -18,17 +20,20 @@
   padding: 10px 0;
   padding: 10px 0;
   position: relative;
   position: relative;
   font-size: 12px;
   font-size: 12px;
+
   &:hover {
   &:hover {
     background-color: #c5d8f0;
     background-color: #c5d8f0;
     border-radius: 5px;
     border-radius: 5px;
     border: 1px solid #c5d8f0;
     border: 1px solid #c5d8f0;
     box-sizing: border-box;
     box-sizing: border-box;
+
     .select {
     .select {
       display: flex;
       display: flex;
       background-color: #7cc6ee;
       background-color: #7cc6ee;
     }
     }
   }
   }
 }
 }
+
 .flex_box_name {
 .flex_box_name {
   width: 100%;
   width: 100%;
   overflow: hidden;
   overflow: hidden;
@@ -36,10 +41,12 @@
   white-space: nowrap;
   white-space: nowrap;
   cursor: pointer;
   cursor: pointer;
   text-align: center;
   text-align: center;
+
   &:hover {
   &:hover {
     color: #1890ff;
     color: #1890ff;
   }
   }
 }
 }
+
 .flex_box_id {
 .flex_box_id {
   width: 85%;
   width: 85%;
   overflow: hidden;
   overflow: hidden;
@@ -47,27 +54,33 @@
   white-space: nowrap;
   white-space: nowrap;
   cursor: pointer;
   cursor: pointer;
   text-align: center;
   text-align: center;
+
   &:hover {
   &:hover {
     color: #1890ff;
     color: #1890ff;
   }
   }
 }
 }
+
 .rt {
 .rt {
   margin: 0 5px;
   margin: 0 5px;
   color: #c5d8f3;
   color: #c5d8f3;
 }
 }
+
 .path {
 .path {
   margin-bottom: 15px;
   margin-bottom: 15px;
   //   margin-top: 10px;
   //   margin-top: 10px;
 }
 }
+
 .path_color {
 .path_color {
   color: #09aaff;
   color: #09aaff;
   cursor: pointer;
   cursor: pointer;
 }
 }
+
 .file_news_content {
 .file_news_content {
   width: 100%;
   width: 100%;
-  columns:300px 5;
+  columns: 300px 5;
   column-gap: 20px;
   column-gap: 20px;
-  > div {
+
+  >div {
     width: 100%;
     width: 100%;
     break-inside: avoid;
     break-inside: avoid;
     margin-bottom: 20px;
     margin-bottom: 20px;
@@ -75,11 +88,13 @@
     justify-content: center;
     justify-content: center;
   }
   }
 }
 }
+
 .file_content {
 .file_content {
   width: 100%;
   width: 100%;
-  columns:200px 7;
+  columns: 200px 7;
   column-gap: 20px;
   column-gap: 20px;
-  > div {
+
+  >div {
     width: 100%;
     width: 100%;
     break-inside: avoid;
     break-inside: avoid;
     margin-bottom: 20px;
     margin-bottom: 20px;
@@ -87,6 +102,7 @@
     justify-content: center;
     justify-content: center;
   }
   }
 }
 }
+
 .select {
 .select {
   position: absolute;
   position: absolute;
   left: 5px;
   left: 5px;
@@ -98,19 +114,23 @@
   justify-content: center;
   justify-content: center;
   align-items: center;
   align-items: center;
   cursor: pointer;
   cursor: pointer;
-  > span {
+
+  >span {
     display: flex;
     display: flex;
     justify-content: center;
     justify-content: center;
     align-items: center;
     align-items: center;
   }
   }
 }
 }
+
 .select_btn {
 .select_btn {
   margin-bottom: 10px;
   margin-bottom: 10px;
-  > span {
+
+  >span {
     color: #09aaff;
     color: #09aaff;
     cursor: pointer;
     cursor: pointer;
   }
   }
 }
 }
+
 .image_box,
 .image_box,
 .video_box,
 .video_box,
 .audio_box {
 .audio_box {
@@ -123,18 +143,21 @@
   padding: 10px 20px;
   padding: 10px 20px;
   position: relative;
   position: relative;
   font-size: 12px;
   font-size: 12px;
+
   img {
   img {
     height: 100px;
     height: 100px;
     width: 130px;
     width: 130px;
     object-fit: contain;
     object-fit: contain;
   }
   }
-  audio {
-  }
+
+  audio {}
+
   &:hover {
   &:hover {
     background-color: #c5d8f0;
     background-color: #c5d8f0;
     border-radius: 5px;
     border-radius: 5px;
     border: 1px solid #c5d8f0;
     border: 1px solid #c5d8f0;
     box-sizing: border-box;
     box-sizing: border-box;
+
     .select {
     .select {
       display: flex;
       display: flex;
       background-color: #7cc6ee;
       background-color: #7cc6ee;
@@ -157,18 +180,21 @@
   border-radius: 5px;
   border-radius: 5px;
   box-shadow: 0 0 8px #ccc;
   box-shadow: 0 0 8px #ccc;
   background-color: #fff;
   background-color: #fff;
-  > li {
+
+  >li {
     cursor: pointer;
     cursor: pointer;
     height: 30px;
     height: 30px;
     line-height: 30px;
     line-height: 30px;
     padding: 0 10px;
     padding: 0 10px;
     text-align: center;
     text-align: center;
     width: 100%;
     width: 100%;
+
     &:hover {
     &:hover {
       background-color: #a4d9f5;
       background-color: #a4d9f5;
     }
     }
   }
   }
 }
 }
+
 .add {
 .add {
   position: absolute;
   position: absolute;
   left: 0;
   left: 0;
@@ -182,6 +208,7 @@
   align-items: center;
   align-items: center;
   justify-content: center;
   justify-content: center;
 }
 }
+
 .news_box {
 .news_box {
   width: 280px;
   width: 280px;
   display: flex;
   display: flex;
@@ -191,7 +218,8 @@
   padding: 15px 30px;
   padding: 15px 30px;
   box-sizing: border-box;
   box-sizing: border-box;
   position: relative;
   position: relative;
-  > div {
+
+  >div {
     height: 60px;
     height: 60px;
     display: flex;
     display: flex;
     flex-flow: row;
     flex-flow: row;
@@ -201,20 +229,24 @@
     width: 100%;
     width: 100%;
     justify-content: space-between;
     justify-content: space-between;
     margin-top: 2px;
     margin-top: 2px;
+
     &:hover {
     &:hover {
-      > p {
+      >p {
         display: flex;
         display: flex;
         cursor: pointer;
         cursor: pointer;
       }
       }
     }
     }
+
     div {
     div {
       order: 2;
       order: 2;
     }
     }
+
     img {
     img {
       object-fit: cover;
       object-fit: cover;
       width: 50px;
       width: 50px;
       height: 50px;
       height: 50px;
     }
     }
+
     span {
     span {
       display: -webkit-box;
       display: -webkit-box;
       -webkit-box-orient: vertical;
       -webkit-box-orient: vertical;
@@ -224,16 +256,19 @@
       height: 40px;
       height: 40px;
       width: 75%;
       width: 75%;
     }
     }
+
     &:nth-child(2) {
     &:nth-child(2) {
       position: relative;
       position: relative;
       height: 120px;
       height: 120px;
       overflow: hidden;
       overflow: hidden;
+
       img {
       img {
         object-fit: cover;
         object-fit: cover;
         width: 100%;
         width: 100%;
         height: 120px;
         height: 120px;
       }
       }
-      > span {
+
+      >span {
         position: absolute;
         position: absolute;
         bottom: 0;
         bottom: 0;
         left: 0;
         left: 0;
@@ -250,17 +285,20 @@
       }
       }
     }
     }
   }
   }
+
   &:hover {
   &:hover {
     background-color: #c5d8f0;
     background-color: #c5d8f0;
     border-radius: 5px;
     border-radius: 5px;
     // border: 1px solid #c5d8f0;
     // border: 1px solid #c5d8f0;
     box-sizing: border-box;
     box-sizing: border-box;
+
     .select {
     .select {
       display: flex;
       display: flex;
       background-color: #7cc6ee;
       background-color: #7cc6ee;
     }
     }
   }
   }
 }
 }
+
 .knews_box {
 .knews_box {
   width: 300px;
   width: 300px;
   display: flex;
   display: flex;
@@ -271,7 +309,8 @@
   box-sizing: border-box;
   box-sizing: border-box;
   position: relative;
   position: relative;
   height: 200px;
   height: 200px;
-  > div {
+
+  >div {
     display: flex;
     display: flex;
     justify-content: space-between;
     justify-content: space-between;
     width: 100%;
     width: 100%;
@@ -280,17 +319,20 @@
     border-radius: 5px;
     border-radius: 5px;
     height: 95px;
     height: 95px;
     box-sizing: border-box;
     box-sizing: border-box;
-    img{
+
+    img {
       width: 50px;
       width: 50px;
       height: 50px;
       height: 50px;
       margin-top: 25px;
       margin-top: 25px;
       object-fit: cover;
       object-fit: cover;
     }
     }
-    span{
+
+    span {
       font-weight: 500;
       font-weight: 500;
       margin-bottom: 5px;
       margin-bottom: 5px;
     }
     }
-    p{
+
+    p {
       font-size: 12px;
       font-size: 12px;
       overflow: hidden;
       overflow: hidden;
       text-overflow: ellipsis;
       text-overflow: ellipsis;
@@ -302,40 +344,46 @@
       width: 160px;
       width: 160px;
     }
     }
   }
   }
+
   &:hover {
   &:hover {
     background-color: #c5d8f0;
     background-color: #c5d8f0;
     border-radius: 5px;
     border-radius: 5px;
     // border: 1px solid #c5d8f0;
     // border: 1px solid #c5d8f0;
     box-sizing: border-box;
     box-sizing: border-box;
+
     .select {
     .select {
       display: flex;
       display: flex;
       background-color: #7cc6ee;
       background-color: #7cc6ee;
     }
     }
   }
   }
 }
 }
-.flex_box_font {
-}
+
+.flex_box_font {}
 
 
 .action {
 .action {
   background-color: #c5d8f0;
   background-color: #c5d8f0;
   border-radius: 5px;
   border-radius: 5px;
   // border: 1px solid #90d8ff;
   // border: 1px solid #90d8ff;
   box-sizing: border-box;
   box-sizing: border-box;
+
   .select {
   .select {
     background-color: #09aaff;
     background-color: #09aaff;
     display: flex;
     display: flex;
   }
   }
+
   &:hover {
   &:hover {
     background-color: #c5d8f0;
     background-color: #c5d8f0;
     border-radius: 5px;
     border-radius: 5px;
     // border: 1px solid #90d8ff;
     // border: 1px solid #90d8ff;
     box-sizing: border-box;
     box-sizing: border-box;
+
     .select {
     .select {
       display: flex;
       display: flex;
       background-color: #09aaff;
       background-color: #09aaff;
     }
     }
   }
   }
 }
 }
+
 .pagination {
 .pagination {
   width: 100%;
   width: 100%;
   display: flex;
   display: flex;
@@ -344,12 +392,40 @@
   margin-bottom: 10px;
   margin-bottom: 10px;
   margin-top: 5px;
   margin-top: 5px;
 }
 }
-.wxSelect{
+
+.wxSelect {
   position: absolute;
   position: absolute;
-  top:0;
+  top: 0;
   right: 20px;
   right: 20px;
   width: 200px;
   width: 200px;
-  >div{
+
+  >div {
     margin-top: 0 !important;
     margin-top: 0 !important;
   }
   }
 }
 }
+
+.pageVideo {
+  position: relative;
+
+  .pagePreview {
+    display: inline-block;
+    width: 130px;
+    height: 100px;
+    position: absolute;
+    top: 0;
+    left: 0;
+    z-index: 10;
+    background-color: rgba(0, 0, 0, 0.6);
+    color: #FFF;
+    font-size: 14px;
+    text-align: center;
+    line-height: 100px;
+    opacity: 0;
+    transition: opacity 0.3s;
+    cursor: pointer;
+  }
+
+  &:hover .pagePreview {
+    opacity: 1;
+  }
+}

+ 11 - 7
src/components/FileBoxAD/index.tsx

@@ -7,6 +7,7 @@ import { useModel } from "umi"
 import ImgModal from "./components/imgModal"
 import ImgModal from "./components/imgModal"
 import TreeBox from "./components/tree"
 import TreeBox from "./components/tree"
 import SortModal from "./components/fileModal/sortModal"
 import SortModal from "./components/fileModal/sortModal"
+import { EyeOutlined } from "@ant-design/icons"
 
 
 interface News {
 interface News {
     id: number,
     id: number,
@@ -77,7 +78,7 @@ function FlieBox(props: Props) {
                     isAll && <li onClick={allFile}>全选/反选</li>
                     isAll && <li onClick={allFile}>全选/反选</li>
                 }
                 }
                 {mediaType === 'PAGE' ? <>
                 {mediaType === 'PAGE' ? <>
-                    <li onClick={() => { setPage && setPage(1, rightClickPup.id) }}>查看</li>
+                    {/* <li onClick={() => { setPage && setPage(1, rightClickPup.id) }}>查看</li> */}
                     <li onClick={() => { setPage && setPage(2, rightClickPup.id) }}>复制</li>
                     <li onClick={() => { setPage && setPage(2, rightClickPup.id) }}>复制</li>
                     <li onClick={() => { setPage && setPage(3, rightClickPup.id) }}>批量复制</li>
                     <li onClick={() => { setPage && setPage(3, rightClickPup.id) }}>批量复制</li>
                 </> : <>
                 </> : <>
@@ -273,26 +274,29 @@ function FlieBox(props: Props) {
                                     switch (topPageElements?.elementType) {
                                     switch (topPageElements?.elementType) {
                                         case 'TOP_IMAGE':
                                         case 'TOP_IMAGE':
                                             topName = "顶部图片"
                                             topName = "顶部图片"
-                                            El = <Image src={topPageElements?.topImageSpec?.imageUrl} onClick={(e) => { e.stopPropagation() }} />
+                                            El = <Image src={topPageElements?.topImageSpec?.imageUrl} preview={{ visible: false }} onClick={(e) => { e.stopPropagation(); setPage && setPage(1, item.id) }} />
                                             break
                                             break
                                         case 'TOP_SLIDER':
                                         case 'TOP_SLIDER':
                                             topName = "顶部轮播图"
                                             topName = "顶部轮播图"
                                             El = <>
                                             El = <>
                                                 <Carousel autoplay style={{ width: 150, textAlign: 'center' }}>
                                                 <Carousel autoplay style={{ width: 150, textAlign: 'center' }}>
-                                                    {topPageElements?.topSliderSpec?.imageUrlList?.map((item: string, index: number) => <div key={index}>
-                                                        <Image preview={{ visible: false }} src={item} onClick={(e) => { e.stopPropagation(); setImgVisible(true) }} />
+                                                    {topPageElements?.topSliderSpec?.imageUrlList?.map((url: string, index: number) => <div key={index}>
+                                                        <Image preview={{ visible: false }} src={url} onClick={(e) => { e.stopPropagation(); /*setImgVisible(true)*/ setPage && setPage(1, item.id) }} />
                                                     </div>)}
                                                     </div>)}
                                                 </Carousel>
                                                 </Carousel>
-                                                <div style={{ display: 'none' }}>
+                                                {/* <div style={{ display: 'none' }}>
                                                     <Image.PreviewGroup preview={{ visible: imgVisible, onVisibleChange: vis => setImgVisible(vis) }}>
                                                     <Image.PreviewGroup preview={{ visible: imgVisible, onVisibleChange: vis => setImgVisible(vis) }}>
                                                         {topPageElements?.topSliderSpec?.imageUrlList?.map((item: string, index: number) => <Image src={item} key={index} />)}
                                                         {topPageElements?.topSliderSpec?.imageUrlList?.map((item: string, index: number) => <Image src={item} key={index} />)}
                                                     </Image.PreviewGroup>
                                                     </Image.PreviewGroup>
-                                                </div>
+                                                </div> */}
                                             </>
                                             </>
                                             break
                                             break
                                         case 'TOP_VIDEO':
                                         case 'TOP_VIDEO':
                                             topName = "顶部视频"
                                             topName = "顶部视频"
-                                            El = <video src={topPageElements?.topVideoSpec?.videoUrl} style={{ width: 130, height: 100 }} controls />
+                                            El = <div className={style.pageVideo}>
+                                                <span className={style.pagePreview} onClick={(e) => { e.stopPropagation(); setPage && setPage(1, item.id) }}><EyeOutlined /> 预览</span>
+                                                <video src={topPageElements?.topVideoSpec?.videoUrl} style={{ width: 130, height: 100 }} controls/>
+                                            </div>
                                             break
                                             break
                                     }
                                     }
                                 }
                                 }