|
@@ -1,35 +1,41 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="mainPage flex-v">
|
3
|
|
- <div class="header flex-h">
|
4
|
|
- <div class="flex-item flex-h">
|
5
|
|
- <i class="iconfont icon-sousuo"></i>
|
6
|
|
- <div class="flex-item">
|
7
|
|
- <div>
|
8
|
|
- <input type="text" v-model="searchKey" placeholder="请输入图书名">
|
|
3
|
+ <loadMore :on-infinite="onInfinite" :dataList="scrollData">
|
|
4
|
+ <div class="header flex-h">
|
|
5
|
+ <div class="flex-item flex-h">
|
|
6
|
+ <i class="iconfont icon-sousuo"></i>
|
|
7
|
+ <div class="flex-item">
|
|
8
|
+ <div>
|
|
9
|
+ <input type="text" v-model="searchKey" placeholder="请输入图书名">
|
|
10
|
+ </div>
|
9
|
11
|
</div>
|
10
|
12
|
</div>
|
|
13
|
+ <a @click="search">搜索</a>
|
11
|
14
|
</div>
|
12
|
|
- <a @click="search">搜索</a>
|
13
|
|
- </div>
|
14
|
|
- <div class="searchRemark" v-if="showSearch">
|
15
|
|
- <span>
|
16
|
|
- 关于“
|
17
|
|
- <em>{{doSearchKey}}</em>”的搜索结果:
|
18
|
|
- </span>
|
19
|
|
- </div>
|
20
|
|
- <div class="flex-item" :hidden="!showSearch">
|
21
|
|
- <div>
|
22
|
|
- <div class="noData" v-if="(books.list || []).length < 1">
|
23
|
|
- <img src="../../../../common/icon/kong.png" alt>
|
24
|
|
- <span>暂无内容</span>
|
|
15
|
+ <div class="searchRemark" v-if="showSearch">
|
|
16
|
+ <span>
|
|
17
|
+ 关于“
|
|
18
|
+ <em>{{doSearchKey}}</em>”的搜索结果:
|
|
19
|
+ </span>
|
|
20
|
+ </div>
|
|
21
|
+ <div class="flex-item list" :hidden="!showSearch">
|
|
22
|
+ <div>
|
|
23
|
+ <div class="noData" v-if="(books.list || []).length < 1">
|
|
24
|
+ <img src="../../../../common/icon/kong.png" alt>
|
|
25
|
+ <span>暂无内容</span>
|
|
26
|
+ </div>
|
|
27
|
+ <ul v-else>
|
|
28
|
+ <li v-for="(item, index) in books.list" :key="index">
|
|
29
|
+ <libraryListItem
|
|
30
|
+ :data="item"
|
|
31
|
+ :status="mineBookStatus(item)"
|
|
32
|
+ @appointmentBook="appointmentBook"
|
|
33
|
+ ></libraryListItem>
|
|
34
|
+ </li>
|
|
35
|
+ </ul>
|
25
|
36
|
</div>
|
26
|
|
- <ul v-else>
|
27
|
|
- <li v-for="(item, index) in books.list" :key="index">
|
28
|
|
- <libraryListItem :data="item" :status="mineBookStatus(item)" @appointmentBook="appointmentBook"></libraryListItem>
|
29
|
|
- </li>
|
30
|
|
- </ul>
|
31
|
37
|
</div>
|
32
|
|
- </div>
|
|
38
|
+ </loadMore>
|
33
|
39
|
<van-dialog v-model="showAppointmentDialog" :show-confirm-button="false">
|
34
|
40
|
<div class="dialogContent">
|
35
|
41
|
<span class="title">确认在线预约当前图书?</span>
|
|
@@ -48,6 +54,7 @@
|
48
|
54
|
<script>
|
49
|
55
|
import libraryListItem from '../../../../components/libraryListItem/index'
|
50
|
56
|
import toolClass from '../../../../util/util'
|
|
57
|
+import loadMore from '@/components/vue-load-more/index'
|
51
|
58
|
import { mapState, createNamespacedHelpers } from 'vuex'
|
52
|
59
|
const { mapState: mapBookState, mapActions: mapBookAction } = createNamespacedHelpers('book')
|
53
|
60
|
export default {
|
|
@@ -62,6 +69,9 @@ export default {
|
62
|
69
|
pagesize: 10,
|
63
|
70
|
doSearchKey: '',
|
64
|
71
|
reserveBookId: '',
|
|
72
|
+ scrollData: {
|
|
73
|
+ noFlag: false // 暂无更多数据显示
|
|
74
|
+ },
|
65
|
75
|
}
|
66
|
76
|
},
|
67
|
77
|
created () {
|
|
@@ -76,13 +86,14 @@ export default {
|
76
|
86
|
books: x => x.books,
|
77
|
87
|
mineBooks: x => x.minebooks,
|
78
|
88
|
}),
|
79
|
|
- reserveEndDate() {
|
|
89
|
+ reserveEndDate () {
|
80
|
90
|
return toolClass.calDate(7)
|
81
|
91
|
}
|
82
|
92
|
},
|
83
|
93
|
mounted () {
|
84
|
94
|
},
|
85
|
95
|
components: {
|
|
96
|
+ loadMore,
|
86
|
97
|
libraryListItem
|
87
|
98
|
},
|
88
|
99
|
methods: {
|
|
@@ -95,7 +106,7 @@ export default {
|
95
|
106
|
search () { // 搜索
|
96
|
107
|
if (this.searchKey !== '') {
|
97
|
108
|
this.doSearchKey = this.searchKey
|
98
|
|
- this.getSearchList()
|
|
109
|
+ this.onInfinite()
|
99
|
110
|
} else {
|
100
|
111
|
this.$toast('搜索关键词不能为空')
|
101
|
112
|
}
|
|
@@ -128,7 +139,26 @@ export default {
|
128
|
139
|
},
|
129
|
140
|
mineBookStatus (item) {
|
130
|
141
|
return ((this.mineBooks.list || []).filter(x => x.BookId === item.BookId && (x.BorrowStatus == '4' || x.BorrowStatus == '1' || x.BorrowStatus == '0'))[0] || {}).BorrowStatus
|
131
|
|
- }
|
|
142
|
+ },
|
|
143
|
+ onInfinite () {
|
|
144
|
+ let more = this.$el.querySelector('.load-more')
|
|
145
|
+ this.getBookList({
|
|
146
|
+ caseid: this.caseid,
|
|
147
|
+ name: this.doSearchKey,
|
|
148
|
+ page: this.page,
|
|
149
|
+ pagesize: this.pagesize,
|
|
150
|
+ }).then((res) => {
|
|
151
|
+ this.showSearch = true
|
|
152
|
+ this.page++
|
|
153
|
+ res.list = res.list || []
|
|
154
|
+ if (res.list.length < res.pageSize) {
|
|
155
|
+ more.style.display = 'none'// 隐藏加载条
|
|
156
|
+ this.scrollData.noFlag = true
|
|
157
|
+ } else {
|
|
158
|
+ more.style.display = 'none'// 隐藏加载条
|
|
159
|
+ }
|
|
160
|
+ })
|
|
161
|
+ },
|
132
|
162
|
}
|
133
|
163
|
}
|
134
|
164
|
</script>
|
|
@@ -187,19 +217,19 @@ export default {
|
187
|
217
|
}
|
188
|
218
|
}
|
189
|
219
|
}
|
190
|
|
- > .flex-item {
|
|
220
|
+ .list {
|
191
|
221
|
position: relative;
|
192
|
222
|
overflow: hidden;
|
193
|
223
|
> div {
|
194
|
224
|
width: 100%;
|
195
|
|
- position: absolute;
|
196
|
|
- left: 0;
|
197
|
|
- top: 0;
|
198
|
|
- bottom: 0;
|
199
|
|
- overflow-y: scroll;
|
200
|
|
- -webkit-overflow-scrolling: touch;
|
201
|
|
- transform: translateZ(0);
|
202
|
|
- -webkit-transform: translateZ(0);
|
|
225
|
+ // position: absolute;
|
|
226
|
+ // left: 0;
|
|
227
|
+ // top: 0;
|
|
228
|
+ // bottom: 0;
|
|
229
|
+ // overflow-y: scroll;
|
|
230
|
+ // -webkit-overflow-scrolling: touch;
|
|
231
|
+ // transform: translateZ(0);
|
|
232
|
+ // -webkit-transform: translateZ(0);
|
203
|
233
|
.noData {
|
204
|
234
|
width: 100%;
|
205
|
235
|
margin: 0.5rem auto 0;
|
|
@@ -229,7 +259,7 @@ export default {
|
229
|
259
|
width: 100%;
|
230
|
260
|
position: relative;
|
231
|
261
|
overflow: hidden;
|
232
|
|
- margin: .1rem auto 0;
|
|
262
|
+ margin: 0.1rem auto 0;
|
233
|
263
|
}
|
234
|
264
|
}
|
235
|
265
|
}
|