shijiplus-web-plugin 0.1.11 → 0.1.12

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 (27) hide show
  1. package/package.json +8 -4
  2. package/src/App.vue +3 -1
  3. package/src/components/plus-comp/index.js +15 -0
  4. package/src/components/plus-comp/permission-component/permission-component.vue +78 -0
  5. package/src/components/plus-comp/plus-card/plus-card.vue +21 -0
  6. package/src/components/plus-comp/plus-city-cascader/plus-city-cascader.vue +108 -0
  7. package/src/components/plus-comp/plus-common-header/plus-common-header.vue +58 -0
  8. package/src/components/plus-comp/plus-count-down/plus-count-down.vue +51 -0
  9. package/src/components/plus-comp/plus-drawer/plus-drawer.vue +116 -0
  10. package/src/components/plus-comp/plus-form/plus-form.vue +149 -0
  11. package/src/components/plus-comp/plus-icon/plus-icon.vue +91 -0
  12. package/src/components/plus-comp/plus-modal/plus-modal.vue +281 -0
  13. package/src/components/plus-comp/plus-poptip/plus-poptip.vue +42 -0
  14. package/src/components/plus-comp/plus-qr-code/plus-qr-code.vue +110 -0
  15. package/src/components/plus-comp/plus-remote-selector/plus-remote-selector.vue +126 -0
  16. package/src/components/plus-comp/plus-scrollview/plus-scrollview.vue +58 -0
  17. package/src/components/plus-comp/plus-select/plus-select.vue +118 -0
  18. package/src/components/plus-comp/plus-table/export-mixin.js +78 -0
  19. package/src/components/plus-comp/plus-table/plus-circle-progress-modal.vue +54 -0
  20. package/src/components/plus-comp/plus-table/plus-table.vue +568 -0
  21. package/src/components/plus-comp/plus-tabs/plus-tabs.vue +76 -0
  22. package/src/directive/index.js +2 -0
  23. package/src/directive/module/authAccess.js +2 -2
  24. package/src/extentionPlugin/string.js +30 -1
  25. package/src/libs/excel.js +203 -0
  26. package/src/libs/util.js +184 -0
  27. package/src/main.js +2 -0
