@10yun/cv-mobile-ui 0.3.24 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -2
- package/plugins/request.js +14 -2
- package/ui-cv/cv-banner/cv-banner.vue +23 -14
- package/ui-cv/cv-banner-card/cv-banner-card.vue +24 -16
- package/ui-cv/cv-block/cv-block.vue +6 -6
- package/ui-cv/cv-box/cv-box.vue +6 -7
- package/ui-cv/cv-button/cv-button.vue +32 -13
- package/ui-cv/cv-cell/cv-cell.vue +21 -25
- package/ui-cv/cv-checkbox/cv-checkbox.vue +22 -22
- package/ui-cv/cv-checkbox-tag/cv-checkbox-tag.vue +30 -25
- package/ui-cv/cv-code-sms/cv-code-sms.vue +60 -38
- package/ui-cv/cv-dialog-bottom/cv-dialog-bottom.vue +14 -18
- package/ui-cv/cv-dialog-full/cv-dialog-full.vue +14 -18
- package/ui-cv/cv-dialog-loading/cv-dialog-loading.vue +10 -17
- package/ui-cv/cv-dialog-share/cv-dialog-share.vue +4 -5
- package/ui-cv/cv-draw-barcode/cv-draw-barcode.vue +54 -51
- package/ui-cv/cv-draw-posters/cv-draw-posters.vue +53 -71
- package/ui-cv/cv-draw-progress/cv-draw-progress.vue +44 -39
- package/ui-cv/cv-draw-qrcode/cv-draw-qrcode.vue +48 -45
- package/ui-cv/cv-editor/compressImage.vue +47 -40
- package/ui-cv/cv-editor/cv-editor.vue +234 -124
- package/ui-cv/cv-editor-parse/cv-editor-parse.vue +21 -30
- package/ui-cv/cv-editor-parse/u-parse.vue +21 -30
- package/ui-cv/cv-filter-hm/cv-filter-hm.vue +140 -74
- package/ui-cv/cv-form-group/cv-form-group.vue +11 -13
- package/ui-cv/cv-form-item/cv-form-item.vue +35 -20
- package/ui-cv/cv-form-merge/cv-form-merge.vue +5 -10
- package/ui-cv/cv-geo-local/cv-geo-local.vue +50 -27
- package/ui-cv/cv-icons/cv-icons.vue +24 -19
- package/ui-cv/cv-info/cv-info.vue +9 -11
- package/ui-cv/cv-input-btn/cv-input-btn.vue +34 -13
- package/ui-cv/cv-input-digit/cv-input-digit.vue +31 -18
- package/ui-cv/cv-input-idcard/cv-input-idcard.vue +31 -21
- package/ui-cv/cv-input-number/cv-input-number.vue +29 -14
- package/ui-cv/cv-input-password/cv-input-password.vue +31 -20
- package/ui-cv/cv-input-text/cv-input-text.vue +32 -17
- package/ui-cv/cv-link/cv-link.vue +7 -7
- package/ui-cv/cv-lists-base/cv-lists-base.vue +148 -114
- package/ui-cv/cv-lists-swiper/cv-lists-swipe2r.vue +24 -15
- package/ui-cv/cv-lists-swiper/cv-lists-swiper.vue +85 -63
- package/ui-cv/cv-load-more/cv-load-more.vue +60 -28
- package/ui-cv/cv-message/cv-message.vue +5 -6
- package/ui-cv/cv-nav-col/cv-nav-col.vue +9 -13
- package/ui-cv/cv-nav-group/cv-nav-group.vue +6 -8
- package/ui-cv/cv-nav-row/cv-nav-row.vue +21 -25
- package/ui-cv/cv-picker-date/cv-picker-date.vue +28 -12
- package/ui-cv/cv-picker-datetime/cv-picker-datetime.vue +43 -21
- package/ui-cv/cv-picker-datetime5/cv-picker-datetime5.vue +108 -60
- package/ui-cv/cv-picker-region/cv-picker-region.vue +46 -32
- package/ui-cv/cv-picker-time/cv-picker-time.vue +26 -11
- package/ui-cv/cv-picker1/cv-picker1.vue +32 -17
- package/ui-cv/cv-picker2/cv-picker2.vue +46 -28
- package/ui-cv/cv-picker3/cv-picker3.vue +77 -44
- package/ui-cv/cv-radio/cv-radio.vue +17 -10
- package/ui-cv/cv-radio-sex/cv-radio-sex.vue +20 -21
- package/ui-cv/cv-radio-tag/cv-radio-tag.vue +22 -11
- package/ui-cv/cv-rate/cv-rate.vue +17 -13
- package/ui-cv/cv-search/cv-search.vue +17 -12
- package/ui-cv/cv-skeleton/cv-skeleton.vue +32 -27
- package/ui-cv/cv-skeleton/cv-skeleton2.vue +56 -33
- package/ui-cv/cv-skeleton-group/cv-skeleton-group.vue +4 -6
- package/ui-cv/cv-specs/cv-specs.vue +31 -30
- package/ui-cv/cv-switch/cv-switch.vue +4 -5
- package/ui-cv/cv-tab-lists/cv-tab-lists.vue +189 -128
- package/ui-cv/cv-textarea/cv-textarea.vue +31 -13
- package/ui-cv/cv-treaty/cv-treaty.vue +8 -8
- package/ui-cv/cv-update-app/cv-update-app.vue +68 -53
- package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +33 -31
- package/ui-cv/cv-upload-img/cv-upload-img.vue +97 -70
- package/ui-cv/dict/area-city.js +612 -612
- package/ui-cv/dict/area-county.js +3392 -3392
- package/ui-cv/dict/area-province.js +35 -35
- package/ui-cv/mixins/mixins-checkbox.js +9 -15
- package/ui-cv/mixins/mixins-common.js +7 -7
- package/ui-cv/mixins/mixins-input.js +11 -12
- package/ui-cv/mixins/mixins-picker.js +9 -13
- package/ui-cv/mixins/mixins-radio.js +10 -14
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-lists-base">
|
|
3
|
-
<view class="cv-lists-base-data-area" :style="disableTab==true?'height:100%;':''">
|
|
4
|
-
<scroll-view
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
<view class="cv-lists-base-data-area" :style="disableTab == true ? 'height:100%;' : ''">
|
|
4
|
+
<scroll-view
|
|
5
|
+
class="cv-lists-base-data-scroll-box"
|
|
6
|
+
scroll-y="true"
|
|
7
|
+
:refresher-enabled="localTabLists[index] && localTabLists[index].enabled && disableEnabled === false"
|
|
8
|
+
refresher-background="#eeeeee"
|
|
9
|
+
:refresher-triggered="localTabLists[index] && localTabLists[index].triggered"
|
|
10
|
+
@scrolltolower="onTolower(index)"
|
|
11
|
+
@scrolltoupper="onToupper"
|
|
12
|
+
@scroll="onScroll"
|
|
13
|
+
@refresherrefresh="onRefresh"
|
|
14
|
+
@refresherrestore="onRestore"
|
|
15
|
+
@refresherabort="onAbort"
|
|
16
|
+
>
|
|
8
17
|
<view v-if="localTabLists[index] && localDataLists[index].data.length > 0" :class="listsClass">
|
|
9
|
-
<view v-for="(rows,i) in localDataLists[index].data" :key="i" style="display: contents !important
|
|
18
|
+
<view v-for="(rows, i) in localDataLists[index].data" :key="i" style="display: contents !important">
|
|
10
19
|
<slot :rows="rows" :index="i" :tabIndex="index" />
|
|
11
20
|
</view>
|
|
12
21
|
</view>
|
|
13
|
-
<view
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
<view
|
|
23
|
+
class="cv-lists-base-data-scroll-box-nodata-msg"
|
|
24
|
+
v-if="
|
|
25
|
+
localTabLists[index] &&
|
|
26
|
+
localTabLists[index].loadMoreStatus == 'noMore' &&
|
|
27
|
+
localDataLists[index].data.length <= 0 &&
|
|
28
|
+
localTabLists[index].nodataMsg
|
|
29
|
+
"
|
|
30
|
+
>
|
|
31
|
+
{{ localTabLists[index].nodataMsg }}
|
|
18
32
|
</view>
|
|
19
|
-
<cv-load-more
|
|
20
|
-
:
|
|
33
|
+
<cv-load-more
|
|
34
|
+
:status="localTabLists[index] && localTabLists[index].loadMoreStatus"
|
|
35
|
+
@clickLoadMore="onTolower(index)"
|
|
36
|
+
:contentText="loadMoreText"
|
|
37
|
+
v-else
|
|
38
|
+
/>
|
|
21
39
|
</scroll-view>
|
|
22
40
|
</view>
|
|
23
41
|
</view>
|
|
@@ -92,14 +110,14 @@ export default {
|
|
|
92
110
|
localTabLists: [],
|
|
93
111
|
localTabIndex: 0,
|
|
94
112
|
localDataLists: [],
|
|
95
|
-
scrollTop: 0
|
|
113
|
+
scrollTop: 0, //当前列顶部位置
|
|
96
114
|
triggered: false,
|
|
97
115
|
tabItemStyle: '',
|
|
98
116
|
windowWidth: 414,
|
|
99
117
|
localTabScrollLeft: 0,
|
|
100
118
|
tabScrollLeft: 0,
|
|
101
|
-
loadMoreText: { contentdown:
|
|
102
|
-
}
|
|
119
|
+
loadMoreText: { contentdown: '上拉或点击显示更多', contentrefresh: '正在加载...', contentnomore: '没有更多数据了' }
|
|
120
|
+
};
|
|
103
121
|
},
|
|
104
122
|
watch: {
|
|
105
123
|
tabsConfig: {
|
|
@@ -129,7 +147,7 @@ export default {
|
|
|
129
147
|
created() {
|
|
130
148
|
uni.getSystemInfo({
|
|
131
149
|
success: (res) => {
|
|
132
|
-
this.windowWidth = res.windowWidth
|
|
150
|
+
this.windowWidth = res.windowWidth;
|
|
133
151
|
}
|
|
134
152
|
});
|
|
135
153
|
},
|
|
@@ -143,14 +161,14 @@ export default {
|
|
|
143
161
|
for (const key in this.tabsConfig) {
|
|
144
162
|
localTabLists.push({ ...this.tabsConfig[key] });
|
|
145
163
|
localTabLists[key].enabled = true; //开启自定义下拉刷新
|
|
146
|
-
localTabLists[key].loadMoreStatus = 'more'
|
|
164
|
+
localTabLists[key].loadMoreStatus = 'more'; //cv-load-more 组件 status 状态
|
|
147
165
|
localTabLists[key].scrollTop = 0;
|
|
148
|
-
localTabLists[key].ordersort = this.tabsConfig[key].ordersort == 'DESC' ? 'DESC' : 'ASC'
|
|
149
|
-
localTabLists[key].pagesize = this.tabsConfig[key].pagesize || 10
|
|
166
|
+
localTabLists[key].ordersort = this.tabsConfig[key].ordersort == 'DESC' ? 'DESC' : 'ASC'; //默认倒叙
|
|
167
|
+
localTabLists[key].pagesize = this.tabsConfig[key].pagesize || 10; //页长
|
|
150
168
|
localDataLists[key] = {
|
|
151
169
|
page: 1,
|
|
152
170
|
data: []
|
|
153
|
-
}
|
|
171
|
+
};
|
|
154
172
|
}
|
|
155
173
|
this.localTabLists = localTabLists;
|
|
156
174
|
this.localDataLists = localDataLists;
|
|
@@ -169,36 +187,20 @@ export default {
|
|
|
169
187
|
/* #ifdef APP-PLUS */
|
|
170
188
|
let query = uni.createSelectorQuery().in(this);
|
|
171
189
|
for (var i = 1; i <= localTabLists.length; ++i) {
|
|
172
|
-
query
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
tabItemWidth +=
|
|
176
|
-
}
|
|
177
|
-
}).exec();
|
|
178
|
-
}
|
|
179
|
-
query.select('.cv-lists-base-tab-box').boundingClientRect((data) => {
|
|
180
|
-
tabWidth = data.width
|
|
181
|
-
/* 写在这里面是为了兼容微信小程序,如果写在外面这句会先执行 */
|
|
182
|
-
if (tabItemWidth <= tabWidth) {
|
|
183
|
-
tabItemStyle += 'width:calc(100% / ' + localTabLists.length + ' - 40px);';
|
|
184
|
-
}
|
|
185
|
-
tabItemStyle += 'top:0;';
|
|
186
|
-
this.tabItemStyle = tabItemStyle;
|
|
187
|
-
this.$forceUpdate();
|
|
188
|
-
}).exec();
|
|
189
|
-
/* #endif */
|
|
190
|
-
/* #ifndef APP-PLUS */
|
|
191
|
-
setTimeout(() => {
|
|
192
|
-
for (var i = 1; i <= localTabLists.length; ++i) {
|
|
193
|
-
uni.createSelectorQuery().in(this).select('.cv-lists-base-tab-item-id-' + i).boundingClientRect((data) => {
|
|
194
|
-
tabItemWidth += 40
|
|
190
|
+
query
|
|
191
|
+
.select('.cv-lists-base-tab-item-id-' + i)
|
|
192
|
+
.boundingClientRect((data) => {
|
|
193
|
+
tabItemWidth += 40;
|
|
195
194
|
if (data) {
|
|
196
|
-
tabItemWidth += data.width
|
|
195
|
+
tabItemWidth += data.width;
|
|
197
196
|
}
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
})
|
|
198
|
+
.exec();
|
|
199
|
+
}
|
|
200
|
+
query
|
|
201
|
+
.select('.cv-lists-base-tab-box')
|
|
202
|
+
.boundingClientRect((data) => {
|
|
203
|
+
tabWidth = data.width;
|
|
202
204
|
/* 写在这里面是为了兼容微信小程序,如果写在外面这句会先执行 */
|
|
203
205
|
if (tabItemWidth <= tabWidth) {
|
|
204
206
|
tabItemStyle += 'width:calc(100% / ' + localTabLists.length + ' - 40px);';
|
|
@@ -206,8 +208,40 @@ export default {
|
|
|
206
208
|
tabItemStyle += 'top:0;';
|
|
207
209
|
this.tabItemStyle = tabItemStyle;
|
|
208
210
|
this.$forceUpdate();
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
+
})
|
|
212
|
+
.exec();
|
|
213
|
+
/* #endif */
|
|
214
|
+
/* #ifndef APP-PLUS */
|
|
215
|
+
setTimeout(() => {
|
|
216
|
+
for (var i = 1; i <= localTabLists.length; ++i) {
|
|
217
|
+
uni
|
|
218
|
+
.createSelectorQuery()
|
|
219
|
+
.in(this)
|
|
220
|
+
.select('.cv-lists-base-tab-item-id-' + i)
|
|
221
|
+
.boundingClientRect((data) => {
|
|
222
|
+
tabItemWidth += 40;
|
|
223
|
+
if (data) {
|
|
224
|
+
tabItemWidth += data.width;
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
.exec();
|
|
228
|
+
}
|
|
229
|
+
uni
|
|
230
|
+
.createSelectorQuery()
|
|
231
|
+
.in(this)
|
|
232
|
+
.select('.cv-lists-base-tab-box')
|
|
233
|
+
.boundingClientRect((data) => {
|
|
234
|
+
tabWidth = data.width;
|
|
235
|
+
/* 写在这里面是为了兼容微信小程序,如果写在外面这句会先执行 */
|
|
236
|
+
if (tabItemWidth <= tabWidth) {
|
|
237
|
+
tabItemStyle += 'width:calc(100% / ' + localTabLists.length + ' - 40px);';
|
|
238
|
+
}
|
|
239
|
+
tabItemStyle += 'top:0;';
|
|
240
|
+
this.tabItemStyle = tabItemStyle;
|
|
241
|
+
this.$forceUpdate();
|
|
242
|
+
})
|
|
243
|
+
.exec();
|
|
244
|
+
}, 0);
|
|
211
245
|
/* #endif */
|
|
212
246
|
},
|
|
213
247
|
/* 处理滚动条距离左边的距离 */
|
|
@@ -219,16 +253,21 @@ export default {
|
|
|
219
253
|
windowWidth = this.windowWidth;
|
|
220
254
|
let tabLeft = 0,
|
|
221
255
|
localTabScrollLeft = this.tabScrollLeft,
|
|
222
|
-
tabWidth = 0
|
|
223
|
-
uni
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
256
|
+
tabWidth = 0;
|
|
257
|
+
uni
|
|
258
|
+
.createSelectorQuery()
|
|
259
|
+
.in(this)
|
|
260
|
+
.select('.cv-lists-base-tab-item-id-' + i)
|
|
261
|
+
.boundingClientRect((data) => {
|
|
262
|
+
tabLeft = data.left - 20;
|
|
263
|
+
tabWidth = data.width + 40;
|
|
264
|
+
localTabScrollLeft += tabLeft - windowWidth / 2 + tabWidth / 2;
|
|
265
|
+
this.localTabScrollLeft = localTabScrollLeft;
|
|
266
|
+
})
|
|
267
|
+
.exec();
|
|
229
268
|
},
|
|
230
269
|
onTabScroll(e) {
|
|
231
|
-
this.tabScrollLeft = e.detail.scrollLeft
|
|
270
|
+
this.tabScrollLeft = e.detail.scrollLeft;
|
|
232
271
|
},
|
|
233
272
|
changeTab(e) {
|
|
234
273
|
if (e != this.localTabIndex) {
|
|
@@ -242,10 +281,10 @@ export default {
|
|
|
242
281
|
if (this.localTabLists[e].orderby) {
|
|
243
282
|
//console.warn('< cvjs >:支持排序的Tab哦');
|
|
244
283
|
if (this.localTabLists[e].ordersort == 'DESC') {
|
|
245
|
-
this.localTabLists[e].ordersort = 'ASC'
|
|
284
|
+
this.localTabLists[e].ordersort = 'ASC';
|
|
246
285
|
//console.warn(this.localTabLists[e].orderby, '排序改为:', this.localTabLists[e].ordersort,)
|
|
247
286
|
} else {
|
|
248
|
-
this.localTabLists[e].ordersort = 'DESC'
|
|
287
|
+
this.localTabLists[e].ordersort = 'DESC';
|
|
249
288
|
//console.warn(this.localTabLists[e].orderby, '排序改为:', this.localTabLists[e].ordersort)
|
|
250
289
|
}
|
|
251
290
|
// console.log('< cvjs >:重置当前列数据重新发起请求');
|
|
@@ -265,13 +304,13 @@ export default {
|
|
|
265
304
|
// console.log('< cvjs >:第一次打开此区初始化数据');
|
|
266
305
|
this.getData();
|
|
267
306
|
}
|
|
268
|
-
this._dealTabScrollLeft()
|
|
269
|
-
this.$set(this.localTabLists[current], 'enabled', true)
|
|
307
|
+
this._dealTabScrollLeft();
|
|
308
|
+
this.$set(this.localTabLists[current], 'enabled', true);
|
|
270
309
|
},
|
|
271
310
|
getData() {
|
|
272
|
-
const localTabLists = this.localTabLists
|
|
273
|
-
const localTabIndex = this.localTabIndex
|
|
274
|
-
const localDataLists = this.localDataLists
|
|
311
|
+
const localTabLists = this.localTabLists; //Tab数组
|
|
312
|
+
const localTabIndex = this.localTabIndex; //当前区域坐标
|
|
313
|
+
const localDataLists = this.localDataLists; //滑块缓存数据
|
|
275
314
|
|
|
276
315
|
console.log(localTabLists);
|
|
277
316
|
|
|
@@ -279,68 +318,66 @@ export default {
|
|
|
279
318
|
console.warn('< cvjs >:localTabLists 参数为有误');
|
|
280
319
|
return;
|
|
281
320
|
}
|
|
282
|
-
this.localTabLists[localTabIndex].loadMoreStatus = 'loading'
|
|
321
|
+
this.localTabLists[localTabIndex].loadMoreStatus = 'loading';
|
|
283
322
|
let apiUrl = localTabLists[localTabIndex].apiUrl;
|
|
284
323
|
let page = 1;
|
|
285
324
|
if (localDataLists[localTabIndex]) {
|
|
286
|
-
page = localDataLists[localTabIndex].page
|
|
325
|
+
page = localDataLists[localTabIndex].page;
|
|
287
326
|
}
|
|
288
327
|
let apiParam = {
|
|
289
328
|
pagesize: localTabLists[localTabIndex].pagesize,
|
|
290
329
|
page: page
|
|
291
330
|
};
|
|
292
|
-
apiParam = Object.assign(apiParam, this.publicParam)
|
|
293
|
-
apiParam = Object.assign(apiParam, localTabLists[localTabIndex].apiParam)
|
|
331
|
+
apiParam = Object.assign(apiParam, this.publicParam); //公共参数
|
|
332
|
+
apiParam = Object.assign(apiParam, localTabLists[localTabIndex].apiParam); //当前列参数
|
|
294
333
|
//排序字段
|
|
295
334
|
if (localTabLists[localTabIndex].orderby) {
|
|
296
|
-
apiParam[localTabLists[localTabIndex].orderby] = localTabLists[localTabIndex].ordersort
|
|
335
|
+
apiParam[localTabLists[localTabIndex].orderby] = localTabLists[localTabIndex].ordersort;
|
|
297
336
|
}
|
|
298
337
|
// console.warn('< cvjs >:apiParam', apiParam)
|
|
299
338
|
|
|
300
|
-
|
|
301
339
|
if (localTabLists[localTabIndex].apiFunc) {
|
|
302
340
|
if (typeof localTabLists[localTabIndex].apiFunc == 'function') {
|
|
303
341
|
//使用私有方法请求
|
|
304
|
-
localTabLists[localTabIndex]
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
342
|
+
localTabLists[localTabIndex]
|
|
343
|
+
.apiFunc(apiParam)
|
|
344
|
+
.then((successRes) => {
|
|
345
|
+
this.dealDataList(successRes.data, localTabIndex, page);
|
|
346
|
+
})
|
|
347
|
+
.catch((error) => {
|
|
348
|
+
this.dealDataList([], localTabIndex, page);
|
|
349
|
+
// console.log('< cvjs >:error', error);
|
|
350
|
+
});
|
|
310
351
|
} else {
|
|
311
|
-
console.warn('< cvjs >:',
|
|
312
|
-
'拿到 apiFunc 开始请求,此处代码不全'
|
|
313
|
-
);
|
|
352
|
+
console.warn('< cvjs >:', '拿到 apiFunc 开始请求,此处代码不全');
|
|
314
353
|
}
|
|
315
354
|
} else if (this.publicFunc) {
|
|
316
355
|
/* 使用公共方法请求 */
|
|
317
356
|
if (localTabLists[localTabIndex].apiFlag) {
|
|
318
357
|
//有标识
|
|
319
|
-
this.publicFunc(localTabLists[localTabIndex].apiFlag, apiParam)
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
358
|
+
this.publicFunc(localTabLists[localTabIndex].apiFlag, apiParam)
|
|
359
|
+
.then((successRes) => {
|
|
360
|
+
this.dealDataList(successRes.data, localTabIndex, page);
|
|
361
|
+
})
|
|
362
|
+
.catch((error) => {
|
|
363
|
+
this.dealDataList([], localTabIndex, page);
|
|
364
|
+
// console.log('< cvjs >:error', error);
|
|
365
|
+
});
|
|
325
366
|
} else {
|
|
326
367
|
//无标识
|
|
327
|
-
this.publicFunc(apiParam)
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
368
|
+
this.publicFunc(apiParam)
|
|
369
|
+
.then((successRes) => {
|
|
370
|
+
this.dealDataList(successRes.data, localTabIndex, page);
|
|
371
|
+
})
|
|
372
|
+
.catch((error) => {
|
|
373
|
+
this.dealDataList([], localTabIndex, page);
|
|
374
|
+
// console.log('< cvjs >:error', error);
|
|
375
|
+
});
|
|
333
376
|
}
|
|
334
|
-
|
|
335
377
|
} else if (localTabLists[localTabIndex].apiUrl) {
|
|
336
|
-
console.warn('< cvjs >:',
|
|
337
|
-
'拿到apiUrl 开始请求,此处代码不全'
|
|
338
|
-
);
|
|
339
|
-
|
|
378
|
+
console.warn('< cvjs >:', '拿到apiUrl 开始请求,此处代码不全');
|
|
340
379
|
} else {
|
|
341
|
-
console.warn('< cvjs >:',
|
|
342
|
-
'参数有误:apiFunc、apiUrl 至少有一个不为空'
|
|
343
|
-
);
|
|
380
|
+
console.warn('< cvjs >:', '参数有误:apiFunc、apiUrl 至少有一个不为空');
|
|
344
381
|
setTimeout(() => {
|
|
345
382
|
this.localTabLists[localTabIndex].triggered = false;
|
|
346
383
|
//console.log('< cvjs >:请求结束,关闭下拉刷新状态', this.localTabLists[this.localTabIndex].enabled, this.localTabLists[this.localTabIndex].triggered)
|
|
@@ -350,8 +387,8 @@ export default {
|
|
|
350
387
|
this.localTabLists[localTabIndex].triggered = 'restore';
|
|
351
388
|
//console.log('< cvjs >:需要重置===========下啦状态')
|
|
352
389
|
this.$forceUpdate();
|
|
353
|
-
}, 10)
|
|
354
|
-
}, 3000)
|
|
390
|
+
}, 10);
|
|
391
|
+
}, 3000);
|
|
355
392
|
}
|
|
356
393
|
},
|
|
357
394
|
/* 整理列表数据 */
|
|
@@ -367,13 +404,13 @@ export default {
|
|
|
367
404
|
data = this.localTabLists[index].parseFunc(data);
|
|
368
405
|
}
|
|
369
406
|
if (this.localDataLists[index]) {
|
|
370
|
-
dataLists = [...this.localDataLists[index].data]
|
|
407
|
+
dataLists = [...this.localDataLists[index].data];
|
|
371
408
|
}
|
|
372
409
|
for (const key in data) {
|
|
373
410
|
dataLists.push(data[key]);
|
|
374
411
|
}
|
|
375
|
-
this.$set(this.localDataLists[index], 'data', dataLists)
|
|
376
|
-
this.$set(this.localDataLists[index], 'page', page + 1)
|
|
412
|
+
this.$set(this.localDataLists[index], 'data', dataLists);
|
|
413
|
+
this.$set(this.localDataLists[index], 'page', page + 1);
|
|
377
414
|
this.$forceUpdate();
|
|
378
415
|
if (data.length < this.localTabLists[index].pagesize) {
|
|
379
416
|
this.localTabLists[index].loadMoreStatus = 'noMore';
|
|
@@ -387,24 +424,22 @@ export default {
|
|
|
387
424
|
setTimeout(() => {
|
|
388
425
|
this.localTabLists[index].triggered = false;
|
|
389
426
|
this.$forceUpdate();
|
|
390
|
-
}, 100)
|
|
427
|
+
}, 100);
|
|
391
428
|
}
|
|
392
429
|
this.$forceUpdate();
|
|
393
|
-
|
|
394
430
|
},
|
|
395
431
|
/* swiper-item 的位置发生改变时会触发 transition 事件,event.detail = {dx: dx, dy: dy},支付宝小程序暂不支持dx, dy */
|
|
396
432
|
onTransition(e) {
|
|
397
433
|
if (this.localTabLists[this.localTabIndex].enabled !== false) {
|
|
398
434
|
// console.log('< cvjs >:swiper-item 左右滑动时 锁定‘scroll-view’下拉刷新功能', e)
|
|
399
|
-
this.$set(this.localTabLists[this.localTabIndex], 'enabled', false)
|
|
435
|
+
this.$set(this.localTabLists[this.localTabIndex], 'enabled', false);
|
|
400
436
|
}
|
|
401
|
-
|
|
402
437
|
},
|
|
403
438
|
/* 动画结束时会触发 animationfinish 事件,event.detail = {current: current, source: source} */
|
|
404
439
|
onAnimationfinish(e) {
|
|
405
440
|
if (this.localTabLists[this.localTabIndex].enabled !== true && this.localTabLists[this.localTabIndex].scrollTop < 45) {
|
|
406
441
|
// console.log('< cvjs >:swiper-item 动画结束时 开启‘scroll-view’下拉刷新功能', e)
|
|
407
|
-
this.$set(this.localTabLists[this.localTabIndex], 'enabled', true)
|
|
442
|
+
this.$set(this.localTabLists[this.localTabIndex], 'enabled', true);
|
|
408
443
|
}
|
|
409
444
|
},
|
|
410
445
|
onScroll(e) {
|
|
@@ -415,14 +450,14 @@ export default {
|
|
|
415
450
|
this.$forceUpdate();
|
|
416
451
|
// console.log('< cvjs >:滑到顶部了 可以开启下拉刷新了', this.localTabLists[this.localTabIndex].enabled);
|
|
417
452
|
} else if (scrollTop > 0 && this.localTabLists[this.localTabIndex].enabled != false) {
|
|
418
|
-
this.$set(this.localTabLists[this.localTabIndex], 'enabled', false)
|
|
453
|
+
this.$set(this.localTabLists[this.localTabIndex], 'enabled', false);
|
|
419
454
|
// console.log('< cvjs >:没在顶部 必须禁止下拉刷新了', this.localTabLists[this.localTabIndex].enabled);
|
|
420
455
|
}
|
|
421
456
|
},
|
|
422
457
|
/* 监听回到顶部 */
|
|
423
458
|
onToupper(e) {
|
|
424
459
|
// console.log('监听回到顶部', e);
|
|
425
|
-
this.$set(this.localTabLists[this.localTabIndex], 'enabled', true)
|
|
460
|
+
this.$set(this.localTabLists[this.localTabIndex], 'enabled', true);
|
|
426
461
|
},
|
|
427
462
|
/* 监听触底 */
|
|
428
463
|
onTolower(e) {
|
|
@@ -468,7 +503,6 @@ export default {
|
|
|
468
503
|
if (this.localTabLists[this.localTabIndex].enabled !== true) {
|
|
469
504
|
// this.$set(this.localTabLists[this.localTabIndex], 'enabled', true)
|
|
470
505
|
}
|
|
471
|
-
|
|
472
506
|
}
|
|
473
507
|
}
|
|
474
508
|
};
|
|
@@ -2,23 +2,35 @@
|
|
|
2
2
|
<view>
|
|
3
3
|
<view class="cv-ls-tabbox-wrap">
|
|
4
4
|
<view class="cv-ls-tabbox-tabs">
|
|
5
|
-
<view
|
|
6
|
-
|
|
5
|
+
<view
|
|
6
|
+
class="cv-ls-tabbox-item"
|
|
7
|
+
v-for="(item, i) in localTabs"
|
|
8
|
+
:key="i"
|
|
9
|
+
:class="{ 'cv-ls-tabbox-item-active': swiperCurrent == i }"
|
|
10
|
+
@click="swiperChange(i)"
|
|
11
|
+
:style="{ transition: transtionTime + 'ms' }"
|
|
12
|
+
>
|
|
7
13
|
<text>{{ item.name }}</text>
|
|
8
14
|
</view>
|
|
9
|
-
<view
|
|
10
|
-
|
|
15
|
+
<view
|
|
16
|
+
class="cv-ls-tabbox-slider-box"
|
|
17
|
+
:style="{ width: 100 / localTabs.length + '%', transition: transtionTime + 'ms', left: swiperCurrentSliderLeft + '%' }"
|
|
18
|
+
>
|
|
11
19
|
<view class="cv-ls-tabbox-slider"></view>
|
|
12
20
|
</view>
|
|
13
21
|
</view>
|
|
14
22
|
</view>
|
|
15
23
|
<view class="cv-ls-main-wrap" :style="{ height: mainHeight }">
|
|
16
|
-
<swiper
|
|
24
|
+
<swiper
|
|
25
|
+
class="cv-ls-main__swiper"
|
|
26
|
+
style="height: 100%"
|
|
27
|
+
:current="swiperCurrent"
|
|
28
|
+
:duration="transtionTime"
|
|
29
|
+
@animationfinish="animationfinish"
|
|
30
|
+
>
|
|
17
31
|
<swiper-item class="swiper-item" v-for="(tabsItem, tabsIndex) in localTabs" :key="tabsIndex">
|
|
18
32
|
<view class="cv-ls-main__scroll-items">
|
|
19
|
-
<scroll-view :refresher-enabled="reloadDown">
|
|
20
|
-
|
|
21
|
-
</scroll-view>
|
|
33
|
+
<scroll-view :refresher-enabled="reloadDown"></scroll-view>
|
|
22
34
|
</view>
|
|
23
35
|
</swiper-item>
|
|
24
36
|
</swiper>
|
|
@@ -27,7 +39,6 @@
|
|
|
27
39
|
</template>
|
|
28
40
|
|
|
29
41
|
<script>
|
|
30
|
-
|
|
31
42
|
// <!-- #ifdef H5 || APP-PLUS -->
|
|
32
43
|
// <slot :name="item.id"></slot>
|
|
33
44
|
// <!-- #endif -->
|
|
@@ -36,7 +47,7 @@
|
|
|
36
47
|
// <!-- #endif -->
|
|
37
48
|
|
|
38
49
|
export default {
|
|
39
|
-
name:
|
|
50
|
+
name: 'cv-lists-swiper',
|
|
40
51
|
props: {
|
|
41
52
|
tabsArr: {
|
|
42
53
|
type: [Array, Object],
|
|
@@ -66,12 +77,10 @@ export default {
|
|
|
66
77
|
for (let i in this.tabsArr) {
|
|
67
78
|
let itemTabs = this.tabsArr[i];
|
|
68
79
|
if (itemTabs.lists) {
|
|
69
|
-
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
// this.swiperChange(option.order_state);
|
|
74
|
-
|
|
75
84
|
},
|
|
76
85
|
methods: {
|
|
77
86
|
animationfinish({ detail: { current } }) {
|
|
@@ -97,7 +106,7 @@ export default {
|
|
|
97
106
|
// 只获取一次数据
|
|
98
107
|
// this.getOrderData(index)
|
|
99
108
|
let apiParam = this.localTabs[index].apiParam || {};
|
|
100
|
-
this.$AllApi.getWmOrder(apiParam).then(res => {
|
|
109
|
+
this.$AllApi.getWmOrder(apiParam).then((res) => {
|
|
101
110
|
setTimeout(() => {
|
|
102
111
|
this.localTabs[index].data = res.data;
|
|
103
112
|
this.localTabs[index].hide_load = true;
|
|
@@ -114,7 +123,7 @@ export default {
|
|
|
114
123
|
this.$emit('close');
|
|
115
124
|
}
|
|
116
125
|
}
|
|
117
|
-
}
|
|
126
|
+
};
|
|
118
127
|
</script>
|
|
119
128
|
|
|
120
129
|
<style>
|
|
@@ -184,4 +193,4 @@ export default {
|
|
|
184
193
|
width: 100%;
|
|
185
194
|
height: 100%;
|
|
186
195
|
}
|
|
187
|
-
</style>
|
|
196
|
+
</style>
|