diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Authentication/AuthService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Authentication/AuthService.cs index b1a91b9f..60c8fc75 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Authentication/AuthService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Authentication/AuthService.cs @@ -66,7 +66,7 @@ namespace Yi.Framework.Rbac.Application.Services.Authentication { (var openId, var name) = await GetOpenIdAndNameAsync(scheme); var userId = CurrentUser.Id; - var authEntityAny = await _repository.AnyAsync(x => x.OpenId == openId && x.AuthType == scheme); + var authEntityAny = await _repository.IsAnyAsync(x => x.OpenId == openId && x.AuthType == scheme); if (authEntityAny) { throw new UserFriendlyException("绑定失败,该第三方账号已被注册"); diff --git a/Yi.Bbs.Vue3/src/apis/auth.js b/Yi.Bbs.Vue3/src/apis/auth.js index 72066cdb..8d2ce5d2 100644 --- a/Yi.Bbs.Vue3/src/apis/auth.js +++ b/Yi.Bbs.Vue3/src/apis/auth.js @@ -115,3 +115,16 @@ export function getOtherAuthInfo(params) { params: params, }); } + +/** + * 删除第三方授权 + * @param {*} ids + * @returns + */ +export function delOtherAuth(ids) { + return request({ + url: `/auth`, + method: "delete", + params: { id: ids }, + }); +} diff --git a/Yi.Bbs.Vue3/src/views/Auth/index.vue b/Yi.Bbs.Vue3/src/views/Auth/index.vue index 77923230..82292cd6 100644 --- a/Yi.Bbs.Vue3/src/views/Auth/index.vue +++ b/Yi.Bbs.Vue3/src/views/Auth/index.vue @@ -13,6 +13,8 @@ const code = ref(route.query.code); const type = ref(route.query.state); const message = ref(""); +const scheme = ref(""); +const authData = ref(""); watch( () => code.value, async (val) => { @@ -20,15 +22,28 @@ watch( // 使用正则表达式提取路由参数 const regex = /\/auth\/([\w-]+)[?]?/; const result = regex.exec(route.fullPath); - const authParam = result != null ? result[1].toUpperCase() : null; - console.log(type.value, "类型"); - if (type.value === "0") { - const res = await authOtherLogin({ code: val }, authParam); - } else if (type.value === "1") { - const res = await authOtherBind({ code: val }, authParam); + const authParam = result != null ? result[1] : null; + switch (authParam) { + case "gitee": + scheme.value = "Gitee"; + break; + case "qq": + scheme.value = "QQ"; + break; } + if (type.value === "0") { + const { data } = await authOtherLogin({ code: val }, scheme.value); + authData.value = data; + } else if (type.value === "1") { + const { data } = await authOtherBind({ code: val }, scheme.value); + authData.value = data; + } + window.opener.postMessage({ + authData: JSON.stringify(authData.value), + type: scheme.value, + }); + console.log(authData.value, "我是打开的窗口页"); message.value = "授权成功"; - // window.close(); } }, { immediate: true } diff --git a/Yi.Bbs.Vue3/src/views/home/Index.vue b/Yi.Bbs.Vue3/src/views/home/Index.vue index b938fff7..3bea4a12 100644 --- a/Yi.Bbs.Vue3/src/views/home/Index.vue +++ b/Yi.Bbs.Vue3/src/views/home/Index.vue @@ -215,7 +215,7 @@ const isPointFinished = ref(false); const friendList = ref([]); const isFriendFinished = ref(false); const themeList = ref([]); -const isThemeFinished = ref([]); +const isThemeFinished = ref(false); const allDiscussList = ref([]); const isAllDiscussFinished = ref(false); const userAnalyseInfo = ref({}); diff --git a/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue b/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue index 8abe08d5..706a01f8 100644 --- a/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue +++ b/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue @@ -1,7 +1,7 @@