@10yun/cv-mobile-ui 0.5.62 → 0.5.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/package.json +1 -1
  2. package/plugins/uni-extend.js +10 -10
  3. package/ui-fireui/components/u-action-sheet/u-action-sheet.vue +46 -16
  4. package/ui-fireui/components/u-alert/u-alert.vue +11 -5
  5. package/ui-fireui/components/u-badge/u-badge.vue +52 -69
  6. package/ui-fireui/components/u-bottom-navigation/u-bottom-navigation.vue +28 -20
  7. package/ui-fireui/components/u-bottom-popup/u-bottom-popup.vue +40 -11
  8. package/ui-fireui/components/u-bubble-popup/u-bubble-popup.vue +3 -6
  9. package/ui-fireui/components/u-button/u-button.vue +262 -259
  10. package/ui-fireui/components/u-calendar/u-calendar.vue +227 -44
  11. package/ui-fireui/components/u-calendar/u-calendar2.js +562 -0
  12. package/ui-fireui/components/u-card/u-card.vue +50 -32
  13. package/ui-fireui/components/u-cascade-selection/u-cascade-selection.vue +197 -74
  14. package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +324 -0
  15. package/ui-fireui/components/u-clipboard2/tui-clipboard.js +53 -0
  16. package/ui-fireui/components/u-collapse/u-collapse.vue +8 -8
  17. package/ui-fireui/components/u-config/index.js +129 -0
  18. package/ui-fireui/components/u-count-down/u-count-down.vue +124 -19
  19. package/ui-fireui/components/u-datetime/u-datetime.vue +416 -176
  20. package/ui-fireui/components/u-divider/u-divider.vue +3 -3
  21. package/ui-fireui/components/u-drawer/u-drawer.vue +55 -12
  22. package/ui-fireui/components/u-dropdown-list/u-dropdown-list.vue +103 -0
  23. package/ui-fireui/components/u-fab/u-fab.vue +344 -0
  24. package/ui-fireui/components/u-footer/u-footer.vue +148 -0
  25. package/ui-fireui/components/u-grid/u-grid.vue +2 -8
  26. package/ui-fireui/components/u-grid-item/u-grid-item.vue +22 -5
  27. package/ui-fireui/components/u-icon/u-icon-new.js +190 -0
  28. package/ui-fireui/components/u-icon/u-icon-new.vue +100 -0
  29. package/ui-fireui/components/u-image-cropper/u-image-cropper.vue +1144 -0
  30. package/ui-fireui/components/u-image-group/u-image-group.vue +164 -0
  31. package/ui-fireui/components/u-keyboard/u-keyboard.vue +3 -2
  32. package/ui-fireui/components/u-keyboard-input/u-keyboard-input.vue +1 -1
  33. package/ui-fireui/components/u-list-cell/u-list-cell.vue +82 -72
  34. package/ui-fireui/components/u-list-view/u-list-view.vue +33 -8
  35. package/ui-fireui/components/u-loading/u-loading.vue +107 -27
  36. package/ui-fireui/components/u-loadmore/u-loadmore.vue +21 -3
  37. package/ui-fireui/components/u-modal/u-modal.vue +140 -176
  38. package/ui-fireui/components/u-navigation-bar/u-navigation-bar.vue +121 -28
  39. package/ui-fireui/components/u-no-data/u-no-data.vue +58 -20
  40. package/ui-fireui/components/u-nomore/u-nomore.vue +5 -4
  41. package/ui-fireui/components/u-numberbox/u-numberbox.vue +88 -45
  42. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.vue +94 -36
  43. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +27 -17
  44. package/ui-fireui/components/u-rate/u-rate.vue +197 -0
  45. package/ui-fireui/components/u-round-progress/u-round-progress.vue +62 -42
  46. package/ui-fireui/components/u-scroll-top/u-scroll-top.vue +4 -3
  47. package/ui-fireui/components/u-section/u-section.vue +149 -0
  48. package/ui-fireui/components/u-skeleton/u-skeleton.vue +37 -6
  49. package/ui-fireui/components/u-steps/u-steps.vue +110 -27
  50. package/ui-fireui/components/u-sticky/u-sticky.vue +35 -21
  51. package/ui-fireui/components/u-sticky-wxs/u-sticky-wxs.vue +7 -4
  52. package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +39 -36
  53. package/ui-fireui/components/u-swipe-action/u-swipe-action.vue +76 -19
  54. package/ui-fireui/components/u-tabbar/u-tabbar.vue +71 -38
  55. package/ui-fireui/components/u-tabs/u-tabs.vue +133 -51
  56. package/ui-fireui/components/u-tag/u-tag.vue +109 -226
  57. package/ui-fireui/components/u-time-axis/u-time-axis.vue +1 -1
  58. package/ui-fireui/components/u-timeaxis-item/u-timeaxis-item.vue +1 -1
  59. package/ui-fireui/components/u-tips/u-tips.vue +35 -15
  60. package/ui-fireui/components/u-toast/u-toast.vue +9 -5
  61. package/ui-fireui/components/u-top-dropdown/u-top-dropdown.vue +8 -6
  62. package/ui-fireui/components/u-upload/u-upload-old.vue +462 -0
  63. package/ui-fireui/components/u-upload/u-upload.vue +648 -446
  64. package/ui-fireui/components/u-white-space/u-white-space.vue +68 -0
  65. package/ui-fireui/components/u-wing-blank/u-wing-blank.vue +100 -0
  66. package/uview-plus/libs/ctocode/index.js +1 -0
  67. package/uview-plus/libs/ctocode/richText.js +0 -1
