Ver código fonte

二维码问题

liuxing 1 ano atrás
pai
commit
500d72fb16
1 arquivos alterados com 31 adições e 29 exclusões
  1. 31 29
      app/src/views/Detail/components/Risklevel.vue

+ 31 - 29
app/src/views/Detail/components/Risklevel.vue

@@ -116,7 +116,7 @@ export default {
       yhList: [],
       hzs: [],
       qrcode: null,
-      color: null
+      color: null,
     };
   },
   props: ["detail"],
@@ -169,35 +169,37 @@ export default {
         this.hzs = list;
       });
 
-      console.log(this.detail.fxdj);
-      let color = "";
-      let bgColor = "";
-      if (this.detail.fxdj.indexOf("低风险") >= 0) {
-        color = "#00D957";
-        bgColor = "#00A3FF";
-      } else if (this.detail.fxjd.indexOf("一般风险") >= 0) {
-        color = "#fbff3d";
-      } else if (
-        this.detail.fxjd.indexOf("较大风险") >= 0 ||
-        this.detail.fxjd.indexOf("较高风险") >= 0
-      ) {
-        color = "#ff833d";
-        bgColor = "#ff833d";
-      } else if (this.detail.fxjd.indexOf("重大风险") >= 0) {
-        color = "#ff0b0b";
-        bgColor = "#ff0b0b";
-      } else {
-        color = "#35c2ff";
-        bgColor = "#35c2ff";
+      console.log(this.detail.fxdj.indexOf("重大风险"));
+      if (this.detail.fxdj) {
+        let color = "";
+        let bgColor = "";
+        if (this.detail.fxdj.indexOf("低风险") >= 0) {
+          color = "#00D957";
+          bgColor = "#00A3FF";
+        } else if (this.detail.fxdj.indexOf("一般风险") >= 0) {
+          color = "#fbff3d";
+        } else if (
+          this.detail.fxdj.indexOf("较大风险") >= 0 ||
+          this.detail.fxdj.indexOf("较高风险") >= 0
+        ) {
+          color = "#ff833d";
+          bgColor = "#ff833d";
+        } else if (this.detail.fxdj.indexOf("重大风险") >= 0) {
+          color = "#ff0b0b";
+          bgColor = "#ff0b0b";
+        } else {
+          color = "#35c2ff";
+          bgColor = "#35c2ff";
+        }
+        this.color = bgColor;
+        getQrcode({
+          url: window.location.origin + "/h5?id=" + this.detail.id,
+          color,
+        }).then((res) => {
+          const data = JSON.parse(res.data.data);
+          this.qrcode = data.qr_code;
+        });
       }
-      this.color = bgColor;
-      getQrcode({
-        url: window.location.origin + "/h5?id=" + this.detail.id,
-        color,
-      }).then((res) => {
-        const data = JSON.parse(res.data.data);
-        this.qrcode = data.qr_code;
-      });
     },
   },
   created() {