perf:区分第三方授权参数
This commit is contained in:
@@ -10,6 +10,7 @@ import { authOtherLogin, authOtherBind } from "@/apis/auth.js";
|
||||
const route = useRoute();
|
||||
|
||||
const code = ref(route.query.code);
|
||||
const type = ref(route.query.state);
|
||||
|
||||
const message = ref("");
|
||||
watch(
|
||||
@@ -20,8 +21,13 @@ watch(
|
||||
const regex = /\/auth\/([\w-]+)[?]?/;
|
||||
const result = regex.exec(route.fullPath);
|
||||
const authParam = result != null ? result[1].toUpperCase() : null;
|
||||
const res = await authOtherBind({ code: val }, authParam);
|
||||
console.log(res, "res");
|
||||
if (type.value === 0) {
|
||||
const res = await authOtherLogin({ code: val }, authParam);
|
||||
console.log(res, "type.value === 0");
|
||||
} else if (type.value === 1) {
|
||||
const res = await authOtherBind({ code: val }, authParam);
|
||||
console.log(res, "type.value === 1");
|
||||
}
|
||||
message.value = "授权成功";
|
||||
// window.close();
|
||||
}
|
||||
|
||||
@@ -140,10 +140,10 @@
|
||||
</div>
|
||||
<div class="icon-list">
|
||||
<div class="icon" @click="handleQQLogin">
|
||||
<img src="@/assets/login_images/QQ.png" alt="" />
|
||||
<img src="@/assets/login_images/qq-setting.png" alt="" />
|
||||
</div>
|
||||
<div class="icon">
|
||||
<img src="@/assets/login_images/WeChat.png" alt="" />
|
||||
<div class="icon" @click="handleGiteeLogin">
|
||||
<img src="@/assets/login_images/gitee-setting.png" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -305,7 +305,15 @@ const handleContact = () => {
|
||||
|
||||
const handleQQLogin = () => {
|
||||
window.open(
|
||||
"https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=true&scope=get_user_info",
|
||||
"https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=0&scope=get_user_info",
|
||||
undefined,
|
||||
"width=500,height=500,left=50,top=50"
|
||||
);
|
||||
};
|
||||
|
||||
const handleGiteeLogin = () => {
|
||||
window.open(
|
||||
"https://gitee.com/oauth/authorize?client_id=949f3519969adc5cfe82c209b71300e8e0868e8536f3d7f59195c8f1e5b72502&redirect_uri=https%3A%2F%2Fccnetcore.com%2Fauth%2Fgitee&state=0&response_type=code",
|
||||
undefined,
|
||||
"width=500,height=500,left=50,top=50"
|
||||
);
|
||||
|
||||
@@ -92,7 +92,7 @@ onMounted(async () => {
|
||||
|
||||
const handleQQLogin = () => {
|
||||
window.open(
|
||||
"https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=true&scope=get_user_info",
|
||||
"https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=1&scope=get_user_info",
|
||||
undefined,
|
||||
"width=500,height=500,left=50,top=50"
|
||||
);
|
||||
@@ -100,7 +100,7 @@ const handleQQLogin = () => {
|
||||
|
||||
const handleGiteeLogin = () => {
|
||||
window.open(
|
||||
"https://gitee.com/oauth/authorize?client_id=949f3519969adc5cfe82c209b71300e8e0868e8536f3d7f59195c8f1e5b72502&redirect_uri=https%3A%2F%2Fccnetcore.com%2Fauth%2Fgitee&response_type=code",
|
||||
"https://gitee.com/oauth/authorize?client_id=949f3519969adc5cfe82c209b71300e8e0868e8536f3d7f59195c8f1e5b72502&redirect_uri=https%3A%2F%2Fccnetcore.com%2Fauth%2Fgitee&state=1&response_type=code",
|
||||
undefined,
|
||||
"width=500,height=500,left=50,top=50"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user