dedsudiyu 1 vuosi sitten
vanhempi
commit
5a10e91930
1 muutettua tiedostoa jossa 23 lisäystä ja 0 poistoa
  1. 23 0
      src/utils/request.js

+ 23 - 0
src/utils/request.js

@@ -53,11 +53,24 @@ service.interceptors.request.use(config => {
     url = url.slice(0, -1);
     config.params = {};
     config.url = url;
+    if (config.url.indexOf('..') != -1) {
+      loadingCount --;
+      messageData = Message({
+        message: '请求包含非法参数',
+        type: 'error',
+        offset:100
+      })
+      setTimeout(function(){
+        messageData = null
+      },1000);
+      return
+    }
   }
   // 弹层相关
   loadingCount ++;
   return config
 }, error => {
+  console.log('config2',config)
   // 弹层相关
     loadingCount --;
     if(loadingCount===0){
@@ -223,4 +236,14 @@ export function downloadUrl(fileUrl,fleName) {
   };
   x.send();
 }
+
+export function dataEncode(str) {
+  let s = "";
+  if (str === null || str === undefined || str === "") {
+    return "";
+  }
+  s = str.replace("..", "");
+  return s;
+}
+
 export default service