Skip to content
Snippets Groups Projects
Commit d3eb988c authored by YongJae's avatar YongJae
Browse files

Error, UI fixed

parent 34c16029
No related branches found
No related tags found
1 merge request!22Error, UI fixed
......@@ -32,7 +32,7 @@ router.post("/cancel", async (req, res) => {
console.error(err);
return;
}
transaction.buyerId = "";
transaction.buyerId = null;
transaction.on_transaction = false;
transaction.save();
res.json({ result: true });
......@@ -43,7 +43,7 @@ router.post("/cancel", async (req, res) => {
}
});
router.post("/success", async (req, res) => {
router.post("/end", async (req, res) => {
console.log("POST - success start");
var sess = req.session;
var req_bookTitle = req.body.bookTitle;
......@@ -68,8 +68,6 @@ router.post("/success", async (req, res) => {
book.stock--;
book.save();
});
// transaction.on_transaction = "";
// transaction.save();
res.json({ result: true });
}
);
......@@ -119,7 +117,7 @@ router.post("/sell", async (req, res) => {
var transaction = new Transaction();
transaction.sellerId = sellerId;
transaction.buyerId = "";
transaction.buyerId = null;
transaction.bookTitle = book.title;
transaction.on_transaction = false;
book.stock++;
......
<template>
<div id="app" class="page-container">
<md-app md-mode="fixed-last">
<md-app-toolbar class="md-large md-dense md-primary">
<md-app-toolbar class="md-dense md-primary">
<div class="md-toolbar-row">
<span class="md-title">MajorBook</span>
</div>
......@@ -15,7 +15,6 @@
<Logout />
</div>
</div>
<div class="md-toolbar-row">
<md-tabs class="md-primary" style="margin: auto; height: 30px">
<md-tab id="tab-home" md-label="Home" to="/home"></md-tab>
......@@ -67,15 +66,6 @@ export default {
});
}
}
// computed: {
// checkLoggedIn() {
// console.log(this.checkSession());
// if (this.checkSession() === true) {
// return true;
// }
// return false;
// }
// }
};
</script>
......
......@@ -120,8 +120,22 @@ export default {
grade: null,
major: null,
type: null,
option1: ["1학년", "2학년", "3학년", "4학년","전학년"],
option2: ["소프트웨어학과", "미디어학과", "경제학과","경영학과","수학과","산업공학과","사회학과","전자공학과","기계공학과","신소재공학과","환경안전공학과","의학전공","공통과목"],
option1: ["1학년", "2학년", "3학년", "4학년", "전학년"],
option2: [
"소프트웨어학과",
"미디어학과",
"경제학과",
"경영학과",
"수학과",
"산업공학과",
"사회학과",
"전자공학과",
"기계공학과",
"신소재공학과",
"환경안전공학과",
"의학전공",
"공통과목"
],
option3: ["전공필수", "전공선택", "교양선택", "기초과목"],
Books: [],
submit: {
......
......@@ -34,9 +34,7 @@
<div class="md-title">이 책을 구매하시겠습니까?</div>
</md-card-header>
<md-card-actions>
<md-button class="md-raised md-primary" v-on:click="buyBook"
>구매</md-button
>
<md-button class="md-raised md-primary" v-on:click="buyBook">구매</md-button>
</md-card-actions>
</md-card>
</div>
......
......@@ -34,9 +34,7 @@
<div class="md-title">이 책을 판매하시겠습니까?</div>
</md-card-header>
<md-card-actions>
<md-button class="md-raised md-primary" v-on:click="sellBook"
>판매</md-button
>
<md-button class="md-raised md-primary" v-on:click="sellBook">판매</md-button>
</md-card-actions>
</md-card>
</div>
......
......@@ -9,38 +9,19 @@
<md-field :class="getValidationClass('id')">
<label>ID</label>
<md-input name="ID" id="ID" v-model="user.id" :disabled="sending" />
<span class="md-error" v-if="!$v.user.id.required"
>The ID is required"</span
>
<span class="md-error" v-else-if="!$v.user.id.minlength"
>아이디는 다섯 자리 이상이어야 합니다.</span
>
<span class="md-error" v-if="!$v.user.id.required">The ID is required"</span>
<span class="md-error" v-else-if="!$v.user.id.minlength">아이디는 다섯 자리 이상이어야 합니다.</span>
</md-field>
<md-field :class="getValidationClass('password')">
<label>Password</label>
<md-input
v-model="user.password"
type="password"
:disabled="sending"
/>
<span class="md-error" v-if="!$v.user.password.required"
>The Password is required</span
>
<span class="md-error" v-else-if="!$v.user.password.minlength"
>비밀번호는 세 자리 이상이어야 합니다.</span
>
<md-input v-model="user.password" type="password" :disabled="sending" />
<span class="md-error" v-if="!$v.user.password.required">The Password is required</span>
<span class="md-error" v-else-if="!$v.user.password.minlength">비밀번호는 세 자리 이상이어야 합니다.</span>
</md-field>
<md-button
class="md-raised md-primary"
type="submit"
:disabled="sending"
>Login</md-button
>
<md-button class="md-primary" v-on:click="active = false"
>Close</md-button
>
<md-button class="md-raised md-primary" type="submit" :disabled="sending">Login</md-button>
<md-button class="md-primary" v-on:click="active = false">Close</md-button>
</md-content>
</form>
</md-dialog>
......@@ -134,7 +115,10 @@ export default {
};
</script>
<style>
<style scoped>
.md-primary {
margin: 0;
}
.select {
margin: 15px;
display: inline-flex;
......
......@@ -8,84 +8,43 @@
<md-field :class="getValidationClass('name')">
<label>Name</label>
<md-input name="name" v-model="user.name" :disabled="sending" />
<span class="md-error" v-if="!$v.user.name.required"
>The Name is required"</span
>
<span class="md-error" v-else-if="!$v.user.name.minlength"
>이름은 두 자리 이상이어야 합니다.</span
>
<span class="md-error" v-if="!$v.user.name.required">The Name is required"</span>
<span class="md-error" v-else-if="!$v.user.name.minlength">이름은 두 자리 이상이어야 합니다.</span>
</md-field>
<md-field :class="getValidationClass('id')">
<label for="id">ID</label>
<md-input name="id" v-model="user.id" :disabled="sending" />
<span class="md-error" v-if="!$v.user.id.required"
>The ID is required"</span
>
<span class="md-error" v-else-if="!$v.user.id.minlength"
>아이디는 다섯 자리 이상이어야 합니다.</span
>
<span class="md-error" v-if="!$v.user.id.required">The ID is required"</span>
<span class="md-error" v-else-if="!$v.user.id.minlength">아이디는 다섯 자리 이상이어야 합니다.</span>
</md-field>
<md-field
:md-toggle-password="true"
:class="getValidationClass('password')"
>
<md-field :md-toggle-password="true" :class="getValidationClass('password')">
<label for="password">Password</label>
<md-input
name="password"
v-model="user.password"
type="password"
:disabled="sending"
/>
<span class="md-error" v-if="!$v.user.password.required"
>The Password is required</span
>
<span class="md-error" v-else-if="!$v.user.password.minlength"
>비밀번호는 세 자리 이상이어야 합니다.</span
>
<md-input name="password" v-model="user.password" type="password" :disabled="sending" />
<span class="md-error" v-if="!$v.user.password.required">The Password is required</span>
<span class="md-error" v-else-if="!$v.user.password.minlength">비밀번호는 세 자리 이상이어야 합니다.</span>
</md-field>
<md-field :class="getValidationClass('email')">
<label for="email">Email</label>
<md-input
name="email"
type="email"
v-model="user.email"
:disabled="sending"
/>
<span class="md-error" v-if="!$v.user.email.required"
>The email is required</span
>
<span class="md-error" v-else-if="!$v.user.email.email"
>Invalid email</span
>
<md-input name="email" type="email" v-model="user.email" :disabled="sending" />
<span class="md-error" v-if="!$v.user.email.required">The email is required</span>
<span class="md-error" v-else-if="!$v.user.email.email">Invalid email</span>
</md-field>
<md-field :class="getValidationClass('phonenumber')">
<label for="phonenumber">Phone Number</label>
<md-input
name="phonenumber"
v-model="user.phonenumber"
:disabled="sending"
/>
<span class="md-error" v-if="!$v.user.phonenumber.required"
>The Phone Number is required</span
>
<span class="md-error" v-else-if="!$v.user.phonenumber.minlength"
>휴대폰 번호는 10자리 이상이어야 합니다.</span
>
<md-input name="phonenumber" v-model="user.phonenumber" :disabled="sending" />
<span class="md-error" v-if="!$v.user.phonenumber.required">The Phone Number is required</span>
<span
class="md-error"
v-else-if="!$v.user.phonenumber.minlength"
>휴대폰 번호는 10자리 이상이어야 합니다.</span>
</md-field>
<md-button
class="md-raised md-primary"
type="submit"
:disabled="sending"
>Sign Up</md-button
>
<md-button class="md-primary" v-on:click="active = false"
>Close</md-button
>
<md-button class="md-raised md-primary" type="submit" :disabled="sending">Sign Up</md-button>
<md-button class="md-primary" v-on:click="active = false">Close</md-button>
</md-content>
</form>
</md-dialog>
......@@ -93,6 +52,9 @@
</template>
<style scoped>
.md-primary {
margin: 0;
}
.select {
margin: 15px;
display: inline-flex;
......
......@@ -7,12 +7,9 @@
<md-list-item
v-for="transaction in transactions"
:key="transaction._id"
v-if="transaction.buyerId == userId"
v-if="transaction.buyerId == userId && transaction.buyerId != null"
>
<md-button
class="md-icon-button md-raised"
style="color:#1DDB16;backgroundColor:#1DDB16"
>
<md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16">
<img src="../../assets/book-open-flat.png" />
</md-button>
<div class="md-list-item-text">
......@@ -51,19 +48,10 @@ export default {
transactions: [],
userId: ""
}),
computed: {
// buyerTransaction() { - v-for에 computed 안쓰면 코드 빨간색됨, 작동은 함
// return this.transactions.filter(tran => {
// if(this.buyerId === this.userId) {
// return mov;
// }
// })
// }
},
methods: {
cancelTransaction(book_Title) {
this.$http
.post("/api/transaction/success", {
.post("/api/transaction/cancel", {
bookTitle: book_Title
})
.then(response => {
......@@ -76,7 +64,7 @@ export default {
},
successTransaction(book_Title) {
this.$http
.post("/api/transaction/success", {
.post("/api/transaction/end", {
bookTitle: book_Title
})
.then(response => {
......
......@@ -9,10 +9,7 @@
:key="transaction._id"
v-if="transaction.sellerId == userId"
>
<md-button
class="md-icon-button md-raised"
style="color:#1DDB16;backgroundColor:#1DDB16"
>
<md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16">
<img src="../../assets/book-open-flat.png" />
</md-button>
<div class="md-list-item-text">
......@@ -54,11 +51,11 @@ export default {
methods: {
cancelTransaction(book_Title) {
this.$http
.post("/api/transaction/success", {
.post("/api/transaction/end", {
bookTitle: book_Title
})
.then(response => {
alert("거래를 취소하였습니다.");
alert("판매를 취소하였습니다.");
location.reload();
})
.catch(error => {
......@@ -67,7 +64,7 @@ export default {
},
successTransaction(book_Title) {
this.$http
.post("/api/transaction/success", {
.post("/api/transaction/end", {
bookTitle: book_Title
})
.then(response => {
......
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