@@ -0,0 +1,568 @@
1
+ /* eslint-disable */
2
+ <template>
3
+ <div
4
+ ref="plusTableInnerRef"
5
+ :class="['plus-table-wrap', fixedHeader ? 'fixed-header' : '']"
6
+ >
7
+ <div
8
+ ref="searchAreaRef"
9
+ :class="[inlineForm && 'i-flex-wrap nowrap', 'p-search-area']"
10
+ v-if="showSearchArea"
11
+ >
12
+ <div :class="[inlineForm && 'f-grow']">
13
+ <slot name="searchArea"></slot>
14
+ </div>
15
+ <div v-if="showButtonArea" class="btn-area f-no-shrink i-flex-wrap">
16
+ <Button v-if="showSeachButton" type="primary" @click="onSearch">
17
+ 搜索
18
+ </Button>
19
+ <Button v-if="showResetButton" type="default" @click="onReset">
20
+ 重置
21
+ </Button>
22
+ <div class="operation-area">
23
+ <slot name="operation"> </slot>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ <slot name="table">
28
+ <Table
29
+ :style="tableStyle"
30
+ :columns="showColumns"
31
+ :data="pageData"
32
+ :loading="loading"
33
+ :size="sizeType"
34
+ :height="height"
35
+ :noDataText="noDataText"
36
+ @on-selection-change="triggerSelectionChange"
37
+ @on-select-all="triggerSelectAll"
38
+ @on-sort-change="onSortChange"
39
+ @on-filter-change="onFilterChange"
40
+ >
41
+ <template
42
+ v-for="item in showColumns"
43
+ :slot="item.slot"
44
+ slot-scope="{ row, column, index }"
45
+ >
46
+ <slot
47
+ v-if="item.slot"
48
+ :name="item.slot"
49
+ :index="localPaging ? beginIndex + index : index"
50
+ :column="column"
51
+ :row="row"
52
+ >
53
+ {{ slotValue(item, row) }}
54
+ </slot>
55
+ <slot v-else-if="!item.render && !item.key">
56
+ {{ item.title }}-未设置渲染方式
57
+ </slot>
58
+ </template>
59
+ </Table>
60
+ </slot>
61
+ <div ref="footerRef">
62
+ <slot name="footer"></slot>
63
+ <div v-if="showPageArea" class="i-flex-wrap">
64
+ <Page
65
+ style="margin: 16px 0 0 auto"
66
+ :total="totalCount"
67
+ :current="currentPage"
68
+ @on-change="onPageChanged"
69
+ :page-size="pageSize"
70
+ :page-size-opts="[10, 20, 30, 50, 100]"
71
+ :show-total="showPageTotal"
72
+ :show-sizer="showPageSizer"
73
+ show-elevator
74
+ @on-page-size-change="onPageSizeChanged"
75
+ />
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </template>
80
+
81
+ <script>
82
+ import exportMixin from './export-mixin'
83
+ import { exportTableExcel } from '../../../libs/util'
84
+ /**
85
+ * 统一了一些基础方法的写法
86
+ * 提供了refresh方法, 需要刷新当前页面时通过 $refs 调用
87
+ * 需要传递的参数 参考props
88
+ *
89
+ * 通过响应 'on-load-data' 事件加载数据, 事件参数包含 3 个属性
90
+ * currentPage: 读取数据的页码
91
+ * pageSize: 单页数据条数
92
+ * clearCondition: 是否需要清空搜索条件
93
+ */
94
+ export default {
95
+ name: 'PlusTable',
96
+ mixins: [exportMixin],
97
+ props: {
98
+ fixedHeader: {
99
+ type: Boolean,
100
+ default: false
101
+ },
102
+ inlineForm: {
103
+ type: Boolean,
104
+ default: false
105
+ },
106
+ // 表格列定义
107
+ columns: {
108
+ type: Array,
109
+ default() {
110
+ return []
111
+ }
112
+ },
113
+ localPaging: {
114
+ type: Boolean,
115
+ default: false
116
+ },
117
+ // 列表数据, 传入res.data即可
118
+ data: {
119
+ type: [Object, Array],
120
+ default() {
121
+ return {}
122
+ }
123
+ },
124
+ // 表格加载状态, 默认false
125
+ loading: {
126
+ type: Boolean,
127
+ default: false
128
+ },
129
+ noDataText: {
130
+ type: String,
131
+ default: '暂无数据'
132
+ },
133
+ // 显示页码按钮
134
+ showPageArea: {
135
+ type: Boolean,
136
+ default: true
137
+ },
138
+ // 显示搜索按钮
139
+ showSeachButton: {
140
+ type: Boolean,
141
+ default: true
142
+ },
143
+ // 显示重置按钮
144
+ showResetButton: {
145
+ type: Boolean,
146
+ default: true
147
+ },
148
+ // 显示按钮区域
149
+ showButtonArea: {
150
+ type: Boolean,
151
+ default: true
152
+ },
153
+ // 是否显示搜索区, 默认显示
154
+ showSearchArea: {
155
+ type: Boolean,
156
+ default: true
157
+ },
158
+ // 每页条数
159
+ defaultPageSize: {
160
+ type: Number,
161
+ default: 10
162
+ },
163
+ sizeType: {
164
+ type: String,
165
+ default: 'default'
166
+ },
167
+ showPageSizer: {
168
+ type: Boolean,
169
+ default: true
170
+ },
171
+ showPageTotal: {
172
+ type: Boolean,
173
+ default: true
174
+ }
175
+ },
176
+ watch: {
177
+ fixedHeader: {
178
+ handler(val) {
179
+ this.$nextTick(() => {
180
+ let tHeight = this.$refs.plusTableInnerRef.clientHeight
181
+ let tableWidth = this.$refs.plusTableInnerRef.clientWidth
182
+
183
+ // 获取元素的所有计算样式
184
+ var styles = window.getComputedStyle(this.$refs.plusTableInnerRef)
185
+
186
+ var styleHeight = parseFloat(styles.getPropertyValue('height'))
187
+ // 如果您只想获取特定方向的padding值,例如padding-top
188
+ var paddingLeft = parseFloat(styles.getPropertyValue('padding-left'))
189
+ var paddingRight = parseFloat(
190
+ styles.getPropertyValue('padding-right')
191
+ )
192
+ var paddingTop = parseFloat(styles.getPropertyValue('padding-top'))
193
+ var paddingBottom = parseFloat(
194
+ styles.getPropertyValue('padding-bottom')
195
+ )
196
+ if (paddingLeft) {
197
+ tableWidth -= paddingLeft
198
+ }
199
+ if (paddingRight) {
200
+ tableWidth -= paddingRight
201
+ }
202
+ if (paddingTop) {
203
+ tHeight -= paddingTop
204
+ }
205
+ if (paddingBottom) {
206
+ tHeight -= paddingBottom
207
+ }
208
+ this.tableWidth = tableWidth
209
+ if (this.$refs.searchAreaRef) {
210
+ tHeight -= this.$refs.searchAreaRef.clientHeight
211
+ }
212
+ if (this.$refs.footerRef) {
213
+ tHeight -= this.$refs.footerRef.clientHeight
214
+ }
215
+ if (val) {
216
+ this.height = tHeight
217
+ } else {
218
+ let tableWrap =
219
+ this.$refs.plusTableInnerRef.getElementsByClassName(
220
+ 'ivu-table-wrapper'
221
+ )[0]
222
+ if (tableWrap) {
223
+ if (!this.data.data || !this.data.data.length) {
224
+ tableWrap.style.minHeight = tHeight + 'px'
225
+ }
226
+ }
227
+ }
228
+ })
229
+ },
230
+ deep: true,
231
+ immediate: true
232
+ },
233
+ defaultPageSize: {
234
+ handler(val) {
235
+ if (val > 0) {
236
+ this.pageSize = val
237
+ }
238
+ },
239
+ deep: true,
240
+ immediate: true
241
+ },
242
+ data: {
243
+ handler(val) {
244
+ if (val) {
245
+ console.log('-----data--------', val)
246
+ let dataArray = []
247
+ if (val instanceof Array) {
248
+ dataArray = val
249
+ this.totalCount = val.length
250
+ } else {
251
+ dataArray = val.data || []
252
+ this.totalCount = 0
253
+ if (val.meta || val.totalCount) {
254
+ this.totalCount = val.totalCount || val.meta.totalCount
255
+ }
256
+ if (this.totalCount < dataArray.length) {
257
+ this.totalCount = dataArray.length
258
+ }
259
+ }
260
+ // if (this.localPaging) {
261
+ // const sortColumn = this.columns.filter((item) => {
262
+ // return item.sortable
263
+ // })[0]
264
+ // if (sortColumn) {
265
+ // dataArray = dataArray
266
+ // .map((item) => {
267
+ // return item
268
+ // })
269
+ // .sort((a, b) => {
270
+ // if (a[sortColumn.key] && b[sortColumn.key]) {
271
+ // if (sortColumn.sortType == 'desc') {
272
+ // return b[sortColumn.key] - a[sortColumn.key]
273
+ // }
274
+ // return a[sortColumn.key] - b[sortColumn.key]
275
+ // }
276
+ // return 0
277
+ // })
278
+ // }
279
+ // }
280
+
281
+ this.dataList = dataArray
282
+ } else {
283
+ this.dataList = []
284
+ this.totalCount = 0
285
+ }
286
+ },
287
+ deep: true,
288
+ immediate: true
289
+ }
290
+ },
291
+ computed: {
292
+ beginIndex() {
293
+ if (this.localPaging) {
294
+ return (this.currentPage - 1) * this.pageSize
295
+ }
296
+ return 0
297
+ },
298
+ pageData() {
299
+ if (this.localPaging) {
300
+ return this.dataList.slice(
301
+ this.beginIndex,
302
+ this.beginIndex + this.pageSize
303
+ )
304
+ }
305
+ return this.dataList
306
+ },
307
+ tableStyle() {
308
+ if (this.tableWidth) {
309
+ return { width: this.tableWidth + 'px' }
310
+ }
311
+ return {}
312
+ },
313
+ showColumns() {
314
+ return this.columns
315
+ .map((item) => {
316
+ if (!item.render && !item.slot) {
317
+ item.slot = `slot` + item.title
318
+ }
319
+ return item
320
+ })
321
+ .filter((item) => {
322
+ if (item.render) {
323
+ const oldRender = item.render
324
+ item.render = (h, params) => {
325
+ if (this.localPaging) {
326
+ params.index = this.beginIndex + params.index
327
+ }
328
+ return oldRender(h, params)
329
+ }
330
+ } else {
331
+ let realValue = ''
332
+ if (typeof item.defaultValue == 'function') {
333
+ realValue = item.defaultValue()
334
+ } else if (typeof item.defaultValue == 'number') {
335
+ realValue = `${item.defaultValue}`
336
+ } else {
337
+ realValue = item.defaultValue
338
+ }
339
+ if (realValue) {
340
+ item.render = (h, params) => {
341
+ if (!params.row[item.key]) {
342
+ return h('span', realValue)
343
+ }
344
+ return h('span', params.row[item.key])
345
+ }
346
+ }
347
+ }
348
+ if (item.filters) {
349
+ if (typeof item.filterMultiple != 'boolean') {
350
+ item.filterMultiple = false
351
+ }
352
+ if (!item.filterKey) {
353
+ item.filterKey = item.key
354
+ }
355
+ if (!item.filterRemote) {
356
+ item.filterRemote = (value, key, column) => {}
357
+ }
358
+ }
359
+ return !item.hide
360
+ })
361
+ }
362
+ },
363
+ data() {
364
+ return {
365
+ tableWidth: 0,
366
+ height: '',
367
+ dataList: [],
368
+ totalCount: 0,
369
+ currentPage: 1,
370
+ pageSize: 10
371
+ }
372
+ },
373
+ methods: {
374
+ slotValue(col, row) {
375
+ return (col.computeValue && col.computeValue(row)) || row[col.key]
376
+ },
377
+ onReset() {
378
+ this.currentPage = 1
379
+ this.triggerLoadEvent(true)
380
+ },
381
+ onSearch() {
382
+ this.currentPage = 1
383
+ this.triggerLoadEvent(false)
384
+ },
385
+ triggerSelectionChange(selection) {
386
+ this.$emit('on-selection-change', selection)
387
+ },
388
+ triggerSelectAll() {
389
+ this.$emit('on-select-all')
390
+ },
391
+ onSortChange(e) {
392
+ this.$emit('on-sort-change', e)
393
+ },
394
+ onFilterChange(e) {
395
+ this.$emit('on-filter-change', { ...e, value: e._filterChecked })
396
+ },
397
+ onPageSizeChanged(size) {
398
+ this.pageSize = size
399
+ this.triggerLoadEvent(false)
400
+ },
401
+ onPageChanged(idx) {
402
+ this.currentPage = idx
403
+ this.triggerLoadEvent(false)
404
+ },
405
+ refresh() {
406
+ this.triggerLoadEvent(false)
407
+ },
408
+ triggerLoadEvent(clearCondition) {
409
+ let e = {
410
+ currentPage: this.currentPage,
411
+ pageSize: this.pageSize,
412
+ clearCondition: clearCondition
413
+ }
414
+ this.$emit('on-load-data', e)
415
+ },
416
+ tableToExcel(p = { params: {}, apiFun: null, fileName: '' }) {
417
+ return new Promise((resolve, reject) => {
418
+ const { params, apiFun, fileName } = Object.assign({}, p)
419
+ if (!apiFun) {
420
+ // 防止被 外部 destory
421
+ setTimeout(() => {
422
+ this.$Message.error({
423
+ content: '需要指定导出的API'
424
+ })
425
+ }, 100)
426
+ resolve()
427
+ return
428
+ }
429
+ this.invokeExportExcel(
430
+ {
431
+ ...params
432
+ },
433
+ apiFun
434
+ )
435
+ .then((data) => {
436
+ if (data) {
437
+ return exportTableExcel(data, this.columns, fileName)
438
+ }
439
+ })
440
+ .finally(() => {
441
+ resolve()
442
+ })
443
+ })
444
+ }
445
+ },
446
+ mounted() {
447
+ this.onSearch()
448
+ }
449
+ }
450
+ </script>
451
+
452
+ <style lang="less" scoped>
453
+ .plus-table-wrap {
454
+ --sibling-nodes-height: 0px;
455
+ --table-th-bg-color: #f8f8f9;
456
+ background-color: #ffffff;
457
+ padding: 0px;
458
+ box-sizing: border-box;
459
+ &.fixed-header {
460
+ height: calc(~'100% - var(--sibling-nodes-height)');
461
+ }
462
+ .p-search-area {
463
+ position: relative;
464
+ padding-bottom: 16px;
465
+ /deep/.plus-form-wrap {
466
+ .ivu-form-item {
467
+ margin-bottom: 0px;
468
+ }
469
+ }
470
+ }
471
+ .btn-area {
472
+ margin-top: auto;
473
+ button {
474
+ margin-left: 8px;
475
+ &:first-child {
476
+ margin-left: 0px;
477
+ }
478
+ }
479
+ }
480
+ .operation-area {
481
+ & > * {
482
+ &:first-child {
483
+ margin-left: 48px !important;
484
+ }
485
+ }
486
+ }
487
+ .ivu-table-wrapper {
488
+ border: none;
489
+ /deep/.ivu-table {
490
+ &::before {
491
+ background-color: transparent;
492
+ }
493
+
494
+ &::after {
495
+ background-color: transparent;
496
+ }
497
+ th {
498
+ height: 54px;
499
+ border-bottom: none;
500
+ background-color: var(--table-th-bg-color);
501
+ .ivu-table-cell {
502
+ font-family: PingFangSC-SNaNpxibold;
503
+ font-weight: 600;
504
+ font-size: 14px;
505
+ color: #515a6e;
506
+ letter-spacing: 0.7px;
507
+ }
508
+ }
509
+ // td {
510
+ // height: 64px;
511
+ // }
512
+ .ivu-table-tip {
513
+ height: ~'calc(100% - 54px)'; // 54 header的高
514
+ table {
515
+ height: 100%;
516
+ }
517
+ }
518
+ .ivu-table-tbody {
519
+ .ivu-table-cell {
520
+ padding-top: 16px;
521
+ padding-bottom: 16px;
522
+ line-height: 1.4;
523
+ }
524
+ }
525
+ }
526
+ /deep/.ivu-table-cell {
527
+ padding-left: 12px;
528
+ padding-right: 12px;
529
+ }
530
+ /deep/.ivu-table-row {
531
+ .ivu-table-cell {
532
+ font-weight: 400;
533
+ font-size: 14px;
534
+ color: #515a6e;
535
+ letter-spacing: 0.7px;
536
+ .ivu-btn {
537
+ margin-right: 4px;
538
+ margin-bottom: 2px;
539
+ margin-top: 2px;
540
+ &:last-child {
541
+ margin-right: 0;
542
+ &:first-child {
543
+ margin-bottom: 0;
544
+ margin-top: 0px;
545
+ }
546
+ }
547
+ }
548
+ }
549
+ }
550
+ }
551
+ /deep/.ivu-page {
552
+ .ivu-page-options-sizer {
553
+ margin-right: 0px;
554
+ }
555
+ }
556
+ }
557
+ .ivu-form-item-error .plus-table-wrap {
558
+ border: #ff0000 1px solid;
559
+ border-radius: var(--border-radius);
560
+ overflow: hidden;
561
+ /deep/.ivu-select-selection {
562
+ border-color: var(--border-color) !important;
563
+ .ivu-select-arrow {
564
+ color: var(--subsidiary-color);
565
+ }
566
+ }
567
+ }
568
+ </style>
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div id="plus-tabs" class="plus-tabs" ref="plusTabsRef">
3
+ <Tabs @on-click="onTabClick">
4
+ <slot></slot>
5
+ </Tabs>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ export default {
10
+ methods: {
11
+ calcInkBar() {
12
+ const inkBar =
13
+ this.$refs.plusTabsRef.getElementsByClassName('ivu-tabs-ink-bar')[0]
14
+ if (inkBar) {
15
+ this.$nextTick(() => {
16
+ const actTab = this.$refs.plusTabsRef.getElementsByClassName(
17
+ 'ivu-tabs-tab-active'
18
+ )[0]
19
+ inkBar.style.left = `${
20
+ actTab.offsetLeft + (actTab.clientWidth - 48) / 2
21
+ }px`
22
+ })
23
+ }
24
+ },
25
+ onTabClick(e) {
26
+ this.$emit('on-click', e)
27
+ this.calcInkBar()
28
+ }
29
+ },
30
+ mounted() {
31
+ this.calcInkBar()
32
+ }
33
+ }
34
+ </script>
35
+ <style lang="less" scoped>
36
+ .plus-tabs {
37
+ height: 100%;
38
+ /deep/.ivu-tabs {
39
+ height: 100%;
40
+ --bar-m-b: 17px;
41
+ --bar-h: 16px;
42
+ --bar-p-b: 16px;
43
+ .ivu-tabs-bar {
44
+ margin-bottom: var(--bar-m-b);
45
+ }
46
+ .ivu-tabs-tab {
47
+ padding: 0 12px;
48
+ min-width: 48px;
49
+ text-align: center;
50
+ line-height: var(--bar-h);
51
+ padding-bottom: var(--bar-p-b);
52
+ color: var(--text-color);
53
+ }
54
+ .ivu-tabs-tab-active {
55
+ color: #17233d;
56
+ font-weight: 600;
57
+ }
58
+ .ivu-tabs-ink-bar {
59
+ width: 48px !important;
60
+ height: 3px !important;
61
+ transform: translate3d(0px, 0px, 0px) !important;
62
+ transition: left 0.3s ease-in-out;
63
+ }
64
+ .ivu-tabs-content {
65
+ height: ~'calc(100% - var(--bar-p-b) - var(--bar-h) - var(--bar-m-b))';
66
+ .tab-pane-content {
67
+ overflow-y: auto;
68
+ }
69
+ .tab-pane-content,
70
+ & > div {
71
+ height: 100%;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ </style>
@@ -13,6 +13,8 @@ const importDirective = Vue => {
13
13
  Vue.directive('draggable', directive.draggable)
14
14
  Vue.directive('access', directive.authAccess)
15
15
  Vue.directive('loading', directive.loading)
16
+ Vue.directive('loading-text', directive.loadingText)
17
+ Vue.directive('loading-icon', directive.loadingIcon)
16
18
  }
17
19
 
18
20
  export default importDirective
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  inserted(el, binding, vnode, oldVnode) {
3
- console.log('plugin-access', vnode.context.$store)
4
- if (document.location.hostname == 'localhost') {
3
+ // console.log('plugin-access', vnode.context.$store)
4
+ if (document.location.hostname == 'localhost' || document.location.hostname.indexOf('192.168') != -1) {
5
5
  return
6
6
  }
7
7
  if (vnode.context.$store.state.user.access === undefined || vnode.context.$store.state.user.access.length === 0) {
@@ -2,10 +2,34 @@ const install = (vue, opts = {}) => {
2
2
  vue.prototype.$trim = trim
3
3
  vue.prototype.$trimStart = trimStart
4
4
  vue.prototype.$trimEnd = trimEnd
5
+ vue.prototype.$formatterBankCard = formatterBankCard
6
+ vue.prototype.$formatterPhoneNo = formatterPhoneNo
5
7
  vue.prototype.$formtterCityName = formtterCityName
6
8
  vue.prototype.$parseUrl = parseUrl
7
9
  vue.prototype.$beautyNum = beautyNum
8
- vue.prototype.$formatterPhoneNo = formatterPhoneNo
10
+ vue.prototype.$numberToChinese = function (num) {
11
+ const chineseNumArr = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']
12
+ const chineseUnitArr = ['', '十', '百', '千', '万', '亿']
13
+ let numArr = String(num).split('')
14
+ let numIndex = numArr.length - 1
15
+ let unitIndex = 0
16
+ let result = []
17
+ while (numIndex >= 0) {
18
+ const num = parseInt(numArr[numIndex])
19
+ let unitStr = num ? chineseUnitArr[unitIndex] : ''
20
+ let numStr = unitIndex == 0 && num == 0 ? '' : chineseNumArr[num]
21
+ let chinese = ''
22
+ if (unitIndex == 1 && numIndex == 0) {
23
+ chinese += (num > 1 ? numStr : '') + unitStr
24
+ } else {
25
+ chinese += numStr + unitStr
26
+ }
27
+ result[numIndex] = chinese
28
+ numIndex--
29
+ unitIndex++
30
+ }
31
+ return result.join('')
32
+ }
9
33
  }
10
34
 
11
35
  function formtterCityName(proName, cityName) {
@@ -16,6 +40,11 @@ function formtterCityName(proName, cityName) {
16
40
  return `${proName}/${cityName}`
17
41
  }
18
42
 
43
+ // 格式化银行卡号
44
+ function formatterBankCard(oriStr) {
45
+ var reg = /^(\d{4})\d+(\d{4})$/
46
+ return oriStr.replace(reg, '$1 **** **** $2')
47
+ }
19
48
  // 格式化手机号
20
49
  function formatterPhoneNo(oriStr) {
21
50
  var reg = /^(\d{3})\d+(\d{4})$/