@10yun/cv-mobile-ui 0.5.19 → 0.5.20
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/other/mpvue-picker/mpvuePicker.vue +402 -0
- package/{uni-ui/lib → other}/mpvue-picker/style.css +0 -1
- package/{uni-ui/lib → other}/tab-nvue/style.css +0 -1
- package/other/uParse/components/style.css +1 -0
- package/other/uParse/components/wxParseAudio.vue +1 -0
- package/other/uParse/components/wxParseImg.vue +86 -0
- package/other/uParse/components/wxParseTable.vue +54 -0
- package/other/uParse/components/wxParseTemplate0.vue +98 -0
- package/other/uParse/components/wxParseTemplate1.vue +81 -0
- package/other/uParse/components/wxParseTemplate10.vue +81 -0
- package/other/uParse/components/wxParseTemplate11.vue +79 -0
- package/other/uParse/components/wxParseTemplate2.vue +81 -0
- package/other/uParse/components/wxParseTemplate3.vue +81 -0
- package/other/uParse/components/wxParseTemplate4.vue +81 -0
- package/other/uParse/components/wxParseTemplate5.vue +81 -0
- package/other/uParse/components/wxParseTemplate6.vue +81 -0
- package/other/uParse/components/wxParseTemplate7.vue +81 -0
- package/other/uParse/components/wxParseTemplate8.vue +81 -0
- package/other/uParse/components/wxParseTemplate9.vue +81 -0
- package/other/uParse/components/wxParseVideo.vue +14 -0
- package/other/uParse/editor.css +495 -0
- package/{uni-ui/lib/uParse/src → other/uParse}/libs/html2json.js +19 -22
- package/{uni-ui/lib/uParse/src → other/uParse}/libs/htmlparser.js +12 -5
- package/{uni-ui/lib/uParse/src → other/uParse}/libs/wxDiscode.js +2 -2
- package/other/uParse/wxParse.vue +196 -0
- package/package.json +1 -1
- package/plugins/map/amqp-wx.js +173 -0
- package/{uni-ui/lib/mpvueGestureLock/index.vue → ui-cv/components/cv-draw-gesture-lock/cv-draw-gesture-lock.vue} +4 -1
- package/ui-cv/components/cv-draw-gesture-lock/gestureLock.js +169 -0
- package/{uni-ui/lib/mpvueGestureLock → ui-cv/components/cv-draw-gesture-lock}/style.css +0 -1
- package/{uni-ui/lib/mpvue-citypicker → ui-cv/components/cv-geo-region}/style.css +0 -1
- package/uni-ui/lib/amap-wx/js/util.js +0 -181
- package/uni-ui/lib/marked/index.js +0 -1
- package/uni-ui/lib/mpvue-citypicker/city-data/area.js +0 -12542
- package/uni-ui/lib/mpvue-citypicker/city-data/city.js +0 -1503
- package/uni-ui/lib/mpvue-citypicker/city-data/province.js +0 -139
- package/uni-ui/lib/mpvue-picker/mpvuePicker.vue +0 -3
- package/uni-ui/lib/mpvueGestureLock/gestureLock.js +0 -175
- package/uni-ui/lib/uParse/src/components/style.css +0 -2
- package/uni-ui/lib/uParse/src/components/wxParseAudio.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseImg.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTable.vue +0 -3
- package/uni-ui/lib/uParse/src/components/wxParseTemplate0.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate1.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate10.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate11.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate2.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate3.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate4.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate5.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate6.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate7.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate8.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseTemplate9.vue +0 -1
- package/uni-ui/lib/uParse/src/components/wxParseVideo.vue +0 -1
- package/uni-ui/lib/uParse/src/editor.css +0 -495
- package/uni-ui/lib/uParse/src/wxParse.vue +0 -1
- /package/{uni-ui/lib → other}/api-set-tabbar.nvue +0 -0
- /package/{uni-ui/lib → other}/mpvue-echarts/src/echarts.vue +0 -0
- /package/{uni-ui/lib → other}/mpvue-echarts/src/style.css +0 -0
- /package/{uni-ui/lib → other}/mpvue-echarts/src/wx-canvas.js +0 -0
- /package/{uni-ui/lib → other}/product.vue +0 -0
- /package/{uni-ui/lib → other}/style.css +0 -0
- /package/{uni-ui/lib → other}/tab-nvue/mediaList.vue +0 -0
- /package/{uni-ui/lib → other}/u-charts/u-charts.js +0 -0
- /package/{uni-ui/lib/uParse/src → other/uParse}/wxParse.css +0 -0
- /package/{uni-ui/lib/amap-wx → plugins/map}/lib/amap-wx.js +0 -0
- /package/{uni-ui/lib/mpvue-citypicker → ui-cv/components/cv-geo-region}/mpvueCityPicker.vue +0 -0
- /package/{uni-ui/lib/marked → ui-cv/components/cv-markdown-show}/lib/marked.js +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="mpvue-picker">
|
|
3
|
+
<view :class="{ pickerMask: showPicker }" @click="maskClick" catchtouchmove="true"></view>
|
|
4
|
+
<view class="mpvue-picker-content" :class="{ 'mpvue-picker-view-show': showPicker }">
|
|
5
|
+
<view class="mpvue-picker__hd" catchtouchmove="true">
|
|
6
|
+
<view class="mpvue-picker__action" @click="pickerCancel">取消</view>
|
|
7
|
+
<view class="mpvue-picker__action" :style="{ color: themeColor }" @click="pickerConfirm">确定</view>
|
|
8
|
+
</view>
|
|
9
|
+
<!-- 单列 -->
|
|
10
|
+
<picker-view
|
|
11
|
+
indicator-style="height: 40px;"
|
|
12
|
+
class="mpvue-picker-view"
|
|
13
|
+
:value="pickerValue"
|
|
14
|
+
@change="pickerChange"
|
|
15
|
+
v-if="mode === 'selector' && pickerValueSingleArray.length > 0"
|
|
16
|
+
>
|
|
17
|
+
<picker-view-column>
|
|
18
|
+
<view class="picker-item" v-for="(item, index) in pickerValueSingleArray" :key="index">{{ item.label }}</view>
|
|
19
|
+
</picker-view-column>
|
|
20
|
+
</picker-view>
|
|
21
|
+
<!-- 时间选择器 -->
|
|
22
|
+
<picker-view
|
|
23
|
+
indicator-style="height: 40px;"
|
|
24
|
+
class="mpvue-picker-view"
|
|
25
|
+
:value="pickerValue"
|
|
26
|
+
@change="pickerChange"
|
|
27
|
+
v-if="mode === 'timeSelector'"
|
|
28
|
+
>
|
|
29
|
+
<picker-view-column>
|
|
30
|
+
<view class="picker-item" v-for="(item, index) in pickerValueHour" :key="index">{{ item.label }}</view>
|
|
31
|
+
</picker-view-column>
|
|
32
|
+
<picker-view-column>
|
|
33
|
+
<view class="picker-item" v-for="(item, index) in pickerValueMinute" :key="index">{{ item.label }}</view>
|
|
34
|
+
</picker-view-column>
|
|
35
|
+
</picker-view>
|
|
36
|
+
<!-- 多列选择 -->
|
|
37
|
+
<picker-view
|
|
38
|
+
indicator-style="height: 40px;"
|
|
39
|
+
class="mpvue-picker-view"
|
|
40
|
+
:value="pickerValue"
|
|
41
|
+
@change="pickerChange"
|
|
42
|
+
v-if="mode === 'multiSelector'"
|
|
43
|
+
>
|
|
44
|
+
<!-- #ifdef VUE3 -->
|
|
45
|
+
<template v-for="(n, index) in pickerValueMulArray.length" :key="index">
|
|
46
|
+
<picker-view-column>
|
|
47
|
+
<view class="picker-item" v-for="(item, index1) in pickerValueMulArray[n]" :key="index1">
|
|
48
|
+
{{ item.label }}
|
|
49
|
+
</view>
|
|
50
|
+
</picker-view-column>
|
|
51
|
+
</template>
|
|
52
|
+
<!-- #endif -->
|
|
53
|
+
<!-- #ifndef VUE3 -->
|
|
54
|
+
<block v-for="(n, index) in pickerValueMulArray.length" :key="index">
|
|
55
|
+
<picker-view-column>
|
|
56
|
+
<view class="picker-item" v-for="(item, index1) in pickerValueMulArray[n]" :key="index1">
|
|
57
|
+
{{ item.label }}
|
|
58
|
+
</view>
|
|
59
|
+
</picker-view-column>
|
|
60
|
+
</block>
|
|
61
|
+
<!-- #endif -->
|
|
62
|
+
</picker-view>
|
|
63
|
+
<!-- 二级联动 -->
|
|
64
|
+
<picker-view
|
|
65
|
+
indicator-style="height: 40px;"
|
|
66
|
+
class="mpvue-picker-view"
|
|
67
|
+
:value="pickerValue"
|
|
68
|
+
@change="pickerChangeMul"
|
|
69
|
+
v-if="mode === 'multiLinkageSelector' && deepLength === 2"
|
|
70
|
+
>
|
|
71
|
+
<picker-view-column>
|
|
72
|
+
<view class="picker-item" v-for="(item, index) in pickerValueMulTwoOne" :key="index">{{ item.label }}</view>
|
|
73
|
+
</picker-view-column>
|
|
74
|
+
<picker-view-column>
|
|
75
|
+
<view class="picker-item" v-for="(item, index) in pickerValueMulTwoTwo" :key="index">{{ item.label }}</view>
|
|
76
|
+
</picker-view-column>
|
|
77
|
+
</picker-view>
|
|
78
|
+
<!-- 三级联动 -->
|
|
79
|
+
<picker-view
|
|
80
|
+
indicator-style="height: 40px;"
|
|
81
|
+
class="mpvue-picker-view"
|
|
82
|
+
:value="pickerValue"
|
|
83
|
+
@change="pickerChangeMul"
|
|
84
|
+
v-if="mode === 'multiLinkageSelector' && deepLength === 3"
|
|
85
|
+
>
|
|
86
|
+
<picker-view-column>
|
|
87
|
+
<view class="picker-item" v-for="(item, index) in pickerValueMulThreeOne" :key="index">{{ item.label }}</view>
|
|
88
|
+
</picker-view-column>
|
|
89
|
+
<picker-view-column>
|
|
90
|
+
<view class="picker-item" v-for="(item, index) in pickerValueMulThreeTwo" :key="index">{{ item.label }}</view>
|
|
91
|
+
</picker-view-column>
|
|
92
|
+
<picker-view-column>
|
|
93
|
+
<view class="picker-item" v-for="(item, index) in pickerValueMulThreeThree" :key="index">
|
|
94
|
+
{{ item.label }}
|
|
95
|
+
</view>
|
|
96
|
+
</picker-view-column>
|
|
97
|
+
</picker-view>
|
|
98
|
+
</view>
|
|
99
|
+
</view>
|
|
100
|
+
</template>
|
|
101
|
+
<script>
|
|
102
|
+
export default {
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
pickerChangeValue: [],
|
|
106
|
+
pickerValue: [],
|
|
107
|
+
pickerValueArrayChange: true,
|
|
108
|
+
modeChange: false,
|
|
109
|
+
pickerValueSingleArray: [],
|
|
110
|
+
pickerValueHour: [],
|
|
111
|
+
pickerValueMinute: [],
|
|
112
|
+
pickerValueMulArray: [],
|
|
113
|
+
pickerValueMulTwoOne: [],
|
|
114
|
+
pickerValueMulTwoTwo: [],
|
|
115
|
+
pickerValueMulThreeOne: [],
|
|
116
|
+
pickerValueMulThreeTwo: [],
|
|
117
|
+
pickerValueMulThreeThree: [],
|
|
118
|
+
/* 是否显示控件 */
|
|
119
|
+
showPicker: false
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
props: {
|
|
123
|
+
/* mode */
|
|
124
|
+
mode: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: 'selector'
|
|
127
|
+
},
|
|
128
|
+
/* picker 数值 */
|
|
129
|
+
pickerValueArray: {
|
|
130
|
+
type: Array,
|
|
131
|
+
default() {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
/* 默认值 */
|
|
136
|
+
pickerValueDefault: {
|
|
137
|
+
type: Array,
|
|
138
|
+
default() {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
/* 几级联动 */
|
|
143
|
+
deepLength: {
|
|
144
|
+
type: Number,
|
|
145
|
+
default: 2
|
|
146
|
+
},
|
|
147
|
+
/* 主题色 */
|
|
148
|
+
themeColor: String
|
|
149
|
+
},
|
|
150
|
+
watch: {
|
|
151
|
+
pickerValueArray(oldVal, newVal) {
|
|
152
|
+
this.pickerValueArrayChange = true;
|
|
153
|
+
},
|
|
154
|
+
mode(oldVal, newVal) {
|
|
155
|
+
this.modeChange = true;
|
|
156
|
+
},
|
|
157
|
+
pickerValueArray(val) {
|
|
158
|
+
this.initPicker(val);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
methods: {
|
|
162
|
+
initPicker(valueArray) {
|
|
163
|
+
let pickerValueArray = valueArray;
|
|
164
|
+
this.pickerValue = this.pickerValueDefault;
|
|
165
|
+
// 初始化多级联动
|
|
166
|
+
if (this.mode === 'selector') {
|
|
167
|
+
this.pickerValueSingleArray = valueArray;
|
|
168
|
+
} else if (this.mode === 'timeSelector') {
|
|
169
|
+
this.modeChange = false;
|
|
170
|
+
let hourArray = [];
|
|
171
|
+
let minuteArray = [];
|
|
172
|
+
for (let i = 0; i < 24; i++) {
|
|
173
|
+
hourArray.push({
|
|
174
|
+
value: i,
|
|
175
|
+
label: i > 9 ? `${i} 时` : `0${i} 时`
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
for (let i = 0; i < 60; i++) {
|
|
179
|
+
minuteArray.push({
|
|
180
|
+
value: i,
|
|
181
|
+
label: i > 9 ? `${i} 分` : `0${i} 分`
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
this.pickerValueHour = hourArray;
|
|
185
|
+
this.pickerValueMinute = minuteArray;
|
|
186
|
+
} else if (this.mode === 'multiSelector') {
|
|
187
|
+
this.pickerValueMulArray = valueArray;
|
|
188
|
+
} else if (this.mode === 'multiLinkageSelector' && this.deepLength === 2) {
|
|
189
|
+
// 两级联动
|
|
190
|
+
let pickerValueMulTwoOne = [];
|
|
191
|
+
let pickerValueMulTwoTwo = [];
|
|
192
|
+
// 第一列
|
|
193
|
+
for (let i = 0, length = pickerValueArray.length; i < length; i++) {
|
|
194
|
+
pickerValueMulTwoOne.push(pickerValueArray[i]);
|
|
195
|
+
}
|
|
196
|
+
// 渲染第二列
|
|
197
|
+
// 如果有设定的默认值
|
|
198
|
+
if (this.pickerValueDefault.length === 2) {
|
|
199
|
+
let num = this.pickerValueDefault[0];
|
|
200
|
+
for (let i = 0, length = pickerValueArray[num].children.length; i < length; i++) {
|
|
201
|
+
pickerValueMulTwoTwo.push(pickerValueArray[num].children[i]);
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
for (let i = 0, length = pickerValueArray[0].children.length; i < length; i++) {
|
|
205
|
+
pickerValueMulTwoTwo.push(pickerValueArray[0].children[i]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
this.pickerValueMulTwoOne = pickerValueMulTwoOne;
|
|
209
|
+
this.pickerValueMulTwoTwo = pickerValueMulTwoTwo;
|
|
210
|
+
} else if (this.mode === 'multiLinkageSelector' && this.deepLength === 3) {
|
|
211
|
+
let pickerValueMulThreeOne = [];
|
|
212
|
+
let pickerValueMulThreeTwo = [];
|
|
213
|
+
let pickerValueMulThreeThree = [];
|
|
214
|
+
// 第一列
|
|
215
|
+
for (let i = 0, length = pickerValueArray.length; i < length; i++) {
|
|
216
|
+
pickerValueMulThreeOne.push(pickerValueArray[i]);
|
|
217
|
+
}
|
|
218
|
+
// 渲染第二列
|
|
219
|
+
this.pickerValueDefault = this.pickerValueDefault.length === 3 ? this.pickerValueDefault : [0, 0, 0];
|
|
220
|
+
if (this.pickerValueDefault.length === 3) {
|
|
221
|
+
let num = this.pickerValueDefault[0];
|
|
222
|
+
for (let i = 0, length = pickerValueArray[num].children.length; i < length; i++) {
|
|
223
|
+
pickerValueMulThreeTwo.push(pickerValueArray[num].children[i]);
|
|
224
|
+
}
|
|
225
|
+
// 第三列
|
|
226
|
+
let numSecond = this.pickerValueDefault[1];
|
|
227
|
+
for (let i = 0, length = pickerValueArray[num].children[numSecond].children.length; i < length; i++) {
|
|
228
|
+
pickerValueMulThreeThree.push(pickerValueArray[num].children[numSecond].children[i]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
this.pickerValueMulThreeOne = pickerValueMulThreeOne;
|
|
232
|
+
this.pickerValueMulThreeTwo = pickerValueMulThreeTwo;
|
|
233
|
+
this.pickerValueMulThreeThree = pickerValueMulThreeThree;
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
show() {
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
if (this.pickerValueArrayChange || this.modeChange) {
|
|
239
|
+
this.initPicker(this.pickerValueArray);
|
|
240
|
+
this.showPicker = true;
|
|
241
|
+
this.pickerValueArrayChange = false;
|
|
242
|
+
this.modeChange = false;
|
|
243
|
+
} else {
|
|
244
|
+
this.showPicker = true;
|
|
245
|
+
}
|
|
246
|
+
}, 0);
|
|
247
|
+
},
|
|
248
|
+
maskClick() {
|
|
249
|
+
this.pickerCancel();
|
|
250
|
+
},
|
|
251
|
+
pickerCancel() {
|
|
252
|
+
this.showPicker = false;
|
|
253
|
+
this._initPickerVale();
|
|
254
|
+
let pickObj = {
|
|
255
|
+
index: this.pickerValue,
|
|
256
|
+
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
|
|
257
|
+
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
|
|
258
|
+
};
|
|
259
|
+
this.$emit('onCancel', pickObj);
|
|
260
|
+
},
|
|
261
|
+
pickerConfirm(e) {
|
|
262
|
+
this.showPicker = false;
|
|
263
|
+
this._initPickerVale();
|
|
264
|
+
let pickObj = {
|
|
265
|
+
index: this.pickerValue,
|
|
266
|
+
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
|
|
267
|
+
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
|
|
268
|
+
};
|
|
269
|
+
this.$emit('onConfirm', pickObj);
|
|
270
|
+
},
|
|
271
|
+
showPickerView() {
|
|
272
|
+
this.showPicker = true;
|
|
273
|
+
},
|
|
274
|
+
pickerChange(e) {
|
|
275
|
+
this.pickerValue = e.mp.detail.value;
|
|
276
|
+
let pickObj = {
|
|
277
|
+
index: this.pickerValue,
|
|
278
|
+
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
|
|
279
|
+
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
|
|
280
|
+
};
|
|
281
|
+
this.$emit('onChange', pickObj);
|
|
282
|
+
},
|
|
283
|
+
pickerChangeMul(e) {
|
|
284
|
+
if (this.deepLength === 2) {
|
|
285
|
+
let pickerValueArray = this.pickerValueArray;
|
|
286
|
+
let changeValue = e.mp.detail.value;
|
|
287
|
+
// 处理第一列滚动
|
|
288
|
+
if (changeValue[0] !== this.pickerValue[0]) {
|
|
289
|
+
let pickerValueMulTwoTwo = [];
|
|
290
|
+
// 第一列滚动第二列数据更新
|
|
291
|
+
for (let i = 0, length = pickerValueArray[changeValue[0]].children.length; i < length; i++) {
|
|
292
|
+
pickerValueMulTwoTwo.push(pickerValueArray[changeValue[0]].children[i]);
|
|
293
|
+
}
|
|
294
|
+
this.pickerValueMulTwoTwo = pickerValueMulTwoTwo;
|
|
295
|
+
// 第二列初始化为 0
|
|
296
|
+
changeValue[1] = 0;
|
|
297
|
+
}
|
|
298
|
+
this.pickerValue = changeValue;
|
|
299
|
+
} else if (this.deepLength === 3) {
|
|
300
|
+
let pickerValueArray = this.pickerValueArray;
|
|
301
|
+
let changeValue = e.mp.detail.value;
|
|
302
|
+
let pickerValueMulThreeTwo = [];
|
|
303
|
+
let pickerValueMulThreeThree = [];
|
|
304
|
+
// 重新渲染第二列
|
|
305
|
+
// 如果是第一列滚动
|
|
306
|
+
if (changeValue[0] !== this.pickerValue[0]) {
|
|
307
|
+
this.pickerValueMulThreeTwo = [];
|
|
308
|
+
for (let i = 0, length = pickerValueArray[changeValue[0]].children.length; i < length; i++) {
|
|
309
|
+
pickerValueMulThreeTwo.push(pickerValueArray[changeValue[0]].children[i]);
|
|
310
|
+
}
|
|
311
|
+
// 重新渲染第三列
|
|
312
|
+
for (let i = 0, length = pickerValueArray[changeValue[0]].children[0].children.length; i < length; i++) {
|
|
313
|
+
pickerValueMulThreeThree.push(pickerValueArray[changeValue[0]].children[0].children[i]);
|
|
314
|
+
}
|
|
315
|
+
changeValue[1] = 0;
|
|
316
|
+
changeValue[2] = 0;
|
|
317
|
+
this.pickerValueMulThreeTwo = pickerValueMulThreeTwo;
|
|
318
|
+
this.pickerValueMulThreeThree = pickerValueMulThreeThree;
|
|
319
|
+
} else if (changeValue[1] !== this.pickerValue[1]) {
|
|
320
|
+
// 第二列滚动
|
|
321
|
+
// 重新渲染第三列
|
|
322
|
+
this.pickerValueMulThreeThree = [];
|
|
323
|
+
pickerValueMulThreeTwo = this.pickerValueMulThreeTwo;
|
|
324
|
+
for (let i = 0, length = pickerValueArray[changeValue[0]].children[changeValue[1]].children.length; i < length; i++) {
|
|
325
|
+
pickerValueMulThreeThree.push(pickerValueArray[changeValue[0]].children[changeValue[1]].children[i]);
|
|
326
|
+
}
|
|
327
|
+
changeValue[2] = 0;
|
|
328
|
+
this.pickerValueMulThreeThree = pickerValueMulThreeThree;
|
|
329
|
+
}
|
|
330
|
+
this.pickerValue = changeValue;
|
|
331
|
+
}
|
|
332
|
+
let pickObj = {
|
|
333
|
+
index: this.pickerValue,
|
|
334
|
+
value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
|
|
335
|
+
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
|
|
336
|
+
};
|
|
337
|
+
this.$emit('onChange', pickObj);
|
|
338
|
+
},
|
|
339
|
+
// 获取 pxikerLabel
|
|
340
|
+
_getPickerLabelAndValue(value, mode) {
|
|
341
|
+
let pickerLable;
|
|
342
|
+
let pickerGetValue = [];
|
|
343
|
+
// selector
|
|
344
|
+
if (mode === 'selector') {
|
|
345
|
+
pickerLable = this.pickerValueSingleArray[value].label;
|
|
346
|
+
pickerGetValue.push(this.pickerValueSingleArray[value].value);
|
|
347
|
+
} else if (mode === 'timeSelector') {
|
|
348
|
+
pickerLable = `${this.pickerValueHour[value[0]].label}-${this.pickerValueMinute[value[1]].label}`;
|
|
349
|
+
pickerGetValue.push(this.pickerValueHour[value[0]].value);
|
|
350
|
+
pickerGetValue.push(this.pickerValueHour[value[1]].value);
|
|
351
|
+
} else if (mode === 'multiSelector') {
|
|
352
|
+
for (let i = 0; i < value.length; i++) {
|
|
353
|
+
if (i > 0) {
|
|
354
|
+
pickerLable += this.pickerValueMulArray[i][value[i]].label + (i === value.length - 1 ? '' : '-');
|
|
355
|
+
} else {
|
|
356
|
+
pickerLable = this.pickerValueMulArray[i][value[i]].label + '-';
|
|
357
|
+
}
|
|
358
|
+
pickerGetValue.push(this.pickerValueMulArray[i][value[i]].value);
|
|
359
|
+
}
|
|
360
|
+
} else if (mode === 'multiLinkageSelector') {
|
|
361
|
+
/* eslint-disable indent */
|
|
362
|
+
pickerLable =
|
|
363
|
+
this.deepLength === 2
|
|
364
|
+
? `${this.pickerValueMulTwoOne[value[0]].label}-${this.pickerValueMulTwoTwo[value[1]].label}`
|
|
365
|
+
: `${this.pickerValueMulThreeOne[value[0]].label}-${this.pickerValueMulThreeTwo[value[1]].label}-${
|
|
366
|
+
this.pickerValueMulThreeThree[value[2]].label
|
|
367
|
+
}`;
|
|
368
|
+
if (this.deepLength === 2) {
|
|
369
|
+
pickerGetValue.push(this.pickerValueMulTwoOne[value[0]].value);
|
|
370
|
+
pickerGetValue.push(this.pickerValueMulTwoTwo[value[1]].value);
|
|
371
|
+
} else {
|
|
372
|
+
pickerGetValue.push(this.pickerValueMulThreeOne[value[0]].value);
|
|
373
|
+
pickerGetValue.push(this.pickerValueMulThreeTwo[value[1]].value);
|
|
374
|
+
pickerGetValue.push(this.pickerValueMulThreeThree[value[2]].value);
|
|
375
|
+
}
|
|
376
|
+
/* eslint-enable indent */
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
label: pickerLable,
|
|
380
|
+
value: pickerGetValue
|
|
381
|
+
};
|
|
382
|
+
},
|
|
383
|
+
// 初始化 pickerValue 默认值
|
|
384
|
+
_initPickerVale() {
|
|
385
|
+
if (this.pickerValue.length === 0) {
|
|
386
|
+
if (this.mode === 'selector') {
|
|
387
|
+
this.pickerValue = [0];
|
|
388
|
+
} else if (this.mode === 'multiSelector') {
|
|
389
|
+
this.pickerValue = new Int8Array(this.pickerValueArray.length);
|
|
390
|
+
} else if (this.mode === 'multiLinkageSelector' && this.deepLength === 2) {
|
|
391
|
+
this.pickerValue = [0, 0];
|
|
392
|
+
} else if (this.mode === 'multiLinkageSelector' && this.deepLength === 3) {
|
|
393
|
+
this.pickerValue = [0, 0, 0];
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
</script>
|
|
400
|
+
<style>
|
|
401
|
+
@import './style.css';
|
|
402
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../wxParse.css');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template>
|
|
2
|
<cv-base-audio
|
|
1
3
|
:id="node.attr.id"
|
|
2
4
|
:class="node.classStr"
|
|
3
5
|
:style="node.styleStr"
|
|
4
6
|
:src="node.attr.src"
|
|
5
7
|
:loop="node.attr.loop"
|
|
6
8
|
:poster="node.attr.poster"
|
|
7
9
|
:name="node.attr.name"
|
|
8
10
|
:author="node.attr.author"
|
|
9
11
|
controls
|
|
10
12
|
/>
|
|
11
13
|
name: 'wxParseAudio',
|
|
12
14
|
props: {
|
|
13
15
|
node: {
|
|
14
16
|
type: Object,
|
|
15
17
|
default() {
|
|
16
18
|
return {};
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<image
|
|
3
|
+
:mode="node.attr.mode"
|
|
4
|
+
:lazy-load="node.attr.lazyLoad"
|
|
5
|
+
:class="node.classStr"
|
|
6
|
+
:style="newStyleStr || node.styleStr"
|
|
7
|
+
:data-src="node.attr.src"
|
|
8
|
+
:src="node.attr.src"
|
|
9
|
+
@tap="wxParseImgTap"
|
|
10
|
+
@load="wxParseImgLoad"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'wxParseImg',
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
newStyleStr: '',
|
|
19
|
+
preview: true
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
inject: ['parseWidth'],
|
|
23
|
+
mounted() {},
|
|
24
|
+
props: {
|
|
25
|
+
node: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default() {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
wxParseImgTap(e) {
|
|
34
|
+
if (!this.preview) return;
|
|
35
|
+
const { src } = e.currentTarget.dataset;
|
|
36
|
+
if (!src) return;
|
|
37
|
+
let parent = this.$parent;
|
|
38
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
39
|
+
// TODO 遍历获取父节点执行方法
|
|
40
|
+
parent = parent.$parent;
|
|
41
|
+
}
|
|
42
|
+
parent.preview(src, e);
|
|
43
|
+
},
|
|
44
|
+
// 图片视觉宽高计算函数区
|
|
45
|
+
wxParseImgLoad(e) {
|
|
46
|
+
const { src } = e.currentTarget.dataset;
|
|
47
|
+
if (!src) return;
|
|
48
|
+
let { width, height } = e.mp.detail;
|
|
49
|
+
const recal = this.wxAutoImageCal(width, height);
|
|
50
|
+
const { imageheight, imageWidth } = recal;
|
|
51
|
+
const { padding, mode } = this.node.attr; //删除padding
|
|
52
|
+
// const { mode } = this.node.attr;
|
|
53
|
+
const { styleStr } = this.node;
|
|
54
|
+
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
|
|
55
|
+
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`; //删除padding
|
|
56
|
+
// this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px;`;
|
|
57
|
+
},
|
|
58
|
+
// 计算视觉优先的图片宽高
|
|
59
|
+
wxAutoImageCal(originalWidth, originalHeight) {
|
|
60
|
+
// 获取图片的原始长宽
|
|
61
|
+
const windowWidth = this.parseWidth.value;
|
|
62
|
+
const results = {};
|
|
63
|
+
if (originalWidth < 60 || originalHeight < 60) {
|
|
64
|
+
const { src } = this.node.attr;
|
|
65
|
+
let parent = this.$parent;
|
|
66
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
67
|
+
parent = parent.$parent;
|
|
68
|
+
}
|
|
69
|
+
parent.removeImageUrl(src);
|
|
70
|
+
this.preview = false;
|
|
71
|
+
}
|
|
72
|
+
// 判断按照那种方式进行缩放
|
|
73
|
+
if (originalWidth > windowWidth) {
|
|
74
|
+
// 在图片width大于手机屏幕width时候
|
|
75
|
+
results.imageWidth = windowWidth;
|
|
76
|
+
results.imageheight = windowWidth * (originalHeight / originalWidth);
|
|
77
|
+
} else {
|
|
78
|
+
// 否则展示原来的数据
|
|
79
|
+
results.imageWidth = originalWidth;
|
|
80
|
+
results.imageheight = originalHeight;
|
|
81
|
+
}
|
|
82
|
+
return results;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tablebox">
|
|
3
|
+
<rich-text :nodes="nodes" :class="node.classStr" :style="'user-select:' + parseSelect"></rich-text>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: 'wxParseTable',
|
|
9
|
+
props: {
|
|
10
|
+
node: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default() {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
inject: ['parseSelect'],
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
nodes: []
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
mounted() {
|
|
24
|
+
this.nodes = this.loadNode([this.node]);
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
loadNode(node) {
|
|
28
|
+
let obj = [];
|
|
29
|
+
for (let children of node) {
|
|
30
|
+
if (children.node == 'element') {
|
|
31
|
+
let t = {
|
|
32
|
+
name: children.tag,
|
|
33
|
+
attrs: {
|
|
34
|
+
class: children.classStr
|
|
35
|
+
// style: children.styleStr,
|
|
36
|
+
},
|
|
37
|
+
children: children.nodes ? this.loadNode(children.nodes) : []
|
|
38
|
+
};
|
|
39
|
+
obj.push(t);
|
|
40
|
+
} else if (children.node == 'text') {
|
|
41
|
+
obj.push({
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: children.text
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
52
|
+
<style>
|
|
53
|
+
@import './style.css';
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--判断是否是标签节点-->
|
|
3
|
+
<block v-if="node.node == 'element'">
|
|
4
|
+
<!--button类型-->
|
|
5
|
+
<button v-if="node.tag == 'button'" type="default" size="mini" :class="node.classStr" :style="node.styleStr">
|
|
6
|
+
<wx-parse-template :node="node" />
|
|
7
|
+
</button>
|
|
8
|
+
<!--a类型-->
|
|
9
|
+
<view
|
|
10
|
+
v-else-if="node.tag == 'a'"
|
|
11
|
+
@click="wxParseATap(node.attr, $event)"
|
|
12
|
+
:class="node.classStr"
|
|
13
|
+
:data-href="node.attr.href"
|
|
14
|
+
:style="node.styleStr"
|
|
15
|
+
>
|
|
16
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
17
|
+
<wx-parse-template :node="node" />
|
|
18
|
+
</block>
|
|
19
|
+
</view>
|
|
20
|
+
<!--li类型-->
|
|
21
|
+
<view v-else-if="node.tag == 'li'" :class="node.classStr" :style="node.styleStr">
|
|
22
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
23
|
+
<wx-parse-template :node="node" />
|
|
24
|
+
</block>
|
|
25
|
+
</view>
|
|
26
|
+
<!--table类型-->
|
|
27
|
+
<wx-parse-table v-else-if="node.tag == 'table'" :class="node.classStr" :style="node.styleStr" :node="node" />
|
|
28
|
+
<!--br类型-->
|
|
29
|
+
<!-- #ifndef H5 -->
|
|
30
|
+
<text v-else-if="node.tag == 'br'">\n</text>
|
|
31
|
+
<!-- #endif -->
|
|
32
|
+
<!-- #ifdef H5 -->
|
|
33
|
+
<br v-else-if="node.tag == 'br'" />
|
|
34
|
+
<!-- #endif -->
|
|
35
|
+
<!--video类型-->
|
|
36
|
+
<wx-parse-video :node="node" v-else-if="node.tag == 'video'" />
|
|
37
|
+
<!--audio类型-->
|
|
38
|
+
<wx-parse-audio :node="node" v-else-if="node.tag == 'audio'" />
|
|
39
|
+
<!--img类型-->
|
|
40
|
+
<wx-parse-img :node="node" v-else-if="node.tag == 'img'" :style="node.styleStr" />
|
|
41
|
+
<!--其他标签-->
|
|
42
|
+
<view v-else :class="node.classStr" :style="node.styleStr">
|
|
43
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
44
|
+
<wx-parse-template :node="node" />
|
|
45
|
+
</block>
|
|
46
|
+
</view>
|
|
47
|
+
</block>
|
|
48
|
+
<!--判断是否是文本节点-->
|
|
49
|
+
<block v-else-if="node.node == 'text'">
|
|
50
|
+
<text decode="true">{{ textHandle(node.text) }}</text>
|
|
51
|
+
</block>
|
|
52
|
+
<!-- <block v-else-if="node.node == 'text'">{{node.text}}</block> -->
|
|
53
|
+
</template>
|
|
54
|
+
<script>
|
|
55
|
+
// #ifdef APP-PLUS | H5
|
|
56
|
+
import wxParseTemplate from './wxParseTemplate0';
|
|
57
|
+
// #endif
|
|
58
|
+
// #ifdef MP
|
|
59
|
+
import wxParseTemplate from './wxParseTemplate1';
|
|
60
|
+
// #endif
|
|
61
|
+
import wxParseImg from './wxParseImg';
|
|
62
|
+
import wxParseVideo from './wxParseVideo';
|
|
63
|
+
import wxParseAudio from './wxParseAudio';
|
|
64
|
+
import wxParseTable from './wxParseTable';
|
|
65
|
+
export default {
|
|
66
|
+
// #ifdef APP-PLUS | H5
|
|
67
|
+
name: 'wxParseTemplate',
|
|
68
|
+
// #endif
|
|
69
|
+
// #ifdef MP
|
|
70
|
+
name: 'wxParseTemplate0',
|
|
71
|
+
// #endif
|
|
72
|
+
props: {
|
|
73
|
+
node: {}
|
|
74
|
+
},
|
|
75
|
+
components: {
|
|
76
|
+
wxParseTemplate,
|
|
77
|
+
wxParseImg,
|
|
78
|
+
wxParseVideo,
|
|
79
|
+
wxParseAudio,
|
|
80
|
+
wxParseTable
|
|
81
|
+
},
|
|
82
|
+
methods: {
|
|
83
|
+
wxParseATap(attr, e) {
|
|
84
|
+
const { href } = e.currentTarget.dataset; // TODO currentTarget才有dataset
|
|
85
|
+
if (!href) return;
|
|
86
|
+
let parent = this.$parent;
|
|
87
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
88
|
+
// TODO 遍历获取父节点执行方法
|
|
89
|
+
parent = parent.$parent;
|
|
90
|
+
}
|
|
91
|
+
parent.navigate(href, e, attr);
|
|
92
|
+
},
|
|
93
|
+
textHandle: function (text) {
|
|
94
|
+
return text ? text.replace(/\n/g, '\n') : '';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
</script>
|