2023-06-20 04:12:49 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2024-05-11 20:00:53 +08:00
|
|
|
<el-table :data="auths" style="width: 100%; height: 100%; font-size: 14px">
|
|
|
|
<el-table-column label="序号" width="50" type="index" />
|
2023-06-20 04:12:49 +00:00
|
|
|
<el-table-column label="绑定账号平台" width="140" align="center" prop="source" show-overflow-tooltip />
|
|
|
|
<el-table-column label="头像" width="120" align="center" prop="avatar">
|
2023-12-13 01:01:52 +00:00
|
|
|
<template #default="scope">
|
2023-06-20 04:12:49 +00:00
|
|
|
<img :src="scope.row.avatar" style="width: 45px; height: 45px" />
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="系统账号" width="180" align="center" prop="userName" :show-overflow-tooltip="true" />
|
|
|
|
<el-table-column label="绑定时间" width="180" align="center" prop="createTime" />
|
|
|
|
<el-table-column label="操作" width="80" align="center" class-name="small-padding fixed-width">
|
2023-12-13 01:01:52 +00:00
|
|
|
<template #default="scope">
|
2023-06-20 04:12:49 +00:00
|
|
|
<el-button size="small" type="text" @click="unlockAuth(scope.row)">解绑</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<div id="git-user-binding">
|
|
|
|
<h4 class="provider-desc">你可以绑定以下第三方帐号</h4>
|
|
|
|
<div id="authlist" class="user-bind">
|
2023-12-13 01:01:52 +00:00
|
|
|
<a class="third-app" href="#" title="使用 微信 账号授权登录" @click="authUrl('wechat')">
|
2023-06-20 04:12:49 +00:00
|
|
|
<div class="git-other-login-icon">
|
2023-07-13 15:38:32 +08:00
|
|
|
<svg-icon icon-class="wechat" />
|
2023-06-20 04:12:49 +00:00
|
|
|
</div>
|
2023-07-13 15:38:32 +08:00
|
|
|
<span class="app-name">WeiXin</span>
|
2023-06-20 04:12:49 +00:00
|
|
|
</a>
|
2023-12-13 01:01:52 +00:00
|
|
|
<a class="third-app" href="#" title="使用 MaxKey 账号授权登录" @click="authUrl('maxkey')">
|
2023-06-20 04:12:49 +00:00
|
|
|
<div class="git-other-login-icon">
|
2023-07-13 15:38:32 +08:00
|
|
|
<svg-icon icon-class="maxkey" />
|
2023-06-20 04:12:49 +00:00
|
|
|
</div>
|
2023-07-13 15:38:32 +08:00
|
|
|
<span class="app-name">MaxKey</span>
|
2023-06-20 04:12:49 +00:00
|
|
|
</a>
|
2024-01-08 11:48:56 +08:00
|
|
|
<a class="third-app" href="#" title="使用 TopIam 账号授权登录" @click="authUrl('topiam')">
|
|
|
|
<div class="git-other-login-icon">
|
|
|
|
<svg-icon icon-class="topiam" />
|
|
|
|
</div>
|
|
|
|
<span class="app-name">TopIam</span>
|
|
|
|
</a>
|
2023-12-13 01:01:52 +00:00
|
|
|
<a class="third-app" href="#" title="使用 Gitee 账号授权登录" @click="authUrl('gitee')">
|
2023-06-20 04:12:49 +00:00
|
|
|
<div class="git-other-login-icon">
|
2023-07-13 15:38:32 +08:00
|
|
|
<svg-icon icon-class="gitee" />
|
2023-06-20 04:12:49 +00:00
|
|
|
</div>
|
2023-07-13 15:38:32 +08:00
|
|
|
<span class="app-name">Gitee</span>
|
2023-06-20 04:12:49 +00:00
|
|
|
</a>
|
2023-12-13 01:01:52 +00:00
|
|
|
<a class="third-app" href="#" title="使用 GitHub 账号授权登录" @click="authUrl('github')">
|
2023-06-20 04:12:49 +00:00
|
|
|
<div class="git-other-login-icon">
|
2023-07-13 15:38:32 +08:00
|
|
|
<svg-icon icon-class="github" />
|
2023-06-20 04:12:49 +00:00
|
|
|
</div>
|
2023-07-13 15:38:32 +08:00
|
|
|
<span class="app-name">Github</span>
|
2023-06-20 04:12:49 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-12-13 01:01:52 +00:00
|
|
|
import { authUnlock, authBinding } from '@/api/system/social/auth';
|
2023-12-14 08:17:12 +00:00
|
|
|
import { propTypes } from '@/utils/propTypes';
|
2024-06-28 10:18:18 +08:00
|
|
|
import useUserStore from '@/store/modules/user';
|
2023-06-20 04:12:49 +00:00
|
|
|
|
2023-07-12 10:48:33 +08:00
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
2023-06-20 04:12:49 +00:00
|
|
|
const props = defineProps({
|
2023-12-14 08:17:12 +00:00
|
|
|
auths: propTypes.any.isRequired
|
2023-06-20 04:12:49 +00:00
|
|
|
});
|
|
|
|
const auths = computed(() => props.auths);
|
|
|
|
|
|
|
|
const unlockAuth = (row: any) => {
|
|
|
|
ElMessageBox.confirm('您确定要解除"' + row.source + '"的账号绑定吗?')
|
|
|
|
.then(() => {
|
|
|
|
return authUnlock(row.id);
|
2023-12-13 01:01:52 +00:00
|
|
|
})
|
|
|
|
.then((res: any) => {
|
2023-06-20 04:12:49 +00:00
|
|
|
if (res.code === 200) {
|
2023-12-13 01:01:52 +00:00
|
|
|
proxy?.$modal.msgSuccess('解绑成功');
|
2023-07-12 10:48:33 +08:00
|
|
|
proxy?.$tab.refreshPage();
|
2023-06-20 04:12:49 +00:00
|
|
|
} else {
|
2023-07-12 10:48:33 +08:00
|
|
|
proxy?.$modal.msgError(res.msg);
|
2023-06-20 04:12:49 +00:00
|
|
|
}
|
2023-12-13 01:01:52 +00:00
|
|
|
})
|
|
|
|
.catch(() => {});
|
2023-06-20 04:12:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const authUrl = (source: string) => {
|
2024-06-19 14:29:44 +08:00
|
|
|
authBinding(source, useUserStore().tenantId).then((res: any) => {
|
2023-06-20 04:12:49 +00:00
|
|
|
if (res.code === 200) {
|
2024-06-19 14:29:44 +08:00
|
|
|
window.location.href = res.data;
|
2023-06-20 04:12:49 +00:00
|
|
|
} else {
|
2023-07-12 10:48:33 +08:00
|
|
|
proxy?.$modal.msgError(res.msg);
|
2023-06-20 04:12:49 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
.user-bind .third-app {
|
|
|
|
display: -webkit-box;
|
|
|
|
display: -ms-flexbox;
|
|
|
|
display: flex;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
-webkit-box-direction: normal;
|
|
|
|
-ms-flex-direction: column;
|
|
|
|
flex-direction: column;
|
|
|
|
-webkit-box-align: center;
|
|
|
|
-ms-flex-align: center;
|
|
|
|
align-items: center;
|
|
|
|
min-width: 80px;
|
|
|
|
float: left;
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-bind {
|
|
|
|
font-size: 1rem;
|
|
|
|
text-align: start;
|
|
|
|
height: 50px;
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
|
2023-12-13 01:01:52 +00:00
|
|
|
.git-other-login-icon > img {
|
2023-06-20 04:12:49 +00:00
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
text-decoration: none;
|
|
|
|
cursor: pointer;
|
|
|
|
color: #005980;
|
|
|
|
}
|
|
|
|
|
|
|
|
.provider-desc {
|
2023-12-13 01:01:52 +00:00
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
|
|
'Liberation Sans', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Wenquanyi Micro Hei', 'WenQuanYi Zen Hei', 'ST Heiti', SimHei, SimSun,
|
|
|
|
'WenQuanYi Zen Hei Sharp', sans-serif;
|
2023-06-20 04:12:49 +00:00
|
|
|
font-size: 1.071rem;
|
|
|
|
}
|
|
|
|
|
2023-12-13 01:01:52 +00:00
|
|
|
td > img {
|
2023-06-20 04:12:49 +00:00
|
|
|
height: 20px;
|
|
|
|
width: 20px;
|
|
|
|
display: inline-block;
|
|
|
|
border-radius: 50%;
|
|
|
|
margin-right: 5px;
|
|
|
|
}
|
|
|
|
</style>
|