xiebaomin 1 سال پیش
والد
کامیت
94374051d0

+ 6 - 0
src/main/resources/static/css/article/drawer-footer.css

@@ -65,6 +65,12 @@
     height: 14.8vw;
 }
 
+.hot-recommend .hot-recommend-content .hot-recommend-content-item div:nth-child(1) img {
+    width: 100%;
+    height: 100%;
+    object-fit: contain;
+}
+
 .hot-recommend .hot-recommend-content .hot-recommend-content-item div:nth-child(2) {
     width: 31.9vw;
     text-overflow:ellipsis;

+ 9 - 3
src/main/resources/static/css/article/recommendation.css

@@ -225,6 +225,12 @@
         height: 60px;
     }
 
+    .infomationlist .list-mainData ul .info-item div:nth-child(1) img {
+        width: 100%;
+        height: 100%;
+        object-fit: contain;
+    }
+
     .infomationlist .list-mainData ul .info-item div:nth-child(2) {
         margin-left: 16px;
     }
@@ -307,9 +313,9 @@
 }
 
 @media screen and (max-width:768px) {
-    #drawer-footer, .advertisement {
-        display: none;
-    }
+    /*#drawer-footer, .advertisement {*/
+    /*    display: none;*/
+    /*}*/
     /*精品推荐*/
     .mainData {
         padding: 3.2vw;

+ 11 - 0
src/main/resources/static/js/article/common.js

@@ -1,4 +1,15 @@
 /*var articleTypeNav = new Swiper('#articleTypeNav');*/
+const handleFileUrl = (url) => {
+    const fileUrl = url.split('?')[0]
+    let index = fileUrl.lastIndexOf('.');
+    let suffix = fileUrl.substring(index);
+    if (suffix === '.doc' || suffix === '.ppt' || suffix === '.pptx' || suffix === '.docx') {
+        window.open('https://view.officeapps.live.com/op/view.aspx?src=' + encodeURIComponent(url), '_black') // 下载
+    } else {
+        window.open(fileUrl, '_blank')
+    }
+}
+
 var articleSide = new Vue({
     el: '#articleSide',
     data: {

+ 11 - 0
src/main/resources/static/js/article/recommendation.js

@@ -185,6 +185,17 @@ var recommendation = new Vue({
             } else {
                 window.location.href = '/info/detail-' + id + '-1.html'
             }
+        },
+        // 文件链接跳转
+        handleFileUrl(url) {
+            const fileUrl = url.split('?')[0]
+            let index = fileUrl.lastIndexOf('.');
+            let suffix = fileUrl.substring(index);
+            if (suffix === '.doc' || suffix === '.ppt' || suffix === '.pptx' || suffix === '.docx') {
+                window.open('https://view.officeapps.live.com/op/view.aspx?src=' + encodeURIComponent(url), '_black') // 下载
+            } else {
+                window.open(fileUrl, '_blank')
+            }
         }
     }
 })

+ 12 - 6
src/main/resources/templates/article/components/article-drawer.html

@@ -8,7 +8,7 @@
 
 <input type="hidden" th:value="${coreServer}" id="coreServer">
 <input type="hidden" th:value="${agent}" id="userAgent">
-  <div id="drawer-footer">
+  <div id="drawer-footer" th:if="${isSelectInfo}">
     <div class="hot-recommend" v-if="recommend.list.length > 0">
       <div class="hot-recommend-title">
         <div>热门推荐</div>
@@ -45,7 +45,9 @@
               <img th:src="${product.image}" style="width: 100%;height: 100%;object-fit: contain;" />
             </a>
           </div>
-          <div th:text="${product.name}"></div>
+          <div>
+            <a th:text="${product.name}" th:href="'/product-'+${product.id}+'.html'" target="_blank"></a>
+          </div>
         </div>
       </div>
     </div>
@@ -59,17 +61,21 @@
       <div class="hot-recommend-content">
         <div class="hot-recommend-content-item" th:each="file: ${archiveFiles}">
           <div>
-            <a th:href="${file.ossUrl}" target="_blank">
-              <img src="/img/article/PC--pdf.png" style="width: 100%;height: 100%;object-fit: contain;" />
+            <a href="javascript:void(0)" target="_blank" th:onclick="handleFileUrl([[${file.ossUrl}]])">
+              <img src="/img/article/PC--pdf.png" th:if="${#strings.containsIgnoreCase(file.ossUrl, 'pdf')}">
+              <img src="/img/info/PC-doc.png" th:if="${#strings.containsIgnoreCase(file.ossUrl, 'doc')}">
+              <img src="/img/info/PC-ppt.png" th:if="${#strings.containsIgnoreCase(file.ossUrl, 'ppt')}">
             </a>
           </div>
-          <div th:text="${file.fileName}"></div>
+          <div>
+            <a th:text="${file.fileName}" target="_blank" href="javascript:void(0)" th:onclick="handleFileUrl([[${file.ossUrl}]])"></a>
+          </div>
         </div>
       </div>
     </div>
   </div>
 <!--    广告-->
-<div class="advertisement">
+<div class="advertisement" th:if="${#arrays.length(ads)} > 0 and ${isSelectInfo}">
   <a class="advertisement-link" th:each="ad : ${ads}" th:href="${ad.link}">
     <img th:src="${ad.image}" th:alt="${ad.title}" class="advertisement-img"/>
   </a>

+ 6 - 4
src/main/resources/templates/article/components/article-sidebar.html

@@ -58,12 +58,14 @@
         </p>
         <div class="row" th:each="file: ${archiveFiles}">
             <div class="new-img xiao">
-                <a th:href="${file.ossUrl}" target="_blank">
-                    <img src="/img/article/PC--pdf.png"/>
+                <a href="javascript:void(0);" th:onclick="handleFileUrl([[${file.ossUrl}]])" target="_blank">
+                    <img src="/img/article/PC--pdf.png" th:if="${#strings.containsIgnoreCase(file.ossUrl, 'pdf')}">
+                    <img src="/img/info/PC-doc.png" th:if="${#strings.containsIgnoreCase(file.ossUrl, 'doc')}">
+                    <img src="/img/info/PC-ppt.png" th:if="${#strings.containsIgnoreCase(file.ossUrl, 'ppt')}">
                 </a>
             </div>
             <div class="new-blurb xiao">
-                <a th:href="${file.ossUrl}" target="_blank">
+                <a target="_blank" href="javascript:void(0);" th:onclick="handleFileUrl([[${file.ossUrl}]])">
                     <p class="shuoming" th:text="${file.fileName}"></p>
                 </a>
             </div>
@@ -74,7 +76,7 @@
 <!--            <img :src="ad.image" alt="ad.title"/>-->
 <!--        </a>-->
         <a th:each="ad : ${ads}" class="tui-img" th:href="${ad.link}" @click="clickAD(ad.id,ad.link)">
-            <img th:src="${ad.image}" th:alt="${ad.title}"></img>
+            <img th:src="${ad.image}" th:alt="${ad.title}" />
         </a>
     </div>
 </div>

+ 4 - 2
src/main/resources/templates/article/recommendation.html

@@ -90,9 +90,11 @@
                     </ul>
                     <ul v-else>
                         <li v-for="item in articlerecommendationData">
-                            <a class="info-item" :href="item.ossUrl">
+                            <a class="info-item" @click="handleFileUrl(item.ossUrl)">
                                 <div>
-                                    <img src="/img/article/PC--pdf.png" style="width: 100%;height: 100%;object-fit: contain;" />
+                                    <img src="/img/article/PC--pdf.png" v-if="/\.pdf/.test(item.ossUrl)">
+                                    <img src="/img/info/PC-doc.png" v-else-if="/\.doc/.test(item.ossUrl)">
+                                    <img src="/img/info/PC-ppt.png" v-else>
                                 </div>
                                 <div v-html="item.fileName"></div>
                             </a>