Skip to content

Commit

Permalink
feat(OAuth2): 提供了Oauth2的配置和跳转
Browse files Browse the repository at this point in the history
  • Loading branch information
HammCn committed Aug 16, 2023
1 parent 3611612 commit ed8a936
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/AirConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export class AirConfig {
*/
static apiUrl = import.meta.env.VITE_APP_API_URL || '/api/'

/**
* # Oauth2的authorize地址
*/
static oauthUrl = import.meta.env.VITE_APP_OAUTH_URL || '/oauth2/authorize'

/**
* # 静态资源根路径
* ---
Expand Down
4 changes: 2 additions & 2 deletions ErrorPage.vue → view/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<script lang="ts" setup>
import { ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { AirConfig } from './config/AirConfig'
import { AirHttpStatus } from './enum/AirHttpStatus'
import { AirConfig } from '../config/AirConfig'
import { AirHttpStatus } from '../enum/AirHttpStatus'
const isLoading = ref(true)
const isError = ref(false)
Expand Down
30 changes: 30 additions & 0 deletions view/login.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<div
v-loading="isLoading"
class="air-login big-loading"
/>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { AirConfig } from '../config/AirConfig'
const isLoading = ref(true)
// eslint-disable-next-line no-restricted-globals
location.replace(`${AirConfig.oauthUrl}?appKey=${AirConfig.appKey}&redirectUri=${encodeURIComponent(`${location.origin}/callback`)}`)
</script>
<style lang="scss" scoped>
.air-login {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: white;
}
</style>

0 comments on commit ed8a936

Please sign in to comment.