From 2073874099d0f28946c11310d17428cd725f7496 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Sat, 18 Mar 2023 11:00:10 +0800
Subject: [PATCH] 添加判断防止报错

---
 src/views/funcView.vue |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/views/funcView.vue b/src/views/funcView.vue
index 5f5b177..d9408f0 100644
--- a/src/views/funcView.vue
+++ b/src/views/funcView.vue
@@ -87,6 +87,7 @@
 import PlusIcon from 'vue-material-design-icons/PlusCircle'
 import MinusIcon from 'vue-material-design-icons/MinusCircle'
 import io from "socket.io-client";
+import {getDetail} from "@/api/modules/modules";
 
 export default {
   name: "funcView",
@@ -159,21 +160,25 @@
         if (data.type == 2) {
           let fileArray = data.fileUrl
           this.flipConfig.pages = []
-          fileArray.forEach(e => {
-            this.flipConfig.pages.push(e.value)
-          })
+          if (fileArray.length>0 && fileArray){
+            fileArray.forEach(e => {
+              this.flipConfig.pages.push(e.value)
+            })
+          }
         } else if (data.type == 3) {
-          url = data.fileUrl[0].value
-          this.path = 'http://192.168.0.200:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
+          if (data.fileUrl&&data.fileUrl.length>0){
+            url = data.fileUrl[0].value
+            this.path = 'http://192.168.0.200:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
+          }
         } else if (data.type == 1) {
-          url = data.fileUrl[0].value
-          this.path = 'http://192.168.0.200:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
+          if (data.fileUrl&&data.fileUrl.length>0){
+            url = data.fileUrl[0].value
+            this.path = 'http://192.168.0.200:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
+          }
         }
       } else if (data.property == 3) {
 
       }
-
-
     },
 
     connect(form, done) {
@@ -210,16 +215,19 @@
       });
 
       this.socketIoClient.on("menuChange", (res) => {
+        console.log(res)
         this.handleSelect(res)
       });
 
       //上一页
       this.socketIoClient.on("previousPage", (res) => {
+        console.log(res)
         this.left()
       });
 
       //下一页
       this.socketIoClient.on("nextPage", (res) => {
+        console.log(res)
         this.right()
       });
 

--
Gitblit v1.9.3