mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-23 23:45:08 +08:00
优化管理后台的社交登录
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {login, logout, getInfo, socialQuickLogin, socialBindLogin, smsLogin} from '@/api/login'
|
||||
import {login, logout, getInfo, socialLogin, socialBindLogin, smsLogin} from '@/api/login'
|
||||
import {getAccessToken, setToken, removeToken, getRefreshToken} from '@/utils/auth'
|
||||
|
||||
const user = {
|
||||
@ -38,8 +38,12 @@ const user = {
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const socialCode = userInfo.socialCode
|
||||
const socialState = userInfo.socialState
|
||||
const socialType = userInfo.socialType
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
login(username, password, code, uuid,
|
||||
socialType, socialCode, socialState).then(res => {
|
||||
res = res.data;
|
||||
// 设置 token
|
||||
setToken(res)
|
||||
@ -56,7 +60,7 @@ const user = {
|
||||
const state = userInfo.state
|
||||
const type = userInfo.type
|
||||
return new Promise((resolve, reject) => {
|
||||
socialQuickLogin(type, code, state).then(res => {
|
||||
socialLogin(type, code, state).then(res => {
|
||||
res = res.data;
|
||||
// 设置 token
|
||||
setToken(res)
|
||||
@ -67,25 +71,7 @@ const user = {
|
||||
})
|
||||
},
|
||||
|
||||
// 社交登录
|
||||
SocialLogin2({ commit }, userInfo) {
|
||||
const code = userInfo.code
|
||||
const state = userInfo.state
|
||||
const type = userInfo.type
|
||||
const username = userInfo.username.trim()
|
||||
const password = userInfo.password
|
||||
return new Promise((resolve, reject) => {
|
||||
socialBindLogin(type, code, state, username, password).then(res => {
|
||||
res = res.data;
|
||||
// 设置 token
|
||||
setToken(res)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 登录
|
||||
// 短信登录
|
||||
SmsLogin({ commit }, userInfo) {
|
||||
const mobile = userInfo.mobile.trim()
|
||||
const mobileCode = userInfo.mobileCode
|
||||
|
Reference in New Issue
Block a user