From ef114839bf4355b597e9ac7f5ba78e732a703770 Mon Sep 17 00:00:00 2001 From: hailin <1356886193@qq.com> Date: 星期一, 07 八月 2023 09:44:13 +0800 Subject: [PATCH] 私人仓库的第一次提交 --- src/main.js | 36 ++++++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main.js b/src/main.js index 24c069b..5421a27 100644 --- a/src/main.js +++ b/src/main.js @@ -20,7 +20,7 @@ Vue.use(qs); Vue.use(api); -const javaApi = 'http://localhost:8001/' +const javaApi = 'http://192.168.110.167:8001/' axios.defaults.baseURL = javaApi axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' @@ -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