فهرست منبع

修改请求失败的处理

fengxu 2 سال پیش
والد
کامیت
6614f860e8
2فایلهای تغییر یافته به همراه27 افزوده شده و 13 حذف شده
  1. 18 11
      cokingCoal/js/newIndex.js
  2. 9 2
      cokingCoal/js/request.js

+ 18 - 11
cokingCoal/js/newIndex.js

@@ -404,7 +404,7 @@ let app = new Vue({
           color: "#EC8AED"
         }
       },],
-      
+
       schoolList2: [{
         name: "产学研合作高校",
         image: "./images/newImage/yellow.png",
@@ -530,6 +530,9 @@ let app = new Vue({
         }
         skillList[this.skillIndex].flag = true
       }, 2000)
+      setTimeout(()=>{
+
+      },9000)
     })
     let that = this;
     localEnvAppToken().then(res => {
@@ -544,6 +547,9 @@ let app = new Vue({
         this.getHumanResources()
         // this.getlaborproductivity()
       })
+    }).catch(err=>{
+      let industry = that.$refs.industry
+        that.initOrganizationElse(industry, "", that.industry, "")
     })
 
 
@@ -4507,16 +4513,17 @@ let app = new Vue({
       let that = this
       let data = {}
       fetchPostMethods("/ierp/kapi/v2/mdnb/mdnb_control/Industrydistribution", data).then(res => {
-        console.log(res.data, "Industrydistribution");
-        let x = []
-        let y = []
-        that.industry = JSON.parse(JSON.stringify({}))
-        res.data.forEach(item => {
-          x.push(item.key)
-          y.push(item.value)
-        })
-        that.industry.x = x
-        that.industry.y = y
+        if (res.data) {
+          let x = []
+          let y = []
+          that.industry = JSON.parse(JSON.stringify({}))
+          res.data.forEach(item => {
+            x.push(item.key)
+            y.push(item.value)
+          })
+          that.industry.x = x
+          that.industry.y = y
+        }
         let industry = that.$refs.industry
         that.initOrganizationElse(industry, "", that.industry, "")
         // 

+ 9 - 2
cokingCoal/js/request.js

@@ -208,12 +208,19 @@ function localEnvAppToken() {
       method: "post",
       body: JSON.stringify(data),
       mode: 'cors'
-    }).then(res => res.json())
+    }).then(res => {
+      return res.json()
+    })
       .catch(error => {
         reject(error)
       })
       .then(response => {
-        resole(response.data)
+        if(response != undefined){
+          resole(response.data)
+        } else {
+          reject({requestType: false})
+        }
+
       });
   })
 };