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

View File

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