|
|
@ -147,9 +147,33 @@ definePageMeta({
|
|
|
|
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
const route = useRoute()
|
|
|
|
const isValid = ref(oaer.isValid())
|
|
|
|
const isValid = ref(oaer.isValid())
|
|
|
|
|
|
|
|
const uuid = ref(route.query.uuid as string)
|
|
|
|
const app = ref<models.App>({} as models.App)
|
|
|
|
const app = ref<models.App>({} as models.App)
|
|
|
|
const app_perm = ref<{ [key: string]: [boolean, string, number] }>({ 'fs': [true, '/', 4], 'app': [true, '', 1], 'user': [true, '', 1] })
|
|
|
|
const app_perm = ref<{ [key: string]: [boolean, string, number] }>({ 'fs': [true, '/', 4], 'app': [true, '', 1], 'user': [true, '', 1] })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto_redirect = () => {
|
|
|
|
|
|
|
|
if (isValid.value) {
|
|
|
|
|
|
|
|
if (uuid.value) {
|
|
|
|
|
|
|
|
api.app.Get(uuid.value).then(e => {
|
|
|
|
|
|
|
|
app.value = e
|
|
|
|
|
|
|
|
console.log(oaer.local())
|
|
|
|
|
|
|
|
api.token.List({ limit: 1, app_id: uuid.value, user_id: oaer.local().id }).then(e => {
|
|
|
|
|
|
|
|
console.log(e)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
|
|
if (e.code === 40401) {
|
|
|
|
|
|
|
|
msg.Warn('参数错误: 该应用不存在')
|
|
|
|
|
|
|
|
uuid.value = ''
|
|
|
|
|
|
|
|
redirect()
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.warn(e)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
redirect()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let data = ref({
|
|
|
|
let data = ref({
|
|
|
|
username: '',
|
|
|
|
username: '',
|
|
|
@ -204,7 +228,9 @@ const signin = () => {
|
|
|
|
salt.toString()
|
|
|
|
salt.toString()
|
|
|
|
}).then(e => {
|
|
|
|
}).then(e => {
|
|
|
|
oaer.init('', '', e).then(() => {
|
|
|
|
oaer.init('', '', e).then(() => {
|
|
|
|
redirect("")
|
|
|
|
isValid.value = true
|
|
|
|
|
|
|
|
auto_redirect()
|
|
|
|
|
|
|
|
// redirect("")
|
|
|
|
}).catch((e) => {
|
|
|
|
}).catch((e) => {
|
|
|
|
console.warn(e)
|
|
|
|
console.warn(e)
|
|
|
|
msg.Warn('登录失败:' + (e?.err || e))
|
|
|
|
msg.Warn('登录失败:' + (e?.err || e))
|
|
|
@ -254,10 +280,9 @@ function redirect(url?: string) {
|
|
|
|
if (route.query.redirect) {
|
|
|
|
if (route.query.redirect) {
|
|
|
|
url = route.query.redirect as string
|
|
|
|
url = route.query.redirect as string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let uuid = route.query.uuid as string
|
|
|
|
if (uuid.value) {
|
|
|
|
if (uuid) {
|
|
|
|
api.app.Get(uuid.value).then((app) => {
|
|
|
|
oaer.api().app.Get(uuid as string).then((app) => {
|
|
|
|
if (uuid.value === oaer.logic().oa_id) {
|
|
|
|
if (uuid === oaer.logic().oa_id) {
|
|
|
|
|
|
|
|
oaer.goto(url || app.init_url || '/')
|
|
|
|
oaer.goto(url || app.init_url || '/')
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
let perm = []
|
|
|
|
let perm = []
|
|
|
@ -271,9 +296,9 @@ function redirect(url?: string) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oaer.api().token.Post({
|
|
|
|
api.token.Post({
|
|
|
|
refresh: oaer.logic().token.refresh.raw(),
|
|
|
|
refresh: oaer.logic().token.refresh.raw(),
|
|
|
|
app_id: uuid,
|
|
|
|
app_id: uuid.value,
|
|
|
|
over_perm: JSON.stringify(perm)
|
|
|
|
over_perm: JSON.stringify(perm)
|
|
|
|
}).then(e => {
|
|
|
|
}).then(e => {
|
|
|
|
url = url || app.init_url
|
|
|
|
url = url || app.init_url
|
|
|
@ -295,19 +320,7 @@ function redirect(url?: string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
let uuid = route.query.uuid as string
|
|
|
|
auto_redirect()
|
|
|
|
if (isValid.value && uuid) {
|
|
|
|
|
|
|
|
oaer.api().app.Get(uuid).then(e => {
|
|
|
|
|
|
|
|
app.value = e
|
|
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
|
|
if (e.code === 40401) {
|
|
|
|
|
|
|
|
msg.Warn('参数错误: 该应用不存在')
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.warn(e)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|