Browse Source

修改邻里社区图片显示问题

D4THYL3\long 3 years ago
parent
commit
e748e2abed
1 changed files with 9 additions and 5 deletions
  1. 9 5
      operationSupport/src/views/propertyManagement/neighbor.vue

+ 9 - 5
operationSupport/src/views/propertyManagement/neighbor.vue

@@ -238,9 +238,11 @@ export default {
     mounted() {},
     methods: {
         typeVideo(str) {
-            let type = str.slice(str.lastIndexOf('.') + 1, str.length);
-            let videoType = ['mp4'];
-            return videoType.includes(type);
+            if (str) {
+                let type = str.slice(str.lastIndexOf('.') + 1, str.length);
+                let videoType = ['mp4'];
+                return videoType.includes(type);
+            }
         },
         lookVideos(src) {
             new Promise((resolve) => {
@@ -326,8 +328,10 @@ export default {
                     if (res.status === 0) {
                         if (res.data.file) {
                             let file = res.data.file;
-                            let mediaList = file.split(',');
-                            this.mediaList.length = 3;
+                            this.mediaList = file.split(',');
+                            if (this.mediaList.length >= 3) {
+                                this.mediaList.length = 3;
+                            }
 
                             this.srcList = this.mediaList.filter((item) => {
                                 return item !== 'mp4';