xbx #200

Merged
theluyuan merged 2 commits from xbx into master 2020-12-01 09:12:14 +08:00
2 changed files with 15 additions and 2 deletions
Showing only changes of commit d84e671823 - Show all commits

View File

@ -1203,3 +1203,12 @@ export async function authLogin(id:number, type: number, img: string = "") {
message.error(res.msg); message.error(res.msg);
} }
} }
export async function accessToken(code:string) {
const res = await get("accessToken", {code})
if(res.code == 0){
return res.data
}else{
message.error(res.msg);
}
}

View File

@ -5,6 +5,7 @@
</style> </style>
<script lang="ts"> <script lang="ts">
import { accessToken } from "@/api";
import axios from "axios"; import axios from "axios";
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
@ -12,8 +13,11 @@ import { useRoute } from "vue-router";
export default defineComponent(({ export default defineComponent(({
setup(){ setup(){
const code = useRoute().query.code; const code: any = useRoute().query.code;
window.location.href=`https://api.weibo.com/oauth2/access_token?client_id=2754574056&client_secret=2f16267634db2de14cda7891c49aa54a&grant_type=authorization_code&redirect_uri=https://beelink.theluyuan.com/wblogin&code=${code}` accessToken(code).then((res)=>{
console.log(res)
})
// window.location.href=`https://api.weibo.com/oauth2/access_token?client_id=2754574056&client_secret=2f16267634db2de14cda7891c49aa54a&grant_type=authorization_code&redirect_uri=https://beelink.theluyuan.com/wblogin&code=${code}`
} }
})) }))
</script> </script>