@10yun/cv-mobile-ui 0.5.62 → 0.5.63
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 +1 -1
- package/plugins/uni-extend.js +10 -10
- package/ui-fireui/components/u-action-sheet/u-action-sheet.vue +46 -16
- package/ui-fireui/components/u-alert/u-alert.vue +11 -5
- package/ui-fireui/components/u-badge/u-badge.vue +52 -69
- package/ui-fireui/components/u-bottom-navigation/u-bottom-navigation.vue +28 -20
- package/ui-fireui/components/u-bottom-popup/u-bottom-popup.vue +40 -11
- package/ui-fireui/components/u-bubble-popup/u-bubble-popup.vue +3 -6
- package/ui-fireui/components/u-button/u-button.vue +262 -259
- package/ui-fireui/components/u-calendar/u-calendar.vue +227 -44
- package/ui-fireui/components/u-calendar/u-calendar2.js +562 -0
- package/ui-fireui/components/u-card/u-card.vue +50 -32
- package/ui-fireui/components/u-cascade-selection/u-cascade-selection.vue +197 -74
- package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +324 -0
- package/ui-fireui/components/u-clipboard2/tui-clipboard.js +53 -0
- package/ui-fireui/components/u-collapse/u-collapse.vue +8 -8
- package/ui-fireui/components/u-config/index.js +129 -0
- package/ui-fireui/components/u-count-down/u-count-down.vue +124 -19
- package/ui-fireui/components/u-datetime/u-datetime.vue +416 -176
- package/ui-fireui/components/u-divider/u-divider.vue +3 -3
- package/ui-fireui/components/u-drawer/u-drawer.vue +55 -12
- package/ui-fireui/components/u-dropdown-list/u-dropdown-list.vue +103 -0
- package/ui-fireui/components/u-fab/u-fab.vue +344 -0
- package/ui-fireui/components/u-footer/u-footer.vue +148 -0
- package/ui-fireui/components/u-grid/u-grid.vue +2 -8
- package/ui-fireui/components/u-grid-item/u-grid-item.vue +22 -5
- package/ui-fireui/components/u-icon/u-icon-new.js +190 -0
- package/ui-fireui/components/u-icon/u-icon-new.vue +100 -0
- package/ui-fireui/components/u-image-cropper/u-image-cropper.vue +1144 -0
- package/ui-fireui/components/u-image-group/u-image-group.vue +164 -0
- package/ui-fireui/components/u-keyboard/u-keyboard.vue +3 -2
- package/ui-fireui/components/u-keyboard-input/u-keyboard-input.vue +1 -1
- package/ui-fireui/components/u-list-cell/u-list-cell.vue +82 -72
- package/ui-fireui/components/u-list-view/u-list-view.vue +33 -8
- package/ui-fireui/components/u-loading/u-loading.vue +107 -27
- package/ui-fireui/components/u-loadmore/u-loadmore.vue +21 -3
- package/ui-fireui/components/u-modal/u-modal.vue +140 -176
- package/ui-fireui/components/u-navigation-bar/u-navigation-bar.vue +121 -28
- package/ui-fireui/components/u-no-data/u-no-data.vue +58 -20
- package/ui-fireui/components/u-nomore/u-nomore.vue +5 -4
- package/ui-fireui/components/u-numberbox/u-numberbox.vue +88 -45
- package/ui-fireui/components/u-picture-cropper/u-picture-cropper.vue +94 -36
- package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +27 -17
- package/ui-fireui/components/u-rate/u-rate.vue +197 -0
- package/ui-fireui/components/u-round-progress/u-round-progress.vue +62 -42
- package/ui-fireui/components/u-scroll-top/u-scroll-top.vue +4 -3
- package/ui-fireui/components/u-section/u-section.vue +149 -0
- package/ui-fireui/components/u-skeleton/u-skeleton.vue +37 -6
- package/ui-fireui/components/u-steps/u-steps.vue +110 -27
- package/ui-fireui/components/u-sticky/u-sticky.vue +35 -21
- package/ui-fireui/components/u-sticky-wxs/u-sticky-wxs.vue +7 -4
- package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +39 -36
- package/ui-fireui/components/u-swipe-action/u-swipe-action.vue +76 -19
- package/ui-fireui/components/u-tabbar/u-tabbar.vue +71 -38
- package/ui-fireui/components/u-tabs/u-tabs.vue +133 -51
- package/ui-fireui/components/u-tag/u-tag.vue +109 -226
- package/ui-fireui/components/u-time-axis/u-time-axis.vue +1 -1
- package/ui-fireui/components/u-timeaxis-item/u-timeaxis-item.vue +1 -1
- package/ui-fireui/components/u-tips/u-tips.vue +35 -15
- package/ui-fireui/components/u-toast/u-toast.vue +9 -5
- package/ui-fireui/components/u-top-dropdown/u-top-dropdown.vue +8 -6
- package/ui-fireui/components/u-upload/u-upload-old.vue +462 -0
- package/ui-fireui/components/u-upload/u-upload.vue +648 -446
- package/ui-fireui/components/u-white-space/u-white-space.vue +68 -0
- package/ui-fireui/components/u-wing-blank/u-wing-blank.vue +100 -0
- package/uview-plus/libs/ctocode/index.js +1 -0
- package/uview-plus/libs/ctocode/richText.js +0 -1
|
@@ -3,34 +3,36 @@
|
|
|
3
3
|
class="up-card-class up-card"
|
|
4
4
|
:class="[full ? 'up-card-full' : '', border ? 'up-card-border' : '']"
|
|
5
5
|
@tap="handleClick"
|
|
6
|
-
@
|
|
6
|
+
@longpress="longTap"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
<view class="up-header-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
<slot>
|
|
9
|
+
<view class="up-card-header" :class="{ 'up-header-line': header.line }" :style="{ background: header.bgcolor || '#fff' }">
|
|
10
|
+
<view class="up-header-left">
|
|
11
|
+
<image
|
|
12
|
+
:src="imageUrl || image.url"
|
|
13
|
+
class="up-header-thumb"
|
|
14
|
+
:class="{ 'up-thumb-circle': image.circle }"
|
|
15
|
+
mode="widthFix"
|
|
16
|
+
v-if="imageUrl || image.url"
|
|
17
|
+
:style="{ height: (image.height || 60) + 'rpx', width: (image.width || 60) + 'rpx' }"
|
|
18
|
+
></image>
|
|
19
|
+
<text
|
|
20
|
+
class="up-header-title"
|
|
21
|
+
:style="{ fontSize: (title.size || 30) + 'rpx', color: title.color || '#7A7A7A' }"
|
|
22
|
+
v-if="titleText || title.text"
|
|
23
|
+
>
|
|
24
|
+
{{ titleText || title.text }}
|
|
25
|
+
</text>
|
|
26
|
+
</view>
|
|
27
|
+
<view
|
|
28
|
+
class="up-header-right"
|
|
29
|
+
:style="{ fontSize: (tag.size || 24) + 'rpx', color: tag.color || '#b2b2b2' }"
|
|
30
|
+
v-if="tagText || tag.text"
|
|
22
31
|
>
|
|
23
|
-
{{
|
|
24
|
-
</
|
|
32
|
+
{{ tagText || tag.text }}
|
|
33
|
+
</view>
|
|
25
34
|
</view>
|
|
26
|
-
|
|
27
|
-
class="up-header-right"
|
|
28
|
-
:style="{ fontSize: (tag.size || 24) + 'rpx', color: tag.color || '#b2b2b2' }"
|
|
29
|
-
v-if="tag.text"
|
|
30
|
-
>
|
|
31
|
-
{{ tag.text }}
|
|
32
|
-
</view>
|
|
33
|
-
</view>
|
|
35
|
+
</slot>
|
|
34
36
|
<view class="up-card-body">
|
|
35
37
|
<slot name="body"></slot>
|
|
36
38
|
</view>
|
|
@@ -42,16 +44,22 @@
|
|
|
42
44
|
|
|
43
45
|
<script>
|
|
44
46
|
export default {
|
|
45
|
-
name: '
|
|
47
|
+
name: 'tuiCard',
|
|
48
|
+
emits: ['click', 'longclick'],
|
|
46
49
|
props: {
|
|
47
50
|
//是否铺满
|
|
48
51
|
full: {
|
|
49
52
|
type: Boolean,
|
|
50
53
|
default: false
|
|
51
54
|
},
|
|
55
|
+
//v2.9.6+ 图片地址,优先级高于image 中 url
|
|
56
|
+
imageUrl: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
52
60
|
image: {
|
|
53
61
|
type: Object,
|
|
54
|
-
default: ()
|
|
62
|
+
default: function () {
|
|
55
63
|
return {
|
|
56
64
|
url: '', //图片地址
|
|
57
65
|
height: 60, //图片高度
|
|
@@ -60,10 +68,15 @@ export default {
|
|
|
60
68
|
};
|
|
61
69
|
}
|
|
62
70
|
},
|
|
71
|
+
//v2.9.6+ 标题文本,优先级高于 title中 text
|
|
72
|
+
titleText: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: ''
|
|
75
|
+
},
|
|
63
76
|
//标题
|
|
64
77
|
title: {
|
|
65
78
|
type: Object,
|
|
66
|
-
default: ()
|
|
79
|
+
default: function () {
|
|
67
80
|
return {
|
|
68
81
|
text: '', //标题文字
|
|
69
82
|
size: 30, //字体大小
|
|
@@ -71,10 +84,15 @@ export default {
|
|
|
71
84
|
};
|
|
72
85
|
}
|
|
73
86
|
},
|
|
87
|
+
//标签文本,优先级高于 tag中 text
|
|
88
|
+
tagText: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: ''
|
|
91
|
+
},
|
|
74
92
|
//标签,时间等
|
|
75
93
|
tag: {
|
|
76
94
|
type: Object,
|
|
77
|
-
default: ()
|
|
95
|
+
default: function () {
|
|
78
96
|
return {
|
|
79
97
|
text: '', //标签文字
|
|
80
98
|
size: 24, //字体大小
|
|
@@ -84,10 +102,10 @@ export default {
|
|
|
84
102
|
},
|
|
85
103
|
header: {
|
|
86
104
|
type: Object,
|
|
87
|
-
default: ()
|
|
105
|
+
default: function () {
|
|
88
106
|
return {
|
|
89
107
|
bgcolor: '#fff', //背景颜色
|
|
90
|
-
line:
|
|
108
|
+
line: false //是否去掉底部线条
|
|
91
109
|
};
|
|
92
110
|
}
|
|
93
111
|
},
|
|
@@ -118,7 +136,7 @@ export default {
|
|
|
118
136
|
|
|
119
137
|
<style scoped>
|
|
120
138
|
.up-card {
|
|
121
|
-
margin: 0
|
|
139
|
+
margin: 0 30rpx;
|
|
122
140
|
font-size: 28rpx;
|
|
123
141
|
background-color: #fff;
|
|
124
142
|
border-radius: 10rpx;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="up-cascade-selection">
|
|
3
3
|
<scroll-view
|
|
4
|
-
scroll-x
|
|
4
|
+
:scroll-x="true"
|
|
5
5
|
scroll-with-animation
|
|
6
6
|
:scroll-into-view="scrollViewId"
|
|
7
7
|
:style="{ backgroundColor: headerBgColor }"
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
<view class="up-selection-header" :style="{ height: tabsHeight, backgroundColor: backgroundColor }">
|
|
12
12
|
<view
|
|
13
13
|
class="up-header-item"
|
|
14
|
-
:class="{ 'up-font-bold':
|
|
15
|
-
:style="{ color:
|
|
16
|
-
:id="`id_${
|
|
14
|
+
:class="{ 'up-font-bold': idx === currentTab && bold }"
|
|
15
|
+
:style="{ color: idx === currentTab ? getActiveColor : color, fontSize: size + 'rpx' }"
|
|
16
|
+
:id="`id_${idx}`"
|
|
17
17
|
@tap.stop="swichNav"
|
|
18
|
-
:data-current="
|
|
19
|
-
v-for="(item,
|
|
20
|
-
:key="
|
|
18
|
+
:data-current="idx"
|
|
19
|
+
v-for="(item, idx) in selectedArr"
|
|
20
|
+
:key="idx"
|
|
21
21
|
>
|
|
22
|
-
{{ item
|
|
23
|
-
<view class="up-active-line" :style="{ backgroundColor:
|
|
22
|
+
{{ item[textField] }}
|
|
23
|
+
<view class="up-active-line" :style="{ backgroundColor: getLineColor }" v-if="idx === currentTab && showLine"></view>
|
|
24
24
|
</view>
|
|
25
25
|
</view>
|
|
26
26
|
</scroll-view>
|
|
27
27
|
<swiper
|
|
28
28
|
class="up-selection-list"
|
|
29
|
-
:current="
|
|
29
|
+
:current="defTab"
|
|
30
30
|
duration="300"
|
|
31
31
|
@change="switchTab"
|
|
32
32
|
:style="{ height: height, backgroundColor: backgroundColor }"
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
:id="`id_${subIndex}`"
|
|
41
41
|
v-for="(subItem, subIndex) in item.list"
|
|
42
42
|
:key="subIndex"
|
|
43
|
-
@tap="change(index, subIndex, subItem)"
|
|
43
|
+
@tap.stop="change(index, subIndex, subItem)"
|
|
44
44
|
>
|
|
45
45
|
<icon
|
|
46
46
|
type="success_no_circle"
|
|
47
47
|
v-if="item.index === subIndex"
|
|
48
|
-
:color="
|
|
48
|
+
:color="getCkMarkColor"
|
|
49
49
|
:size="checkMarkSize"
|
|
50
50
|
class="up-icon-success"
|
|
51
51
|
></icon>
|
|
52
52
|
<image
|
|
53
|
-
:src="subItem
|
|
54
|
-
v-if="subItem
|
|
53
|
+
:src="subItem[srcField]"
|
|
54
|
+
v-if="subItem[srcField]"
|
|
55
55
|
class="up-cell-img"
|
|
56
56
|
:style="{ width: imgWidth, height: imgHeight, borderRadius: radius }"
|
|
57
57
|
></image>
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
:class="{ 'up-font-bold': item.index === subIndex && textBold, 'up-flex-shrink': nowrap }"
|
|
61
61
|
:style="{ color: item.index === subIndex ? textActiveColor : textColor, fontSize: textSize + 'rpx' }"
|
|
62
62
|
>
|
|
63
|
-
{{ subItem
|
|
63
|
+
{{ subItem[textField] }}
|
|
64
64
|
</view>
|
|
65
65
|
<view
|
|
66
66
|
class="up-cell-sub_title"
|
|
67
67
|
:style="{ color: subTextColor, fontSize: subTextSize + 'rpx' }"
|
|
68
|
-
v-if="subItem
|
|
68
|
+
v-if="subItem[subTextField]"
|
|
69
69
|
>
|
|
70
|
-
{{ subItem
|
|
70
|
+
{{ subItem[subTextField] }}
|
|
71
71
|
</view>
|
|
72
72
|
</view>
|
|
73
73
|
</scroll-view>
|
|
@@ -78,11 +78,12 @@
|
|
|
78
78
|
|
|
79
79
|
<script>
|
|
80
80
|
export default {
|
|
81
|
-
name: '
|
|
81
|
+
name: 'tuiCascadeSelection',
|
|
82
|
+
emits: ['change', 'complete'],
|
|
82
83
|
props: {
|
|
83
84
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
* 如果下一级是请求返回,则为第一级数据,否则所有数据
|
|
86
|
+
* 数据格式
|
|
86
87
|
[{
|
|
87
88
|
src: "",
|
|
88
89
|
text: "",
|
|
@@ -95,28 +96,54 @@ export default {
|
|
|
95
96
|
children:[]
|
|
96
97
|
}]
|
|
97
98
|
}]
|
|
98
|
-
|
|
99
|
+
* */
|
|
99
100
|
itemList: {
|
|
100
101
|
type: Array,
|
|
101
102
|
default: () => {
|
|
102
103
|
return [];
|
|
103
104
|
}
|
|
104
105
|
},
|
|
106
|
+
srcField: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: 'src'
|
|
109
|
+
},
|
|
110
|
+
textField: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: 'text'
|
|
113
|
+
},
|
|
114
|
+
subTextField: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: 'subText'
|
|
117
|
+
},
|
|
118
|
+
valueField: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: 'value'
|
|
121
|
+
},
|
|
122
|
+
childrenField: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: 'children'
|
|
125
|
+
},
|
|
105
126
|
/*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
初始化默认选中数据
|
|
128
|
+
[{
|
|
129
|
+
text: "",//选中text
|
|
130
|
+
subText: '',//选中subText
|
|
131
|
+
value: '',//选中value
|
|
132
|
+
src: '', //选中src,没有则传空或不传
|
|
133
|
+
index: 0, //选中数据在当前layer索引
|
|
134
|
+
list: [{src: "", text: "", subText: "", value: 101}] //当前layer下所有数据集合
|
|
135
|
+
}];
|
|
136
|
+
|
|
137
|
+
*/
|
|
117
138
|
defaultItemList: {
|
|
118
139
|
type: Array,
|
|
119
|
-
|
|
140
|
+
default() {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
defaultKey: {
|
|
145
|
+
type: String,
|
|
146
|
+
default: 'text'
|
|
120
147
|
},
|
|
121
148
|
//是否显示header底部细线
|
|
122
149
|
headerLine: {
|
|
@@ -151,7 +178,7 @@ export default {
|
|
|
151
178
|
//选中颜色
|
|
152
179
|
activeColor: {
|
|
153
180
|
type: String,
|
|
154
|
-
default: '
|
|
181
|
+
default: ''
|
|
155
182
|
},
|
|
156
183
|
//选中后文字加粗
|
|
157
184
|
bold: {
|
|
@@ -166,7 +193,7 @@ export default {
|
|
|
166
193
|
//线条颜色
|
|
167
194
|
lineColor: {
|
|
168
195
|
type: String,
|
|
169
|
-
default: '
|
|
196
|
+
default: ''
|
|
170
197
|
},
|
|
171
198
|
//icon 大小
|
|
172
199
|
checkMarkSize: {
|
|
@@ -176,7 +203,7 @@ export default {
|
|
|
176
203
|
//icon 颜色
|
|
177
204
|
checkMarkColor: {
|
|
178
205
|
type: String,
|
|
179
|
-
default: '
|
|
206
|
+
default: ''
|
|
180
207
|
},
|
|
181
208
|
//item 图片宽度
|
|
182
209
|
imgWidth: {
|
|
@@ -265,6 +292,17 @@ export default {
|
|
|
265
292
|
default: 0
|
|
266
293
|
}
|
|
267
294
|
},
|
|
295
|
+
computed: {
|
|
296
|
+
getActiveColor() {
|
|
297
|
+
return this.activeColor || (uni && uni.$tui && uni.$tui.color.primary) || '#5677fc';
|
|
298
|
+
},
|
|
299
|
+
getLineColor() {
|
|
300
|
+
return this.lineColor || (uni && uni.$tui && uni.$tui.color.primary) || '#5677fc';
|
|
301
|
+
},
|
|
302
|
+
getCkMarkColor() {
|
|
303
|
+
return this.checkMarkColor || (uni && uni.$tui && uni.$tui.color.primary) || '#5677fc';
|
|
304
|
+
}
|
|
305
|
+
},
|
|
268
306
|
watch: {
|
|
269
307
|
itemList(val) {
|
|
270
308
|
this.initData(val, -1);
|
|
@@ -274,32 +312,94 @@ export default {
|
|
|
274
312
|
},
|
|
275
313
|
reset() {
|
|
276
314
|
this.initData(this.itemList, -1);
|
|
315
|
+
},
|
|
316
|
+
defaultItemList(val) {
|
|
317
|
+
this.setDefaultData(val);
|
|
277
318
|
}
|
|
278
319
|
},
|
|
279
320
|
created() {
|
|
280
|
-
|
|
281
|
-
if (defaultItemList.length > 0) {
|
|
282
|
-
defaultItemList.map((item) => {
|
|
283
|
-
item.scrollViewId = `id_${item.index}`;
|
|
284
|
-
});
|
|
285
|
-
this.selectedArr = defaultItemList;
|
|
286
|
-
this.currentTab = defaultItemList.length - 1;
|
|
287
|
-
this.$nextTick(() => {
|
|
288
|
-
this.checkCor();
|
|
289
|
-
});
|
|
290
|
-
} else {
|
|
291
|
-
this.initData(this.itemList, -1);
|
|
292
|
-
}
|
|
321
|
+
this.setDefaultData(this.defaultItemList);
|
|
293
322
|
},
|
|
294
323
|
data() {
|
|
295
324
|
return {
|
|
296
325
|
currentTab: 0,
|
|
326
|
+
defTab: 0,
|
|
297
327
|
//tab栏scrollview滚动的位置
|
|
298
328
|
scrollViewId: 'id__1',
|
|
299
329
|
selectedArr: []
|
|
300
330
|
};
|
|
301
331
|
},
|
|
302
332
|
methods: {
|
|
333
|
+
setDefaultData(val) {
|
|
334
|
+
let defaultItemList = JSON.parse(JSON.stringify(val || []));
|
|
335
|
+
if (defaultItemList.length > 0) {
|
|
336
|
+
if ((typeof defaultItemList[0] === 'string' || typeof defaultItemList[0] === 'number') && !this.request) {
|
|
337
|
+
let subi = -1;
|
|
338
|
+
let selectedArr = [];
|
|
339
|
+
for (let j = 0, len = defaultItemList.length; j < len; j++) {
|
|
340
|
+
let item = defaultItemList[j];
|
|
341
|
+
let list = [];
|
|
342
|
+
let obj = {};
|
|
343
|
+
if (j === 0) {
|
|
344
|
+
list = this.getItemList(-1);
|
|
345
|
+
} else {
|
|
346
|
+
list = this.getItemList(j - 1, subi, selectedArr);
|
|
347
|
+
}
|
|
348
|
+
subi = this.getDefaultIndex(list, item);
|
|
349
|
+
if (subi !== -1) {
|
|
350
|
+
obj = list[subi];
|
|
351
|
+
selectedArr.push({
|
|
352
|
+
[this.textField]: obj[this.textField] || this.text,
|
|
353
|
+
[this.valueField]: obj[this.valueField] || '',
|
|
354
|
+
[this.srcField]: obj[this.srcField] || '',
|
|
355
|
+
[this.subTextField]: obj[this.subTextField] || '',
|
|
356
|
+
index: subi,
|
|
357
|
+
scrollViewId: `id_${subi}`,
|
|
358
|
+
list: list
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (subi === -1) break;
|
|
363
|
+
}
|
|
364
|
+
this.selectedArr = selectedArr;
|
|
365
|
+
this.defTab = this.currentTab;
|
|
366
|
+
this.$nextTick(() => {
|
|
367
|
+
setTimeout(() => {
|
|
368
|
+
this.currentTab = selectedArr.length - 1;
|
|
369
|
+
this.defTab = this.currentTab;
|
|
370
|
+
this.checkCor();
|
|
371
|
+
}, 20);
|
|
372
|
+
});
|
|
373
|
+
} else {
|
|
374
|
+
defaultItemList.map((item) => {
|
|
375
|
+
item.scrollViewId = `id_${item.index}`;
|
|
376
|
+
});
|
|
377
|
+
this.selectedArr = defaultItemList;
|
|
378
|
+
this.defTab = this.currentTab;
|
|
379
|
+
this.$nextTick(() => {
|
|
380
|
+
setTimeout(() => {
|
|
381
|
+
this.currentTab = defaultItemList.length - 1;
|
|
382
|
+
this.defTab = this.currentTab;
|
|
383
|
+
this.checkCor();
|
|
384
|
+
}, 20);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
this.initData(this.itemList, -1);
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
getDefaultIndex(arr, val) {
|
|
392
|
+
if (!arr || arr.length === 0 || val === undefined) return -1;
|
|
393
|
+
let index = -1;
|
|
394
|
+
let key = this.defaultKey || 'text';
|
|
395
|
+
for (let i = 0, len = arr.length; i < len; i++) {
|
|
396
|
+
if (arr[i][key] == val) {
|
|
397
|
+
index = i;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return index;
|
|
402
|
+
},
|
|
303
403
|
initData(data, layer) {
|
|
304
404
|
if (!data || data.length === 0) return;
|
|
305
405
|
if (this.request) {
|
|
@@ -316,24 +416,27 @@ export default {
|
|
|
316
416
|
},
|
|
317
417
|
removeChildren(data) {
|
|
318
418
|
let list = data.map((item) => {
|
|
319
|
-
delete item[
|
|
419
|
+
delete item[this.childrenField];
|
|
320
420
|
return item;
|
|
321
421
|
});
|
|
322
422
|
return list;
|
|
323
423
|
},
|
|
324
|
-
getItemList(layer, index) {
|
|
424
|
+
getItemList(layer, index, selectedArr) {
|
|
325
425
|
let list = [];
|
|
326
426
|
let arr = JSON.parse(JSON.stringify(this.itemList));
|
|
427
|
+
selectedArr = selectedArr || this.selectedArr;
|
|
327
428
|
if (layer == -1) {
|
|
328
429
|
list = this.removeChildren(arr);
|
|
329
430
|
} else {
|
|
330
|
-
let value =
|
|
331
|
-
value = value == -1 ? index : value;
|
|
332
|
-
|
|
431
|
+
let value = selectedArr[0].index;
|
|
432
|
+
value = value === undefined || value == -1 ? index : value;
|
|
433
|
+
if (arr[value] && arr[value][this.childrenField]) {
|
|
434
|
+
list = arr[value][this.childrenField];
|
|
435
|
+
}
|
|
333
436
|
if (layer > 0) {
|
|
334
437
|
for (let i = 1; i < layer + 1; i++) {
|
|
335
|
-
let val = layer === i ? index :
|
|
336
|
-
list = list[val].
|
|
438
|
+
let val = layer === i ? index : selectedArr[i].index;
|
|
439
|
+
list = val === -1 ? [] : list[val][this.childrenField] || [];
|
|
337
440
|
if (list.length === 0) break;
|
|
338
441
|
}
|
|
339
442
|
}
|
|
@@ -350,7 +453,11 @@ export default {
|
|
|
350
453
|
swichNav(e) {
|
|
351
454
|
let cur = e.currentTarget.dataset.current;
|
|
352
455
|
if (this.currentTab != cur) {
|
|
353
|
-
this.
|
|
456
|
+
this.defTab = this.currentTab;
|
|
457
|
+
setTimeout(() => {
|
|
458
|
+
this.currentTab = cur;
|
|
459
|
+
this.defTab = this.currentTab;
|
|
460
|
+
}, 20);
|
|
354
461
|
}
|
|
355
462
|
},
|
|
356
463
|
checkCor() {
|
|
@@ -360,7 +467,7 @@ export default {
|
|
|
360
467
|
setTimeout(() => {
|
|
361
468
|
let val = item.index < 2 ? 0 : Number(item.index - 2);
|
|
362
469
|
item.scrollViewId = `id_${val}`;
|
|
363
|
-
},
|
|
470
|
+
}, 20);
|
|
364
471
|
});
|
|
365
472
|
|
|
366
473
|
if (this.currentTab > 1) {
|
|
@@ -373,11 +480,10 @@ export default {
|
|
|
373
480
|
let item = this.selectedArr[index];
|
|
374
481
|
if (item.index == subIndex) return;
|
|
375
482
|
item.index = subIndex;
|
|
376
|
-
item.
|
|
377
|
-
item.
|
|
378
|
-
item.
|
|
379
|
-
item.
|
|
380
|
-
|
|
483
|
+
item[this.textField] = subItem[this.textField];
|
|
484
|
+
item[this.valueField] = subItem[this.valueField];
|
|
485
|
+
item[this.subTextField] = subItem[this.subTextField] || '';
|
|
486
|
+
item[this.srcField] = subItem[this.srcField] || '';
|
|
381
487
|
this.$emit('change', {
|
|
382
488
|
layer: index,
|
|
383
489
|
subIndex: subIndex, //layer=> Array index
|
|
@@ -394,11 +500,16 @@ export default {
|
|
|
394
500
|
if (!data || data.length === 0) {
|
|
395
501
|
if (layer == -1) return;
|
|
396
502
|
//完成选择
|
|
503
|
+
let arr = this.selectedArr;
|
|
504
|
+
if (layer < arr.length - 1) {
|
|
505
|
+
let newArr = arr.slice(0, layer + 1);
|
|
506
|
+
this.selectedArr = newArr;
|
|
507
|
+
}
|
|
397
508
|
let result = JSON.parse(JSON.stringify(this.selectedArr));
|
|
398
509
|
let lastItem = result[result.length - 1] || {};
|
|
399
510
|
let text = '';
|
|
400
511
|
result.map((item) => {
|
|
401
|
-
text += item.
|
|
512
|
+
text += item[this.textField];
|
|
402
513
|
delete item['list'];
|
|
403
514
|
//delete item['index'];
|
|
404
515
|
delete item['scrollViewId'];
|
|
@@ -406,19 +517,19 @@ export default {
|
|
|
406
517
|
});
|
|
407
518
|
this.$emit('complete', {
|
|
408
519
|
result: result,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
520
|
+
[this.valueField]: lastItem[this.valueField],
|
|
521
|
+
[this.textField]: text,
|
|
522
|
+
[this.subTextField]: lastItem[this.subTextField],
|
|
523
|
+
[this.srcField]: lastItem[this.srcField]
|
|
413
524
|
});
|
|
414
525
|
} else {
|
|
415
526
|
//重置数据( >layer层级)
|
|
416
527
|
let item = [
|
|
417
528
|
{
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
529
|
+
[this.textField]: this.text,
|
|
530
|
+
[this.subTextField]: '',
|
|
531
|
+
[this.valueField]: '',
|
|
532
|
+
[this.srcField]: '',
|
|
422
533
|
index: -1,
|
|
423
534
|
scrollViewId: 'id__1',
|
|
424
535
|
list: data
|
|
@@ -427,11 +538,20 @@ export default {
|
|
|
427
538
|
if (layer == -1) {
|
|
428
539
|
this.selectedArr = item;
|
|
429
540
|
} else {
|
|
430
|
-
let retainArr = this.selectedArr.slice(0, layer + 1);
|
|
541
|
+
let retainArr = this.selectedArr.slice(0, layer + 1) || [];
|
|
431
542
|
this.selectedArr = retainArr.concat(item);
|
|
432
543
|
}
|
|
544
|
+
|
|
545
|
+
let current = this.selectedArr.length - 1;
|
|
546
|
+
if (current >= this.currentTab) {
|
|
547
|
+
this.defTab = this.currentTab;
|
|
548
|
+
}
|
|
433
549
|
this.$nextTick(() => {
|
|
434
|
-
|
|
550
|
+
setTimeout(() => {
|
|
551
|
+
this.defTab = current;
|
|
552
|
+
this.currentTab = current;
|
|
553
|
+
this.scrollViewId = `id_${this.currentTab > 1 ? this.currentTab - 1 : 0}`;
|
|
554
|
+
}, 50);
|
|
435
555
|
});
|
|
436
556
|
}
|
|
437
557
|
}
|
|
@@ -468,6 +588,8 @@ export default {
|
|
|
468
588
|
bottom: 0;
|
|
469
589
|
right: 0;
|
|
470
590
|
left: 0;
|
|
591
|
+
z-index: 1;
|
|
592
|
+
pointer-events: none;
|
|
471
593
|
}
|
|
472
594
|
|
|
473
595
|
.up-btm-none::after {
|
|
@@ -532,6 +654,7 @@ export default {
|
|
|
532
654
|
margin-left: 20rpx;
|
|
533
655
|
word-break: break-all;
|
|
534
656
|
}
|
|
657
|
+
|
|
535
658
|
.up-first-item {
|
|
536
659
|
width: 100%;
|
|
537
660
|
}
|