From 0747a32003b83a155466496d18f7dddf6f800436 Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期五, 11 八月 2023 17:49:33 +0800
Subject: [PATCH] Crunchy-08/11下班

---
 src/main.js |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/main.js b/src/main.js
index 24c069b..3b771af 100644
--- a/src/main.js
+++ b/src/main.js
@@ -40,11 +40,19 @@
   }
   if (token) {
     config.headers['token'] = "" + token
-    config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
+    // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
+    // config.headers['Content-Type'] = 'application/json'
   }
+  // console.log(config)
   if (config.method === 'post' || config.method === 'put') {
+    
     config.data = qs.stringify(config.data)
   }
+  if(config.headers['Content-Type'] =='application/json'){
+    config.data = qs.parse(config.data)
+    // console.log(config.data)
+  }
+  
   return config
 }, function(error) {
   return Promise.reject(error)
@@ -89,18 +97,18 @@
 })
 
 // 璺敱鎷︽埅鍣�
-router.beforeEach((to, from, next) => {
-  // 璺緞涓簆roduct鏃堕獙璇佹槸鍚︾櫥褰曪紝娌℃湁璺宠浆鑷崇櫥褰曢〉闈�
-  if (to.path.indexOf('/') > -1 && to.path.indexOf('/enter') != 0) {
-    if (sessionStorage.getItem('token') == null || sessionStorage.getItem('token') == '' || sessionStorage.getItem(
-        'token') == undefined) {
-      next({
-        path: '/enter'
-      })
-    }
-  }
-  next()
-});
+// router.beforeEach((to, from, next) => {
+//   // 璺緞涓簆roduct鏃堕獙璇佹槸鍚︾櫥褰曪紝娌℃湁璺宠浆鑷崇櫥褰曢〉闈�
+//   if (to.path.indexOf('/') > -1 && to.path.indexOf('/enter') != 0) {
+//     if (sessionStorage.getItem('token') == null || sessionStorage.getItem('token') == '' || sessionStorage.getItem(
+//         'token') == undefined) {
+//       next({
+//         path: '/enter'
+//       })
+//     }
+//   }
+//   next()
+// });
 
 new Vue({
   el: '#app',

--
Gitblit v1.9.3