From 1d50b93bf019017964fa4716b2368343a8da0091 Mon Sep 17 00:00:00 2001 From: AnHanTech Date: Wed, 8 Feb 2023 02:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4ajax=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BF=A1=E6=81=AF=20Signed-off-by:=20AnHanTe?= =?UTF-8?q?ch=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 3 ++- common/ajax.js | 2 +- store/modules/user.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/App.vue b/App.vue index f75433d..be1b481 100644 --- a/App.vue +++ b/App.vue @@ -13,7 +13,8 @@ console.log(resLogin) that.$ajax("Demo/test",{code:resLogin.code}) .then(res=>{ - if (res.code == 200) { + console.log(res) + if (res.code == 1) { that.saveOpenIdSession(res.data) } }) diff --git a/common/ajax.js b/common/ajax.js index f715008..fe37d6b 100644 --- a/common/ajax.js +++ b/common/ajax.js @@ -25,7 +25,7 @@ instance.interceptors.request.use( instance.interceptors.response.use( response => { // 对响应数据做些什么 - return response + return response.data }, error => { // 对响应错误做些什么 diff --git a/store/modules/user.js b/store/modules/user.js index 2b97e43..3eb280d 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -51,6 +51,7 @@ export default { }, // 将 token 字符串持久化存储到本地 saveOpenIdSession(state, res) { + console.log("saveOpenIdSession",res) state.openId = res.openid state.sessionKey = res.session_key //this.unionid = res.unionid