Showing
4 changed files
with
12 additions
and
4 deletions
@@ -30,6 +30,7 @@ const plugin = { | @@ -30,6 +30,7 @@ const plugin = { | ||
30 | // return Promise.reject(); | 30 | // return Promise.reject(); |
31 | }, | 31 | }, |
32 | initPurview(Vue, user) { | 32 | initPurview(Vue, user) { |
33 | + Vue.$cookie.set('_isLogin', true); | ||
33 | Vue.$cookie.set('shopsId', user.currentShop.id); | 34 | Vue.$cookie.set('shopsId', user.currentShop.id); |
34 | return userService.purviews().then((purviews) => { | 35 | return userService.purviews().then((purviews) => { |
35 | this.updateUser(Vue, user, purviews); | 36 | this.updateUser(Vue, user, purviews); |
@@ -78,9 +79,9 @@ const plugin = { | @@ -78,9 +79,9 @@ const plugin = { | ||
78 | local: (username, password) => { | 79 | local: (username, password) => { |
79 | return userService.login(username, password).then((res) => { | 80 | return userService.login(username, password).then((res) => { |
80 | if (res.code === 200) { | 81 | if (res.code === 200) { |
81 | - Vue.$cookie.set('_isLogin', true); | ||
82 | - this.initPurview(Vue, res.data); | 82 | + return this.initPurview(Vue, res.data).then(() => { |
83 | return res.data; | 83 | return res.data; |
84 | + }); | ||
84 | } | 85 | } |
85 | return Promise.reject(res); | 86 | return Promise.reject(res); |
86 | }); | 87 | }); |
@@ -5,8 +5,6 @@ const request = require('request'); | @@ -5,8 +5,6 @@ const request = require('request'); | ||
5 | 5 | ||
6 | const logger = global.yoho.logger; | 6 | const logger = global.yoho.logger; |
7 | 7 | ||
8 | - | ||
9 | - | ||
10 | const API_INTERNAL_ERROR = { | 8 | const API_INTERNAL_ERROR = { |
11 | code: 500, | 9 | code: 500, |
12 | message: '服务器错误' | 10 | message: '服务器错误' |
@@ -69,6 +67,7 @@ class Api extends Context { | @@ -69,6 +67,7 @@ class Api extends Context { | ||
69 | resolveWithFullResponse: true | 67 | resolveWithFullResponse: true |
70 | }); | 68 | }); |
71 | return rp[options.method || 'get'](options).then(response => { | 69 | return rp[options.method || 'get'](options).then(response => { |
70 | + console.log(response.rawHeaders) | ||
72 | let jsonBody = JSON.parse(response.body); | 71 | let jsonBody = JSON.parse(response.body); |
73 | let req = response.request; | 72 | let req = response.request; |
74 | 73 |
@@ -22,6 +22,9 @@ class UserService extends Context { | @@ -22,6 +22,9 @@ class UserService extends Context { | ||
22 | password, | 22 | password, |
23 | platform: config.platform | 23 | platform: config.platform |
24 | }).then(userInfo => { | 24 | }).then(userInfo => { |
25 | + this.api.get(`http://192.168.102.211:30016/loginInter?user=${account}&password=${password}`).then(res => { | ||
26 | + console.log(res); | ||
27 | + }); | ||
25 | if (userInfo.code !== 200 || !userInfo.data.pid) { | 28 | if (userInfo.code !== 200 || !userInfo.data.pid) { |
26 | return Promise.reject({code: 500, message: '用户名密码错误'}); | 29 | return Promise.reject({code: 500, message: '用户名密码错误'}); |
27 | } | 30 | } |
-
Please register or login to post a comment