|
@@ -0,0 +1,454 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="bgColor">
|
|
3
|
+ <div slot="content" class="scroll-wrapper">
|
|
4
|
+ <div class="demo">
|
|
5
|
+ <div class="scroll-list-wrap">
|
|
6
|
+ <cube-scroll
|
|
7
|
+ ref="scroll"
|
|
8
|
+ :data="items"
|
|
9
|
+ :options="options"
|
|
10
|
+ @pulling-down="onPullingDown"
|
|
11
|
+ @pulling-up="onPullingUp"
|
|
12
|
+ >
|
|
13
|
+ <div class="search">
|
|
14
|
+ <input
|
|
15
|
+ type="text"
|
|
16
|
+ placeholder="搜索"
|
|
17
|
+ v-model="search"
|
|
18
|
+ @input="searchFnDebounce()"
|
|
19
|
+ />
|
|
20
|
+ </div>
|
|
21
|
+ <ul class="foods-wrapper">
|
|
22
|
+ <li
|
|
23
|
+ v-for="data in items"
|
|
24
|
+ class="food-item border-1px"
|
|
25
|
+ :key="data.id"
|
|
26
|
+ >
|
|
27
|
+ <div class="food-content">
|
|
28
|
+ <div class="title">
|
|
29
|
+ <div>
|
|
30
|
+ <i class="iconfont icon-changjianwenti1"></i>
|
|
31
|
+ </div>
|
|
32
|
+ <div class="title_t">
|
|
33
|
+ <span>{{ data.dept }}</span>
|
|
34
|
+ <span v-if="data.phone"
|
|
35
|
+ ><a :href="'tel:' + data.phone"
|
|
36
|
+ ><i class="iconfont icon-shouji"></i
|
|
37
|
+ >{{ data.phone }}</a
|
|
38
|
+ ></span
|
|
39
|
+ >
|
|
40
|
+ </div>
|
|
41
|
+ </div>
|
|
42
|
+ <div class="content">
|
|
43
|
+ <span
|
|
44
|
+ >单位名称:{{
|
|
45
|
+ data.unit ? data.unit.unit : "无"
|
|
46
|
+ }}</span
|
|
47
|
+ >
|
|
48
|
+ </div>
|
|
49
|
+ <div class="content">
|
|
50
|
+ <span>办公地址:{{data.address}}</span>
|
|
51
|
+ <span></span>
|
|
52
|
+ </div>
|
|
53
|
+ </div>
|
|
54
|
+ </li>
|
|
55
|
+ <div class="wushuju" v-show="wushuju">
|
|
56
|
+ <img src="./../../static/images/wushuju.svg" alt="" />
|
|
57
|
+ <div class="noDataFont">暂无数据</div>
|
|
58
|
+ </div>
|
|
59
|
+ </ul>
|
|
60
|
+ <template v-if="customPullDown" slot="pulldown" slot-scope="props">
|
|
61
|
+ <div
|
|
62
|
+ v-if="props.pullDownRefresh"
|
|
63
|
+ class="cube-pulldown-wrapper"
|
|
64
|
+ :style="props.pullDownStyle"
|
|
65
|
+ >
|
|
66
|
+ <div
|
|
67
|
+ v-show="props.beforePullDown"
|
|
68
|
+ class="before-trigger"
|
|
69
|
+ :style="{ paddingTop: props.bubbleY + 'px' }"
|
|
70
|
+ >
|
|
71
|
+ <span
|
|
72
|
+ :class="{
|
|
73
|
+ rotate: props.bubbleY > pullDownRefreshThreshold - 40
|
|
74
|
+ }"
|
|
75
|
+ >↓</span
|
|
76
|
+ >
|
|
77
|
+ </div>
|
|
78
|
+ <div class="after-trigger" v-show="!props.beforePullDown">
|
|
79
|
+ <div v-show="props.isPullingDown" class="loading">
|
|
80
|
+ <cube-loading></cube-loading>
|
|
81
|
+ </div>
|
|
82
|
+ <div v-show="!props.isPullingDown" class="text">
|
|
83
|
+ <span class="refresh-text">更新成功</span>
|
|
84
|
+ </div>
|
|
85
|
+ </div>
|
|
86
|
+ </div>
|
|
87
|
+ </template>
|
|
88
|
+ </cube-scroll>
|
|
89
|
+ </div>
|
|
90
|
+ </div>
|
|
91
|
+ </div>
|
|
92
|
+ <load-ing v-show="loadShow"></load-ing>
|
|
93
|
+ </div>
|
|
94
|
+</template>
|
|
95
|
+<script>
|
|
96
|
+import Vue from "vue";
|
|
97
|
+import debounce from "lodash/debounce";
|
|
98
|
+import CubePage from "../components/cube-page.vue";
|
|
99
|
+import SwitchOption from "../components/switch-option";
|
|
100
|
+import InputOption from "../components/input-option";
|
|
101
|
+import SelectOption from "../components/select-option";
|
|
102
|
+import LoadIng from "./../views/loading.vue";
|
|
103
|
+export default {
|
|
104
|
+ data() {
|
|
105
|
+ return {
|
|
106
|
+ items: [],
|
|
107
|
+ pullDownRefresh: true,
|
|
108
|
+ pullDownRefreshThreshold: 60,
|
|
109
|
+ pullDownRefreshStop: 40,
|
|
110
|
+ pullDownRefreshTxt: "Refresh success",
|
|
111
|
+ pullUpLoad: true,
|
|
112
|
+ pullUpLoadThreshold: 0,
|
|
113
|
+ pullUpLoadMoreTxt: "Load more",
|
|
114
|
+ pullUpLoadNoMoreTxt: "没有更多数据",
|
|
115
|
+ wushuju: false,
|
|
116
|
+ customPullDown: true,
|
|
117
|
+ search: "",
|
|
118
|
+ sum: 10,
|
|
119
|
+ idx: 0,
|
|
120
|
+ loadShow: true,
|
|
121
|
+ lastSearchKey: "",
|
|
122
|
+ searchFnDebounce: null
|
|
123
|
+ };
|
|
124
|
+ },
|
|
125
|
+ components: {
|
|
126
|
+ CubePage,
|
|
127
|
+ SwitchOption,
|
|
128
|
+ InputOption,
|
|
129
|
+ SelectOption,
|
|
130
|
+ LoadIng
|
|
131
|
+ },
|
|
132
|
+ computed: {
|
|
133
|
+ options() {
|
|
134
|
+ return {
|
|
135
|
+ pullDownRefresh: this.pullDownRefreshObj,
|
|
136
|
+ pullUpLoad: this.pullUpLoadObj,
|
|
137
|
+ scrollbar: true
|
|
138
|
+ };
|
|
139
|
+ },
|
|
140
|
+ pullDownRefreshObj: function() {
|
|
141
|
+ return this.pullDownRefresh
|
|
142
|
+ ? {
|
|
143
|
+ threshold: parseInt(this.pullDownRefreshThreshold),
|
|
144
|
+ txt: this.pullDownRefreshTxt
|
|
145
|
+ }
|
|
146
|
+ : false;
|
|
147
|
+ },
|
|
148
|
+ pullUpLoadObj: function() {
|
|
149
|
+ return this.pullUpLoad
|
|
150
|
+ ? {
|
|
151
|
+ threshold: parseInt(this.pullUpLoadThreshold),
|
|
152
|
+ txt: {
|
|
153
|
+ more: this.pullUpLoadMoreTxt,
|
|
154
|
+ noMore: this.pullUpLoadNoMoreTxt
|
|
155
|
+ }
|
|
156
|
+ }
|
|
157
|
+ : false;
|
|
158
|
+ }
|
|
159
|
+ },
|
|
160
|
+ methods: {
|
|
161
|
+ getParams() {
|
|
162
|
+ if (this.$route.params.keword) {
|
|
163
|
+ this.search = this.$route.params.keword;
|
|
164
|
+ }
|
|
165
|
+ },
|
|
166
|
+ searchFn() {
|
|
167
|
+ var that = this;
|
|
168
|
+ that.loadShow = true;
|
|
169
|
+ this.idx = 0;
|
|
170
|
+ this.lastSearchKey = that.search;
|
|
171
|
+ this.$http
|
|
172
|
+ .post("service/user/data/fetchDataList/department", {
|
|
173
|
+ idx: 0,
|
|
174
|
+ sum: 10,
|
|
175
|
+ department: {
|
|
176
|
+ selectType: "pinyin_qs",
|
|
177
|
+ dept: that.search
|
|
178
|
+ }
|
|
179
|
+ })
|
|
180
|
+ .then(function(res) {
|
|
181
|
+ if (that.lastSearchKey == that.search) {
|
|
182
|
+ if (res.data.list.length > 0) {
|
|
183
|
+ that.items = res.data.list;
|
|
184
|
+ that.wushuju = false;
|
|
185
|
+ } else {
|
|
186
|
+ that.wushuju = true;
|
|
187
|
+ that.items = [];
|
|
188
|
+ }
|
|
189
|
+ that.loadShow = false;
|
|
190
|
+ }
|
|
191
|
+ });
|
|
192
|
+ },
|
|
193
|
+ toKnowDetails(data) {
|
|
194
|
+ // this.$router.push({path:'/knowDetails'})
|
|
195
|
+ this.$router.push({
|
|
196
|
+ name: "KnowDetails",
|
|
197
|
+ params: {
|
|
198
|
+ data: JSON.stringify(data)
|
|
199
|
+ }
|
|
200
|
+ });
|
|
201
|
+ },
|
|
202
|
+ onPullingDown() {
|
|
203
|
+ // 模拟更新数据
|
|
204
|
+ this.idx = 0;
|
|
205
|
+ setTimeout(() => {
|
|
206
|
+ var that = this;
|
|
207
|
+ this.$http
|
|
208
|
+ .post("service/user/data/fetchDataList/department", {
|
|
209
|
+ idx: 0,
|
|
210
|
+ sum: 10,
|
|
211
|
+ department: {
|
|
212
|
+ selectType: "pinyin_qs",
|
|
213
|
+ dept: that.search
|
|
214
|
+ }
|
|
215
|
+ })
|
|
216
|
+ .then(function(res) {
|
|
217
|
+ if (res.data.list.length > 0) {
|
|
218
|
+ that.items = res.data.list;
|
|
219
|
+ that.wushuju = false;
|
|
220
|
+ } else {
|
|
221
|
+ that.$refs.scroll.forceUpdate();
|
|
222
|
+ that.wushuju = true;
|
|
223
|
+ }
|
|
224
|
+ });
|
|
225
|
+ }, 1000);
|
|
226
|
+ },
|
|
227
|
+ getData(idx, sum) {
|
|
228
|
+ var that = this;
|
|
229
|
+ this.$http
|
|
230
|
+ .post("service/user/data/fetchDataList/phoneDirectory", {
|
|
231
|
+ idx: idx,
|
|
232
|
+ sum: sum,
|
|
233
|
+ user: {
|
|
234
|
+ // selectType: "pinyin_qs",
|
|
235
|
+ // dept: that.search
|
|
236
|
+ }
|
|
237
|
+ })
|
|
238
|
+ .then(function(res) {
|
|
239
|
+ if (res.data.list.length > 0) {
|
|
240
|
+ that.items = res.data.list;
|
|
241
|
+ that.wushuju = false;
|
|
242
|
+ } else {
|
|
243
|
+ that.wushuju = true;
|
|
244
|
+ }
|
|
245
|
+ that.loadShow = false;
|
|
246
|
+ });
|
|
247
|
+ },
|
|
248
|
+ onPullingUp() {
|
|
249
|
+ var that = this;
|
|
250
|
+ that.idx = that.idx + 1;
|
|
251
|
+ this.$http
|
|
252
|
+ .post("service/user/data/fetchDataList/department", {
|
|
253
|
+ idx: that.idx,
|
|
254
|
+ sum: that.sum,
|
|
255
|
+ department: {
|
|
256
|
+ selectType: "pinyin_qs",
|
|
257
|
+ dept: that.search
|
|
258
|
+ }
|
|
259
|
+ })
|
|
260
|
+ .then(function(res) {
|
|
261
|
+ setTimeout(() => {
|
|
262
|
+ if (res.data.list.length > 0) {
|
|
263
|
+ that.items = that.items.concat(res.data.list);
|
|
264
|
+ } else {
|
|
265
|
+ that.$refs.scroll.forceUpdate();
|
|
266
|
+ }
|
|
267
|
+ }, 1000);
|
|
268
|
+ });
|
|
269
|
+ },
|
|
270
|
+ updatePullDownRefresh(val) {
|
|
271
|
+ this.pullDownRefresh = val;
|
|
272
|
+ },
|
|
273
|
+ updatePullDownRefreshThreshold(val) {
|
|
274
|
+ this.pullDownRefreshThreshold = val;
|
|
275
|
+ },
|
|
276
|
+ updatePullDownRefreshTxt(val) {
|
|
277
|
+ this.pullDownRefreshTxt = val;
|
|
278
|
+ },
|
|
279
|
+ updatePullUpLoad(val) {
|
|
280
|
+ this.pullUpLoad = val;
|
|
281
|
+ },
|
|
282
|
+ updatePullUpLoadThreshold(val) {
|
|
283
|
+ this.pullUpLoadThreshold = val;
|
|
284
|
+ },
|
|
285
|
+ updatePullUpLoadMoreTxt(val) {
|
|
286
|
+ this.pullUpLoadMoreTxt = val;
|
|
287
|
+ },
|
|
288
|
+ updatePullUpLoadNoMoreTxt(val) {
|
|
289
|
+ this.pullUpLoadNoMoreTxt = val;
|
|
290
|
+ },
|
|
291
|
+ updateCustomPullDown(val) {
|
|
292
|
+ this.customPullDown = val;
|
|
293
|
+ },
|
|
294
|
+ rebuildScroll() {
|
|
295
|
+ Vue.nextTick(() => {
|
|
296
|
+ this.$refs.scroll.destroy();
|
|
297
|
+ this.$refs.scroll.initScroll();
|
|
298
|
+ });
|
|
299
|
+ }
|
|
300
|
+ },
|
|
301
|
+ created() {
|
|
302
|
+ this.searchFnDebounce = debounce(this.searchFn, 500);
|
|
303
|
+ this.getParams();
|
|
304
|
+ this.getData(this.idx, this.sum);
|
|
305
|
+ },
|
|
306
|
+ beforeDestroy() {
|
|
307
|
+ this.searchFnDebounce.cancel();
|
|
308
|
+ }
|
|
309
|
+};
|
|
310
|
+</script>
|
|
311
|
+<style lang="stylus" rel="stylesheet/stylus" scoped>
|
|
312
|
+.scroll-list-wrap
|
|
313
|
+ /* height: 350px */
|
|
314
|
+ height:100vh
|
|
315
|
+ /* border: 1px solid rgba(0, 0, 0, 0.1) */
|
|
316
|
+ border-radius: 5px
|
|
317
|
+ transform: rotate(0deg) // fix 子元素超出边框圆角部分不隐藏的问题
|
|
318
|
+ overflow: hidden
|
|
319
|
+
|
|
320
|
+.foods-wrapper
|
|
321
|
+ .food-item
|
|
322
|
+ display: flex
|
|
323
|
+ /* min-width: 0 */
|
|
324
|
+ /* padding: 18px
|
|
325
|
+ border-bottom: 1px solid rgba(7, 17, 27, 0.1) */
|
|
326
|
+
|
|
327
|
+ &:last-child
|
|
328
|
+ border-none()
|
|
329
|
+ margin-bottom: 0
|
|
330
|
+
|
|
331
|
+ .food-content
|
|
332
|
+ flex: 1
|
|
333
|
+ min-width: 0;
|
|
334
|
+ .cartcontrol-wrapper
|
|
335
|
+ position: absolute
|
|
336
|
+ right: 0
|
|
337
|
+ bottom: 12px
|
|
338
|
+ .scroll-wrapper{
|
|
339
|
+ .cube-pulldown-wrapper{
|
|
340
|
+ .before-trigger{
|
|
341
|
+ font-size: 30px;
|
|
342
|
+ line-height: 30px;
|
|
343
|
+ align-self: flex-end;
|
|
344
|
+ span{
|
|
345
|
+ display: inline-block;
|
|
346
|
+ transition: all 0.3s;
|
|
347
|
+ color: #666;
|
|
348
|
+ &.rotate{
|
|
349
|
+ transform: rotate(180deg)
|
|
350
|
+ }
|
|
351
|
+ }
|
|
352
|
+ }
|
|
353
|
+ .after-trigger{
|
|
354
|
+ .refresh-text{
|
|
355
|
+ color: grey
|
|
356
|
+ }
|
|
357
|
+ }
|
|
358
|
+ }
|
|
359
|
+}
|
|
360
|
+</style>
|
|
361
|
+<style scoped>
|
|
362
|
+.bgColor {
|
|
363
|
+ background-color: white;
|
|
364
|
+}
|
|
365
|
+.search {
|
|
366
|
+ padding: 0.16rem 0.24rem;
|
|
367
|
+ height: 0.6rem;
|
|
368
|
+ background-color: #eeeeee;
|
|
369
|
+ border-bottom: 0.01rem #999999 solid;
|
|
370
|
+}
|
|
371
|
+.search input {
|
|
372
|
+ width: 100%;
|
|
373
|
+ height: 0.56rem;
|
|
374
|
+ border-radius: 4px;
|
|
375
|
+ text-align: center;
|
|
376
|
+ font-size: 0.28rem;
|
|
377
|
+}
|
|
378
|
+.search:focus {
|
|
379
|
+ outline: none;
|
|
380
|
+}
|
|
381
|
+.food-item {
|
|
382
|
+ border-top: 0.16rem rgb(238, 238, 238) solid;
|
|
383
|
+}
|
|
384
|
+.food-content {
|
|
385
|
+ border-top: 0.01rem rgb(223, 222, 222) solid;
|
|
386
|
+ border-bottom: 0.01rem rgb(223, 222, 222) solid;
|
|
387
|
+}
|
|
388
|
+.title {
|
|
389
|
+ display: flex;
|
|
390
|
+ min-width: 0;
|
|
391
|
+ padding: 0.2rem 0.24rem;
|
|
392
|
+ line-height: 0.45rem;
|
|
393
|
+ border-bottom: 0.01rem rgb(223, 222, 222) solid;
|
|
394
|
+}
|
|
395
|
+.title .title_t {
|
|
396
|
+ display: flex;
|
|
397
|
+ justify-content: space-between;
|
|
398
|
+}
|
|
399
|
+.title div:nth-child(1) {
|
|
400
|
+ width: 6%;
|
|
401
|
+}
|
|
402
|
+.title div:nth-child(1) i {
|
|
403
|
+ font-size: 0.32rem;
|
|
404
|
+ color: #005395;
|
|
405
|
+ line-height: 0.49rem;
|
|
406
|
+}
|
|
407
|
+.title div:nth-child(2) {
|
|
408
|
+ width: 94%;
|
|
409
|
+ font-size: 0.32rem;
|
|
410
|
+ overflow: hidden;
|
|
411
|
+ white-space: nowrap;
|
|
412
|
+ text-overflow: ellipsis;
|
|
413
|
+}
|
|
414
|
+.content {
|
|
415
|
+ font-size: 0.28rem;
|
|
416
|
+ /* margin-top: .3rem; */
|
|
417
|
+ line-height: 0.39rem;
|
|
418
|
+ overflow: hidden;
|
|
419
|
+ display: -webkit-box;
|
|
420
|
+ -webkit-line-clamp: 2;
|
|
421
|
+ -webkit-box-orient: vertical;
|
|
422
|
+ word-break: break-all;
|
|
423
|
+ padding: 0 0.64rem;
|
|
424
|
+ margin: 0.24rem 0;
|
|
425
|
+ max-height: 0.78rem;
|
|
426
|
+}
|
|
427
|
+.timeBox {
|
|
428
|
+ display: flex;
|
|
429
|
+ justify-content: space-between;
|
|
430
|
+ /* margin-top: .3rem; */
|
|
431
|
+ border-top: 0.01rem rgb(223, 222, 222) solid;
|
|
432
|
+ padding: 0.2rem 0.64rem;
|
|
433
|
+}
|
|
434
|
+.timeBox .time {
|
|
435
|
+ color: #999999;
|
|
436
|
+ font-size: 0.24rem;
|
|
437
|
+}
|
|
438
|
+.timeBox .good i {
|
|
439
|
+ font-size: 0.3rem;
|
|
440
|
+ color: #a37200;
|
|
441
|
+}
|
|
442
|
+.timeBox .good span {
|
|
443
|
+ color: #a37200;
|
|
444
|
+ font-size: 0.24rem;
|
|
445
|
+}
|
|
446
|
+.wushuju {
|
|
447
|
+ margin-top: 2.4rem;
|
|
448
|
+ text-align: center;
|
|
449
|
+}
|
|
450
|
+.wushuju img {
|
|
451
|
+ width: 5.12rem;
|
|
452
|
+ height: 2.84rem;
|
|
453
|
+}
|
|
454
|
+</style>
|