thirdParty.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <el-table :data="auths" style="width: 100%; height: 100%; font-size: 10px">
  4. <el-table-column label="序号" width="50" type="index"></el-table-column>
  5. <el-table-column label="绑定账号平台" width="140" align="center" prop="source" show-overflow-tooltip />
  6. <el-table-column label="头像" width="120" align="center" prop="avatar">
  7. <template v-slot="scope">
  8. <img :src="scope.row.avatar" style="width: 45px; height: 45px" />
  9. </template>
  10. </el-table-column>
  11. <el-table-column label="系统账号" width="180" align="center" prop="userName" :show-overflow-tooltip="true" />
  12. <el-table-column label="绑定时间" width="180" align="center" prop="createTime" />
  13. <el-table-column label="操作" width="80" align="center" class-name="small-padding fixed-width">
  14. <template v-slot="scope">
  15. <el-button size="small" type="text" @click="unlockAuth(scope.row)">解绑</el-button>
  16. </template>
  17. </el-table-column>
  18. </el-table>
  19. <div id="git-user-binding">
  20. <h4 class="provider-desc">你可以绑定以下第三方帐号</h4>
  21. <div id="authlist" class="user-bind">
  22. <a class="third-app" href="#" @click="authUrl('gitee');" title="使用 Gitee 账号授权登录">
  23. <div class="git-other-login-icon">
  24. <svg-icon icon-class="gitee" />
  25. </div>
  26. <span class="app-name">Gitee</span>
  27. </a>
  28. <a class="third-app" href="#" @click="authUrl('github');" title="使用 GitHub 账号授权登录">
  29. <div class="git-other-login-icon">
  30. <svg-icon icon-class="github" />
  31. </div>
  32. <span class="app-name">Github</span>
  33. </a>
  34. <a class="third-app" href="#" @click="authUrl('wechar');" title="使用 微信 账号授权登录">
  35. <div class="git-other-login-icon">
  36. <svg-icon icon-class="wechat" />
  37. </div>
  38. <span class="app-name">WeiXin</span>
  39. </a>
  40. <a class="third-app" href="#" @click="authUrl('qq');" title="使用 QQ 账号授权登录">
  41. <div class="git-other-login-icon">
  42. <svg-icon icon-class="qq" />
  43. </div>
  44. <span class="app-name">QQ</span>
  45. </a>
  46. </div>
  47. </div>
  48. </div>
  49. </template>
  50. <script lang="ts" setup>
  51. import { authUnlock, authBinding } from "@/api/system/social/auth";
  52. import { PropType } from "vue";
  53. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  54. const props = defineProps({
  55. auths: {
  56. type: Object as PropType<any>,
  57. }
  58. });
  59. const auths = computed(() => props.auths);
  60. const unlockAuth = (row: any) => {
  61. ElMessageBox.confirm('您确定要解除"' + row.source + '"的账号绑定吗?')
  62. .then(() => {
  63. return authUnlock(row.id);
  64. }).then((res: any) => {
  65. if (res.code === 200) {
  66. proxy?.$modal.msgSuccess("解绑成功");
  67. proxy?.$tab.refreshPage();
  68. } else {
  69. proxy?.$modal.msgError(res.msg);
  70. }
  71. }).catch(() => { });
  72. };
  73. const authUrl = (source: string) => {
  74. authBinding(source).then((res: any) => {
  75. if (res.code === 200) {
  76. window.location.href = res.data;
  77. } else {
  78. proxy?.$modal.msgError(res.msg);
  79. }
  80. });
  81. };
  82. </script>
  83. <style type="text/css">
  84. .user-bind .third-app {
  85. display: -webkit-box;
  86. display: -ms-flexbox;
  87. display: flex;
  88. -webkit-box-orient: vertical;
  89. -webkit-box-direction: normal;
  90. -ms-flex-direction: column;
  91. flex-direction: column;
  92. -webkit-box-align: center;
  93. -ms-flex-align: center;
  94. align-items: center;
  95. min-width: 80px;
  96. float: left;
  97. }
  98. .user-bind {
  99. font-size: 1rem;
  100. text-align: start;
  101. height: 50px;
  102. margin-top: 10px;
  103. }
  104. .git-other-login-icon>img {
  105. height: 32px;
  106. }
  107. a {
  108. text-decoration: none;
  109. cursor: pointer;
  110. color: #005980;
  111. }
  112. .provider-desc {
  113. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
  114. "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Liberation Sans",
  115. "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Wenquanyi Micro Hei",
  116. "WenQuanYi Zen Hei", "ST Heiti", SimHei, SimSun, "WenQuanYi Zen Hei Sharp",
  117. sans-serif;
  118. font-size: 1.071rem;
  119. }
  120. td>img {
  121. height: 20px;
  122. width: 20px;
  123. display: inline-block;
  124. border-radius: 50%;
  125. margin-right: 5px;
  126. }
  127. </style>