Skip to content
Snippets Groups Projects
Commit 282238ac authored by LeeYongJae's avatar LeeYongJae
Browse files

Revert "Merge branch 'login_with_session' into 'master'"

This reverts merge request !13
parent eba4d26a
No related branches found
No related tags found
No related merge requests found
......@@ -43,12 +43,11 @@ router.get("/logout", function(req, res) {
if (err) {
console.log(err);
} else {
console.log("Hello");
res.redirect("http://localhost:8081/"); // 수정해야 할 듯
res.redirect("/"); // 수정해야 할 듯
}
});
} else {
res.redirect("http://localhost:8081/");
res.redirect("/");
}
});
......
......@@ -6,13 +6,15 @@
<span class="md-title">MajorBook</span>
</div>
<div style="flex:1; height:20px" align="right">
<div v-if="isLoggedIn === false">
<Login />
<SignUp />
</div>
<div v-else>
<Logout />
<div style="flex:1">
<div align="right">
<div v-if="!checkLoggedIn">
<Login />
<SignUp />
</div>
<div v-if="checkLoggedIn">
<Logout />
</div>
</div>
</div>
......@@ -20,7 +22,11 @@
<md-tabs class="md-primary" style="margin: auto; height: 30px">
<md-tab id="tab-home" md-label="Home" to="/home"></md-tab>
<md-tab id="tab-profile" md-label="Profile" to="/profile"></md-tab>
<md-tab id="tab-list" md-label="전공서적보기" to="/BookSearchPage"></md-tab>
<md-tab
id="tab-list"
md-label="전공서적보기"
to="/BookSearchPage"
></md-tab>
</md-tabs>
</div>
</md-app-toolbar>
......@@ -57,26 +63,25 @@ export default {
},
methods: {
checkSession() {
this.$http.get("/api/login/checkSession").then(response => {
console.log(response.data);
this.$http.get("/api/login/checkSession").then(function(response) {
//console.log(response.data);
if (response.data === true) {
return (this.isLoggedIn = true);
//this.$router.push("home");
return true;
} else {
return (this.isLoggedIn = false);
return false;
}
});
}
},
computed: {
checkLoggedIn() {
console.log(this.checkSession());
if (this.checkSession() === true) {
return true;
}
return false;
}
}
// computed: {
// checkLoggedIn() {
// console.log(this.checkSession());
// if (this.checkSession() === true) {
// return (this.isLoggedIn = true);
// }
// return (this.isLoggedIn = false);
// }
// }
};
</script>
......
......@@ -33,18 +33,18 @@
<md-card-header>
<md-card-header-text>
<div class="md-title">
{{ Book.title }}
{{Book.title}}
<br />
<br />
</div>
<div class="md-subhead" style="text-align:left;font-weight: bold;">
# 학년: {{ Book.grade }}
# 학년: {{Book.grade}}
<br />
# 전공: {{ Book.major }}
# 전공: {{Book.major}}
<br />
# 세부사항: {{ Book.type }}
# 세부사항: {{Book.type}}
<br />
# 매물: {{ Book.stock }}
# 매물: {{Book.stock}}
</div>
</md-card-header-text>
<md-card-media md-medium>
......@@ -96,85 +96,98 @@
</div>
</template>
<script>
import Vue from "vue";
import VueMaterial from "vue-material";
import Multiselect from "vue-multiselect";
import "vue-material/dist/vue-material.min.css";
import "vue-material/dist/theme/default.css";
Vue.use(VueMaterial);
import Vue from 'vue'
import VueMaterial from 'vue-material'
import Multiselect from 'vue-multiselect'
import 'vue-material/dist/vue-material.min.css'
import 'vue-material/dist/theme/default.css'
Vue.use(VueMaterial)
export default {
components: { Multiselect },
name: "MaterialIcons",
data() {
return {
bottomPosition: "md-bottom-right",
active: false,
SearchResult: false,
grade: null,
major: null,
type: null,
option1: ["1학년", "2학년", "3학년", "4학년"],
option2: ["소프트웨어학과", "미디어학과", "경제학과"],
option3: ["전공 필수", "전공 선택", "교양선택", "기초과목"],
Books: [],
submit: {
title: "",
grade: "",
major: "",
src: ""
}
};
},
created() {
this.$http.get("/api/books").then(response => {
this.Books = response.data;
console.log("Success");
console.log(this.Books);
});
},
methods: {
Search: function() {
if (this.grade !== null && this.major !== null && this.type !== null) {
this.SearchResult = true;
console.log(this.SearchResult);
} else {
alert("검색할 카테고리를 전부 입력해주세요");
}
components: { Multiselect },
name: 'MaterialIcons',
data() {
return {
bottomPosition: 'md-bottom-right',
active : false,
SearchResult : false,
grade: null,
major: null,
type: null,
option1: ['1학년','2학년','3학년','4학년'],
option2: ['소프트웨어학과','미디어학과','경제학과'],
option3: ['전공 필수', '전공 선택', '교양선택','기초과목'],
Books : [
],
submit:{
title : "",
grade: "",
major : "",
src : "",
}
};
},
Register() {
this.$http
.post("/api/books", this.submit)
.then(res => {
console.log("Sumit Success");
})
.catch(err => {
console.log("Submit failed");
});
this.active = false;
created() {
this
.$http
.get('/api/books')
.then(response => {
this.Books = response.data;
console.log("Success")
console.log(this.Books)
})
},
methods:{
Search: function(){
if(this.grade !== null && this.major !== null && this.type !== null)
{
this.SearchResult = true;
console.log(this.SearchResult);
}
else
{
alert("검색할 카테고리를 전부 입력해주세요")
}
},
Register(){
this.$http
.post("/api/books", this.submit)
.then(res => {
console.log("Sumit Success");
})
.catch(err => {
console.log("Submit failed");
});
this.active = false;
}
}
}
};
</script>
<style lang="css">
html,
body {
text-align: center;
margin: 0;
width: 100%;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
justify-content: center;
<style lang='css'>
html,body {
text-align: center;
margin:0;
width:100%;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
justify-content: center;
}
.search {
margin-bottom: 0.5%;
margin-Bottom: 0.5%;
}
.select {
text-align: center;
margin-top: 2%;
text-align: center;
margin-Top: 2%;
}
.button {
margin-top: 70px;
.button{
margin-top: 70px;
}
</style>
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
<style src="vue-multiselect/dist/vue-multiselect.min.css">
</style>
\ No newline at end of file
......@@ -13,8 +13,10 @@
<md-input v-model="user.password" type="password" />
</md-field>
<md-button class="md-raised md-primary" v-on:click="login">Login</md-button>
<md-button class="md-primary" v-on:click="active = false">Close</md-button>
<md-button class="md-primary" v-on:click="login">Login</md-button>
<md-button class="md-primary" v-on:click="active = false"
>Close</md-button
>
</md-dialog>
</div>
</template>
......@@ -25,7 +27,6 @@ import VueMaterial from "vue-material";
import "vue-material/dist/vue-material.min.css";
import "vue-material/dist/theme/default.css";
Vue.use(VueMaterial);
export default {
data: function() {
return {
......@@ -49,7 +50,6 @@ export default {
alert("success login");
//this.$router.push("Logout");
this.active = false;
location.reload();
},
error => {
// error 를 보여줌
......
......@@ -20,9 +20,7 @@ export default {
console.log("Logout start");
this.$http.get("/api/login/logout").then(response => {
if (response) {
alert("success logout");
//this.$router.push("home");
location.reload();
}
});
}
......
<template>
<div id="signup">
<div id="logout">
<md-button class="md-primary" v-on:click="active = true">Sign Up</md-button>
<md-dialog :md-active.sync="active" style="width:500px; height: 1000px">
<md-dialog-title>Sign Up</md-dialog-title>
......@@ -23,13 +23,17 @@
<md-input name="email" v-model="user.email" />
</md-field>
<md-button class="md-raised md-primary" v-on:click="signUp">Sign Up</md-button>
<md-button class="md-primary" v-on:click="active = false">Close</md-button>
<md-button class="md-raised md-primary" v-on:click="signUp"
>Sign Up</md-button
>
<md-button class="md-primary" v-on:click="active = false"
>Close</md-button
>
</md-dialog>
</div>
</template>
<style scoped>
<style>
.select {
margin: 15px;
display: inline-flex;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment