Sfoglia il codice sorgente

修改post请求conten-Type

Shan9312 1 anno fa
parent
commit
b308f90834

BIN
dist-tmr-20250103-正式包.zip


+ 3 - 2
src/utils/request.js

@@ -33,11 +33,12 @@ service.interceptors.request.use(
     // do something before request is sent
     // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'  //此处是增加的代码,设置请求头的类型
     // debugger
+    console.log(process.env.VUE_APP_BASE_API,'process.env.VUE_APP_BASE_API')
     if (process.env.VUE_APP_BASE_API !== '/dev-api') {
-      config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
+      config.headers['Content-Type'] = 'application/json;charset=UTF-8'
       config.withCredentials = false
     }
-    // console.log(config,'config')
+    console.log(config,'config')
 
     if (store.getters.token) {
       // let each request carry token

+ 6 - 1
src/views/formulationPlan/pushMaterialPlan/index.vue

@@ -182,7 +182,12 @@ export default {
           pastureid: Cookies.get('pastureid'),eqtype:'1'
         }
       }
-      postJson(url,data).then(response => {
+      postJson(url, data, {
+         headers: {
+          'Content-Type': 'application/json',
+            type:'true'
+         }
+      }).then(response => {
         if (response.data.list !== null) {
           this.tmrList = response.data.list
         } else {