update
This commit is contained in:
@@ -1,5 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view />
|
<div id="app">
|
||||||
|
<router-view
|
||||||
|
:startSpin="startSpin"
|
||||||
|
:stopSpin="stopSpin"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div id="spinner-container" v-if="spin">
|
||||||
|
<div class="spinner-container__inner">
|
||||||
|
<div class="spinner-container__inner__inner">
|
||||||
|
<div class="lds-ripple" ><div></div><div></div></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -7,6 +22,25 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
components: {
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
spin: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
startSpin() {
|
||||||
|
this.spin = true;
|
||||||
|
},
|
||||||
|
stopSpin(smooth = false) {
|
||||||
|
if (smooth) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.spin = false;
|
||||||
|
}, 300);
|
||||||
|
} else {
|
||||||
|
this.spin = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -20,4 +54,61 @@ export default {
|
|||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
margin-top: 60px;
|
margin-top: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#spinner-container {
|
||||||
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner-container__inner {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
/*background-color: #2c3e50;*/
|
||||||
|
/*background-color: rgba(44, 62, 80, 0.25);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner-container__inner__inner {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lds-ripple {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
.lds-ripple div {
|
||||||
|
position: absolute;
|
||||||
|
border: 4px solid slateblue;
|
||||||
|
opacity: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
|
||||||
|
}
|
||||||
|
.lds-ripple div:nth-child(2) {
|
||||||
|
animation-delay: -0.5s;
|
||||||
|
}
|
||||||
|
@keyframes lds-ripple {
|
||||||
|
0% {
|
||||||
|
top: 36px;
|
||||||
|
left: 36px;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width: 72px;
|
||||||
|
height: 72px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateArticle(id, {title = '', content = ''}, authorization) {
|
updateArticle(id, {title = '', content = ''}, authorization) {
|
||||||
|
|
||||||
return axios({
|
return axios({
|
||||||
url: '/api/articles/' + id,
|
url: '/api/articles/' + id,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
|
|||||||
15
src/front/src/components/common/Header.vue
Normal file
15
src/front/src/components/common/Header.vue
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<header>
|
||||||
|
Head
|
||||||
|
</header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "Header"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,37 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="!pending">
|
<div>
|
||||||
<article v-for="article in articles" v-bind:key="article.id">
|
<Header />
|
||||||
<router-link :to="{name: 'DetailArticle', params: {id: article.id}}">
|
<div v-if="!pending">
|
||||||
<span>{{ article.title }}</span>
|
<article v-for="article in articles" v-bind:key="article.id">
|
||||||
</router-link>
|
<router-link :to="{name: 'DetailArticle', params: {id: article.id}}">
|
||||||
<span @click="clickUser">{{ article.user.name }}</span>
|
<span>{{ article.title }}</span>
|
||||||
</article>
|
</router-link>
|
||||||
|
<span @click="clickUser">{{ article.user.name }}</span>
|
||||||
|
</article>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<div v-if="user">
|
<div v-if="user">
|
||||||
<div>
|
<div>
|
||||||
<router-link to="/articles/write">글쓰기</router-link>
|
<router-link to="/articles/write">글쓰기</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button type="button" @click="logout">로그아웃</button>
|
<button type="button" @click="logout">로그아웃</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<router-link to="/me">My</router-link>
|
<router-link to="/me">My</router-link>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import authService from "../../services/authService";
|
import authService from "../../services/authService";
|
||||||
import articleService from "../../services/articleService";
|
import articleService from "../../services/articleService";
|
||||||
|
import Header from '../../components/common/Header';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "List",
|
name: "List",
|
||||||
|
components: {
|
||||||
|
Header
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
startSpin: Function,
|
||||||
|
stopSpin: Function
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
articles: [],
|
articles: [],
|
||||||
@@ -48,6 +58,8 @@
|
|||||||
// );
|
// );
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
|
this.startSpin();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await authService.session();
|
const { data } = await authService.session();
|
||||||
this.user = data;
|
this.user = data;
|
||||||
@@ -55,9 +67,10 @@
|
|||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// await authService.banishIfUserUnAuthenticated();
|
|
||||||
this.articles = await articleService.getArticles({});
|
this.articles = await articleService.getArticles({});
|
||||||
this.pending = false;
|
this.pending = false;
|
||||||
|
|
||||||
|
this.stopSpin(true);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async logout() {
|
async logout() {
|
||||||
|
|||||||
Reference in New Issue
Block a user