mirror of https://github.com/veypi/OneAuth.git
feat: oa fs doc
parent
655af2fcb1
commit
fe0f3b07d0
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* auth.ts
|
||||
* Copyright (C) 2024 veypi <i@veypi.com>
|
||||
* 2024-11-05 10:34
|
||||
* Distributed under terms of the GPL license.
|
||||
*/
|
||||
import oaer from '@veypi/oaer'
|
||||
|
||||
oaer.on('logout', () => {
|
||||
let r = useRoute()
|
||||
console.log(r.path)
|
||||
if (r.path === now_auth && r.path !== '/') {
|
||||
oaer.goto('/')
|
||||
}
|
||||
})
|
||||
let now_auth = ''
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
console.log(to.path)
|
||||
if (!oaer.isValid() && to.path !== '/login') {
|
||||
return navigateTo('/login')
|
||||
}
|
||||
now_auth = to.path
|
||||
// if (to.params.id === '1') {
|
||||
// return abortNavigation()
|
||||
// }
|
||||
// 在实际应用中,你可能不会将每个路由重定向到 `/`
|
||||
// 但是在重定向之前检查 `to.path` 是很重要的,否则可能会导致无限重定向循环
|
||||
// if (to.path !== '/') {
|
||||
// return navigateTo('/')
|
||||
// }
|
||||
})
|
@ -0,0 +1,64 @@
|
||||
<!--
|
||||
* [...furl].vue
|
||||
* Copyright (C) 2024 veypi <i@veypi.com>
|
||||
* 2024-11-05 18:08
|
||||
* Distributed under terms of the GPL license.
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="w-full h-full">
|
||||
<!-- <h1 class="page-h1">文档中心</h1> -->
|
||||
<!-- <q-inner-loading :showing="!visible" label="Please wait..." label-class="text-teal" label-style="font-size: 1.1em" /> -->
|
||||
<div class="w-full px-8">
|
||||
<Editor v-if='doc' eid='doc' preview :content="doc"></Editor>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import msg from '@veypi/msg';
|
||||
import { fs } from '@veypi/oaer';
|
||||
let doc = ref('')
|
||||
|
||||
let route = useRoute()
|
||||
let router = useRouter()
|
||||
let typ = computed(() => route.params.typ)
|
||||
let furl = computed(() => {
|
||||
let f = route.params.furl
|
||||
if (typ.value === 'pub') {
|
||||
return '/doc/' + f
|
||||
}
|
||||
return f
|
||||
})
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
|
||||
|
||||
const render = (url: string) => {
|
||||
console.log(url)
|
||||
if (!url) {
|
||||
return
|
||||
}
|
||||
if (typ.value === 'pub') {
|
||||
fs.download(url).then(t => {
|
||||
doc.value = t
|
||||
visible.value = true
|
||||
}).catch(e => {
|
||||
console.warn(e)
|
||||
msg.Warn('访问文档地址不存在')
|
||||
router.back()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
watch(furl, (u, o) => {
|
||||
if (u && u !== o) {
|
||||
render(u as string)
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
@ -1,15 +1,66 @@
|
||||
<!--
|
||||
<!--
|
||||
* docs.vue
|
||||
* Copyright (C) 2024 veypi <i@veypi.com>
|
||||
* 2024-06-06 17:29
|
||||
* Distributed under terms of the MIT license.
|
||||
-->
|
||||
<template>
|
||||
<div>docs</div>
|
||||
<div>
|
||||
<h1 class="page-h1">文档中心</h1>
|
||||
<div class="mx-8 mt-10">
|
||||
<template v-for="(doc, i) in Docs" :key="i">
|
||||
<div class="mb-10">
|
||||
<div class="text-xl flex items-center mb-4">
|
||||
<OneIcon class="mx-2" :name="doc.icon"></OneIcon>
|
||||
<span>{{ doc.name }}</span>
|
||||
</div>
|
||||
<div class="flex gap-8 ml-10">
|
||||
<template v-for="item in doc.items" :key="item.name">
|
||||
<div class="doc-item border-2 rounded-md px-4 py-2" clickable outline
|
||||
@click="$router.push('/doc_pub/' + item.url)" icon="bookmark">
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<UDivider class="mt-6" label="OR" size="sm" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { models } from '#imports';
|
||||
const Docs = ref<models.DocGroup[]>([
|
||||
{
|
||||
name: '用户',
|
||||
icon: 'team',
|
||||
items: [
|
||||
{ name: '用户注册授权过程', url: '' },
|
||||
{ name: '用户角色与权限', url: '' },
|
||||
{ name: 'api文档', url: '' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "应用",
|
||||
icon: 'apps',
|
||||
items: [
|
||||
{ name: '应用创建及基本设置', url: '' },
|
||||
{ name: '应用权限设置', url: '' },
|
||||
{ name: '应用对接oa流程', url: '' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "系统使用",
|
||||
icon: "setting",
|
||||
items: [
|
||||
{ name: "编辑器使用及语法", url: 'markdown.md' }
|
||||
]
|
||||
}
|
||||
])
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
<style scoped>
|
||||
.doc-item {}
|
||||
</style>
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue