fstarter 2.10.45 → 2.10.46

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.
Files changed (78) hide show
  1. package/.babelrc +6 -6
  2. package/.editorconfig +9 -9
  3. package/README.md +18 -18
  4. package/fstarter.iml +9 -0
  5. package/index.html +22 -22
  6. package/index.js +222 -222
  7. package/package.json +104 -104
  8. package/src/App.vue +38 -38
  9. package/src/i18n/en-US.js +35 -35
  10. package/src/i18n/zh-CN.js +35 -35
  11. package/src/main.js +87 -87
  12. package/src/plugins/assets/ak.js +948 -948
  13. package/src/plugins/assets/callNative.js +488 -488
  14. package/src/plugins/assets/compressImg.js +75 -75
  15. package/src/plugins/assets/config.js +106 -106
  16. package/src/plugins/assets/fileServer.js +469 -469
  17. package/src/plugins/assets/http.js +343 -343
  18. package/src/plugins/assets/ua.js +27 -27
  19. package/src/plugins/components/BSButton.vue +61 -61
  20. package/src/plugins/components/BSCascader.vue +465 -465
  21. package/src/plugins/components/BSCell.vue +48 -48
  22. package/src/plugins/components/BSDatePicker.vue +167 -167
  23. package/src/plugins/components/BSImage.vue +42 -42
  24. package/src/plugins/components/BSInput.vue +140 -140
  25. package/src/plugins/components/BSList.vue +81 -81
  26. package/src/plugins/components/BSPicCode.vue +96 -96
  27. package/src/plugins/components/BSPopup.vue +43 -43
  28. package/src/plugins/components/BSRadio.vue +97 -97
  29. package/src/plugins/components/BSSearch.vue +109 -109
  30. package/src/plugins/components/BSSelect.vue +144 -144
  31. package/src/plugins/components/BSSign.vue +454 -454
  32. package/src/plugins/components/BSStepper.vue +115 -115
  33. package/src/plugins/components/BSUpload.vue +92 -92
  34. package/src/plugins/components/BSUpload2.vue +382 -392
  35. package/src/plugins/components/BSVerCode.vue +131 -135
  36. package/src/plugins/components/BSViewer.vue +92 -92
  37. package/src/plugins/components/base.js +496 -496
  38. package/src/plugins/components/base2.js +489 -489
  39. package/src/plugins/lib/weixin.js +20 -20
  40. package/src/plugins/platform/index.js +7 -7
  41. package/src/plugins/platform/isp_phone.js +306 -306
  42. package/src/plugins/route/index.js +140 -140
  43. package/src/plugins/selector/index.js +342 -342
  44. package/src/plugins/service/index.js +81 -81
  45. package/src/plugins/services/callCamera.js +53 -53
  46. package/src/plugins/services/exit.js +36 -36
  47. package/src/plugins/services/face.js +69 -69
  48. package/src/plugins/services/faceInApp.js +31 -31
  49. package/src/plugins/services/getFaceResult.js +104 -104
  50. package/src/plugins/services/getMenus.js +40 -40
  51. package/src/plugins/services/getSystemData.js +128 -128
  52. package/src/plugins/services/getToken.js +79 -79
  53. package/src/plugins/services/getUserInfo.js +47 -47
  54. package/src/plugins/services/goSetPage.js +40 -40
  55. package/src/plugins/services/hideFhoneTitle.js +36 -36
  56. package/src/plugins/services/index.js +37 -41
  57. package/src/plugins/services/init.js +35 -35
  58. package/src/plugins/services/jumpView.js +40 -40
  59. package/src/plugins/services/logout.js +43 -43
  60. package/src/plugins/services/share.js +113 -113
  61. package/src/plugins/services/statusBarHeight.js +39 -39
  62. package/src/plugins/session/index.js +32 -32
  63. package/src/services/getAuthInfo.js +22 -22
  64. package/src/services/index.js +9 -9
  65. package/src/services/sendVerCode.js +23 -23
  66. package/src/views/auth.vue +354 -361
  67. package/src/views/auth2.vue +90 -90
  68. package/src/views/auth3.vue +148 -157
  69. package/src/views/auth4.vue +8979 -8979
  70. package/src/views/auth5.vue +50 -50
  71. package/src/views/components/BankSelect.vue +55 -55
  72. package/src/views/foot.vue +140 -140
  73. package/src/views/page.vue +219 -219
  74. package/src/views/shellFunc.vue +41 -41
  75. package/themes/basic.css +1 -1
  76. package/webpack.config.js +144 -144
  77. package/src/plugins/services/faceTx.js +0 -61
  78. package/src/plugins/services/getTxFaceResult.js +0 -83
@@ -1,465 +1,465 @@
1
- <template>
2
- <div>
3
- <van-field
4
- is-link
5
- readonly
6
- :label="model.label"
7
- :value="model.text"
8
- @click="onOpen"
9
- @blur="blur"
10
- />
11
- <van-popup @close="onClose" :lock-scroll="false" ref="popup" v-model="show" round position="bottom"
12
- :style="{ height: model.height }">
13
- <van-nav-bar class="vanBar" style="margin-bottom:5px" :title="model.popTitle?model.popTitle:model.label">
14
- <template #right>
15
- <van-icon name="cross" :color="color" size="1.5rem" @click="show=false"/>
16
- </template>
17
- </van-nav-bar>
18
- <van-search class="vanField" v-if="model.searchFlag"
19
- v-model="searchValueTemp"
20
- show-action
21
- shape="round"
22
- maxlength="20"
23
- style="width: 95%;margin:0 auto;margin-bottom:5px"
24
- :placeholder="model.searchPlaceholder" @search="search(false)" @clear="search(false)"
25
- >
26
- <template #action>
27
- <div @click="search(false)">搜&nbsp;&nbsp;索</div>
28
- </template>
29
- </van-search>
30
- <div class="vanHot" style="width: 100% ;margin-bottom:15px " v-if="hotListSort.length>0">
31
- <van-divider
32
- :style="{ width: '95%',margin:'0 auto','margin-bottom':'0.5rem' ,color: '#000000', borderColor: '#929292', 'font-size': '1rem' }"
33
- dashed>
34
- {{ model.hotTitle ? model.hotTitle : '常用选项' }}
35
- </van-divider>
36
- <van-row style="width: 80% ;margin:0 auto;padding: 0 0.6rem 0 1rem ">
37
-
38
- <van-button v-for="(item,index) in hotListSort" round plain type="default"
39
- style="margin-bottom:5px ;margin-right:0.4rem;height:1.5rem" @click="select(item)">
40
- {{ item.text.length > 7 ? item.text.substring(0, 7) + '...' : item.text }}
41
- </van-button>
42
- </van-row>
43
- </div>
44
- <van-tabs style="width: 97%;margin:0 auto" class="vanTab def_color" animated v-model="active" ref="tabs"
45
- :before-change="beforeChange">
46
- <van-tab v-for="(item,index) in options" :title="titles[index]?titles[index]:''">
47
- <van-cell-group class=" divScrollbar divStyle divStyleBorder" :key="key"
48
- :style="{ height: height}">
49
- <div style="height: 1.5rem"></div>
50
- <van-cell clickable style="padding-left: 1rem ;padding-right: 1rem" size="large" center
51
- v-for="(item1,index1) in item" :title="item1.text"
52
- @click="onChange(item1,index1)" :label="item1.label">
53
- <template #right-icon>
54
- <van-icon name="checked" v-show="item1.value==thisRadio" :color="color" size="1.2rem"/>
55
- </template>
56
- </van-cell>
57
- <div style="height: 0.5rem"></div>
58
- </van-cell-group>
59
- </van-tab>
60
- </van-tabs>
61
-
62
- </van-popup>
63
- </div>
64
- </template>
65
-
66
- <script>
67
-
68
- import base2 from './base2.js'
69
-
70
- export default {
71
- name: "bs-cascader",
72
- mixins: [base2],
73
- watch: {
74
- active(newVal) {
75
- if (this.values['level' + newVal]) {
76
- this.thisRadio = this.values['level' + newVal].value
77
- } else {
78
- this.thisRadio = undefined
79
- }
80
- // && newVal != this.level_length - 1
81
- if (!this.selectFlag) {
82
- this.search()
83
- }
84
- this.selectFlag = false
85
- },
86
- 'model.items': {
87
- handler(val, oldval) {
88
-
89
- this.onInit()
90
- },
91
- deep: false
92
- }
93
- }
94
- ,
95
- methods: {
96
- blur(){
97
-
98
- if(!this.model.readonly)
99
- this.model.validateToken++
100
-
101
- this.$emit('blur',function(){
102
-
103
- },this.fullName)
104
-
105
- },
106
- onInit() {
107
- this.options1 = this.model.items
108
- let that = this
109
- that.level_length = 0
110
- let options2 = {}
111
- this.hotListSort = []
112
- Object.keys(that.options1).sort().forEach(function (key) {
113
- options2[key] = that.options1[key];
114
- that.level_length++
115
- })
116
- that.options1 = options2
117
- for (const level in that.options1) {
118
- this.options[level] = []
119
- if (!this.model.defaultTitles[level]) {
120
- this.model.defaultTitles[level] = this.defaultTitle
121
- }
122
- if (level == 'level0') {
123
- this.titles[level] = this.model.defaultTitles[level]
124
- } else {
125
- this.titles[level] = ''
126
- }
127
-
128
- that.options1[level].forEach((item, index) => {
129
- item['level'] = level
130
- item.parentsIndex = ''
131
- this.optionsMap[item.value] = index
132
- item.show = true
133
- item.index = level + '-' + index
134
- item.i = index
135
- this.getParentsIndex(item, level)
136
- item.fullIndex = item.parentsIndex + item.index + ','
137
- if (level == 'level0') {
138
- this.options[level].push(item)
139
- }
140
- if (that.model.hotList.length != 0 && that.model.hotList.indexOf(item.value) != -1) {
141
- this.hotListSort.push(item)
142
- }
143
- })
144
-
145
- }
146
- this.hotListSort.sort(function (a, b) {
147
- return a.text.length > b.text.length ? 1 : -1;
148
- })
149
- },
150
- onOpen() {
151
- if (this.model.readonly)
152
- return
153
- if (this.options1['level0']) {
154
- //调试用
155
- // if (!this.options1.level0) {
156
- // this.onInit()
157
- // }
158
- if (this.model.value) {
159
- this.select(this.options1['level' + (this.level_length - 1)][this.optionsMap[this.model.value]])
160
- this.search()
161
- }
162
- this.show = true
163
- let that = this
164
- setTimeout(() => {
165
- that.height = that.getHeight();
166
- }, 50);
167
- }
168
-
169
- },
170
- onClose() {
171
- this.onFinish()
172
- },
173
- // 全部选项选择完毕后,会触发 finish 事件
174
- getHeight() {
175
- // this.$refs.tabs.$el.style.setProperty("--variable", this.model.color);
176
- return this.$refs.popup.$el.offsetHeight - 46 + 'px'
177
- },
178
- onFinish() {
179
- if (this.values['level' + (this.level_length - 1)]) {
180
- this.select(this.values['level' + (this.level_length - 1)])
181
- this.model.value2 = JSON.parse(JSON.stringify(this.values['level' + (this.level_length - 1)]));
182
- this.model.value = this.model.value2.value
183
- this.model.text = this.model.value2.text
184
- this.model.data = JSON.parse(JSON.stringify(this.values));
185
- this.searchValueTemp = this.searchValue = ''
186
- }
187
- },
188
- beforeChange(index) {
189
- if (!this.titles['level' + index]) {
190
- return false;
191
- }
192
- this.selectFlag = false
193
- return true
194
- },
195
- onChange(item, index) {
196
- try {
197
- if (!this.titles[item.level]) {
198
- return
199
- }
200
- this.thisRadio = item.value
201
- this.putItem(item)
202
- const nextIndex = (this.getLevelIndex(item.level) + 1)
203
- const nextlevel = 'level' + nextIndex
204
- for (let j = this.level_length - 1; j > this.getLevelIndex(item.level); j--) {
205
- if (j == nextIndex) {
206
- this.titles[nextlevel] = this.defaultTitle
207
- } else {
208
- this.titles['level' + j] = undefined
209
- }
210
- this.values['level' + j] = undefined
211
- }
212
- let that = this
213
- if (nextIndex < that.level_length) {
214
- setTimeout(() => {
215
- that.active = nextIndex
216
- }, 50);
217
- } else if (this.autoFinish) {
218
- this.show = false
219
- }
220
- } catch (e) {
221
- console.log(e.stack); // print stack trace
222
- this.show = false
223
- this.onInit()
224
- }
225
-
226
- },
227
- getParentsIndex(children, level) {
228
- if (children.parent) {
229
- level = 'level' + (this.getLevelIndex(level) - 1)
230
- this.options1[level].forEach((item, index) => {
231
- if (children.parent == item.value) {
232
- children.parentsIndex += item.parentsIndex + (level + '-' + index + ',')
233
- }
234
- })
235
- }
236
- },
237
- getLevelIndex(level) {
238
- return Number(level.charAt(level.length - 1))
239
- },
240
- //搜索选择, false点击搜索
241
- search(flag = true) {
242
- try {
243
- let active = this.active
244
- let reStr = "level" + active + "-[0-9]{1,1000},"
245
- let re = new RegExp(reStr)
246
- if (!flag) {
247
- this.searchValue = this.searchValueTemp
248
- this.reset(this.active + 1)
249
- }
250
- if (active > 0) {
251
- re = new RegExp(this.values['level' + (active - 1)].fullIndex + reStr)
252
- }
253
- let re1 = new RegExp(reStr)
254
- if (!this.searchValue) {
255
- this.reflash(re, active)
256
- } else {
257
- let levelset = new Set([]);
258
- for (let j = this.level_length - 1; j >= active; j--) {
259
- this.options['level' + j].length = 0
260
- this.options1['level' + j].forEach((item, index) => {
261
- if (item.fullIndex.search(re) != -1) {
262
- if (this.matchText(item)) {
263
- levelset.add(item.fullIndex.match(re1)[0])
264
- }
265
- }
266
- if (j == active) {
267
- if (levelset.has(item.index + ',')) {
268
- this.options['level' + j].push(item)
269
- }
270
- }
271
- })
272
- }
273
- if (flag) {
274
- if (levelset.size == 0 && active > 0) {
275
- for (let j = 0; j < active; j++) {
276
- if (this.matchText(this.values['level' + j])) {
277
- this.reflash(re, active)
278
- break
279
- }
280
- }
281
- }
282
- }
283
- }
284
- this.key++
285
- } catch (e) {
286
- console.log(e.stack); // print stack trace
287
- this.show = false
288
- this.onInit()
289
- }
290
- },
291
- //热们选择,flag 显示单个
292
- select(item) {
293
- try {
294
- this.searchValueTemp = this.searchValue = ''
295
- let fullindex = item.fullIndex.split(',')
296
- let nextindex = (this.getLevelIndex(item.level) + 1)
297
- this.reset(this.getLevelIndex(item.level))
298
- if (nextindex < this.level_length) {
299
- this.titles['level' + nextindex] = this.model.defaultTitles['level' + nextindex]
300
- }
301
- for (let i = 0; i < nextindex; i++) {
302
- let item1 = this.options1['level' + i][fullindex[i].split('-')[1]]
303
- this.putItem(item1)
304
- this.options[item1.level].push(item1)
305
- }
306
- this.thisRadio = this.values[item.level].value
307
- let that = this
308
- this.searchValue = ''
309
- // this.$refs.tabs.resize();
310
- if (that.active != (fullindex.length - 2)) {
311
- this.selectFlag = true
312
- setTimeout(() => {
313
- that.active = (fullindex.length - 2)
314
- }, 50);
315
- }
316
- this.key++
317
- } catch (e) {
318
- console.log(e.stack); // print stack trace
319
- this.show = false
320
- this.onInit()
321
- }
322
- },
323
- putItem(item) {
324
- this.values[item.level] = item
325
- this.titles[item.level] = item.text
326
- },
327
- //清空option
328
- reset(start, end = this.level_length - 1) {
329
- for (let i = start; i <= end; i++) {
330
- let level = "level" + i
331
- this.values[level] = undefined
332
- this.options[level].length = 0
333
- if (i == start && this.values["level" + (i - 1)]) {
334
- this.titles[level] = this.model.defaultTitles[level]
335
- } else {
336
- this.titles[level] = undefined
337
- }
338
- }
339
- },
340
- //刷新option
341
- reflash(re, active) {
342
- this.options['level' + active].length = 0
343
- this.options1['level' + active].forEach((item, index) => {
344
- if (item.fullIndex.search(re) != -1) {
345
- this.options['level' + active].push(item)
346
- }
347
- })
348
- },
349
- matchText(item) {
350
- let re = new RegExp(this.searchValue.toLowerCase())
351
- return item.text.search(re) != -1 || item.value.toLowerCase().search(re) != -1
352
- },
353
- createDefaultModel() {
354
- return {
355
- value: '',
356
- value2: {},
357
- height: '80%',
358
- text: '',
359
- type: 'BSCascader',
360
- placeholder: 'lang.ctl.BSCascader.placeholder',
361
- searchPlaceholder: 'lang.ctl.BSCascader.placeholder',
362
- searchFlag: true,
363
- autoFinish: false,
364
- hotTitle: 'lang.ctl.BSCascader.hotTitle',
365
- items: {},
366
- popTitle: '',
367
- hotList: [],
368
- defaultTitles: {},
369
- };
370
- }
371
- }
372
- ,
373
- data() {
374
- return {
375
- show: false,
376
- color: '#1989fa',
377
- fieldValue: '',
378
- active: 0,
379
- key: 0,
380
- height: '0px',
381
- values: {},
382
- hotListSort: [],
383
- thisRadio: undefined,
384
- selectFlag: false,
385
- defaultTitle: '请选择',
386
- level_length: 0,
387
- searchValueTemp: '',
388
- searchValue: '',
389
- options: {},
390
- optionsMap: {},
391
- titles: {},
392
- options1: {}
393
- };
394
- },
395
- }
396
-
397
-
398
- </script>
399
-
400
- <style scoped>
401
-
402
- .divScrollbar::-webkit-scrollbar { /*滚动条整体样式*/
403
- display: none /*高宽分别对应横竖滚动条的尺寸*/
404
- }
405
-
406
- .def_color {
407
- --variable: #1989fa;
408
- }
409
-
410
- /deep/ .van-tabs__line {
411
- background-color: var(--variable);
412
- }
413
-
414
-
415
- /deep/ .van-tab--active {
416
- font-weight: bold;
417
- }
418
-
419
- .divStyle {
420
- border: none;
421
- overflow: auto;
422
- bottom: 1rem;
423
- margin: 0 auto;
424
-
425
- }
426
-
427
- /*标题*/
428
- .vanBar /deep/ .van-nav-bar__title {
429
- font-size: 1.4rem;
430
- }
431
-
432
- .vanBar[class*=van-hairline]::after {
433
- border: none;
434
- }
435
-
436
- /*搜索*/
437
- .vanField /deep/ .van-field__control {
438
- font-size: 1rem;
439
- }
440
-
441
- /*搜索*/
442
- .vanField /deep/ .van-search__action {
443
- font-size: 1rem;
444
- }
445
-
446
- /*常用标题*/
447
- .vanHot /deep/ .van-divider {
448
- font-size: 1rem;
449
- }
450
-
451
- /*常用词*/
452
- .vanHot /deep/ .van-button__text {
453
- font-size: 0.95rem;
454
- }
455
-
456
- /*TAB文字*/
457
- .vanTab /deep/ .van-tab {
458
- font-size: 1.1rem;
459
- }
460
-
461
- .divStyleBorder[class*=van-hairline]::after {
462
- border: none;
463
- }
464
-
465
- </style>
1
+ <template>
2
+ <div>
3
+ <van-field
4
+ is-link
5
+ readonly
6
+ :label="model.label"
7
+ :value="model.text"
8
+ @click="onOpen"
9
+ @blur="blur"
10
+ />
11
+ <van-popup @close="onClose" :lock-scroll="false" ref="popup" v-model="show" round position="bottom"
12
+ :style="{ height: model.height }">
13
+ <van-nav-bar class="vanBar" style="margin-bottom:5px" :title="model.popTitle?model.popTitle:model.label">
14
+ <template #right>
15
+ <van-icon name="cross" :color="color" size="1.5rem" @click="show=false"/>
16
+ </template>
17
+ </van-nav-bar>
18
+ <van-search class="vanField" v-if="model.searchFlag"
19
+ v-model="searchValueTemp"
20
+ show-action
21
+ shape="round"
22
+ maxlength="20"
23
+ style="width: 95%;margin:0 auto;margin-bottom:5px"
24
+ :placeholder="model.searchPlaceholder" @search="search(false)" @clear="search(false)"
25
+ >
26
+ <template #action>
27
+ <div @click="search(false)">搜&nbsp;&nbsp;索</div>
28
+ </template>
29
+ </van-search>
30
+ <div class="vanHot" style="width: 100% ;margin-bottom:15px " v-if="hotListSort.length>0">
31
+ <van-divider
32
+ :style="{ width: '95%',margin:'0 auto','margin-bottom':'0.5rem' ,color: '#000000', borderColor: '#929292', 'font-size': '1rem' }"
33
+ dashed>
34
+ {{ model.hotTitle ? model.hotTitle : '常用选项' }}
35
+ </van-divider>
36
+ <van-row style="width: 80% ;margin:0 auto;padding: 0 0.6rem 0 1rem ">
37
+
38
+ <van-button v-for="(item,index) in hotListSort" round plain type="default"
39
+ style="margin-bottom:5px ;margin-right:0.4rem;height:1.5rem" @click="select(item)">
40
+ {{ item.text.length > 7 ? item.text.substring(0, 7) + '...' : item.text }}
41
+ </van-button>
42
+ </van-row>
43
+ </div>
44
+ <van-tabs style="width: 97%;margin:0 auto" class="vanTab def_color" animated v-model="active" ref="tabs"
45
+ :before-change="beforeChange">
46
+ <van-tab v-for="(item,index) in options" :title="titles[index]?titles[index]:''">
47
+ <van-cell-group class=" divScrollbar divStyle divStyleBorder" :key="key"
48
+ :style="{ height: height}">
49
+ <div style="height: 1.5rem"></div>
50
+ <van-cell clickable style="padding-left: 1rem ;padding-right: 1rem" size="large" center
51
+ v-for="(item1,index1) in item" :title="item1.text"
52
+ @click="onChange(item1,index1)" :label="item1.label">
53
+ <template #right-icon>
54
+ <van-icon name="checked" v-show="item1.value==thisRadio" :color="color" size="1.2rem"/>
55
+ </template>
56
+ </van-cell>
57
+ <div style="height: 0.5rem"></div>
58
+ </van-cell-group>
59
+ </van-tab>
60
+ </van-tabs>
61
+
62
+ </van-popup>
63
+ </div>
64
+ </template>
65
+
66
+ <script>
67
+
68
+ import base2 from './base2.js'
69
+
70
+ export default {
71
+ name: "bs-cascader",
72
+ mixins: [base2],
73
+ watch: {
74
+ active(newVal) {
75
+ if (this.values['level' + newVal]) {
76
+ this.thisRadio = this.values['level' + newVal].value
77
+ } else {
78
+ this.thisRadio = undefined
79
+ }
80
+ // && newVal != this.level_length - 1
81
+ if (!this.selectFlag) {
82
+ this.search()
83
+ }
84
+ this.selectFlag = false
85
+ },
86
+ 'model.items': {
87
+ handler(val, oldval) {
88
+
89
+ this.onInit()
90
+ },
91
+ deep: false
92
+ }
93
+ }
94
+ ,
95
+ methods: {
96
+ blur(){
97
+
98
+ if(!this.model.readonly)
99
+ this.model.validateToken++
100
+
101
+ this.$emit('blur',function(){
102
+
103
+ },this.fullName)
104
+
105
+ },
106
+ onInit() {
107
+ this.options1 = this.model.items
108
+ let that = this
109
+ that.level_length = 0
110
+ let options2 = {}
111
+ this.hotListSort = []
112
+ Object.keys(that.options1).sort().forEach(function (key) {
113
+ options2[key] = that.options1[key];
114
+ that.level_length++
115
+ })
116
+ that.options1 = options2
117
+ for (const level in that.options1) {
118
+ this.options[level] = []
119
+ if (!this.model.defaultTitles[level]) {
120
+ this.model.defaultTitles[level] = this.defaultTitle
121
+ }
122
+ if (level == 'level0') {
123
+ this.titles[level] = this.model.defaultTitles[level]
124
+ } else {
125
+ this.titles[level] = ''
126
+ }
127
+
128
+ that.options1[level].forEach((item, index) => {
129
+ item['level'] = level
130
+ item.parentsIndex = ''
131
+ this.optionsMap[item.value] = index
132
+ item.show = true
133
+ item.index = level + '-' + index
134
+ item.i = index
135
+ this.getParentsIndex(item, level)
136
+ item.fullIndex = item.parentsIndex + item.index + ','
137
+ if (level == 'level0') {
138
+ this.options[level].push(item)
139
+ }
140
+ if (that.model.hotList.length != 0 && that.model.hotList.indexOf(item.value) != -1) {
141
+ this.hotListSort.push(item)
142
+ }
143
+ })
144
+
145
+ }
146
+ this.hotListSort.sort(function (a, b) {
147
+ return a.text.length > b.text.length ? 1 : -1;
148
+ })
149
+ },
150
+ onOpen() {
151
+ if (this.model.readonly)
152
+ return
153
+ if (this.options1['level0']) {
154
+ //调试用
155
+ // if (!this.options1.level0) {
156
+ // this.onInit()
157
+ // }
158
+ if (this.model.value) {
159
+ this.select(this.options1['level' + (this.level_length - 1)][this.optionsMap[this.model.value]])
160
+ this.search()
161
+ }
162
+ this.show = true
163
+ let that = this
164
+ setTimeout(() => {
165
+ that.height = that.getHeight();
166
+ }, 50);
167
+ }
168
+
169
+ },
170
+ onClose() {
171
+ this.onFinish()
172
+ },
173
+ // 全部选项选择完毕后,会触发 finish 事件
174
+ getHeight() {
175
+ // this.$refs.tabs.$el.style.setProperty("--variable", this.model.color);
176
+ return this.$refs.popup.$el.offsetHeight - 46 + 'px'
177
+ },
178
+ onFinish() {
179
+ if (this.values['level' + (this.level_length - 1)]) {
180
+ this.select(this.values['level' + (this.level_length - 1)])
181
+ this.model.value2 = JSON.parse(JSON.stringify(this.values['level' + (this.level_length - 1)]));
182
+ this.model.value = this.model.value2.value
183
+ this.model.text = this.model.value2.text
184
+ this.model.data = JSON.parse(JSON.stringify(this.values));
185
+ this.searchValueTemp = this.searchValue = ''
186
+ }
187
+ },
188
+ beforeChange(index) {
189
+ if (!this.titles['level' + index]) {
190
+ return false;
191
+ }
192
+ this.selectFlag = false
193
+ return true
194
+ },
195
+ onChange(item, index) {
196
+ try {
197
+ if (!this.titles[item.level]) {
198
+ return
199
+ }
200
+ this.thisRadio = item.value
201
+ this.putItem(item)
202
+ const nextIndex = (this.getLevelIndex(item.level) + 1)
203
+ const nextlevel = 'level' + nextIndex
204
+ for (let j = this.level_length - 1; j > this.getLevelIndex(item.level); j--) {
205
+ if (j == nextIndex) {
206
+ this.titles[nextlevel] = this.defaultTitle
207
+ } else {
208
+ this.titles['level' + j] = undefined
209
+ }
210
+ this.values['level' + j] = undefined
211
+ }
212
+ let that = this
213
+ if (nextIndex < that.level_length) {
214
+ setTimeout(() => {
215
+ that.active = nextIndex
216
+ }, 50);
217
+ } else if (this.autoFinish) {
218
+ this.show = false
219
+ }
220
+ } catch (e) {
221
+ console.log(e.stack); // print stack trace
222
+ this.show = false
223
+ this.onInit()
224
+ }
225
+
226
+ },
227
+ getParentsIndex(children, level) {
228
+ if (children.parent) {
229
+ level = 'level' + (this.getLevelIndex(level) - 1)
230
+ this.options1[level].forEach((item, index) => {
231
+ if (children.parent == item.value) {
232
+ children.parentsIndex += item.parentsIndex + (level + '-' + index + ',')
233
+ }
234
+ })
235
+ }
236
+ },
237
+ getLevelIndex(level) {
238
+ return Number(level.charAt(level.length - 1))
239
+ },
240
+ //搜索选择, false点击搜索
241
+ search(flag = true) {
242
+ try {
243
+ let active = this.active
244
+ let reStr = "level" + active + "-[0-9]{1,1000},"
245
+ let re = new RegExp(reStr)
246
+ if (!flag) {
247
+ this.searchValue = this.searchValueTemp
248
+ this.reset(this.active + 1)
249
+ }
250
+ if (active > 0) {
251
+ re = new RegExp(this.values['level' + (active - 1)].fullIndex + reStr)
252
+ }
253
+ let re1 = new RegExp(reStr)
254
+ if (!this.searchValue) {
255
+ this.reflash(re, active)
256
+ } else {
257
+ let levelset = new Set([]);
258
+ for (let j = this.level_length - 1; j >= active; j--) {
259
+ this.options['level' + j].length = 0
260
+ this.options1['level' + j].forEach((item, index) => {
261
+ if (item.fullIndex.search(re) != -1) {
262
+ if (this.matchText(item)) {
263
+ levelset.add(item.fullIndex.match(re1)[0])
264
+ }
265
+ }
266
+ if (j == active) {
267
+ if (levelset.has(item.index + ',')) {
268
+ this.options['level' + j].push(item)
269
+ }
270
+ }
271
+ })
272
+ }
273
+ if (flag) {
274
+ if (levelset.size == 0 && active > 0) {
275
+ for (let j = 0; j < active; j++) {
276
+ if (this.matchText(this.values['level' + j])) {
277
+ this.reflash(re, active)
278
+ break
279
+ }
280
+ }
281
+ }
282
+ }
283
+ }
284
+ this.key++
285
+ } catch (e) {
286
+ console.log(e.stack); // print stack trace
287
+ this.show = false
288
+ this.onInit()
289
+ }
290
+ },
291
+ //热们选择,flag 显示单个
292
+ select(item) {
293
+ try {
294
+ this.searchValueTemp = this.searchValue = ''
295
+ let fullindex = item.fullIndex.split(',')
296
+ let nextindex = (this.getLevelIndex(item.level) + 1)
297
+ this.reset(this.getLevelIndex(item.level))
298
+ if (nextindex < this.level_length) {
299
+ this.titles['level' + nextindex] = this.model.defaultTitles['level' + nextindex]
300
+ }
301
+ for (let i = 0; i < nextindex; i++) {
302
+ let item1 = this.options1['level' + i][fullindex[i].split('-')[1]]
303
+ this.putItem(item1)
304
+ this.options[item1.level].push(item1)
305
+ }
306
+ this.thisRadio = this.values[item.level].value
307
+ let that = this
308
+ this.searchValue = ''
309
+ // this.$refs.tabs.resize();
310
+ if (that.active != (fullindex.length - 2)) {
311
+ this.selectFlag = true
312
+ setTimeout(() => {
313
+ that.active = (fullindex.length - 2)
314
+ }, 50);
315
+ }
316
+ this.key++
317
+ } catch (e) {
318
+ console.log(e.stack); // print stack trace
319
+ this.show = false
320
+ this.onInit()
321
+ }
322
+ },
323
+ putItem(item) {
324
+ this.values[item.level] = item
325
+ this.titles[item.level] = item.text
326
+ },
327
+ //清空option
328
+ reset(start, end = this.level_length - 1) {
329
+ for (let i = start; i <= end; i++) {
330
+ let level = "level" + i
331
+ this.values[level] = undefined
332
+ this.options[level].length = 0
333
+ if (i == start && this.values["level" + (i - 1)]) {
334
+ this.titles[level] = this.model.defaultTitles[level]
335
+ } else {
336
+ this.titles[level] = undefined
337
+ }
338
+ }
339
+ },
340
+ //刷新option
341
+ reflash(re, active) {
342
+ this.options['level' + active].length = 0
343
+ this.options1['level' + active].forEach((item, index) => {
344
+ if (item.fullIndex.search(re) != -1) {
345
+ this.options['level' + active].push(item)
346
+ }
347
+ })
348
+ },
349
+ matchText(item) {
350
+ let re = new RegExp(this.searchValue.toLowerCase())
351
+ return item.text.search(re) != -1 || item.value.toLowerCase().search(re) != -1
352
+ },
353
+ createDefaultModel() {
354
+ return {
355
+ value: '',
356
+ value2: {},
357
+ height: '80%',
358
+ text: '',
359
+ type: 'BSCascader',
360
+ placeholder: 'lang.ctl.BSCascader.placeholder',
361
+ searchPlaceholder: 'lang.ctl.BSCascader.placeholder',
362
+ searchFlag: true,
363
+ autoFinish: false,
364
+ hotTitle: 'lang.ctl.BSCascader.hotTitle',
365
+ items: {},
366
+ popTitle: '',
367
+ hotList: [],
368
+ defaultTitles: {},
369
+ };
370
+ }
371
+ }
372
+ ,
373
+ data() {
374
+ return {
375
+ show: false,
376
+ color: '#1989fa',
377
+ fieldValue: '',
378
+ active: 0,
379
+ key: 0,
380
+ height: '0px',
381
+ values: {},
382
+ hotListSort: [],
383
+ thisRadio: undefined,
384
+ selectFlag: false,
385
+ defaultTitle: '请选择',
386
+ level_length: 0,
387
+ searchValueTemp: '',
388
+ searchValue: '',
389
+ options: {},
390
+ optionsMap: {},
391
+ titles: {},
392
+ options1: {}
393
+ };
394
+ },
395
+ }
396
+
397
+
398
+ </script>
399
+
400
+ <style scoped>
401
+
402
+ .divScrollbar::-webkit-scrollbar { /*滚动条整体样式*/
403
+ display: none /*高宽分别对应横竖滚动条的尺寸*/
404
+ }
405
+
406
+ .def_color {
407
+ --variable: #1989fa;
408
+ }
409
+
410
+ /deep/ .van-tabs__line {
411
+ background-color: var(--variable);
412
+ }
413
+
414
+
415
+ /deep/ .van-tab--active {
416
+ font-weight: bold;
417
+ }
418
+
419
+ .divStyle {
420
+ border: none;
421
+ overflow: auto;
422
+ bottom: 1rem;
423
+ margin: 0 auto;
424
+
425
+ }
426
+
427
+ /*标题*/
428
+ .vanBar /deep/ .van-nav-bar__title {
429
+ font-size: 1.4rem;
430
+ }
431
+
432
+ .vanBar[class*=van-hairline]::after {
433
+ border: none;
434
+ }
435
+
436
+ /*搜索*/
437
+ .vanField /deep/ .van-field__control {
438
+ font-size: 1rem;
439
+ }
440
+
441
+ /*搜索*/
442
+ .vanField /deep/ .van-search__action {
443
+ font-size: 1rem;
444
+ }
445
+
446
+ /*常用标题*/
447
+ .vanHot /deep/ .van-divider {
448
+ font-size: 1rem;
449
+ }
450
+
451
+ /*常用词*/
452
+ .vanHot /deep/ .van-button__text {
453
+ font-size: 0.95rem;
454
+ }
455
+
456
+ /*TAB文字*/
457
+ .vanTab /deep/ .van-tab {
458
+ font-size: 1.1rem;
459
+ }
460
+
461
+ .divStyleBorder[class*=van-hairline]::after {
462
+ border: none;
463
+ }
464
+
465
+ </style>