瀏覽代碼

Merge branch 'dev/v4.9.27_yf' of qmx/jy into feature/v4.9.27

yangfeng 1 年之前
父節點
當前提交
dc9abd3e43
共有 2 個文件被更改,包括 11 次插入1 次删除
  1. 二進制
      src/web/staticres/images/pc/doc-error.png
  2. 11 1
      src/web/staticres/js/index/index_2023.12.js

二進制
src/web/staticres/images/pc/doc-error.png


+ 11 - 1
src/web/staticres/js/index/index_2023.12.js

@@ -168,7 +168,7 @@ var _page = {
     this.initHotIndustrySearch()
     this.initDocsDescTab()
     this.docImgClick()
-
+    this.docImgPlaceholder()
   },
   // 计算九宫格高度
   initUserInfoCard: function () {
@@ -383,6 +383,16 @@ var _page = {
       var href = $(this).parents().siblings('a').attr('href')
       window.open(href)
     })
+  },
+  // 处理文图图片访问不到时用默认图片占位
+  docImgPlaceholder: function() {
+    var $img = $('.doc-card-list-item .doc-main-img')
+    $img.each(function() {
+      if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
+        this.src = '/images/pc/doc-error.png'
+        $(this).parents('.doc-card-list-item-img').css({"border": "0"})
+      }
+    })
   }
 }