Commit 04ca0d0b authored by Gyeongho Park's avatar Gyeongho Park

[REFACTOR] 불필요 코드 정리

parent e0d7ec96
@charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;700;900&display=swap');
.v-application{
&.default-guide-wrap{
//background-color: #fff !important;
}
}
.default-guide-wrap {
//background-color: #fff !important;
.guide-app {
overflow-x: hidden;
font-size: 16px !important;
*{
-webkit-font-smoothing: antialiased;
font-weight: 400;
letter-spacing: -0.25px;;
}
.guide-wrap-container{
padding-right: 240px;
}
.guide-wrap {
min-height: 100vh !important;
max-width: 1280px !important;
......@@ -118,10 +107,7 @@
}
.guide-navigator{
display: block;
box-shadow: none !important;
min-width:230px;
......@@ -179,7 +165,7 @@
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.1);
}
}
// navigation-drawer
.navigation-wrap {
overflow-x: hidden;
border-right:1px solid rgba(0,0,0,0.05) !important;
......
<template>
<v-dialog
v-model="dialog"
:persistent="persistent"
scrollable
:max-width="maxWidth"
:max-height="maxHeight"
:width="width"
:fullscreen="fullDialog"
@keydown.enter="enterKeyEvent"
overlay-opacity="0.2"
transition="slide-y-reverse-transition"
content-class="vridge-dialog-container"
>
<template v-slot:activator="{on, attrs}">
<slot name="button" v-on="on" v-bind="{on, attrs}"></slot>
</template>
<v-card class="vridge-dialog" :tile="tile" elevation="0">
<v-card-title class="vridge-dialog-title">
<slot name="title" v-if="$slots.title">
</slot>
<v-row v-else no-gutters align="center">
<span class="font-weight-bold">
{{title}}
</span>
<v-spacer/>
<v-avatar size="28" class="vridge-dialog-close" v-if="closeButton">
<v-icon class="font-weight-bold" @click="clickNo" >mdi-close</v-icon>
</v-avatar>
</v-row>
</v-card-title>
<v-card-text class="vridge-content-container" color="white" flat :style="'height:' + height +'px !important; overflow-y:' + overflow + ';background:' + background" style="min-height:140px;">
<v-container fluid style="width:100%; height:100%;">
<slot name="content">
</slot>
</v-container>
</v-card-text>
<v-card-actions class="vridge_actions" v-if="!$slots.actionButton" >
<v-spacer></v-spacer>
<v-btn
:ripple="false"
elevation="0"
@click="clickNo"
:disabled="disabledNo"
:loading="loading"
>
<span>{{$t('close')}}</span>
</v-btn>
<v-btn
color="primary"
@click="clickYes"
elevation="0"
:ripple="false"
v-if="clickYesBtn"
:loading="loading"
:disabled="disabledYes"
>
<span>{{clickYesBtn}}</span>
</v-btn>
</v-card-actions>
<v-card-actions v-else class="vridge_actions">
<v-spacer/>
<slot name="actionButton"> </slot>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
export default {
name: 'vridgeDialog',
props: {
persistent:{
type:Boolean,
default:false
},
borderBottom:{
type:Number
},
borderRadius:{
type:Number
},
color:{
type:String
},
colorHeader:{
type:String
},
fullscreen:{
type:Boolean,
default:false
},
disabled:{
type: Boolean,
default: false
},
icon:{
type: String,
default: ''
},
title:{
type: String,
default: '새창'
},
width:{
type: Number,
default: 500
},
height:{
type: Number,
default: 120
},
maxWidth:{
type: Number,
default: 1080
},
maxHeight:{
type: Number,
default: 1080
},
padding:{
type:String
},
overflow:{
type:String,
default:'auto'
},
background:{
type:String
},
backgroundHeader:{
type:String
},
clickYesBtn:{
type:String,
default:""
},
mobileFull:{
type:Boolean,
default:false
},
enterKeyActive:{
type:Boolean,
default:false
},
tile:{
type:Boolean,
default:false
},
closeButton:{
type:Boolean,
default:false
},
loading: {
type:Boolean,
default:false
},
disabledYes: {
type:Boolean,
default:false
},
disabledNo: {
type:Boolean,
default:false
},
autoClose: {
type:Boolean,
default:true
}
},
data: () => ({
dialog: false,
format:'YYYY-MM-DD',
isFullDialog:false
}),
watch:{
dialog() {
this.$emit('change')
if(this.dialog) {
this.init()
if(this.mobileFull){
this.isFullDialog = window.innerWidth <= 768
}
} else {
this.$emit('click-no')
this.$emit('close')
}
},
},
computed: {
fullDialog(){
return this.isFullDialog || this.fullscreen
}
},
methods:{
init(){
},
clickYes(){
if(this.autoClose) this.dialog = false
this.$emit('click-yes')
},
enterKeyEvent(){
if(this.enterKeyActive){
this.$emit('click-yes')
}
},
select (index) {
this.selectedIndex = index
},
clickNo(){
this.dialog = false
this.$emit('click-no')
},
resizeEventHandler(e) {
if(this.dialog && this.mobileFull) {
if(e.currentTarget.outerWidth <= 768) {
this.isFullDialog = true
} else {
this.isFullDialog = false
}
} else {
this.isFullDialog = false
}
},
},
mounted(){
window.addEventListener("resize", this.resizeEventHandler);
},
destroyed() {
window.removeEventListener("resize", this.resizeEventHandler);
},
}
</script>
<style lang="scss">
.vridge-dialog-container{
.theme--light &{
box-shadow: rgba(0, 0, 0, 0.1) 0px 20px 30px !important;
}
}
.theme--dark{
.vridge-dialog{
border:1px solid #2a2a2a !important;
}
}
.theme--light{
.vridge-dialog{
border:1px solid #eee !important;
}
}
.vridge-dialog{
overflow-x:hidden;
padding:24px;
> .v-card__title{
font-size:20px !important;
padding:12px !important;
//margin-bottom:12px !important;
}
.vridge-content-container{
padding:0px !important;
font-size: 14px;
transition: height 0.5s ease-in-out;
}
.vridge_actions{
padding: 12px !important;
}
}
.create-slot-cover{
padding:0;
margin:0;
.search-menu-cover{
display:flex;
background-color:transparent;
border:1px solid #e0e0e0;
border-radius: 5px;
}
.search-menu-check-cover{
.v-input--selection-controls {
padding: 0;
margin: 0;
}
.v-messages {
display:none !important;
}
}
}
.v-dialog--persistent{
.vdp-datepicker, .vdpWithInput{
height:38px;
width:100%;
input{
height: 38px;
padding-left:12px;
width:100%;
font-size:15px;
}
.vdp-datepicker__calendar{
bottom: 40px;
}
}
}
.vdpClearInput{
display:none !important;
}
.dateInput >>> input{
padding:8px 0px;
font-size: 13px;
font-weight: 500;
opacity: .7;
}
.dateInput >>> button::before{
display:none !important;
}
.calendarCustom{
font-size:20px;
margin-left:-25px;
position:relative;
color:#4159b2;
cursor:pointer;
display:flex;
align-items:center;
}
/* .v-dialog{
overflow-y: initial;
}*/
.search-menu-cover{
.vdpHeader{
background:rgba(0,0,0,0.05) !important;
}
}
.vridge-dialog-close{
transition: all 0.2s ease-in-out;
opacity: 0.7;
&:hover{
transform:scale(1.1) !important;
opacity: 1.0;
.theme--dark{
background-color:#1b1c20 !important;
}
.theme--light{
background-color:#ccc !important;
}
font-weight: bold !important;
}
}
</style>
\ No newline at end of file
<template>
<v-app class="default-guide-wrap">
<v-app class="guide-app">
<div class="no-shadow">
<client-only>
......@@ -57,9 +57,9 @@
>
<v-list-item
:ripple="false"
@click="[$router.push('/docs'), guideIndex.forEach((x)=>x.active = false)]"
@click="[$router.push('/'), guideIndex.forEach((x)=>x.active = false)]"
active-class="active"
:class="{active: $route.path === '/docs'}"
:class="{active: $route.path === '/'}"
>
<v-list-item-title></v-list-item-title>
</v-list-item>
......@@ -96,7 +96,7 @@
<template v-slot:activator>
<v-list-item-content @click="openGuide(item, item.title)">
<v-list-item-title v-text="$t('guide_title_' + item.title)"></v-list-item-title>
<v-list-item-title v-text="item.title"></v-list-item-title>
</v-list-item-content>
......@@ -131,7 +131,7 @@
<template v-slot:activator>
<v-list-item-content @click="openGuide(subItem, item.title + '_' + subItem.title)">
<v-list-item-title v-text="$t('guide_title_' + item.title+ '_' + subItem.title)"></v-list-item-title>
<v-list-item-title v-text="subItem.title"></v-list-item-title>
</v-list-item-content>
<v-btn small icon v-if="$store.state.editMode" @click="removeGuide(subItem.id)"><v-icon>mdi-close</v-icon></v-btn>
......@@ -147,7 +147,7 @@
@click="openGuide(grandSubItem, item.title + '_' + subItem.title + '_' + grandSubItem.title)"
active-class="active"
>
<v-list-item-title v-text="$t('guide_title_' + item.title+ '_' + subItem.title+ '_' + grandSubItem.title)"></v-list-item-title>
<v-list-item-title v-text="grandSubItem.title"></v-list-item-title>
<v-btn small icon v-if="$store.state.editMode" @click="removeGuide(grandSubItem.id)"><v-icon>mdi-close</v-icon></v-btn>
</v-list-item>
</v-list-group>
......@@ -161,7 +161,7 @@
:class="{active: isActiveMenu(subItem.id)}"
:style="isActiveMenu(subItem.id) ? 'border-left:2px solid #1E88E5;' : 'border-left:1px solid rgba(0,0,0,0.15);'"
>
<v-list-item-title v-text="$t('guide_title_' + item.title+ '_' + subItem.title)"></v-list-item-title>
<v-list-item-title v-text="subItem.title"></v-list-item-title>
<v-btn small icon v-if="$store.state.editMode" @click="removeGuide(subItem.id)"><v-icon>mdi-close</v-icon></v-btn>
</v-list-item>
......@@ -215,8 +215,7 @@
<span style="cursor:pointer;" class="pa-2">
<img @click="$router.push('/docs')" class="mobile-hide" src="/logo_v2/01.png" cover height="28"/>
<img @click="$router.push('/docs')" class="mobile-show" src="/logo_v2/s01.png" cover height="36"/>
<img @click="$router.push('/')" src="/logo_v2/01.png" cover height="28"/>
</span>
<v-spacer/>
......@@ -344,7 +343,7 @@ export default{
isActiveMenu(id) {
if(this.$route.path !== '/docs' && id === this.$store.state.guideId) {
if(this.$route.path !== '/' && id === this.$store.state.guideId) {
return true
}
return false
......@@ -352,7 +351,7 @@ export default{
// 가이드 페이지 이동
openGuide(guide, path) {
this.$router.push('/docs/' + path)
this.$router.push('/' + path)
this.$store.commit('setGuide',{guideId:guide.id, flag:false})
this.$store.state.guideId = guide.id
},
......@@ -362,7 +361,7 @@ export default{
await this.$axios.get('http://docs.vridgeai.com/api/index')
.then(res => {
this.guideIndex = res.data.body
this.guideIndex = res.data
})
.catch(err => {
console.log(err)
......@@ -466,7 +465,7 @@ export default{
search(){
if(this.keyword){
this.$router.push('/docs/search?keyword=' + this.keyword)
this.$router.push('/search?keyword=' + this.keyword)
this.keyword = ''
}
},
......@@ -487,12 +486,9 @@ export default{
}
},
created() {
mounted(){
this.getGuideIndex()
},
mounted(){
window.addEventListener("scroll", this.scrollEvent);
},
......
......@@ -41,7 +41,7 @@ export default {
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'~/plugins/global.js'
//'~/plugins/global.js'
],
// Auto import components: https://go.nuxtjs.dev/config-components
......@@ -55,7 +55,8 @@ export default {
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
'nuxt-healthcheck'
'nuxt-healthcheck',
'@nuxtjs/markdownit'
],
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
......@@ -119,4 +120,14 @@ export default {
return JSON.stringify({result: 'ok'})
}
},
markdownit: {
preset: 'default',
linkify: true,
breaks: true,
use: [
'markdown-it-div',
'markdown-it-attrs'
]
}
}
\ No newline at end of file
......@@ -9,7 +9,10 @@
"version": "1.0.0",
"dependencies": {
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/markdownit": "^2.0.0",
"core-js": "^3.25.3",
"markdown-it-attrs": "^4.1.6",
"markdown-it-div": "^1.1.0",
"nuxt": "^2.15.8",
"nuxt-healthcheck": "^1.0.1",
"sass-loader": "^10.2.0",
......@@ -3200,6 +3203,83 @@
"resolved": "https://registry.npmjs.org/defu/-/defu-5.0.1.tgz",
"integrity": "sha512-EPS1carKg+dkEVy3qNTqIdp2qV7mUP08nIsupfwQpz++slCVRw7qbQyWvSTig+kFPwz2XXp5/kIIkH+CwrJKkQ=="
},
"node_modules/@nuxtjs/markdownit": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/markdownit/-/markdownit-2.0.0.tgz",
"integrity": "sha512-YAEK/s0IzdWK1L74WKTQSMcvNhGgOW0xIWdu5VMxDo1NkNpm/0CbJZgSPt1JYAnT8r8r6wVQ5SY1v/1MZanPlQ==",
"dependencies": {
"@nuxtjs/markdownit-loader": "^1.1.1",
"defu": "^3.2.2",
"raw-loader": "^4.0.2"
}
},
"node_modules/@nuxtjs/markdownit-loader": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/markdownit-loader/-/markdownit-loader-1.2.0.tgz",
"integrity": "sha512-D6m4578NavamwD03nOU3H3NkS2zYfFJSMChUczlCGDx05DgAoenY4GdCmML1CnAEH/Cv6Bf230RIwDnD926oyQ==",
"dependencies": {
"highlight.js": "^10.5.0",
"loader-utils": "^1.1.0",
"markdown-it": "^8.3.1"
}
},
"node_modules/@nuxtjs/markdownit-loader/node_modules/entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
},
"node_modules/@nuxtjs/markdownit-loader/node_modules/json5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dependencies": {
"minimist": "^1.2.0"
},
"bin": {
"json5": "lib/cli.js"
}
},
"node_modules/@nuxtjs/markdownit-loader/node_modules/linkify-it": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz",
"integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==",
"dependencies": {
"uc.micro": "^1.0.1"
}
},
"node_modules/@nuxtjs/markdownit-loader/node_modules/loader-utils": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz",
"integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==",
"dependencies": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^1.0.1"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/@nuxtjs/markdownit-loader/node_modules/markdown-it": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz",
"integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==",
"dependencies": {
"argparse": "^1.0.7",
"entities": "~1.1.1",
"linkify-it": "^2.0.0",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
},
"bin": {
"markdown-it": "bin/markdown-it.js"
}
},
"node_modules/@nuxtjs/markdownit/node_modules/defu": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/defu/-/defu-3.2.2.tgz",
"integrity": "sha512-8UWj5lNv7HD+kB0e9w77Z7TdQlbUYDVWqITLHNqFIn6khrNHv5WQo38Dcm1f6HeNyZf0U7UbPf6WeZDSdCzGDQ=="
},
"node_modules/@nuxtjs/proxy": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/proxy/-/proxy-2.1.0.tgz",
......@@ -3892,7 +3972,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"dependencies": {
"sprintf-js": "~1.0.2"
}
......@@ -7393,6 +7472,14 @@
"he": "bin/he"
}
},
"node_modules/highlight.js": {
"version": "10.7.3",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
"integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
"engines": {
"node": "*"
}
},
"node_modules/hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
......@@ -8435,6 +8522,15 @@
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
},
"node_modules/linkify-it": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
"peer": true,
"dependencies": {
"uc.micro": "^1.0.1"
}
},
"node_modules/loader-runner": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
......@@ -8560,6 +8656,56 @@
"node": ">=0.10.0"
}
},
"node_modules/markdown-it": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz",
"integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==",
"peer": true,
"dependencies": {
"argparse": "^2.0.1",
"entities": "~3.0.1",
"linkify-it": "^4.0.1",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
},
"bin": {
"markdown-it": "bin/markdown-it.js"
}
},
"node_modules/markdown-it-attrs": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-4.1.6.tgz",
"integrity": "sha512-O7PDKZlN8RFMyDX13JnctQompwrrILuz2y43pW2GagcwpIIElkAdfeek+erHfxUOlXWPsjFeWmZ8ch1xtRLWpA==",
"engines": {
"node": ">=6"
},
"peerDependencies": {
"markdown-it": ">= 9.0.0"
}
},
"node_modules/markdown-it-div": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/markdown-it-div/-/markdown-it-div-1.1.0.tgz",
"integrity": "sha512-Vz1T8cPG4sRofn5VlwiGMpy7AyhizbBZcFmvVDf/mlDgF7Mt6QqjPhc/nLlLYB3EANkJfO4kym7R6SZ7RhGvCQ=="
},
"node_modules/markdown-it/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"peer": true
},
"node_modules/markdown-it/node_modules/entities": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
"peer": true,
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/md5.js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
......@@ -8575,6 +8721,11 @@
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow=="
},
"node_modules/mdurl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
"node_modules/memfs": {
"version": "3.4.13",
"resolved": "https://registry.npmjs.org/memfs/-/memfs-3.4.13.tgz",
......@@ -11211,7 +11362,6 @@
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-4.0.2.tgz",
"integrity": "sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==",
"dev": true,
"dependencies": {
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0"
......@@ -11231,7 +11381,6 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.8",
"ajv": "^6.12.5",
......@@ -12346,8 +12495,7 @@
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
},
"node_modules/ssri": {
"version": "8.0.1",
......@@ -13670,6 +13818,11 @@
"node": "*"
}
},
"node_modules/uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
},
"node_modules/ufo": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.0.1.tgz",
......@@ -17810,6 +17963,78 @@
}
}
},
"@nuxtjs/markdownit": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/markdownit/-/markdownit-2.0.0.tgz",
"integrity": "sha512-YAEK/s0IzdWK1L74WKTQSMcvNhGgOW0xIWdu5VMxDo1NkNpm/0CbJZgSPt1JYAnT8r8r6wVQ5SY1v/1MZanPlQ==",
"requires": {
"@nuxtjs/markdownit-loader": "^1.1.1",
"defu": "^3.2.2",
"raw-loader": "^4.0.2"
},
"dependencies": {
"defu": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/defu/-/defu-3.2.2.tgz",
"integrity": "sha512-8UWj5lNv7HD+kB0e9w77Z7TdQlbUYDVWqITLHNqFIn6khrNHv5WQo38Dcm1f6HeNyZf0U7UbPf6WeZDSdCzGDQ=="
}
}
},
"@nuxtjs/markdownit-loader": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/markdownit-loader/-/markdownit-loader-1.2.0.tgz",
"integrity": "sha512-D6m4578NavamwD03nOU3H3NkS2zYfFJSMChUczlCGDx05DgAoenY4GdCmML1CnAEH/Cv6Bf230RIwDnD926oyQ==",
"requires": {
"highlight.js": "^10.5.0",
"loader-utils": "^1.1.0",
"markdown-it": "^8.3.1"
},
"dependencies": {
"entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
},
"json5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"requires": {
"minimist": "^1.2.0"
}
},
"linkify-it": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz",
"integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==",
"requires": {
"uc.micro": "^1.0.1"
}
},
"loader-utils": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz",
"integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==",
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^1.0.1"
}
},
"markdown-it": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz",
"integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==",
"requires": {
"argparse": "^1.0.7",
"entities": "~1.1.1",
"linkify-it": "^2.0.0",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
}
}
}
},
"@nuxtjs/proxy": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/proxy/-/proxy-2.1.0.tgz",
......@@ -18403,7 +18628,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
......@@ -21018,6 +21242,11 @@
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
},
"highlight.js": {
"version": "10.7.3",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
"integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="
},
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
......@@ -21770,6 +21999,15 @@
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
},
"linkify-it": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
"peer": true,
"requires": {
"uc.micro": "^1.0.1"
}
},
"loader-runner": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
......@@ -21874,6 +22112,44 @@
"object-visit": "^1.0.0"
}
},
"markdown-it": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz",
"integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==",
"peer": true,
"requires": {
"argparse": "^2.0.1",
"entities": "~3.0.1",
"linkify-it": "^4.0.1",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
},
"dependencies": {
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"peer": true
},
"entities": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
"peer": true
}
}
},
"markdown-it-attrs": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-4.1.6.tgz",
"integrity": "sha512-O7PDKZlN8RFMyDX13JnctQompwrrILuz2y43pW2GagcwpIIElkAdfeek+erHfxUOlXWPsjFeWmZ8ch1xtRLWpA==",
"requires": {}
},
"markdown-it-div": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/markdown-it-div/-/markdown-it-div-1.1.0.tgz",
"integrity": "sha512-Vz1T8cPG4sRofn5VlwiGMpy7AyhizbBZcFmvVDf/mlDgF7Mt6QqjPhc/nLlLYB3EANkJfO4kym7R6SZ7RhGvCQ=="
},
"md5.js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
......@@ -21889,6 +22165,11 @@
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow=="
},
"mdurl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
"memfs": {
"version": "3.4.13",
"resolved": "https://registry.npmjs.org/memfs/-/memfs-3.4.13.tgz",
......@@ -23727,7 +24008,6 @@
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-4.0.2.tgz",
"integrity": "sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==",
"dev": true,
"requires": {
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0"
......@@ -23737,7 +24017,6 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.8",
"ajv": "^6.12.5",
......@@ -24589,8 +24868,7 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
},
"ssri": {
"version": "8.0.1",
......@@ -25601,6 +25879,11 @@
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.33.tgz",
"integrity": "sha512-RqshF7TPTE0XLYAqmjlu5cLLuGdKrNu9O1KLA/qp39QtbZwuzwv1dT46DZSopoUMsYgXpB3Cv8a03FI8b74oFQ=="
},
"uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
},
"ufo": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.0.1.tgz",
......@@ -10,7 +10,10 @@
},
"dependencies": {
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/markdownit": "^2.0.0",
"core-js": "^3.25.3",
"markdown-it-attrs": "^4.1.6",
"markdown-it-div": "^1.1.0",
"nuxt": "^2.15.8",
"nuxt-healthcheck": "^1.0.1",
"sass-loader": "^10.2.0",
......
......@@ -17,24 +17,22 @@
<span v-if="!loading && guide !== null">
<v-breadcrumbs
class="ma-0 px-0 py-2 "
:items="getBreadcrumbs(guide)"
:items="getBreadcrumbs()"
>
<template v-slot:divider>
<v-icon dark>mdi-chevron-right</v-icon>
</template>
<template v-slot:item= "{item}">
<!-- <span class="text--grey text--caption" style="cursor:pointer;" @click="openGuide(item.content)" >{{item.text}}</span> -->
<span class="text--caption">{{item.text}}</span>
<span class="text--grey text--caption" style="cursor:pointer;" @click="openGuide(item.path)" >{{item.text}}</span>
</template>
</v-breadcrumbs>
<h1 v-text="$t('guide_title_' + $route.params.guide)" class="font-weight-bold"></h1>
<h1 v-text="guide.title" class="font-weight-bold"></h1>
</span>
<v-spacer/>
<span v-if="!loading && guide !== null">
<!-- <span class="">{{$time.dateToFormatKorean(guide.updateDate)}}</span> -->
<v-tooltip bottom transition="slide-y-transition">
<template v-slot:activator="{on, attrs}">
<v-btn dark v-on="on" v-bind="attrs" icon @click="openGithub(guide.contentKey)"><v-icon>mdi-github</v-icon></v-btn>
......@@ -55,7 +53,7 @@
style="width:100%;"
></v-skeleton-loader>
<div v-if="$store.state.editMode && guide">
<!-- <div v-if="$store.state.editMode && guide">
<v-chip v-if="guide.keywordSet !== null" small label v-for="item in guide.keywordSet" :key="item" class="mr-1" close @click:close="removeKeyword(item)">
{{item}}
</v-chip>
......@@ -77,7 +75,7 @@
</v-text-field>
</template>
</vridge-dialog>
</div>
</div> -->
<div v-if="!loading && guide && guide.content" v-html="$md.render(guide.content)" style="padding-bottom:200px;"></div>
</v-row>
......@@ -93,7 +91,7 @@
<v-col align="end" justify="end">
<span class="grey--text">이전 페이지</span> <br/>
<span style="font-size:1.1rem;font-weight:bold;">
{{$t('guide_title_' + parsingContentTitle(guide.prevContent))}}
{{parsingContentTitle(guide.prevContent)}}
</span>
</v-col>
......@@ -114,7 +112,7 @@
<v-col align="start" justify="start">
<span class="grey--text">다음 페이지</span> <br/>
<span style="font-size:1.1rem;font-weight:bold;">
{{$t('guide_title_' + parsingContentTitle(guide.nextContent))}}
{{ parsingContentTitle(guide.nextContent)}}
</span>
</v-col>
<v-col class="ml-8">
......@@ -129,26 +127,6 @@
></v-skeleton-loader>
</v-row>
</v-container>
<!-- <v-container v-if="$store.state.editMode" fluid>
<v-row no-gutters v-if="guide !== null" align="center">
<v-text-field filled :maxlength="50" hide-details solo label="title" v-model="guide.title" class="no-shadow font-weight-bold px-4">
</v-text-field>
<v-spacer/>
<span class="grey--text" style="font-size:1rem; " v-if="!loading && guide !== null">
updated: <span class="mx-2">{{$time.toLocalDateTimeString(guide.updateDate)}}</span>
</span>
<v-btn text @click="$store.state.editMode = false">취소</v-btn>
<v-btn class="mr-4" color="primary" @click="save">저장</v-btn>
</v-row>
<v-row no-gutters >
<v-card v-if="guide" elevation="0" style="width:100%; height:100%;">
<v-card-text>
<VueEditor v-if="guide.content" v-model="guide.content" class="editor-content" />
</v-card-text>
</v-card>
</v-row>
</v-container> -->
</div>
</template>
......@@ -170,7 +148,7 @@ export default {
}
})
.then(res=>{
this.guide = res.data.body
this.guide = res.data
})
.catch(err=>{
console.log(err)
......@@ -213,26 +191,19 @@ export default {
return titleKey
},
getBreadcrumbs(content){
getBreadcrumbs(){
let items = []
let keyArray = content.contentKey.replace('.md','').split('/')
let titleKey = 'guide_title'
if(keyArray[0] !== keyArray[1]) {
for(let i = 0; i < keyArray.length; i++) {
titleKey += '_' + keyArray[i]
items.push({
text: this.$t(titleKey),
href: titleKey,
content: content
})
let paths = this.$route.path.substring(1).split('_')
let pathTemp = ''
for(let i = 0; i < paths.length; i++) {
pathTemp += paths[i]
let item = {
text: paths[i],
paths: pathTemp
}
} else {
titleKey += '_' + keyArray[0]
items.push({
text: this.$t(titleKey),
href: titleKey,
content: content
})
pathTemp += '_'
items.push(item)
}
return items
......@@ -299,7 +270,7 @@ export default {
},
openGuide(guide) {
this.$router.push('/docs/' + this.parsingContentTitle(guide))
this.$router.push('/' + this.parsingContentTitle(guide))
this.$store.commit('setGuide', {guideId:guide.id, flag:true})
this.$store.state.guideId = guide.id
},
......
<template>
<guide-board-editor
:board="board"
>
</guide-board-editor>
</template>
<script>
export default {
layout:'guide',
meta:{
title:'가이드 편집',
},
components: {
},
data:()=>({
board:null
}),
mounted(){
this.getBoard()
},
methods:{
getBoard(){
this.board.title = this.$route.params.guideSub
this.board.content = this.$store.state.guidSubList.contents
},
}
};
</script>
\ No newline at end of file
......@@ -16,7 +16,7 @@
<v-treeview :items="guideIndex" item-text="title">
<template v-slot:label="{ item }">
<a @click="openGuide(item)">{{$t('guide_title_' + parsingContentTitle(item))}}</a>
<a @click="openGuide(item)">{{parsingContentTitle(item)}}</a>
</template>
</v-treeview>
</v-card>
......@@ -40,7 +40,7 @@ export default {
this.$store.commit('setGuide', {guideId:null, flag:false})
this.$axios.get('http://docs.vridgeai.com/api/index')
.then(res => {
this.guideIndex = res.data.body
this.guideIndex = res.data
})
.catch(err => {
console.log(err)
......@@ -48,7 +48,7 @@ export default {
},
openGuide(guide) {
this.$router.push('/docs/' + this.parsingContentTitle(guide))
this.$router.push('/' + this.parsingContentTitle(guide))
this.$store.commit('setGuide', {guideId:guide.id, flag:true})
this.$store.state.guideId = guide.id
},
......
......@@ -43,8 +43,8 @@
:key="item.id"
class="text-center"
>
<td>{{ $t('guide_title_' + parsingContentTitle(item))}}</td>
<td><a @click="openGuide(item)">{{ $t('guide_title_' + parsingContentTitle(item)) }}</a></td>
<td>{{ parsingContentTitle(item)}}</td>
<td><a @click="openGuide(item)">{{parsingContentTitle(item)}}</a></td>
</tr>
</tbody>
</template>
......@@ -82,13 +82,13 @@ export default {
}
this.documents = []
await this.$axios.get('/docs/search',{
await this.$axios.get('/search',{
params:{
keyword: this.keyword
}
})
.then(res => {
this.documents = res.data.body
this.documents = res.data
})
.catch(err => {
console.log(err)
......@@ -99,7 +99,7 @@ export default {
},
openGuide(guide) {
this.$router.push('/docs/' + this.parsingContentTitle(guide))
this.$router.push('/' + this.parsingContentTitle(guide))
this.$store.commit('setGuide', {guideId:guide.id, flag:true})
this.$store.state.guideId = guide.id
},
......
import Vue from 'vue'
const time = {
toLocalDateTimeString(dateString) {
try{
if(typeof dateString !== 'string') {
let date = new Date(dateString[0], (dateString[1] - 1), dateString[2], dateString[3], dateString[4], dateString[5]);
date.setHours(date.getHours() + 9);
return date.toISOString().replace('T', ' ').substring(0, 19);
} else {
let date = new Date(dateString);
date.setHours(date.getHours() + 9);
return date.toISOString().replace('T', ' ').substring(0, 19);
}
}catch{
return ''
}
},
getTimeFromNow(date) {
const now = new Date();
const today = now
const timeValue = new Date(date);
const betweenTime = Math.floor((today.getTime() - timeValue.getTime()) / 1000 / 60);
if (betweenTime < 1) return '방금전';
if (betweenTime < 60) {
return `${betweenTime}분전`;
}
const betweenTimeHour = Math.floor(betweenTime / 60);
if (betweenTimeHour < 24) {
return `${betweenTimeHour}시간전`;
}
const betweenTimeDay = Math.floor(betweenTime / 60 / 24);
if (betweenTimeDay < 365) {
return `${betweenTimeDay}일전`;
}
return `${Math.floor(betweenTimeDay / 365)}년전`;
},
getTimeFromAnotherTime(targetDate, baseDate) {
const now = new Date(baseDate);
const today = now
const timeValue = new Date(targetDate);
const betweenTime = Math.floor((today.getTime() - timeValue.getTime()) / 1000 / 60);
if (betweenTime < 1) {
return `${betweenTime * 60}초`;
}
if (betweenTime < 60) {
return `${betweenTime}분`;
}
const betweenTimeHour = Math.floor(betweenTime / 60);
if (betweenTimeHour < 24) {
return `${betweenTimeHour}시간`;
}
const betweenTimeDay = Math.floor(betweenTime / 60 / 24);
if (betweenTimeDay < 365) {
return `${betweenTimeDay}일`;
}
return `${Math.floor(betweenTimeDay / 365)}년`;
},
getElapsedTimeFromSecond(second){
let min = Math.floor(second/60);
let hour = Math.floor(min/60);
let sec = second%60;
min = min%60;
let th = hour;
let tm = min;
let ts = sec;
if(th<10){
th = "0" + hour;
}
if(tm < 10){
tm = "0" + min;
}
if(ts < 10){
ts = "0" + sec;
}
return th + ":" + tm + ":" + ts
},
dateToFormatKorean (date) {
if(typeof date !== 'string') {
return date[0] + '년 ' + date[1] + '월 ' + date[2] +'일'
} else {
let dateString = date.substring(0,10)
return dateString.substring(0,4) + '년 ' + dateString.substring(5,7) + '월 ' + dateString.substring(8) +'일'
}
},
dateTimeToFormatKorean (date) {
if(typeof date !== 'string') {
date = this.convertDateArrayToString(date)
}
var week = ['일', '월', '화', '수', '목', '금', '토'];
var dayOfWeek = week[new Date(date).getDay()];
return date.substring(0,4) + '년 ' + date.substring(5,7) + '월 ' + date.substring(8,10) +'일 ' + dayOfWeek + '요일 ' + date.substring(11,19)
},
dateShotToFormatKorean (date) {
if(typeof date !== 'string') {
return date[0] + '.' + date[1] + '.' + date[2]
} else {
let dateString = date.substring(0,10)
return dateString.substring(0,4) + '.' + dateString.substring(5,7) + '.' + dateString.substring(8)
}
},
simpleFormat(date){
let data = new Date(date)
return data.toLocaleDateString();
},
convertDateArrayToString(dateArray) {
try{
let date = dateArray[0] + "-" + this.addTimeBlank(dateArray[1]) + "-" + this.addTimeBlank(dateArray[2]) + "T" + this.addTimeBlank(dateArray[3])+":" + this.addTimeBlank(dateArray[4]) + ":" + this.addTimeBlank(dateArray[5])
this.addTimeBlank(dateArray[3])
return date
}catch{
return new Date().toLocaleTimeString()
}
},
addTimeBlank(time) {
return time.toString().length === 1 ? '0' + time : time.toString()
}
}
const utils = {
// 소수점2자리까지의 바이트 단위로 변환시키는 함수
convertByteToString(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
},
checkViewMode(level, vuetify) {
let viewMode = ['xs', 'sm', 'md', 'lg', 'xl']
if(viewMode.slice(0,level).indexOf(vuetify.breakpoint.name) !== -1) {
return false
} else {
return true
}
},
btoa(content) {
return window.btoa(content)
},
btoaEscape(content) {
return window.btoa(encodeURIComponent(content).replace(/%([0-9A-F]{2})/g,function(match,p1){return String.fromCharCode('0x'+p1)}))
},
// 이미지파일과 어노테이션 파일을 Zip으로 압축해서 다운받는 함수
async downloadDatasetZip(files, name){
let zip = new JSZip()
return new Promise((resolve, reject) => {
for (let i = 0; i < files.length; i++) {
let filename = files[i].filename
let folder = files[i].folder
zip.file(folder+"/"+filename, files[i].image,{ base64: true, createFolders: true })
filename = filename.substring(0,filename.indexOf("."))
zip.file(folder+"/"+filename + '.xml', atob(files[i].annotation))
}
zip.generateAsync({
type: "blob"
}).then((content) => {
FileSaver.saveAs(content, name + "_dataset_" + Date.now() + ".zip")
resolve()
})
})
},
getSizeOfImageFile(file) {
return new Promise((resolve, reject)=> {
let img= new Image();
let src = URL.createObjectURL(file);
let size = {
width:0,
height:0
}
img.src = src
img.onload = function () {
size.width = this.width
size.height = this.height
resolve(size)
};
img.onerror = reject
})
},
// 클립보드 저장 함수
copy(val, callback = null) {
if(val) {
if(navigator.clipboard) {
navigator.clipboard.writeText(val).then(() => {
})
} else {
const t = document.createElement("textarea");
document.body.appendChild(t);
t.value = val;
t.select();
document.execCommand('copy');
document.body.removeChild(t);
}
if(callback !== null)
callback()
}
},
isNumeric(num, opt){
// 좌우 trim(공백제거)을 해준다.
num = String(num).replace(/^\s+|\s+$/g, "");
if(typeof opt == "undefined" || opt == "1"){
// 모든 10진수 (부호 선택, 자릿수구분기호 선택, 소수점 선택)
var regex = /^[+\-]?(([1-9][0-9]{0,2}(,[0-9]{3})*)|[0-9]+){1}(\.[0-9]+)?$/g;
}else if(opt == "2"){
// 부호 미사용, 자릿수구분기호 선택, 소수점 선택
var regex = /^(([1-9][0-9]{0,2}(,[0-9]{3})*)|[0-9]+){1}(\.[0-9]+)?$/g;
}else if(opt == "3"){
// 부호 미사용, 자릿수구분기호 미사용, 소수점 선택
var regex = /^[0-9]+(\.[0-9]+)?$/g;
}else{
// only 숫자만(부호 미사용, 자릿수구분기호 미사용, 소수점 미사용)
var regex = /^[0-9]$/g;
}
if( regex.test(num) ){
num = num.replace(/,/g, "");
return isNaN(num) ? false : true;
}else{ return false; }
}
}
const properties = {
getImageCdnUrl(key, w, h, q) {
let f = key.split('.').pop() === 'png' ? 'webp' : ''
let url = 'https://d2q9yzkd471o7j.cloudfront.net/' + key + '?w=' + w + '&h=' + h + '&f=' + f + '&q=' + q
return url
},
getAvatar(key, w, h, q) {
let defaultAvatar = []
for(let i=1; i<=8; ++i){
for(let j=1; j<=3; ++j){
defaultAvatar.push(`/profileAvatar/${i}-${j}.png`)
}
}
for(let i=1; i<=6; ++i){
defaultAvatar.push(`/profileSmaple${i}.png`)
}
if(typeof key === 'undefined' || key === null) {
return '/default-image.png'
}else if(defaultAvatar.indexOf(key) !== -1) {
return key
}else{
return this.getImageCdnUrl(key, w, h, q)
}
},
getProjectKey(orgId, projectId, projectType) {
return btoa(orgId + '/' + projectType.toLowerCase() + '/' + projectId)
},
// auth = $auth
getUserInfo(auth) {
let user = auth.user.body
return {
id: user.id,
name: user.name,
email: user.email,
avatar: user.avatar
}
},
getUserInfoBase64(auth) {
return Buffer.from(JSON.stringify(this.getUserInfo(auth))).toString("base64")
},
// 공개용(데모용) 조직인지 확인
isPublicOrg(orgId) {
const publicOrgsId = ['6c34d2b00b604a689953cb0d5bd4b1cf','o-84e97db78ba14166ae523aa2283a378f']
return orgId && publicOrgsId.indexOf(orgId) !== -1
}
}
const regular = {
basic(data){
let reg=/[\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]/gi;
return reg.test(data)
},
noBlank(data){ // 공백 없을 경우 true 반환
let reg = /[\s]/g;
return !reg.test(data)
},
passwordPatten(data){
//영문,숫자,특수문자(!@$%^&* 만 허용) 9 이상
let reg= /^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{9,20}$/g
return reg.test(data)
},
emailPatten(data){
let reg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return reg.test(data)
},
name(data){
let reg = /^[ㄱ-ㅎ가-힣a-zA-Z\s]+$/
return reg.test(data)
},
projName(data){ // 한글,영문,숫자,공백만 입력되었는지 TEST
let reg = /^[ㄱ-ㅎ가-힣a-zA-Z0-9\s]+$/
return reg.test(data)
},
projDescription(data){ // 한글,영문,숫자,공백,특수문자만 입력되었는지 TEST
let reg = /^[ㄱ-ㅎ가-힣a-zA-Z0-9\s!?@#$%^&*():;+-=~{}<>\_\[\]\|\\\"\'\,\.\/\`\₩]+$/
return reg.test(data)
},
number(data){
let reg = /^[0-9]/
return reg.test(data)
},
phone(data) {
let reg = /^[+]*[(]{0,1}[0-9]{1,3}[)]{0,1}[-\s\./0-9]*$/g
return reg.test(data)
}
}
const rules = {
title: [
v => v.length > 0 || '값을 입력해주세요.',
v => v.length <= 20 || '20자 초과되었습니다.',
v => regular.noBlank(v[0]) || '공백으로 시작할 수 없습니다.',
v => v === "" || regular.projName(v) || '한글,영문,숫자 외의 문자가 입력되었습니다.'
],
description: [
v => v.length <= 100 || '100자 초과되었습니다.',
v => v === "" || regular.projDescription(v) || '적절하지 않은 문자가 입력되었습니다.'
],
}
const lang = {
getString(key){
let la = navigator.language || navigator.userLanguage
if(la.indexOf('en')!==-1) {
return dictionary['en'][key]
} else {
return dictionary['ko'][key]
}
}
}
const dictionary = {
ko:{
dashboard: '대시보드',
alert_save:'성공적으로 저장되었습니다.',
},
en:{
dashboard: 'dashboard',
alert_save:'It has been saved successfully.',
}
}
const move = {
async setOrganizationAndProject(project, axios, store) {
// 프로젝트 참여 여부 확인
const isParticipated = await axios.get('/auth/project/user-list',{
params:{
userId: store.state.auth.user.body.id
}
})
.then(res=>{
const projectList = res.data.body
if(projectList.findIndex(item => item.id === project.id) > -1){
return true
} else {
return false
}
})
.catch(err=>{
console.log('프로젝트 참여 여부 확인 중 에러발생 err : ', err)
})
if(isParticipated){
if(project.organizationId !== store.state.organizationId) {
axios.defaults.headers.common['orgId'] = project.organizationId
store.commit('setOrganizationId', project.organizationId)
store.commit('setKeepOrganizationId', project.organizationId)
}
axios.defaults.headers.common['projectId'] = project.id
store.commit('setProject', project)
} else {
alert("프로젝트 접근 권한이 없습니다.")
}
return isParticipated
},
async goOrg(org, axios, store, router) {
store.state.organization = org
axios.defaults.headers.common['orgId'] = org.orgId
store.commit('setOrganizationId', org.orgId)
store.commit('setKeepOrganizationId', org.orgId)
router.push('/console')
},
async goProject(project, axios, store, router) {
if(await this.setOrganizationAndProject(project,axios,store))
router.push({path:'/console/project/'+ project.id})
},
async goProjectById(projectId, axios, store, router) {
let project = null
await axios.get('/auth/project/' + projectId, {
params:{
m: true
}
})
.then(res=> {
project= res.data.body
})
if(await this.setOrganizationAndProject(project,axios,store))
router.push({path:'/console/project/'+ project.id})
},
async goProjectModel(project, model, axios, store, router) {
if(await this.setOrganizationAndProject(project,axios,store))
router.push({path:'/console/project/'+ project.id +'/models/' + model.versionId})
},
async goProjectWebPoint(project, point, axios, store, router) {
if(await this.setOrganizationAndProject(project,axios,store))
router.push({path:'/console/project/'+ project.id +'/webpoint/' + point.id})
},
async goProjectEdgePoint(project, point, axios, store, router) {
if(await this.setOrganizationAndProject(project,axios,store) ){
router.push({path:'/console/project/' + project.id + '/edges/' + point.id})
}
},
async goProjectCallback(projectId, axios, store, callback) {
let project = null
await axios.get('/auth/project/' + projectId, {
params:{
m: true
}
})
.then(res=> {
project= res.data.body
})
if(await this.setOrganizationAndProject(project,axios,store)){
if(callback) {
callback()
}
}
},
}
const colors = {
colToHex(c) {
let color = (c < 75) ? c + 75 : c
let hex = color.toString(16);
return hex.length == 1 ? "0" + hex : hex;
},
rgbToHex(r,g,b) {
return "#" + this.colToHex(r) + this.colToHex(g) + this.colToHex(b);
},
getRandomColor() {
return this.rgbToHex(
Math.floor(Math.random() * 255),
Math.floor(Math.random() * 255),
Math.floor(Math.random() * 255));
},
getRandomColorByEmail(email) {
return this.rgbToHex(
Math.floor((email.length * email.length * email.charCodeAt(0)) % 255),
Math.floor((email.length * email.length * email.charCodeAt(1)) % 255),
Math.floor((email.length * email.length * email.charCodeAt(2)) % 255));
},
getSplitColor(i) {
if(i === 1 || i === 'VALID') {
return '#2E7D32'
} else if (i === 2 || i === 'TEST') {
return '#9E9D24'
} else {
return '#01579B'
}
},
}
Vue.prototype.$time = time;
Vue.prototype.$utils = utils;
Vue.prototype.$regular = regular;
Vue.prototype.$rules = rules;
Vue.prototype.$lang = lang;
Vue.prototype.$properties = properties;
Vue.prototype.$colors = colors;
Vue.prototype.$move = move;
export default ({app}, inject) => {
inject('time', time);
inject('utils', utils);
inject('regular', regular);
inject('rules', rules);
inject('lang', lang);
inject('properties', properties);
inject('colors', colors);
inject('move', move);
}
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