@@ -21,9 +21,9 @@
21
21
  :data-imgWidth="imgWidth"
22
22
  :data-imgHeight="imgHeight"
23
23
  :data-angle="angle"
24
- @touchend.stop="parse.cutTouchEnd"
25
- @touchstart.stop="parse.cutTouchStart"
26
- @touchmove.stop="parse.cutTouchMove"
24
+ @touchend="parse.cutTouchEnd"
25
+ @touchstart="parse.cutTouchStart"
26
+ @touchmove="parse.cutTouchMove"
27
27
  >
28
28
  <view class="up-content">
29
29
  <view class="up-content-top up-bg-transparent" :style="{ transitionProperty: cutAnimation ? '' : 'background' }"></view>
@@ -57,9 +57,9 @@
57
57
  <image
58
58
  @load="imageLoad"
59
59
  @error="imageLoad"
60
- @touchstart.stop="parse.touchstart"
61
- @touchmove.stop="parse.touchmove"
62
- @touchend.stop="parse.touchend"
60
+ @touchstart="parse.touchstart"
61
+ @touchmove="parse.touchmove"
62
+ @touchend="parse.touchend"
63
63
  :data-minScale="minScale"
64
64
  :data-maxScale="maxScale"
65
65
  :data-disableRotate="disableRotate"
@@ -69,8 +69,8 @@
69
69
  transitionDuration: (cutAnimation ? 0.3 : 0) + 's'
70
70
  }"
71
71
  class="up-cropper-image"
72
+ :class="{ 'up-cropper__image-hidden': !imageUrl }"
72
73
  :src="imageUrl"
73
- v-if="imageUrl"
74
74
  mode="widthFix"
75
75
  ></image>
76
76
  </view>
@@ -97,7 +97,8 @@
97
97
  *也可直接转成base64(不建议)
98
98
  * */
