Commit 382f96d9 by zhanghaozhe

修改登录接口

parent 69c28b11
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
"jest-watch-typeahead": "^0.2.1", "jest-watch-typeahead": "^0.2.1",
"js-base64": "^2.5.1", "js-base64": "^2.5.1",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"json-stringify-safe": "^5.0.1",
"less": "^3.9.0", "less": "^3.9.0",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
......
...@@ -9,6 +9,7 @@ import { compose } from 'redux' ...@@ -9,6 +9,7 @@ import { compose } from 'redux'
import { getParam, http, browser } from "@/utils" import { getParam, http, browser } from "@/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { addDays } from 'date-fns' import { addDays } from 'date-fns'
import stringify from 'json-stringify-safe'
//拦截ajax请求,返回mock数据 //拦截ajax请求,返回mock数据
...@@ -69,7 +70,7 @@ class App extends Component { ...@@ -69,7 +70,7 @@ class App extends Component {
this.getUser() this.getUser()
} }
if (location.pathname === '/passport') { if (location.pathname === '/passport') {
window.localStorage.setItem('binding_redirect', JSON.stringify(this.previousLocation)) window.localStorage.setItem('binding_redirect', stringify(this.previousLocation))
} }
const {pathname, state} = location const {pathname, state} = location
if (pathname.startsWith('/passport')) { if (pathname.startsWith('/passport')) {
......
...@@ -48,13 +48,13 @@ class Passport extends Component { ...@@ -48,13 +48,13 @@ class Passport extends Component {
{ {
logo: qq, logo: qq,
text: 'QQ', text: 'QQ',
url: `${API["passport-api"]}/mob/qqlogin?redirect_url=${encodeURIComponent(this.redirectURL)}`, url: `${API["passport-api"]}/m/login/qqLogin?redirect_url=${encodeURIComponent(this.redirectURL)}`,
id: 'qq' id: 'qq'
}, },
{ {
logo: sina, logo: sina,
text: '新浪', text: '新浪',
url: `${API['passport-api']}/mob/sinalogin?redirect_url=${encodeURIComponent(this.redirectURL)}`, url: `${API['passport-api']}/m/login/sinaLogin?redirect_url=${encodeURIComponent(this.redirectURL)}`,
id: 'sina' id: 'sina'
} }
] ]
......
...@@ -4,7 +4,7 @@ import jsCookie from 'js-cookie' ...@@ -4,7 +4,7 @@ import jsCookie from 'js-cookie'
const accountLogin = user => dispatch => { const accountLogin = user => dispatch => {
return http.post(`${API['passport-api']}/user_login`, { return http.post(`${API['passport-api']}/m/login/accountLogin`, {
user_name: user.username, user_name: user.username,
password: encrypt(user.password), password: encrypt(user.password),
is_encrypt: 1, is_encrypt: 1,
...@@ -15,7 +15,7 @@ const accountLogin = user => dispatch => { ...@@ -15,7 +15,7 @@ const accountLogin = user => dispatch => {
} }
const quickLogin = user => dispatch => { const quickLogin = user => dispatch => {
return http.post(`${API['passport-api']}/quick_login`, { return http.post(`${API['passport-api']}/m/login/quickLogin`, {
...user, ...user,
plat: 5 plat: 5
}).then(res => { }).then(res => {
...@@ -26,7 +26,7 @@ const quickLogin = user => dispatch => { ...@@ -26,7 +26,7 @@ const quickLogin = user => dispatch => {
const storeUser = (res, dispatch) => { const storeUser = (res, dispatch) => {
const data = res.data const data = res.data
let payload let payload
if (data.errno === 0) { if (data.errno === 200) {
const {user_name: username, avatar_file: avatar,is_vip: isVIP, ...rest} = data.data.user_info const {user_name: username, avatar_file: avatar,is_vip: isVIP, ...rest} = data.data.user_info
payload = { payload = {
hasError: false, hasError: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment