@kyfe/hroa-ui 0.0.1

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 (105) hide show
  1. package/README.md +50 -0
  2. package/dist/demo.html +8 -0
  3. package/dist/hrui.common.js +3892 -0
  4. package/dist/hrui.common.js.map +1 -0
  5. package/dist/hrui.umd.js +3902 -0
  6. package/dist/hrui.umd.js.map +1 -0
  7. package/dist/hrui.umd.min.js +2 -0
  8. package/dist/hrui.umd.min.js.map +1 -0
  9. package/lib/hr-bottom-button/index.css +1 -0
  10. package/lib/hr-bottom-button/index.js +1 -0
  11. package/lib/hr-button/index.css +1 -0
  12. package/lib/hr-button/index.js +1 -0
  13. package/lib/hr-clipboard/index.css +1 -0
  14. package/lib/hr-clipboard/index.js +1 -0
  15. package/lib/hr-condition-filtrate/index.css +1 -0
  16. package/lib/hr-condition-filtrate/index.js +1 -0
  17. package/lib/hr-emotional-picture/index.css +1 -0
  18. package/lib/hr-emotional-picture/index.js +1 -0
  19. package/lib/hr-module-card/index.css +1 -0
  20. package/lib/hr-module-card/index.js +1 -0
  21. package/lib/hr-notice-bar/index.js +1 -0
  22. package/lib/hr-open-ks/index.css +1 -0
  23. package/lib/hr-open-ks/index.js +1 -0
  24. package/lib/hr-pager/index.css +1 -0
  25. package/lib/hr-pager/index.js +1 -0
  26. package/lib/hr-search-input/index.css +1 -0
  27. package/lib/hr-search-input/index.js +1 -0
  28. package/lib/hr-select/index.js +1 -0
  29. package/lib/hr-slide-pager/index.css +1 -0
  30. package/lib/hr-slide-pager/index.js +1 -0
  31. package/lib/hr-stack-image/index.css +1 -0
  32. package/lib/hr-stack-image/index.js +1 -0
  33. package/lib/hr-tab-nav/index.css +1 -0
  34. package/lib/hr-tab-nav/index.js +1 -0
  35. package/lib/hr-view-item/index.css +1 -0
  36. package/lib/hr-view-item/index.js +1 -0
  37. package/lib/index/index.css +1 -0
  38. package/lib/index/index.js +1 -0
  39. package/lib/utils/index.js +1 -0
  40. package/package.json +66 -0
  41. package/packages/hr-bottom-button/index.js +7 -0
  42. package/packages/hr-bottom-button/src/index.vue +85 -0
  43. package/packages/hr-button/index.js +13 -0
  44. package/packages/hr-button/src/hr-button.vue +39 -0
  45. package/packages/hr-clipboard/index.js +3 -0
  46. package/packages/hr-clipboard/src/icon.png +0 -0
  47. package/packages/hr-clipboard/src/main.vue +64 -0
  48. package/packages/hr-clipboard/src/util.js +9 -0
  49. package/packages/hr-condition-filtrate/enum/index.js +11 -0
  50. package/packages/hr-condition-filtrate/image/arrow-right.png +0 -0
  51. package/packages/hr-condition-filtrate/index.js +7 -0
  52. package/packages/hr-condition-filtrate/src/employee-choose/index.vue +101 -0
  53. package/packages/hr-condition-filtrate/src/index.vue +246 -0
  54. package/packages/hr-condition-filtrate/src/multiterm-choose/index.vue +167 -0
  55. package/packages/hr-condition-filtrate/src/org-tree-choose/index.vue +102 -0
  56. package/packages/hr-condition-filtrate/src/single-choose/index.vue +144 -0
  57. package/packages/hr-condition-filtrate/src/text-input/index.vue +60 -0
  58. package/packages/hr-condition-filtrate/src/time-selector/date-range-select.vue +154 -0
  59. package/packages/hr-condition-filtrate/src/time-selector/images/date-icon.png +0 -0
  60. package/packages/hr-condition-filtrate/src/time-selector/index.vue +380 -0
  61. package/packages/hr-condition-filtrate/src/time-selector/utils/constant.js +30 -0
  62. package/packages/hr-condition-filtrate/src/time-selector/utils/tools.js +213 -0
  63. package/packages/hr-emotional-picture/index.js +7 -0
  64. package/packages/hr-emotional-picture/src/index.vue +66 -0
  65. package/packages/hr-emotional-picture//346/203/205/346/204/237/345/233/276/347/273/204/344/273/266.md +0 -0
  66. package/packages/hr-module-card/index.js +13 -0
  67. package/packages/hr-module-card/src/index.vue +132 -0
  68. package/packages/hr-module-card//346/250/241/345/235/227/345/215/241/347/211/207/347/273/204/344/273/266.md +29 -0
  69. package/packages/hr-notice-bar/index.js +7 -0
  70. package/packages/hr-notice-bar/src/bem.js +38 -0
  71. package/packages/hr-notice-bar/src/index.js +52 -0
  72. package/packages/hr-notice-bar//351/200/232/347/237/245/346/240/217/347/273/204/344/273/266.md +3 -0
  73. package/packages/hr-open-ks/index.js +3 -0
  74. package/packages/hr-open-ks/src/icon.png +0 -0
  75. package/packages/hr-open-ks/src/main.vue +85 -0
  76. package/packages/hr-open-ks/src/util.js +31 -0
  77. package/packages/hr-pager/images/next-page.png +0 -0
  78. package/packages/hr-pager/images/prev-page.png +0 -0
  79. package/packages/hr-pager/index.js +7 -0
  80. package/packages/hr-pager/src/index.vue +95 -0
  81. package/packages/hr-pager//346/214/211/351/222/256/347/277/273/351/241/265/347/273/204/344/273/266.md +0 -0
  82. package/packages/hr-search-input/image/input-close-icon.png +0 -0
  83. package/packages/hr-search-input/image/search-icon.png +0 -0
  84. package/packages/hr-search-input/index.js +8 -0
  85. package/packages/hr-search-input/src/index.vue +144 -0
  86. package/packages/hr-select/index.js +3 -0
  87. package/packages/hr-select/src/main.vue +62 -0
  88. package/packages/hr-slide-pager/guide/image/turn-left.png +0 -0
  89. package/packages/hr-slide-pager/guide/image/turn-right.png +0 -0
  90. package/packages/hr-slide-pager/guide/index.vue +59 -0
  91. package/packages/hr-slide-pager/guide//346/226/260/346/211/213/346/214/207/345/274/225.md +0 -0
  92. package/packages/hr-slide-pager/index.js +7 -0
  93. package/packages/hr-slide-pager/src/index.vue +371 -0
  94. package/packages/hr-slide-pager//346/273/221/345/212/250/347/277/273/351/241/265/347/273/204/344/273/266.md +0 -0
  95. package/packages/hr-stack-image/index.js +3 -0
  96. package/packages/hr-stack-image/src/main.vue +77 -0
  97. package/packages/hr-stack-image//345/261/202/345/217/240/345/233/276/347/211/207/347/273/204/344/273/266.md +0 -0
  98. package/packages/hr-tab-nav/index.js +8 -0
  99. package/packages/hr-tab-nav/src/index.vue +96 -0
  100. package/packages/hr-view-item/index.js +13 -0
  101. package/packages/hr-view-item/src/index.vue +89 -0
  102. package/packages/hr-view-item//350/241/250/345/215/225/351/241/271item/345/261/225/347/244/272.md +0 -0
  103. package/packages/index.js +53 -0
  104. package/packages/utils/directive.js +58 -0
  105. package/packages/utils/index.js +73 -0
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div>
3
+ <van-field readonly
4
+ clickable
5
+ v-bind="$attrs"
6
+ :placeholder="placeholder"
7
+ @click="myShow = true" />
8
+ <van-popup v-model="myShow"
9
+ v-bind="$attrs"
10
+ :position="position"
11
+ :round="round">
12
+ <van-picker show-toolbar
13
+ v-bind="$attrs"
14
+ @cancel="myShow = false"
15
+ @confirm="confirm" />
16
+ </van-popup>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ export default {
22
+ name: "HrSelect",
23
+ model: {
24
+ prop: 'inputValue'
25
+ },
26
+ props: {
27
+ position: {
28
+ type: String,
29
+ default: 'bottom'
30
+ },
31
+ round: {
32
+ type: Boolean,
33
+ default: true
34
+ },
35
+ placeholder: {
36
+ type: String,
37
+ default: '请选择'
38
+ },
39
+ show: {
40
+ type: Boolean,
41
+ default: false
42
+ }
43
+ },
44
+ computed: {
45
+ myShow: {
46
+ get () {
47
+ return this.show
48
+ },
49
+ set (val) {
50
+ this.$emit('update:show', val)
51
+ }
52
+ }
53
+ },
54
+ methods: {
55
+ confirm (val) {
56
+ this.$emit('input', val.code)
57
+ this.$emit('select', val)
58
+ this.myShow = false
59
+ }
60
+ }
61
+ }
62
+ </script>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <div class="slide-pager-guide">
3
+ <div class="content-box">
4
+ <div class="arrow-img">
5
+ <img src="./image/turn-left.png">
6
+ <img src="./image/turn-right.png">
7
+ </div>
8
+
9
+ <div class="tips">左右滑动可切换上下篇</div>
10
+
11
+ <van-button type="primary"
12
+ style="width: 128px; height: 40px;"
13
+ @click="$emit('markRead')">知道了</van-button>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ }
21
+ </script>
22
+
23
+ <style lang="less" scoped>
24
+ .slide-pager-guide {
25
+ position: fixed;
26
+ left: 0;
27
+ top: 0;
28
+ height: 100%;
29
+ width: 100%;
30
+ z-index: 999;
31
+ // opacity: 1;
32
+ /* 中性色/蒙层#000000-70% */
33
+ background: rgba(0, 0, 0, 0.7);
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+
38
+ .content-box {
39
+ display: flex;
40
+ flex-direction: column;
41
+ align-items: center;
42
+ justify-content: center;
43
+ }
44
+
45
+ .arrow-img {
46
+ display: flex;
47
+ align-items: center;
48
+ justify-content: space-around;
49
+ > img {
50
+ width: 28%;
51
+ }
52
+ }
53
+ .tips {
54
+ margin: 60px 0;
55
+ font-size: 32px;
56
+ color: #ffffff;
57
+ }
58
+ }
59
+ </style>
@@ -0,0 +1,7 @@
1
+ import hrSlidePager from './src/index.vue'
2
+
3
+ hrSlidePager.install = function (Vue) {
4
+ Vue.component(hrSlidePager.name, hrSlidePager);
5
+ };
6
+
7
+ export default hrSlidePager;
@@ -0,0 +1,371 @@
1
+ <template>
2
+ <div class="hr-slide-pager"
3
+ ref="swiper">
4
+ <div class="shadow left"
5
+ ref="left"
6
+ :style="{ width: leftShadowWidth + 'px' }">
7
+ <span v-show="leftShadowWidth > threshold"
8
+ class="text">向右滑动可切换上一篇</span>
9
+ </div>
10
+
11
+ <div class="shadow right"
12
+ ref="right"
13
+ :style="{ width: rightShadowWidth + 'px' }">
14
+ <span v-show="rightShadowWidth > threshold"
15
+ class="text">向左滑动可切换下一篇</span>
16
+ </div>
17
+
18
+ <guide v-if="isShowGuide"
19
+ @markRead="markRead" />
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ import { debounce, ksStorage } from '../../utils/index.js'
25
+ import guide from '../guide/index.vue'
26
+
27
+ // 新手指引标识
28
+ const GuideVersion = 'SlidePagerGuideVersion_V2'
29
+
30
+ export default {
31
+ name: 'hr-slide-pager',
32
+ components: {
33
+ guide
34
+ },
35
+ props: {
36
+ // 当前id
37
+ currentId: {
38
+ type: [String, Number],
39
+ default: ''
40
+ },
41
+ // 需分页的id集合
42
+ ids: {
43
+ type: Array,
44
+ default: () => []
45
+ },
46
+ // 切换上下周周报时是否冻结分页器,用于保留当前分页id
47
+ isFreeze: {
48
+ type: Boolean,
49
+ default: false
50
+ },
51
+ // 是否可以切换分页的钩子,为true可切换,为false不可切换
52
+ canTurnPageFn: {
53
+ type: Function,
54
+ default () {
55
+ return () => true
56
+ }
57
+ },
58
+ // 是否禁用翻页
59
+ disabled: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ // 滑动翻页的阈值 (即滑动多远距离后触发翻页动作 单位:px)
64
+ threshold: {
65
+ type: Number,
66
+ default: 60
67
+ },
68
+ // 监听触摸的容器
69
+ container: {
70
+ type: String,
71
+ default: 'hr-slide-pager'
72
+ }
73
+ },
74
+ data () {
75
+ return {
76
+ startX: 0,
77
+ startY: 0,
78
+ leftShadowWidth: 0, // 左边界阴影宽度
79
+ rightShadowWidth: 0, // 右边界阴影宽度
80
+ currentIndex: 0, // 当前分页器索引
81
+ isSelectTextNow: false, // 当前是否正在选择文本
82
+ isShowGuide: false, // 是否展示新手指引
83
+ pageTurning: false, // 当前是否翻页中
84
+ }
85
+ },
86
+ created () {
87
+ this.judgeIsShowGuide() // 2个迭代后移除,避免app清空标识导致状态丢失
88
+ this.nextPage = debounce(this.nextPage, 100)
89
+ this.prevPage = debounce(this.prevPage, 100)
90
+ },
91
+ mounted () {
92
+ this.addEventForContainer()
93
+ },
94
+ computed: {
95
+ // 下一页是否禁用
96
+ nextDisabled () {
97
+ return this.currentIndex >= this.ids.length - 1
98
+ },
99
+ // 上一页是否禁用
100
+ prevDisabled () {
101
+ return this.currentIndex <= 0
102
+ },
103
+ // 是否禁用翻页器
104
+ disabledSlider () {
105
+ // 禁用的场景 传入的disabled || 用户正在选择文本 || 翻页中 || ids数量小于2
106
+ return this.disabled || this.isSelectTextNow || this.pageTurning || this.ids.length < 2
107
+ }
108
+ },
109
+ watch: {
110
+ currentId: {
111
+ handler () {
112
+ this.getCurrentIndex()
113
+ },
114
+ immediate: true
115
+ },
116
+ ids: {
117
+ handler () {
118
+ this.getCurrentIndex()
119
+ },
120
+ immediate: true
121
+ },
122
+ },
123
+ methods: {
124
+ /**
125
+ * @description 给指定容器添加触摸监听事件
126
+ */
127
+ addEventForContainer () {
128
+ this.$nextTick(() => {
129
+ let containerDom = document.querySelector(`.${this.container}`)
130
+ containerDom.addEventListener('touchstart', this.handleTouchStart)
131
+ containerDom.addEventListener('touchmove', this.handleTouchMove)
132
+ containerDom.addEventListener('touchend', this.handleTouchEnd)
133
+ containerDom.addEventListener('touchcancel', this.handleTouchEnd)
134
+ })
135
+ },
136
+ /**
137
+ * @description 判断是否展示新手指引
138
+ */
139
+ async judgeIsShowGuide () {
140
+ let res = await ksStorage.getItem(GuideVersion)
141
+ this.isShowGuide = res !== '10'
142
+ },
143
+ /**
144
+ * @description 新手指引标记已读
145
+ */
146
+ markRead () {
147
+ this.isShowGuide = false
148
+ ksStorage.setItem(GuideVersion, '10')
149
+ },
150
+ /**
151
+ * @description 获取当前页面是否用户正在选择文本
152
+ */
153
+ judgeIsSelectText () {
154
+ setTimeout(() => {
155
+ this.isSelectTextNow = !!window.getSelection().toString()
156
+ })
157
+ },
158
+ /**
159
+ * @description 重置触摸状态
160
+ */
161
+ resetTouchStatus () {
162
+ setTimeout(() => {
163
+ cancelAnimationFrame(this.animationId)
164
+ this.animationId = null
165
+ this.leftShadowWidth = 0
166
+ this.rightShadowWidth = 0
167
+ }, 100)
168
+ },
169
+ /**
170
+ * @description 获取当前id在ids的索引
171
+ */
172
+ getCurrentIndex () {
173
+ // 切换上下周周报时,冻结分页器后不响应id变化处理
174
+ if (this.ids && !this.isFreeze) {
175
+ this.currentIndex = this.ids.findIndex(v => +v === +this.currentId)
176
+ }
177
+ },
178
+ /**
179
+ * @description 手指触摸开始(记录触发的xy轴坐标)
180
+ * @param {*} event
181
+ */
182
+ handleTouchStart (event) {
183
+ if (this.disabledSlider) return
184
+
185
+ console.log('handleTouchStart------🐸🐸🐸🐸')
186
+ this.startX = event.touches[0].clientX
187
+ this.startY = event.touches[0].clientY
188
+ },
189
+ /**
190
+ * @description 手指触摸移动事件 (用于绘制翻页动画效果)
191
+ * @param {*} event
192
+ */
193
+ handleTouchMove (event) {
194
+ if (this.disabledSlider) return
195
+
196
+ const deltaX = event.touches[0].clientX - this.startX
197
+ const deltaY = event.touches[0].clientY - this.startY
198
+
199
+ if ((Math.abs(deltaX) > Math.abs(deltaY))) {
200
+ if (deltaX > 0) {
201
+ this.animationId = requestAnimationFrame(() => {
202
+ this.rightShadowWidth = 0
203
+ this.leftShadowWidth = Math.min(deltaX, 80)
204
+ })
205
+ } else if (deltaX < 0) {
206
+ this.animationId = requestAnimationFrame(() => {
207
+ this.leftShadowWidth = 0
208
+ this.rightShadowWidth = Math.min(-deltaX, 80)
209
+ })
210
+ }
211
+ }
212
+ },
213
+ /**
214
+ * @description 手指触摸结束 (决定是否触发翻页事件)
215
+ * @param {*} event
216
+ */
217
+ handleTouchEnd (event) {
218
+ this.judgeIsSelectText()
219
+
220
+ if (this.disabledSlider) return
221
+
222
+ console.log('handleTouchEnd-----💥💥💥💥💥💥')
223
+
224
+ const deltaX = event.changedTouches[0].clientX - this.startX
225
+ const deltaY = event.changedTouches[0].clientY - this.startY
226
+ console.log('handleTouchEnd----', deltaX, deltaY)
227
+
228
+ if (Math.abs(deltaX) > Math.abs(deltaY)) {
229
+ if (deltaX > this.threshold) {
230
+ if (!this.prevDisabled) {
231
+ console.log('左滑-----🚀🚀🚀🚀')
232
+ this.prevPage()
233
+ } else {
234
+ window.vant.Toast('已经到第一篇~')
235
+ }
236
+
237
+ } else if (deltaX < -this.threshold) {
238
+ if (!this.nextDisabled) {
239
+ console.log('右滑-----🐸🐸🐸🐸')
240
+ this.nextPage()
241
+ } else {
242
+ window.vant.Toast('已经到最后一篇~')
243
+ }
244
+ }
245
+ }
246
+
247
+ this.resetTouchStatus()
248
+ },
249
+ /**
250
+ * @description 维护是否翻页中状态
251
+ */
252
+ setPageTurningStatus () {
253
+ if (this.timer) return
254
+ this.pageTurning = true
255
+ this.timer = setTimeout(() => {
256
+ this.pageTurning = false
257
+ if (this.timer) {
258
+ clearTimeout(this.timer)
259
+ this.timer = null
260
+ }
261
+ }, 500)
262
+ },
263
+ /**
264
+ * @descrition 下一页
265
+ */
266
+ async nextPage () {
267
+ this.setPageTurningStatus()
268
+ // 校验切分页钩子,判断是否可切换分页
269
+ let isLimitSwitch = await this.isLimitSwitchPage()
270
+
271
+ if (isLimitSwitch || this.nextDisabled) {
272
+ return
273
+ }
274
+ this.currentIndex++
275
+ this.$emit('turnPage', this.ids[this.currentIndex])
276
+ },
277
+ /**
278
+ * @descrition 上一页
279
+ */
280
+ async prevPage () {
281
+ this.setPageTurningStatus()
282
+ // 校验切分页钩子,判断是否可切换分页
283
+ let isLimitSwitch = await this.isLimitSwitchPage()
284
+
285
+ if (isLimitSwitch || this.prevDisabled) {
286
+ return
287
+ }
288
+ this.currentIndex--
289
+ this.$emit('turnPage', this.ids[this.currentIndex])
290
+ },
291
+ /**
292
+ * @description 校验是否可切换分页钩子
293
+ * @returns {Boolean} true-禁止切换 false-可切换
294
+ */
295
+ async isLimitSwitchPage () {
296
+ // 钩子存在,并且不可切换分页
297
+ if (this.canTurnPageFn && typeof this.canTurnPageFn === 'function') {
298
+ let canSwitchPage = await this.canTurnPageFn()
299
+ if (!canSwitchPage) {
300
+ return true
301
+ }
302
+ }
303
+ }
304
+ }
305
+ };
306
+ </script>
307
+
308
+ <style lang="less">
309
+ .hr-slide-pager {
310
+ transform: translate3d(0, 0, 1);
311
+ position: fixed;
312
+ top: 0;
313
+ left: 0;
314
+ width: 100%;
315
+ height: 100%;
316
+ z-index: 9;
317
+ overflow: hidden;
318
+ pointer-events: none;
319
+
320
+ .shadow {
321
+ position: absolute;
322
+ top: 44px;
323
+ height: 100%;
324
+ pointer-events: none;
325
+ z-index: 9;
326
+ display: flex;
327
+ align-items: center;
328
+ justify-content: center;
329
+ transition: all 0.1s;
330
+ overflow: hidden;
331
+ opacity: 0.9;
332
+ &::before {
333
+ content: "";
334
+ width: 100%;
335
+ height: 100%;
336
+ position: absolute;
337
+ z-index: -1;
338
+ opacity: 0.9;
339
+ background: #ffffff;
340
+ filter: blur(10px);
341
+ }
342
+ .text {
343
+ filter: blur(0);
344
+ display: inline-block;
345
+ width: 10px;
346
+ color: #888ea6;
347
+ font-size: 13px;
348
+ }
349
+ }
350
+
351
+ .left {
352
+ left: 0;
353
+ }
354
+
355
+ .right {
356
+ right: 0;
357
+ }
358
+ }
359
+
360
+ .ios {
361
+ .hr-slide-pager .shadow {
362
+ top: 64px;
363
+ }
364
+ }
365
+
366
+ .ios.ipx {
367
+ .hr-slide-pager .shadow {
368
+ top: 88px !important;
369
+ }
370
+ }
371
+ </style>
@@ -0,0 +1,3 @@
1
+ import hrStackImage from './src/main'
2
+
3
+ export default hrStackImage
@@ -0,0 +1,77 @@
1
+ <script>
2
+ export default {
3
+ name: 'HrStackImage',
4
+ props: {
5
+ list: {
6
+ type: Array,
7
+ default: () => []
8
+ },
9
+ size: {
10
+ type: String,
11
+ default: '30px'
12
+ },
13
+ radius: {
14
+ type: String,
15
+ default: '30px'
16
+ },
17
+ stackSize: {
18
+ type: String,
19
+ default: '6px'
20
+ }
21
+ },
22
+ emits: ['click'],
23
+ computed: {
24
+ hasList () {
25
+ return Array.isArray(this.list) && this.list.length > 0
26
+ }
27
+ },
28
+ methods: {
29
+ handleImageClick (index) {
30
+ this.$emit('click', index)
31
+ }
32
+ },
33
+ render () {
34
+ const imgConfigStyle = {
35
+ width: this.size,
36
+ height: this.size,
37
+ borderRadius: this.radius
38
+ }
39
+ return (
40
+ this.hasList ? <div class="image-group">
41
+ {
42
+ this.list.map((url, index) =>
43
+ <img
44
+ src={url}
45
+ style={{ ...imgConfigStyle, marginLeft: index === 0 ? '0' : `-${this.stackSize}` }}
46
+ onClick={() => this.handleImageClick(index)}>
47
+ </img>
48
+ )
49
+ }
50
+ </div> : null
51
+ )
52
+ }
53
+ }
54
+ </script>
55
+
56
+ <style lang="less" scoped>
57
+ .image-group {
58
+ display: flex;
59
+ align-items: center;
60
+
61
+ img {
62
+ width: 20px;
63
+ height: 20px;
64
+ border-radius: 20px;
65
+ border: 1px solid #ffffff;
66
+ cursor: pointer;
67
+
68
+ &:hover {
69
+ transform: scale(1.5);
70
+ }
71
+
72
+ &:last-child {
73
+ margin-left: 0;
74
+ }
75
+ }
76
+ }
77
+ </style>
@@ -0,0 +1,8 @@
1
+
2
+ import HrTabNav from './src/index.vue'
3
+
4
+ HrTabNav.install = function (Vue) {
5
+ Vue.component(HrTabNav.name, HrTabNav)
6
+ }
7
+
8
+ export default HrTabNav
@@ -0,0 +1,96 @@
1
+ <script>
2
+ export default {
3
+ name: 'HrTabNav',
4
+ props: {
5
+ defaultType: {
6
+ type: Number,
7
+ default () {
8
+ return 10
9
+ }
10
+ }
11
+ },
12
+ data () {
13
+ return {
14
+ tabList: [
15
+ {
16
+ text: '待调度',
17
+ count: 20,
18
+ type: 10
19
+ },
20
+ {
21
+ text: '已调度',
22
+ count: 20,
23
+ type: 20
24
+ },
25
+ {
26
+ text: '调度中',
27
+ count: 20,
28
+ type: 30
29
+ }
30
+ ],
31
+ currentType: 10
32
+ }
33
+ },
34
+ watch: {
35
+ defaultType: {
36
+ immediate: true,
37
+ handler (value) {
38
+ this.currentType = value
39
+ }
40
+ }
41
+ },
42
+ methods: {
43
+ switchTab (type) {
44
+ this.currentType = type
45
+ }
46
+ },
47
+ render () {
48
+ // render tab
49
+ const renderHeaderTab = (params = {}) => {
50
+ const { text, type, count } = params
51
+ const active = this.currentType === type
52
+
53
+ return <div class={['nav-item', active && 'active']} onClick={this.switchTab.bind(this, type)}>
54
+ {text} {count}
55
+ {active && <i class="item-border"></i>}
56
+ </div>
57
+ }
58
+
59
+ return <div class="hr-tab-nav">
60
+ {
61
+ this.tabList.map((item) => {
62
+ return renderHeaderTab(item)
63
+ })
64
+ }
65
+ </div>
66
+ }
67
+ }
68
+ </script>
69
+ <style scoped lang="less">
70
+ .hr-tab-nav {
71
+ display: flex;
72
+ line-height: 34px;
73
+ margin-bottom: 11px;
74
+ .nav-item {
75
+ font-size: 13px;
76
+ font-weight: 600;
77
+ color: #858793;
78
+ position: relative;
79
+ margin-right: 29px;
80
+ .item-border {
81
+ width: 15px;
82
+ height: 3px;
83
+ position: absolute;
84
+ left: 50%;
85
+ bottom: 0;
86
+ transform: translateX(-50%);
87
+ background: #a68cff;
88
+ border-radius: 1.5px;
89
+ }
90
+ }
91
+ .nav-item.active {
92
+ font-size: 16px;
93
+ color: #03050d;
94
+ }
95
+ }
96
+ </style>