This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5607ec2
commit f8833b4
Showing
2 changed files
with
132 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import request from '@/utils/request' | ||
|
||
export const getWishBooks = (query) => request({ | ||
url: '/api/wishbook', | ||
method: 'get', | ||
params: Object.assign(query, { | ||
page: query.page | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,125 @@ | ||
<template> | ||
<div> | ||
희망도서 현재 내역 | ||
<div class="app-container"> | ||
<!-- 검색부 --> | ||
<el-form :inline="true" :model="queryForm"> | ||
<el-form-item label="제목"> | ||
<el-input v-model="queryForm.title"></el-input> | ||
</el-form-item> | ||
<el-form-item label="저자"> | ||
<el-input v-model="queryForm.author"></el-input> | ||
</el-form-item> | ||
<el-form-item label="출판사"> | ||
<el-input v-model="queryForm.publisher"></el-input> | ||
</el-form-item> | ||
<el-form-item label="isbn"> | ||
<el-input v-model="queryForm.isbn"></el-input> | ||
</el-form-item> | ||
<el-form-item> | ||
<el-button type="primary" @click="onSubmit">검색</el-button> | ||
</el-form-item> | ||
</el-form> | ||
|
||
<!-- 책 리스트 --> | ||
<el-table | ||
empty-text="희망도서가 없습니다." | ||
:data="wishBooks.content" | ||
style="width: 100%; min-height: 400px;" | ||
highlight-current-row | ||
fit | ||
> | ||
<el-table-column align="center" label="번호" width="100"> | ||
<span slot-scope="scope">{{ scope.row.id }}</span> | ||
</el-table-column> | ||
<el-table-column align="center" label="제목"> | ||
<span slot-scope="scope" class="link-type" @click="onClickTitle(scope.row.id)">{{ scope.row.title }}</span> | ||
</el-table-column> | ||
<el-table-column align="center" label="작가"> | ||
<span slot-scope="scope">{{ scope.row.author }}</span> | ||
</el-table-column> | ||
<el-table-column align="center" label="출판사"> | ||
<span slot-scope="scope">{{ scope.row.publisher }}</span> | ||
</el-table-column> | ||
<el-table-column align="center" label="ISBN"> | ||
<span slot-scope="scope">{{ scope.row.isbn }}</span> | ||
</el-table-column> | ||
<el-table-column align="center" label="신청자"> | ||
<span slot-scope="scope">{{ scope.row.requestUser }}</span> | ||
</el-table-column> | ||
<el-table-column align="center" label="신청일자"> | ||
<span slot-scope="scope">{{ scope.row.createdAt }}</span> | ||
</el-table-column> | ||
</el-table> | ||
|
||
<!-- 페이지네이션 --> | ||
<div class="block" style="margin: 16px;"> | ||
<el-pagination | ||
:current-page="queryForm.page" | ||
:page-sizes="[10, 20, 30, 50]" | ||
:page-size="queryForm.size" | ||
layout="total, sizes, prev, pager, next, jumper" | ||
:total="wishBooks.totalElements" | ||
@size-change="handleSizeChange" | ||
@current-change="handleCurrentChange" | ||
> | ||
</el-pagination> | ||
</div> | ||
</div> | ||
</template> | ||
</template> | ||
|
||
<script> | ||
import {getWishBooks} from "@/api/wishBook"; | ||
export default { | ||
data() { | ||
return { | ||
queryForm: { | ||
title: '', | ||
author: '', | ||
publisher: '', | ||
isbn: '', | ||
page: 0, | ||
size: 10 | ||
}, | ||
wishBooks: { | ||
totalElements: 1, | ||
totalPages: 1, | ||
number: 1, | ||
content: [] | ||
}, | ||
} | ||
}, | ||
async beforeMount() { | ||
await this.fetchWishBooks() | ||
}, | ||
methods: { | ||
async fetchWishBooks() { | ||
try { | ||
const response = await getWishBooks(this.queryForm) | ||
const {content, totalElements, totalPages, number} = response | ||
this.wishBooks.content = content | ||
this.wishBooks.totalElements = totalElements | ||
this.wishBooks.totalPages = totalPages | ||
this.wishBooks.number = number | ||
console.log(this.wishBooks) | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
}, | ||
async onSubmit() { | ||
await this.fetchWishBooks() | ||
}, | ||
handleSizeChange(size) { | ||
this.queryForm.size = size | ||
}, | ||
handleCurrentChange(page) { | ||
this.queryForm.page = page | ||
} | ||
} | ||
} | ||
</script> |