改进 登录
This commit is contained in:
parent
9a8f75d6d0
commit
e1db06b126
@ -48,8 +48,8 @@ const drawer = ref(false);
|
||||
|
||||
const items = [
|
||||
{ icon: "mdi-home", text: "首页", to: { name: "home" } },
|
||||
{ icon: "mdi-home", text: "资料库", to: { name: "libraries" } },
|
||||
{ icon: "mdi-content-copy", text: "资料库", to: { name: "libraries" } },
|
||||
// { icon: "mdi-history", text: "Frequently contacted", to: "/documents" },
|
||||
{ icon: "mdi-content-copy", text: "login", to: "/auth/login" },
|
||||
{ icon: "mdi-account", text: "登录", to: { name: "login" } },
|
||||
];
|
||||
</script>
|
||||
|
@ -12,20 +12,24 @@
|
||||
<div>
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
v-if="status == 0 || status == 3"
|
||||
v-if="status == 0 || status == 3 || status == 1"
|
||||
></v-progress-circular>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<div v-if="status == 0">
|
||||
<p>请稍后...</p>
|
||||
<p>正在请求账户服务器...</p>
|
||||
</div>
|
||||
<div v-if="status == 1">
|
||||
<p>前往授权页面。</p>
|
||||
</div>
|
||||
<div v-if="status == 2">
|
||||
<p>验证失败。</p>
|
||||
<v-icon color="red">mdi-alert</v-icon>
|
||||
<p>创建 Auth Requests 时出现了问题。</p>
|
||||
|
||||
<v-btn @click="restart" class="mt-3">重试</v-btn>
|
||||
</div>
|
||||
<div v-if="status == 3">
|
||||
<p>正在验证...</p>
|
||||
<p>正在获取 Token</p>
|
||||
</div>
|
||||
<div v-if="status == 4">
|
||||
<p>验证失败。</p>
|
||||
@ -59,8 +63,6 @@ const restart = () => {
|
||||
const query = router.currentRoute.value.query;
|
||||
|
||||
const login = () => {
|
||||
status.value = 1;
|
||||
|
||||
// clear url
|
||||
window.history.replaceState(null, "", window.location.pathname);
|
||||
|
||||
@ -71,13 +73,16 @@ const login = () => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.url) {
|
||||
status.value = 1;
|
||||
|
||||
window.location.href = res.data.url;
|
||||
}
|
||||
|
||||
console.log(res.data);
|
||||
// console.log(status.value)
|
||||
// console.log(res.data);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
status.value = 2;
|
||||
});
|
||||
};
|
||||
@ -93,8 +98,8 @@ const validate = () => {
|
||||
if (res.data.refresh_token && res.data.token) {
|
||||
userStore.login(res.data.refresh_token, res.data.token);
|
||||
|
||||
userStore.setExpired(res.data.expires_in)
|
||||
console.log(userStore.expired_at)
|
||||
userStore.setExpired(res.data.expires_in);
|
||||
console.log(userStore.expired_at);
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = "/";
|
||||
|
Loading…
Reference in New Issue
Block a user