调整ajax请求返回信息

Signed-off-by: AnHanTech <admin@xixingwl.cn>
This commit is contained in:
AnHanTech
2023-02-08 02:17:33 +08:00
parent 98cfbb0b77
commit 1d50b93bf0
3 changed files with 4 additions and 2 deletions

View File

@@ -13,7 +13,8 @@
console.log(resLogin) console.log(resLogin)
that.$ajax("Demo/test",{code:resLogin.code}) that.$ajax("Demo/test",{code:resLogin.code})
.then(res=>{ .then(res=>{
if (res.code == 200) { console.log(res)
if (res.code == 1) {
that.saveOpenIdSession(res.data) that.saveOpenIdSession(res.data)
} }
}) })

View File

@@ -25,7 +25,7 @@ instance.interceptors.request.use(
instance.interceptors.response.use( instance.interceptors.response.use(
response => { response => {
// 对响应数据做些什么 // 对响应数据做些什么
return response return response.data
}, },
error => { error => {
// 对响应错误做些什么 // 对响应错误做些什么

View File

@@ -51,6 +51,7 @@ export default {
}, },
// 将 token 字符串持久化存储到本地 // 将 token 字符串持久化存储到本地
saveOpenIdSession(state, res) { saveOpenIdSession(state, res) {
console.log("saveOpenIdSession",res)
state.openId = res.openid state.openId = res.openid
state.sessionKey = res.session_key state.sessionKey = res.session_key
//this.unionid = res.unionid //this.unionid = res.unionid