99
99
  export default {
100
- name: 'fuiPictureCropper',
100
+ name: 'tuiPictureCropper',
101
+ emits: ['ready', 'cropper', 'initAngle', 'imageLoad'],
101
102
  props: {
102
103
  //图片路径
103
104
  imageUrl: {
@@ -105,9 +106,9 @@ export default {
105
106
  default: ''
106
107
  },
107
108
  /*
108
- 默认正方形,可修改大小控制比例
109
- 裁剪框高度 px
110
- */
109
+ 默认正方形,可修改大小控制比例
110
+ 裁剪框高度 px
111
+ */
111
112
  height: {
112
113
  type: Number,
113
114
  default: 280
@@ -337,6 +338,20 @@ export default {
337
338
  }, 200);
338
339
  },
339
340
  methods: {
341
+ //网络图片转成本地文件[同步执行]
342
+ async getLocalImage(url) {
343
+ return await new Promise((resolve, reject) => {
344
+ uni.downloadFile({
345
+ url: url,
346
+ success: (res) => {
347
+ resolve(res.tempFilePath);
348
+ },
349
+ fail: (res) => {
350
+ reject(false);
351
+ }
352
+ });
353
+ });
354
+ },
340
355
  //返回裁剪后图片信息
341
356
  getImage() {
342
357
  if (!this.imageUrl) {
@@ -347,7 +362,7 @@ export default {
347
362
  return;
348
363
  }
349
364
  this.loadding && this.showLoading();
350
- let draw = () => {
365
+ let draw = async () => {
351
366
  //图片实际大小
352
367
  let imgWidth = this.imgWidth * this.scale * this.scaleRatio;
353
368
  let imgHeight = this.imgHeight * this.scale * this.scaleRatio;
@@ -357,7 +372,13 @@ export default {
357
372
  //旋转画布
358
373
  this.ctx.translate(xpos * this.scaleRatio, ypos * this.scaleRatio);
359
374
  this.ctx.rotate((this.angle * Math.PI) / 180);
360
- this.ctx.drawImage(this.imageUrl, -imgWidth / 2, -imgHeight / 2, imgWidth, imgHeight);
375
+ let imgUrl = this.imageUrl;
376
+ // #ifdef APP-PLUS || MP-WEIXIN
377
+ if (~this.imageUrl.indexOf('https:')) {
378
+ imgUrl = await this.getLocalImage(this.imageUrl);
379
+ }
380
+ // #endif
381
+ this.ctx.drawImage(imgUrl, -imgWidth / 2, -imgHeight / 2, imgWidth, imgHeight);
361
382
  this.ctx.draw(false, () => {
362
383
  let params = {
363
384
  width: this.canvasWidth * this.scaleRatio,
@@ -385,7 +406,7 @@ export default {
385
406
  this.ctx.toTempFilePath({
386
407
  ...params,
387
408
  success: (res) => {
388
- data.url = res.tempFilePath;
409
+ data.url = res.apFilePath;
389
410
  this.loadding && uni.hideLoading();
390
411
  this.$emit('cropper', data);
391
412
  }
@@ -394,24 +415,54 @@ export default {
394
415
  // #endif
395
416
 
396
417
  // #ifndef MP-ALIPAY
418
+ let isBase64 = this.isBase64;
397
419
  // #ifdef MP-BAIDU || MP-TOUTIAO || H5
398
- this.isBase64 = false;
420
+ isBase64 = false;
399
421
  // #endif
400
- if (this.isBase64) {
401
- uni.canvasGetImageData({
402
- canvasId: 'up-image-cropper',
403
- x: 0,
404
- y: 0,
405
- width: this.canvasWidth * this.scaleRatio,
406
- height: Math.round(this.canvasHeight * this.scaleRatio),
407
- success: (res) => {
408
- const arrayBuffer = new Uint8Array(res.data);
409
- const base64 = uni.arrayBufferToBase64(arrayBuffer);
410
- data.base64 = base64;
411
- this.loadding && uni.hideLoading();
412
- this.$emit('cropper', data);
413
- }
414
- });
422
+ if (isBase64) {
423
+ // #ifdef MP-WEIXIN
424
+ uni.canvasToTempFilePath(
425
+ {
426
+ ...params,
427
+ canvasId: 'up-image-cropper',
428
+ success: (res) => {
429
+ data.url = res.tempFilePath;
430
+ const fs = wx.getFileSystemManager();
431
+ // 读取文件, base64 格式
432
+ const base64Str = fs.readFileSync(res.tempFilePath, 'base64');
433
+ const imgBase64 = `data:image/png;base64,${base64Str}`;
434
+ data.base64 = imgBase64;
435
+
436
+ this.loadding && uni.hideLoading();
437
+ this.$emit('cropper', data);
438
+ },
439
+ fail(res) {
440
+ console.log(res);
441
+ }
442
+ },
443
+ this
444
+ );
445
+ // #endif
446
+
447
+ // #ifndef MP-WEIXIN
448
+ uni.canvasGetImageData(
449
+ {
450
+ canvasId: 'up-image-cropper',
451
+ x: 0,
452
+ y: 0,
453
+ width: this.canvasWidth * this.scaleRatio,
454
+ height: Math.round(this.canvasHeight * this.scaleRatio),
455
+ success: (res) => {
456
+ const arrayBuffer = new Uint8Array(res.data);
457
+ const base64 = uni.arrayBufferToBase64(arrayBuffer);
458
+ data.base64 = base64;
459
+ this.loadding && uni.hideLoading();
460
+ this.$emit('cropper', data);
461
+ }
462
+ },
463
+ this
464
+ );
465
+ // #endif
415
466
  } else {
416
467
  uni.canvasToTempFilePath(
417
468
  {
@@ -451,10 +502,10 @@ export default {
451
502
  change(e) {
452
503
  this.cutX = e.cutX || 0;
453
504
  this.cutY = e.cutY || 0;
454
- this.canvasWidth = e.canvasWidth || 100;
455
- this.canvasHeight = e.canvasHeight || 100;
456
- this.imgWidth = e.imgWidth || 100;
457
- this.imgHeight = e.imgHeight || 100;
505
+ this.canvasWidth = e.canvasWidth || this.width;
506
+ this.canvasHeight = e.canvasHeight || this.height;
507
+ this.imgWidth = e.imgWidth || this.imgWidth;
508
+ this.imgHeight = e.imgHeight || this.imgHeight;
458
509
  this.scale = e.scale || 1;
459
510
  this.angle = e.angle || 0;
460
511
  this.imgTop = e.imgTop || 0;
@@ -463,7 +514,7 @@ export default {
463
514
  imageReset() {
464
515
  this.scale = 1;
465
516
  this.angle = 0;
466
- let sys = this.sysInfo.windowHeight || uni.getSystemInfoSync();
517
+ let sys = this.sysInfo.windowHeight ? this.sysInfo : uni.getSystemInfoSync();
467
518
  this.imgTop = sys.windowHeight / 2;
468
519
  this.imgLeft = sys.windowWidth / 2;
469
520
  this.resetChange++;
@@ -490,7 +541,7 @@ export default {
490
541
  imgHeight = (height / width) * imgWidth;
491
542
  }
492
543
  } else {
493
- let sys = this.sysInfo || uni.getSystemInfoSync();
544
+ let sys = this.sysInfo.windowHeight ? this.sysInfo : uni.getSystemInfoSync();
494
545
  imgWidth = sys.windowWidth;
495
546
  imgHeight = 0;
496
547
  }
@@ -543,6 +594,7 @@ export default {
543
594
  .up-container {
544
595
  width: 100vw;
545
596
  height: 100vh;
597
+ padding: 0;
546
598
  background-color: rgba(0, 0, 0, 0.6);
547
599
  position: fixed;
548
600
  top: 0;
@@ -559,6 +611,7 @@ export default {
559
611
  .up-content {
560
612
  width: 100vw;
561
613
  height: 100vh;
614
+ padding: 0;
562
615
  position: absolute;
563
616
  z-index: 9;
564
617
  display: flex;
@@ -606,6 +659,11 @@ export default {
606
659
  transform-origin: center;
607
660
  }
608
661
 
662
+ .up-cropper__image-hidden {
663
+ visibility: hidden;
664
+ opacity: 0;
665
+ }
666
+
609
667
  .up-cropper-canvas {
610
668
  position: fixed;
611
669
  z-index: 10;
@@ -246,17 +246,20 @@ if (currentX > right_x1 && currentX
246
246
  cutY = cropper.cutY,
247
247
  cutX = cropper.cutX;
248
248
 
249
- function size_correct() {
249
+ var size_correct = function() {
250
250
  width = width
251
- <= cropper.maxWidth ? (width>= cropper.minWidth ? width : cropper.minWidth) : cropper.maxWidth;
251
+ <= cropper.maxWidth ? (width>= cropper.minWidth ? width : cropper.minWidth) : cropper
252
+ .maxWidth;
252
253
  height = height
253
- <= cropper.maxHeight ? (height>= cropper.minHeight ? height : cropper.minHeight) : cropper.maxHeight;
254
+ <= cropper.maxHeight ? (height>= cropper.minHeight ? height : cropper.minHeight) :
255
+ cropper.maxHeight;
254
256
  }
255
257
 
256
- function size_inspect() {
258
+ var size_inspect = function() {
257
259
  if ((width > cropper.maxWidth || width
258
260
  < cropper.minWidth || height> cropper.maxHeight || height
259
- < cropper.minHeight ) &&
261
+ <
262
+ cropper.minHeight ) &&
260
263
  lockRatio) {
261
264
  size_correct();
262
265
  return false;
@@ -330,7 +333,7 @@ function cutDetectionPosition(ins) {
330
333
  var windowHeight = cropper.windowHeight,
331
334
  windowWidth = cropper.windowWidth;
332
335
 
333
- function cutDetectionPositionTop() {
336
+ var cutDetectionPositionTop = function() {
334
337
  //检测上边距是否在范围内
335
338
  if (cropper.cutY
336
339
  < 0) {
@@ -341,7 +344,7 @@ cropper.cutY = windowHeight - cropper.canvasHeight;
341
344
  }
342
345
  }
343
346
 
344
- function cutDetectionPositionLeft() {
347
+ var cutDetectionPositionLeft = function() {
345
348
  //检测左边距是否在范围内
346
349
  if (cropper.cutX
347
350
  < 0) {
@@ -410,11 +413,13 @@ if (imgWidth * scale
410
413
  }
411
414
  left= cropper.cutX + (imgWidth * scale) / 2>= left ? left : cropper.cutX + (imgWidth * scale) / 2;
412
415
  left = cropper.cutX + cropper.canvasWidth - (imgWidth * scale) / 2
413
- <= left ? left : cropper.cutX + cropper.canvasWidth -
416
+ <= left ? left : cropper.cutX + cropper
417
+ .canvasWidth -
414
418
  (imgWidth * scale) / 2;
415
419
  top = cropper.cutY + (imgHeight * scale) / 2>= top ? top : cropper.cutY + (imgHeight * scale) / 2;
416
420
  top = cropper.cutY + cropper.canvasHeight - (imgHeight * scale) / 2
417
- <= top ? top : cropper.cutY + cropper.canvasHeight -
421
+ <= top ? top : cropper.cutY + cropper
422
+ .canvasHeight -
418
423
  (imgHeight * scale) / 2;
419
424
 
420
425
  cropper.imgLeft = left;
@@ -453,17 +458,22 @@ cropper.cutY = cropper.windowHeight - cropper.cutY;
453
458
 
454
459
  function styleUpdate(ins) {
455
460
  if (!ins) return;
456
- ins.selectComponent('.up-cropper-box').setStyle({
461
+ var tcb = ins.selectComponent('.up-cropper-box');
462
+ var tcm = ins.selectComponent('.up-content-middle')
463
+ var tct = ins.selectComponent('.up-content-top')
464
+ var twb = ins.selectComponent('.up-wxs-bg')
465
+ if (!tcb || !tcm || !tct || !twb) return;
466
+ tcb.setStyle({
457
467
  'width': cropper.canvasWidth + 'px',
458
468
  'height': cropper.canvasHeight + 'px'
459
469
  })
460
- ins.selectComponent('.up-content-middle').setStyle({
470
+ tcm.setStyle({
461
471
  'height': cropper.canvasHeight + 'px'
462
472
  })
463
- ins.selectComponent('.up-content-top').setStyle({
473
+ tct.setStyle({
464
474
  'height': cropper.cutY + 'px'
465
475
  })
466
- ins.selectComponent('.up-wxs-bg').setStyle({
476
+ twb.setStyle({
467
477
  'width': cropper.cutX + 'px'
468
478
  })
469
479
 
@@ -475,8 +485,8 @@ if (!owner) return
475
485
  var x = cropper.imgLeft - cropper.imgWidth / 2;
476
486
  var y = cropper.imgTop - cropper.imgHeight / 2;
477
487
  owner.setStyle({
478
- 'transform': 'translate3d(' + x + 'px,' + y + 'px,0) scale(' + cropper.scale + ') rotate(' +
479
- cropper.angle + 'deg)'
488
+ 'transform': 'translate3d(' + x + 'px,' + y + 'px,0) scale(' + cropper.scale + ') rotate(' + cropper
489
+ .angle + 'deg)'
480
490
  })
481
491
  }
482
492
 
@@ -536,7 +546,7 @@ if (cropper.canvasWidth
536
546
  cropper.windowHeight = +dataset.windowheight;
537
547
  cropper.windowWidth = +dataset.windowwidth;
538
548
  cropper.init = false
539
- } else if (type == 2) {
549
+ } else if (type == 2 || type == 3) {
540
550
  cropper.imgWidth = +dataset.imgwidth;
541
551
  cropper.imgHeight = +dataset.imgheight;
542
552
  }
@@ -571,7 +581,7 @@ if (cropper.canvasWidth
571
581
  }
572
582
  }
573
583
 
574
- export default {
584
+ module.exports = {
575
585
  touchstart: touchstart,
576
586
  touchmove: touchmove,
577
587
  touchend: touchend,
@@ -0,0 +1,197 @@
1
+ <template>
2
+ <view class="up-rate-box" @touchmove="touchMove">
3
+ <block v-for="(item, index) in numbers" :key="index">
4
+ <view
5
+ class="up-icon"
6
+ :class="[
7
+ 'up-relative',
8
+ 'up-icon-collection' + (hollow && (current <= index || (disabled && current <= index + 1)) ? '' : '-fill')
9
+ ]"
10
+ :data-index="index"
11
+ @tap="handleTap"
12
+ :style="{ fontSize: size + 'px', color: current > index + 1 || (!disabled && current > index) ? getActiveColor : normal }"
13
+ >
14
+ <view
15
+ class="up-icon"
16
+ :class="['up-icon-main', 'up-icon-collection-fill']"
17
+ v-if="disabled && current == index + 1"
18
+ :style="{ fontSize: size + 'px', color: getActiveColor, width: percent + '%' }"
19
+ ></view>
20
+ </view>
21
+ </block>
22
+ </view>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'tuiRate',
28
+ emits: ['change'],
29
+ props: {
30
+ //数量
31
+ quantity: {
32
+ type: [Number, String],
33
+ default: 5
34
+ },
35
+ //当前选中
36
+ current: {
37
+ type: Number,
38
+ default: 0
39
+ },
40
+ //当前选中星星分数(大于0,小于等于1的数)
41
+ score: {
42
+ type: [Number, String],
43
+ default: 1
44
+ },
45
+ //禁用点击
46
+ disabled: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ //大小
51
+ size: {
52
+ type: Number,
53
+ default: 20
54
+ },
55
+ //未选中颜色
56
+ normal: {
57
+ type: String,
58
+ default: '#b2b2b2'
59
+ },
60
+ //选中颜色
61
+ active: {
62
+ type: String,
63
+ default: ''
64
+ },
65
+ //未选中是否为空心
66
+ hollow: {
67
+ type: Boolean,
68
+ default: false
69
+ },
70
+ //自定义参数
71
+ params: {
72
+ type: [Number, String],
73
+ default: 0
74
+ }
75
+ },
76
+ computed: {
77
+ getActiveColor() {
78
+ return this.active || (uni && uni.$tui && uni.$tui.color.danger) || '#EB0909';
79
+ }
80
+ },
81
+ data() {
82
+ return {
83
+ pageX: 0,
84
+ percent: 0,
85
+ numbers: []
86
+ };
87
+ },
88
+ created() {
89
+ this.handleQuantity(this.quantity);
90
+ this.percent = Number(this.score || 0) * 100;
91
+ },
92
+ watch: {
93
+ score(newVal, oldVal) {
94
+ this.percent = Number(newVal || 0) * 100;
95
+ },
96
+ quantity(val) {
97
+ this.handleQuantity(val);
98
+ }
99
+ },
100
+ methods: {
101
+ handleTap(e) {
102
+ if (this.disabled) {
103
+ return;
104
+ }
105
+ const index = e.currentTarget.dataset.index;
106
+ this.$emit('change', {
107
+ index: Number(index) + 1,
108
+ params: this.params
109
+ });
110
+ },
111
+ touchMove(e) {
112
+ if (this.disabled) {
113
+ return;
114
+ }
115
+ if (!e.changedTouches[0]) {
116
+ return;
117
+ }
118
+ const movePageX = e.changedTouches[0].pageX;
119
+ const distance = movePageX - this.pageX;
120
+
121
+ if (distance <= 0) {
122
+ return;
123
+ }
124
+ let index = Math.ceil(distance / this.size);
125
+ index = index > this.quantity ? this.quantity : index;
126
+ this.$emit('change', {
127
+ index: index,
128
+ params: this.params
129
+ });
130
+ },
131
+ handleQuantity(quantity) {
132
+ quantity = Number(quantity) || 5;
133
+ quantity = Math.ceil(quantity);
134
+ this.numbers = Array.from(new Array(quantity + 1).keys()).slice(1);
135
+ }
136
+ },
137
+ mounted() {
138
+ this.$nextTick(() => {
139
+ setTimeout(() => {
140
+ const className = '.up-rate-box';
141
+ let query = uni.createSelectorQuery().in(this);
142
+ query
143
+ .select(className)
144
+ .boundingClientRect((res) => {
145
+ this.pageX = res.left || 0;
146
+ })
147
+ .exec();
148
+ }, 80);
149
+ });
150
+ }
151
+ };
152
+ </script>
153
+
154
+ <style scoped>
155
+ @font-face {
156
+ font-family: 'rateFont';
157
+ src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAT4AA0AAAAAB4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAE3AAAABoAAAAciBprQUdERUYAAAS8AAAAHgAAAB4AKQALT1MvMgAAAaAAAABDAAAAVj1YSN1jbWFwAAAB+AAAAEIAAAFCAA/qlmdhc3AAAAS0AAAACAAAAAj//wADZ2x5ZgAAAkgAAADwAAABZLMTdXtoZWFkAAABMAAAADAAAAA2FZKISmhoZWEAAAFgAAAAHQAAACQHYgOFaG10eAAAAeQAAAARAAAAEgx6AHpsb2NhAAACPAAAAAwAAAAMAEYAsm1heHAAAAGAAAAAHgAAACABEQBPbmFtZQAAAzgAAAFJAAACiCnmEVVwb3N0AAAEhAAAAC0AAABHLO3vkXjaY2BkYGAA4t2/VF7G89t8ZeBmYQCBm9ZKMnC6ikGMuYXpP5DLwcAEEgUAHPQJOXjaY2BkYGBu+N/AEMPCAALMLQyMDKiABQBQwgLwAAAAeNpjYGRgYGBlcGZgYgABEMkFhAwM/8F8BgAPigFhAAB42mNgZGFgnMDAysDA1Ml0hoGBoR9CM75mMGLkAIoysDIzYAUBaa4pDA7PXj17zdzwv4EhhrmBoQEozAiSAwD/YA2wAHjaY2GAABYIrmKoAgACggEBAAAAeNpjYGBgZoBgGQZGBhCwAfIYwXwWBgUgzQKEQP6z1///A8lX//9LSkJVMjCyMcCYDIxMQIKJARUwMgx7AAA/9QiLAAAAAAAAAAAAAABGALJ42mNgZKhiEGNuYfrPoMnAwGimps+ox6jPqKbEz8jHCMLyjHJAmk1czMie0cxInlHMDChrZs6cJyaosI+NlzmU34I/lImPdb+CoHgXCyujIosYtzTfKlYBtlWyuqwKjKwsjNvFTdlkGDnZ1srKrmXjZJRhMxVvZxFgA+rgYI9iYoriV1TYzybAwsDABHeLBIMT0DUg29VBTjEHucvcjtGeUVyOUZ6JaFcybefnZ5HuFdEX6ZVm5uMvniemxuXmzqUmNs+FeOfHCeiKzfPi4vKaJ6YrUCDOIiM8YYKwDIu4OMRbrOtkZdex4vMWACzGM5B42n2QPU4DMRCFn/MHJBJCIKhdUQDa/JQpEyn0CKWjSDbekGjXXnmdSDkBLRUHoOUYHIAbINFyCl6WSZMia+3o85uZ57EBnOMbCv/fJe6EFY7xKFzBETLhKvUX4Rr5XbiOFj6FG9R/hJu4VQPhFi7UGx1U7YS7m9JtywpnGAhXcIon4Sr1lXCN/CpcxxU+hBvUv4SbGONXuIVrZakM4WEwQWCcQWOKDeMCMRwskjIG1qE59GYSzExPN3oRO5s4GyjvV2KXAx5oOeeAKe09t2a+Sif+YMuB1JhuHgVLtimNLiJ0KBtfLJzV3ahzsP2e7ba02L9rgTXH7FENbNT8Pdsz0khsDK+QkjXyMrekElOPaGus8btnKdbzXgiJTrzL9IjHmjR1OvduaeLA4ufyjBx9tLmSPfeoHD5jWQh5v91OxCCKXYY/k9hxGQAAAHjaY2BigAAuMMnIgA5YwaJMjEyMzPzJ+Tk5qcklmfl58WmZOTlcCD4Ak9QKlAAAAAAAAAH//wACAAEAAAAMAAAAFgAAAAIAAQADAAQAAQAEAAAAAgAAAAB42mNgYGBkAIKrS9Q5QPRNayUZGA0AM8UETgAA)
158
+ format('woff');
159
+ font-weight: normal;
160
+ font-style: normal;
161
+ }
162
+
163
+ .up-icon {
164
+ font-family: 'rateFont' !important;
165
+ font-style: normal;
166
+ -webkit-font-smoothing: antialiased;
167
+ -moz-osx-font-smoothing: grayscale;
168
+ display: block;
169
+ }
170
+
171
+ .up-relative {
172
+ position: relative;
173
+ }
174
+
175
+ .up-icon-main {
176
+ position: absolute;
177
+ height: 100%;
178
+ left: 0;
179
+ top: 0;
180
+ overflow: hidden;
181
+ }
182
+
183
+ .up-icon-collection-fill:before {
184
+ content: '\e6ea';
185
+ }
186
+
187
+ .up-icon-collection:before {
188
+ content: '\e6eb';
189
+ }
190
+
191
+ .up-rate-box {
192
+ display: inline-flex;
193
+ align-items: center;
194
+ margin: 0;
195
+ padding: 0;
196
+ }
197
+ </style>