2024-09-19 10:46:07 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="oauth">
|
|
|
|
|
<el-card class="card">
|
2024-09-25 22:24:16 +08:00
|
|
|
<h2>{{ T('OauthLogining') }}</h2>
|
2024-09-19 10:46:07 +08:00
|
|
|
<el-form class="info" label-width="100px">
|
2024-09-25 22:24:16 +08:00
|
|
|
<el-form-item :label="T('Device')">
|
2024-09-19 10:46:07 +08:00
|
|
|
<div class="impt">{{ oauthInfo.device_name }}</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="ID">
|
|
|
|
|
<div class="impt">{{ oauthInfo.id }}</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label-width="0">
|
2024-09-25 22:24:16 +08:00
|
|
|
<el-button style="width: 100%" v-if="!resStatus" type="success" size="large" @click="toConfirm">{{ T('ConfirmOauth') }}</el-button>
|
2024-09-19 10:46:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label-width="0">
|
2024-09-25 22:24:16 +08:00
|
|
|
<el-button style="width: 100%" size="large" @click="out">{{ T('Close') }}</el-button>
|
2024-09-19 10:46:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
2024-09-25 22:24:16 +08:00
|
|
|
{{ T('OauthCloseNote') }}
|
2024-09-19 10:46:07 +08:00
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
|
|
import { info, confirm } from '@/api/oauth'
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
|
|
|
|
|
const oauthInfo = ref({})
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const code = route.params?.code
|
|
|
|
|
if (!code) {
|
|
|
|
|
// router.push('/')
|
|
|
|
|
}
|
|
|
|
|
const getInfo = async () => {
|
|
|
|
|
const res = await info({ code }).catch(_ => false)
|
|
|
|
|
if (res) {
|
|
|
|
|
oauthInfo.value = res.data
|
|
|
|
|
} else {
|
|
|
|
|
// router.push('/')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getInfo()
|
|
|
|
|
const resStatus = ref(0)
|
|
|
|
|
const toConfirm = async () => {
|
|
|
|
|
const res = await confirm({ code }).catch(_ => false)
|
|
|
|
|
if (res) {
|
|
|
|
|
resStatus.value = 1
|
2024-09-25 22:24:16 +08:00
|
|
|
ElMessage.success(T('OperationSuccessAndCloseAfter3Seconds'))
|
2024-09-19 10:46:07 +08:00
|
|
|
setTimeout(_ => {
|
|
|
|
|
out()
|
|
|
|
|
}, 3000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const out = () => {
|
|
|
|
|
window.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.oauth {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
background-color: #2d3a4b;
|
|
|
|
|
padding-top: 25vh;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
.card {
|
|
|
|
|
max-width: 500px;
|
|
|
|
|
background-color: #283342;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border: none;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
.info {
|
|
|
|
|
display: block;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
margin-bottom: 50px;
|
|
|
|
|
|
|
|
|
|
::v-deep(.el-form-item__label) {
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.impt {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|