diff --git a/src/api/user.js b/src/api/user.js index a2c0ccb..0de15ee 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -146,3 +146,31 @@ export function oauth() { method: 'get' }) } + +/** + * 获取 OAuth2 统一认证可选账号列表 + * @param {string} code - 授权码 + */ +export function getOAuth2Selection(code) { + return request({ + url: '/aiccs-api/oauth2/unified/selection', + method: 'get', + params: { code } + }) +} + +/** + * OAuth2 选择账号登录 + * @param {string} code - 授权码 + * @param {string|number} userId - 选择的用户ID + */ +export function selectOAuth2Login(code, userId) { + const params = new FormData() + params.append('code', code) + params.append('userId', userId) + return request({ + url: '/aiccs-api/oauth2/unified/select/login', + method: 'post', + data: params + }) +} diff --git a/src/router/index.js b/src/router/index.js index 911622c..04fb637 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -42,6 +42,15 @@ export const constantRoutes = [ title: '登录' } }, + { + path: '/oauth2', + component: () => import('@/views/oauth2/index'), + hidden: true, + meta: { + roles: ['guest'], + title: '账号选择' + } + }, { name: 'Maintain', path: '/maintain', diff --git a/src/views/oauth2/index.vue b/src/views/oauth2/index.vue new file mode 100644 index 0000000..00965b5 --- /dev/null +++ b/src/views/oauth2/index.vue @@ -0,0 +1,267 @@ + + + + +