添加facebook登录方式,修改部分逻辑

This commit is contained in:
junleea 2025-05-01 13:30:44 +08:00
parent bf7d9b02d3
commit 34163edd8b
2 changed files with 18 additions and 11 deletions

View File

@ -134,12 +134,16 @@ const thirdPartyLogoInfoList = ref([
},
{
name: "qq",
logo: "https://wiki.connect.qq.com/wp-content/uploads/2016/12/Connect_logo_4.png",
logo: "https://wiki.connect.qq.com/wp-content/uploads/2016/12/Connect_logo_7.png",
},
{
name: "google",
logo: "https://www.ljsea.top/wp-content/uploads/2025/04/google-logo_resized.png",
},
{
name: "facebook",
logo: "https://www.ljsea.top/wp-content/uploads/2025/05/icons8-facebook.png",
}
]);
@ -155,6 +159,7 @@ const thirdPartyPlatform = ref([
{ label: 'Github', value: 'github' },
{ label: 'Gitee', value: 'gitee' },
{ label: 'Google', value: 'google' },
{ label: 'Facebook', value: 'facebook'}
]);
const thirdLogin = async (type) => {
@ -171,15 +176,12 @@ const thirdLogin = async (type) => {
}
let result={};
//
for(let i = 0; i < thirdPartyPlatform.value.length; i++) {
if (thirdPartyPlatform.value[i].value === type) {
break;
}
if (i === thirdPartyPlatform.value.length - 1) {
ElMessage.error("不支持的登录平台!请稍后再试:"+type);
return;
}
}
// for(let i = 0; i < thirdPartyLogoInfoList.value.length; i++) {
// if(thirdPartyLogoInfoList.value[i].name === type) {
// result = thirdPartyLogoInfoList.value[i];
// break;
// }
// }
result = await getThirdPartyLoginUrl({uuid: uuid,"type": "login", "platform": type });
if (result["code"] !== 0) {
ElMessage.error("获取登录地址失败!请稍后再试");
@ -323,7 +325,7 @@ const getMyUserInfo = async (id) => {
}
.login-container {
width: 450px;
width: 470px;
border-radius: 5px;
background: #fff;
padding: 40px 50px 50px;
@ -345,6 +347,9 @@ const getMyUserInfo = async (id) => {
.login-btn {
display: block;
/* 文字水平竖直居中 */
text-align: center;
width: 100%;
}

View File

@ -168,6 +168,7 @@ const thirdPartyPlatform = ref([
{ label: 'Github', value: 'github' },
{ label: 'Gitee', value: 'gitee' },
{ label: 'Google', value: 'google' },
{ label: 'Facebook', value: 'facebook'}
]);
@ -447,6 +448,7 @@ const thirdLogin = async (type) => {
localStorage.setItem("username", status["username"]);
let now = new Date();
localStorage.setItem("end_time", (now.setDate(now.getHours() + 12)).toString()); //
getThirdPartyUserInfo();
return;
}
}, 2000);