lilishop-uniapp/api/connect.js

62 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2021-05-13 11:03:32 +08:00
/**
* 信任登录相关API
*/
import {
http,
Method
} from '@/utils/request.js';
const request = http.request;
/**
* web 第三方登录
* @param {Object} code
*/
export function webConnect(code) {
return http.request({
2022-02-14 18:23:00 +08:00
url: `passport/connect/connect/login/web/${code}`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
needToken: true,
header: {
"clientType": "H5"
}
});
}
export function openIdLogin(params, clientType) {
return http.request({
2022-02-14 18:23:00 +08:00
url: `passport/connect/connect/app/login`,
method: Method.POST,
2021-05-13 11:03:32 +08:00
needToken: true,
data: params,
header: {
"clientType": clientType
}
});
}
/**
* 第三方登录成功 回调接口
*/
export function loginCallback(state) {
return http.request({
2022-02-14 18:23:00 +08:00
url: `passport/connect/connect/result?state=${state}`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
needToken: false
});
}
/**
* 小程序自动登录
* @param params
*/
export function mpAutoLogin(params) {
return http.request({
2022-02-14 18:33:23 +08:00
url: 'passport/connect/miniProgram/auto-login',
2021-05-13 11:03:32 +08:00
method: Method.GET,
params
});
}