浏览代码

页面bug

彭宇 2 年之前
父节点
当前提交
3c6d01d83e
共有 2 个文件被更改,包括 13 次插入4 次删除
  1. 1 1
      src/views/eventdetailsdialog.vue
  2. 12 3
      src/views/forest.vue

+ 1 - 1
src/views/eventdetailsdialog.vue

@@ -98,7 +98,7 @@
                                                 v-for="(itemfile,index1) in item.fileVOs">
                                       </el-image>
                                       <br>
-                                      <el-link :href="itemfile.fileUrl" :underline="false" target="_blank"
+                                      <el-link :href="itemfile.fileUrl"  :underline="false" target="_blank"
                                                v-for="(itemfile,index1) in item.fileVOs"
                                                v-if="!isAssetTypeAnImage(itemfile.fileUrl)">
                                         <span class="el-icon-document"> {{ itemfile.fileName }} </span>

+ 12 - 3
src/views/forest.vue

@@ -258,7 +258,7 @@
                 <div class="d-l-con padding-box nowrap" v-for="(item,index) in eventList"
                      @click="dropLocation(item.latitude,item.longitude)">
                   <div class="bgt-img">
-                    <img v-if="item.picturePath!=null&&item.picturePath!=''" :src="item.picturePath"
+                    <img v-if="item.picturePath!=null&&item.picturePath!=''&& isAssetTypeAnImage(item.picturePath)" :src="item.picturePath"
                          style="width: 93px;height: 64px"/>
                     <img v-else src="../assets/images/integrated/event-img-sub.png" style="width: 93px;height: 64px"/>
                   </div>
@@ -582,7 +582,7 @@ export default {
             '                </div>' +
             '                </div>' +
             '                </span>'
-          if (this.eventList[i].picturePath != null && this.eventList[i].picturePath != '') {
+          if (this.eventList[i].picturePath != null && this.eventList[i].picturePath != ''&& this.isAssetTypeAnImage(this.eventList[i].picturePath)) {
             markersMap.bindPopupHtml += '<span>' +
               '                  <div class="d-l-con">' +
               '                  <div class="d-l-l-text">' +
@@ -940,7 +940,7 @@ export default {
               '                </div>' +
               '                </div>' +
               '                </span>'
-            if (this.eventList[i].picturePath != null && this.eventList[i].picturePath != '') {
+            if (this.eventList[i].picturePath != null && this.eventList[i].picturePath != ''&& this.isAssetTypeAnImage(this.eventList[i].picturePath) {
               markersMap.bindPopupHtml += '<span>' +
                 '                  <div class="d-l-con">' +
                 '                  <div class="d-l-l-text">' +
@@ -965,6 +965,15 @@ export default {
         }
       })
     },
+    // 判断是否为图片
+    isAssetTypeAnImage(filePath) {
+      //获取最后一个.的位置
+      var index = filePath.lastIndexOf('.')
+      //获取后缀
+      var ext = filePath.substr(index + 1)
+      let aa = ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext.toLowerCase()) !== -1
+      return aa
+    },
     getEventByEventType(day) {
       let that = this
       //右侧获取事件分类