Эх сурвалжийг харах

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

yangfeng 1 жил өмнө
parent
commit
10cb6b5fc3

BIN
src/web/staticres/images/pc/doc-error.png


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

@@ -168,7 +168,6 @@ var _page = {
     this.initHotIndustrySearch()
     this.initDocsDescTab()
     this.docImgClick()
-    this.docImgPlaceholder()
   },
   // 计算九宫格高度
   initUserInfoCard: function () {
@@ -383,16 +382,6 @@ 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"})
-      }
-    })
   }
 }
 

+ 1 - 1
src/web/templates/pc/template/index/doc-card-module.html

@@ -17,7 +17,7 @@
             {{range $kk,$vv := $v}}
             <li class="doc-card-list-item">
               <div class='doc-card-list-item-img {{if not $vv.productType}}{{else if Eq $vv.productType 1}}free{{end}}'>
-                <img class="doc-main-img" src="{{$vv.previewImg}}" alt="{{$vv.docName}}">
+                <img class="doc-main-img" src="{{$vv.previewImg}}" alt="{{$vv.docName}}" onerror="javascript:this.src='/images/pc/doc-error.png';this.οnerrοr=null">
                 {{if or (eq $vv.docFileSuffix "doc") (eq $vv.docFileSuffix "docx")}}
                 <img class="doc-type-img" src='/images/pc/word.png' alt="{{$vv.docFileSuffix}}">
                 {{else if  eq $vv.docFileSuffix "pdf"}}