mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-30 18:00:56 +01:00
* 增加Docker开发环境
* 更新Dockerfile构建文件,升级NodeJS依赖版本。 * 遵循ESLint重新格式化代码,修复部分警告 * 登录Token失效增加登出提示 * 网络请求问题增加错误错误提示 * 升级UI依赖库
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
<template>
|
||||
<el-tree
|
||||
:data="docData"
|
||||
ref="documentation-tree"
|
||||
:data="docData"
|
||||
node-key="fullUrl"
|
||||
>
|
||||
<span class="custom-tree-node" :class="[data.active ? 'active' : '', `level-${data.level}`]"
|
||||
slot-scope="{ node, data }">
|
||||
<span
|
||||
slot-scope="{ node, data }"
|
||||
class="custom-tree-node"
|
||||
:class="[data.active ? 'active' : '', `level-${data.level}`]"
|
||||
>
|
||||
<template v-if="data.level === 1 && data.children && data.children.length">
|
||||
<span>{{node.label}}</span>
|
||||
<span>{{ node.label }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>
|
||||
<a :href="data.fullUrl" target="_blank" style="display: block" @click="onClickDocumentationLink">
|
||||
{{node.label}}
|
||||
{{ node.label }}
|
||||
</a>
|
||||
</span>
|
||||
</template>
|
||||
@@ -21,86 +24,86 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex'
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Documentation',
|
||||
data () {
|
||||
return {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState('doc', [
|
||||
'docData'
|
||||
]),
|
||||
pathLv1 () {
|
||||
if (this.$route.path === '/') return '/'
|
||||
const m = this.$route.path.match(/(^\/\w+)/)
|
||||
return m[1]
|
||||
},
|
||||
currentDoc () {
|
||||
// find current doc
|
||||
let currentDoc
|
||||
for (let i = 0; i < this.$utils.doc.docs.length; i++) {
|
||||
const doc = this.$utils.doc.docs[i]
|
||||
if (this.pathLv1 === doc.path) {
|
||||
currentDoc = doc
|
||||
break
|
||||
}
|
||||
export default {
|
||||
name: 'Documentation',
|
||||
data() {
|
||||
return {
|
||||
data: []
|
||||
}
|
||||
return currentDoc
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pathLv1 () {
|
||||
},
|
||||
computed: {
|
||||
...mapState('doc', [
|
||||
'docData'
|
||||
]),
|
||||
pathLv1() {
|
||||
if (this.$route.path === '/') return '/'
|
||||
const m = this.$route.path.match(/(^\/\w+)/)
|
||||
return m[1]
|
||||
},
|
||||
currentDoc() {
|
||||
// find current doc
|
||||
let currentDoc
|
||||
for (let i = 0; i < this.$utils.doc.docs.length; i++) {
|
||||
const doc = this.$utils.doc.docs[i]
|
||||
if (this.pathLv1 === doc.path) {
|
||||
currentDoc = doc
|
||||
break
|
||||
}
|
||||
}
|
||||
return currentDoc
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pathLv1() {
|
||||
this.update()
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
},
|
||||
mounted() {
|
||||
this.update()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isActiveNode (d) {
|
||||
// check match
|
||||
if (!this.currentDoc) return false
|
||||
return !!d.url.match(this.currentDoc.pattern)
|
||||
},
|
||||
update () {
|
||||
// expand related documentation list
|
||||
setTimeout(() => {
|
||||
this.docData.forEach(d => {
|
||||
// parent node
|
||||
const isActive = this.isActiveNode(d)
|
||||
const node = this.$refs['documentation-tree'].getNode(d)
|
||||
node.expanded = isActive
|
||||
this.$set(d, 'active', isActive)
|
||||
methods: {
|
||||
isActiveNode(d) {
|
||||
// check match
|
||||
if (!this.currentDoc) return false
|
||||
return !!d.url.match(this.currentDoc.pattern)
|
||||
},
|
||||
update() {
|
||||
// expand related documentation list
|
||||
setTimeout(() => {
|
||||
this.docData.forEach(d => {
|
||||
// parent node
|
||||
const isActive = this.isActiveNode(d)
|
||||
const node = this.$refs['documentation-tree'].getNode(d)
|
||||
node.expanded = isActive
|
||||
this.$set(d, 'active', isActive)
|
||||
|
||||
// child nodes
|
||||
d.children.forEach(c => {
|
||||
const node = this.$refs['documentation-tree'].getNode(c)
|
||||
const isActive = this.isActiveNode(c)
|
||||
if (!node.parent.expanded && isActive) {
|
||||
node.parent.expanded = true
|
||||
}
|
||||
this.$set(c, 'active', isActive)
|
||||
// child nodes
|
||||
d.children.forEach(c => {
|
||||
const node = this.$refs['documentation-tree'].getNode(c)
|
||||
const isActive = this.isActiveNode(c)
|
||||
if (!node.parent.expanded && isActive) {
|
||||
node.parent.expanded = true
|
||||
}
|
||||
this.$set(c, 'active', isActive)
|
||||
})
|
||||
})
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
async getDocumentationData () {
|
||||
// fetch api data
|
||||
await this.$store.dispatch('doc/getDocData')
|
||||
},
|
||||
onClickDocumentationLink () {
|
||||
this.$st.sendEv('全局', '点击右侧文档链接')
|
||||
}, 100)
|
||||
},
|
||||
async getDocumentationData() {
|
||||
// fetch api data
|
||||
await this.$store.dispatch('doc/getDocData')
|
||||
},
|
||||
onClickDocumentationLink() {
|
||||
this.$st.sendEv('全局', '点击右侧文档链接')
|
||||
}
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
},
|
||||
mounted () {
|
||||
this.update()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-tree >>> .custom-tree-node.active {
|
||||
|
||||
Reference in New Issue
Block a user