From 76da76135e3a7564b9f81116a2567454ecad3577 Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期二, 15 八月 2023 17:21:37 +0800
Subject: [PATCH] 8-15 下班提交
---
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