From 5e73d562bae941a7658c3c13fdb585461f1a24e4 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期一, 28 四月 2025 21:21:07 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/wyyDatabase

---
 src/views/chronology/index.vue |  204 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 156 insertions(+), 48 deletions(-)

diff --git a/src/views/chronology/index.vue b/src/views/chronology/index.vue
index f60bbfb..9e8b18a 100644
--- a/src/views/chronology/index.vue
+++ b/src/views/chronology/index.vue
@@ -30,8 +30,14 @@
           <div>鍏朵粬</div>
         </div>
       </div>
-      <div class="contentBox">
-        <div class="chartsBox" v-if="showList">
+      <div
+        class="contentBox"
+        element-loading-text="骞磋氨鍔犺浇涓�"
+        element-loading-spinner="el-icon-loading"
+        element-loading-background="rgba(0, 0, 0, 0)"
+        v-loading="!showList"
+      >
+        <div class="chartsBox">
           <div
             class="chartsItemBox"
             v-for="(item, index) in contentList"
@@ -43,24 +49,25 @@
                   class="gradchild"
                   v-for="(citem, cindex) in item.list"
                   :style="{ background: citem.color }"
-                  @mouseover="showDetail(index, cindex, 1)"
+                  @click.self="showDetail(index, cindex, 1, $event)"
                   :key="cindex"
                 >
-                  <div class="detailDialog" v-if="citem.showDetail">
-                    <!-- <div class="dialogContent" @click="gotoDetail(citem)"> -->
+                  <div
+                    class="detailDialog"
+                    :style="popupStyle"
+                    v-if="citem.showChildDetail"
+                  >
                     <div
                       class="closeBtn"
-                      @click="closeDetail(index, cindex, 0)"
+                      @click.stop="closeDetail(index, cindex, 0)"
                     >
                       <i class="el-icon-close"></i>
                     </div>
                     <floatingWindow :info="citem" />
-                    <!-- </div> -->
                   </div>
                 </div>
               </div>
               <div class="item-circle" @click="showYearWindow(index, 1)"></div>
-
               <div class="item-text">
                 <div class="">
                   {{ item.name.split("锛�")[0] }}
@@ -78,6 +85,7 @@
             </div>
           </div>
         </div>
+        <div></div>
       </div>
     </div>
   </div>
@@ -87,6 +95,9 @@
 import moment from "moment";
 import floatingWindow from "./floatingWindow.vue";
 import yearWindow from "./yearWindow.vue";
+import { nextTick } from "vue";
+import fileApi from "@/assets/js/middleGround/api/file";
+import { requestCtx, appRefCode } from "@/assets/js/config";
 
 export default {
   components: {
@@ -106,6 +117,10 @@
         newspaper: "#8d77b3",
         other: "#009f9f",
       },
+      popupStyle: {
+        left: "0",
+        top: "0",
+      },
     };
   },
 
@@ -114,7 +129,7 @@
   },
 
   methods: {
-    showYearWindow(item) {
+    showYearWindow(item, event) {
       console.log(item, "item");
       for (let i = 0; i < this.contentList.length; i++) {
         const item = this.contentList[i];
@@ -151,12 +166,13 @@
             const listData = await this.getYearResource(item);
             if (listData.length > 0) {
               this.$set(item, "list", listData);
-              console.log(item, "item");
+              for (let j = 0; j < listData.length; j++) {
+                const element = listData[j];
+                this.$set(element, "showChildDetail", false);
+              }
             }
           }
-
-          console.log(this.contentList, "this.contentList");
-          this.contentList = res.datas.reverse();
+          this.contentList = res.datas;
           this.showList = true;
         });
     },
@@ -188,48 +204,99 @@
       const filterList = yearDataList.datas.filter((item) => {
         return item.cmsItemType != "chronology" && item.cmsItemType != "AWARD";
       });
+
       if (filterList && filterList.length > 0) {
         for (let i = 0; i < filterList.length; i++) {
           const item = filterList[i];
           if (item.file) {
-            const requestCtx =
-              this.config.requestCtx + `/file/api/ApiDownload?md5=${item.file}`;
+            const requestCtx = await this.getResourcePath(item.file);
             this.$set(item, "fileLink", requestCtx);
-            console.log(item.fileLink, "item.fileLink");
           }
           this.$set(item, "showDetail", false);
           this.$set(item, "color", this.colorList[item.cmsItemType]);
         }
       }
