Commit 465eea8a authored by shj's avatar shj

[MOD] 가이드 홈 페이지 스타일 정리

- 좌측에 nav bar가 없을 경우에만 메인 섹션에 목차 로드
parent 48aae8f1
<template> <template>
<div> <div class="tree-container">
<div <div
v-for="(item, i) in items" v-for="(item, i) in items"
:key="`guide-${item.title}-${i}`" :key="`guide-${item.title}-${i}`"
...@@ -80,3 +80,9 @@ export default { ...@@ -80,3 +80,9 @@ export default {
}, },
} }
</script> </script>
<style lang="scss" scoped>
.tree-container {
width: 100%;
}
</style>
\ No newline at end of file
<template> <template>
<div class="guide-wrap-container"> <div class="guide-wrap-container">
<v-container class="guide-wrap"> <v-container class="guide-wrap">
<v-row no-gutters align="center" justify="center" class="guide-wrap-header"> <v-row no-gutters align="center" justify="center" class="guide-wrap-header">
<h1 class="font-weight-bold">서비스 가이드</h1> <h1 class="font-weight-bold">서비스 가이드</h1>
</v-row> </v-row>
<v-row no-gutters class="guide-content"> <v-row no-gutters class="guide-content">
<v-col cols="12" align="center" justify="center" class="mt-8"> <v-col cols="12" align="center" justify="center" class="ma-auto">
브릿지 AI 플랫폼에서 제공하는 서비스를 사용하는 방법을 설명합니다. <img src="/logo_v2/s01.png" cover />
<p>AI를 손쉽게 개발할 수 있는 플랫폼,<br>브릿지 사용 방법을 소개합니다.</p>
<v-list v-if="guideIndex" class="d-md-flex d-lg-none">
<tree
:items="guideIndex"
@clickItemEvent="openGuide"
/>
</v-list>
</v-col> </v-col>
<v-card style="width:100%;" flat color="transparent" class="px-4">
<v-divider class="my-12"/>
<v-col cols="12" class="my-4"><h3 class="font-weight-bold">목차</h3></v-col>
<v-treeview :items="guideIndex" item-text="title">
<template v-slot:label="{ item }">
<a @click="openGuide(item)">{{item.title}}</a>
</template>
</v-treeview>
</v-card>
</v-row> </v-row>
</v-container> </v-container>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
layout:'guide', layout:'guide',
data:() => ({ data:() => ({
guideIndex: [] guideIndex: [],
}), }),
methods:{ methods:{
getGuideIndex() { async getGuideIndex(){
this.$store.state.guideId = null await this.$axios.get('http://localhost:5000/guide-index/all')
this.$store.commit('setGuide', {guideId:null, flag:false})
this.$axios.get('http://localhost:5000/test/index')
.then(res => { .then(res => {
this.guideIndex = res.data this.getIndexTree(JSON.parse(JSON.stringify(res.data)));
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)
}) })
}, },
getIndexTree(unclassifiedList){
let indexTree = []
openGuide(guide) { // depth 1 리스트 생성
this.$router.push('/' + this.parsingContentTitle(guide)) unclassifiedList.forEach(el => {
this.$store.commit('setGuide', {guideId:guide.id, flag:true}) if(el.depth === 1){
this.$store.state.guideId = guide.id indexTree.push(el)
delete unclassifiedList[unclassifiedList.indexOf(el)]
}
})
// depth 2 이상인 인덱스들 트리구조 생성
this.setTreeChild(indexTree, unclassifiedList)
this.guideIndex = JSON.parse(JSON.stringify(indexTree))
}, },
setTreeChild(targetList, unclassifiedList){
targetList.forEach(el => {
el.children = []
parsingContentTitle(content) { unclassifiedList.forEach(ucsfEl => {
let keyArray = content.contentKey.replace('.md','').split('/') if(ucsfEl.path.indexOf(el.path) > -1 && ucsfEl.depth === el.depth + 1){
let titleKey = '' el.children.push(ucsfEl)
if(keyArray[0] !== keyArray[1]) { delete unclassifiedList[unclassifiedList.indexOf(ucsfEl)]
for(let i = 0; i < keyArray.length - 1; i++) {
titleKey += keyArray[i] + '_'
} }
titleKey += content.title })
} else {
titleKey = content.title if(el.children.length > 0){
this.setTreeChild(el.children, unclassifiedList)
} }
return titleKey })
},
openGuide(guide) {
this.$router.push('/' + guide.id)
}, },
}, },
mounted(){ mounted(){
this.getGuideIndex() this.getGuideIndex()
}, },
watch:{ watch:{
} }
} }
</script> </script>
<style lang="scss" scoped>
.guide-content {
.v-list {
max-width: 400px;
text-align: left;
margin-top: 20px !important;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment