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