+
+      if (filterList.length > 0) {
+        console.log(filterList, "filterList");
+      }
       return filterList;
     },
-    closeDetail(index, cindex, type) {
-      console.log(index, cindex, type);
-      for (let i = 0; i < this.contentList.length; i++) {
-        const item = this.contentList[i];
-        if (item && item.length > 0) {
-          for (let j = 0; j < item.list.length; j++) {
-            const citem = item.list[j];
-            this.$set(citem, "showDetail", false);
-          }
-        }
+
+    // 鑾峰彇闃块噷浜戝姞閫熷湴鍧� (瑙嗛锛岄煶棰�)
+    async getResourcePath(md5) {
+      try {
+        // 濡傛灉杩斿洖鐨勬暟鎹负绌烘垨鏈畾涔夛紝鍒欐嫾鎺ラ粯璁や笅杞借矾寰�
+        return requestCtx + "/file/api/ApiDownload?md5=" + md5;
+      } catch (error) {
+        // 鎹曡幏寮傚父骞舵墦鍗伴敊璇棩蹇�
+        console.error("鑾峰彇璧勬簮璺緞澶辫触:", error);
+        // 杩斿洖涓�涓粯璁ゅ�兼垨鎶涘嚭閿欒锛堟牴鎹笟鍔¢渶姹傦級
+        return requestCtx + "/file/api/ApiDownload?md5=" + md5;
       }
     },
-    showDetail(index, cindex, type) {
+
+    closeDetail(index, cindex, type) {
       for (let i = 0; i < this.contentList.length; i++) {
         const item = this.contentList[i];
-        if (item && item.length > 0) {
+        if (item && item.list?.length > 0) {
           for (let j = 0; j < item.list.length; j++) {
             const citem = item.list[j];
-            this.$set(citem, "showDetail", false);
+            this.$set(citem, "showChildDetail", false);
           }
         }
       }
-      if (this.contentList[index].list[cindex].type) {
-        this.contentList[index].list[cindex].showDetail = true;
+      this.contentList[index].list[cindex].showDetail = false;
+    },
+    showDetail(index, cindex, type, event) {
+      const rect = event.target.getBoundingClientRect();
+      const screenWidth = window.innerWidth;
+      const popupWidth = 542; // 鍋囪寮规瀹藉害涓�200px
+      // 鍒ゆ柇瑙﹀彂鍏冪礌浣嶇疆
+      if (rect.left + rect.width / 2 < screenWidth / 2) {
+        // 宸︿晶鏄剧ず寮规鍦ㄥ彸渚�
+        this.popupStyle = {
+          left: `${rect.right}px`,
+          top: `${rect.bottom - 150}px`,
+        };
       } else {
-        this.contentList[index].list[cindex].showDetail = false;
+        // 鍙充晶鏄剧ず寮规鍦ㄥ乏渚�
+        this.popupStyle = {
+          left: `${rect.left - popupWidth}px`,
+          top: `${rect.bottom - 150}px`,
+        };
       }
+      console.log(this.popupStyle.top, "this.top");
+      console.log(this.popupStyle.left, "this.left");
+      // if (rect.left - popupWidth < 0) {
+      //   // 宸︿晶绌洪棿涓嶈冻鏃跺己鍒跺彸渚ф樉绀�
+      //   this.popupStyle.left = `${rect.right}px`;
+      // } else if (rect.right + popupWidth > screenWidth) {
+      //   // 鍙充晶绌洪棿涓嶈冻鏃跺己鍒跺乏渚ф樉绀�
+      //   this.popupStyle.left = `${rect.left - popupWidth}px`;
+      // }
+
+      console.log(event, "event");
+      for (let i = 0; i < this.contentList.length; i++) {
+        const item = this.contentList[i];
+        if (item && item.list?.length > 0) {
+          for (let j = 0; j < item.list.length; j++) {
+            const citem = item.list[j];
+            if (citem.showChildDetail) {
+              this.contentList[i].list[j].showDetail = false;
+              citem.showChildDetail = false;
+            }
+          }
+        }
+      }
+
+      if (this.contentList[index].list[cindex].type) {
+        this.contentList[index].list[cindex].showChildDetail = true;
+      }
+      console.log(
+        this.contentList[index].list,
+        "this.contentList[index].list[cindex]"
+      );
     },
   },
 };
@@ -244,6 +311,7 @@
   display: flex;
   flex-direction: column;
   overflow: auto;
+  font-family: Source Han Sans;
 }
 
 .pageBox {
@@ -273,6 +341,12 @@
     display: flex;
     align-items: end;
     overflow: auto;
+
+    ::v-deep .el-loading-spinner .el-loading-text {
+      font-size: 14px;
+      color: #937950;
+    }
+
     .chartsBox {
       white-space: nowrap;
       padding: 0 80px;
@@ -285,7 +359,7 @@
     // }
     /* 瀵逛簬WebKit娴忚鍣ㄥ拰Blink寮曟搸锛堝Chrome, Opera锛� */
     ::-webkit-scrollbar {
-      width: 16px; /* 婊氬姩鏉$殑瀹藉害 */
+      width: 4px; /* 婊氬姩鏉$殑瀹藉害 */
       height: 16px; /* 婊氬姩鏉$殑楂樺害 */
     }
 
@@ -295,7 +369,8 @@
 
     ::-webkit-scrollbar-thumb {
       background: #b9a587; /* 婊氬姩鏉℃粦鍧楃殑棰滆壊 */
-      border-radius: 16px; /* 婊氬姩鏉℃粦鍧楃殑鍦嗚 */
+      border-radius: 2px; /* 婊氬姩鏉℃粦鍧楃殑鍦嗚 */
+      width: 4px;
     }
 
     ::-webkit-scrollbar-thumb:hover {
@@ -346,6 +421,19 @@
   cursor: pointer;
   position: relative;
 }
+.gradchild:hover {
+  // transform: scale(1.1);
+  width: 23px;
+  height: 23px;
+  cursor: pointer;
+  position: relative;
+}
+
+/* 閲嶇疆瀛愬厓绱犵殑鏍峰紡 */
+// .gradchild:hover .detailDialog {
+//   transform: scale(1);
+//   z-index: 999;
+// }
 
 .item-circle {
   width: 100%;
@@ -377,6 +465,11 @@
   margin-left: -9px;
   z-index: 99;
   background: #fff;
+  cursor: pointer;
+}
+.item-circle:hover:before {
+  background-color: #b9a587;
+  border: 1px solid #8f7a5a;
 }
 
 .item-text {
@@ -388,16 +481,19 @@
   align-items: center;
 }
 .detailDialog {
-  position: absolute;
-  // left: -54px;
-  // bottom: 50px;
-  top: -550%;
-  width: 400px;
+  position: fixed;
+  width: 524px;
   z-index: 9999;
   cursor: pointer;
   background: #fff;
   border: 2px solid #cbbeaa;
   box-shadow: 2px 2px 4px 1px rgba(0, 0, 0, 0.5);
+}
+
+video {
+  border-radius: 10px;
+  border: 1px solid #dcdcdc;
+  box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
 }
 
 .yaerWindow {
@@ -411,15 +507,15 @@
   border: 2px solid #cbbeaa;
   box-shadow: 2px 2px 4px 1px rgba(0, 0, 0, 0.5);
 }
-.detailDialog .dialogContent {
-  width: 100%;
-  height: 100%;
-  background-color: #fff;
-  position: relative;
-  padding: 5px;
-  z-index: 20;
-  box-sizing: border-box;
-}
+// .detailDialog .dialogContent {
+//   width: 100%;
+//   height: 100%;
+//   background-color: #fff;
+//   position: relative;
+//   padding: 5px;
+//   z-index: 20;
+//   box-sizing: border-box;
+// }
 .closeBtn {
   position: absolute;
   width: 20px;
@@ -428,4 +524,16 @@
   right: 5px;
   z-index: 999;
 }
+
+::v-deep .el-loading-spinner {
+  .el-loading-text {
+    font-size: 14px;
+    color: #937950;
+  }
+
+  .el-icon-loading {
+    font-size: 14px;
+    color: #937950;
+  }
+}
 </style>

--
Gitblit v1.9.1