xiaoe_mp_npm 1.0.0-live5 → 1.0.0-live7

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 (35) hide show
  1. package/miniprogram_dist/Task/TaskBubble/index.js +47 -1
  2. package/miniprogram_dist/Task/TaskBubble/index.scss +2 -1
  3. package/miniprogram_dist/Task/TaskBubble/index.wxml +22 -24
  4. package/miniprogram_dist/Task/TaskBubble/index.wxss +6 -3
  5. package/miniprogram_dist/Task/TaskIcon/index.js +5 -1
  6. package/miniprogram_dist/Task/TaskIcon/index.scss +1 -0
  7. package/miniprogram_dist/Task/TaskIcon/index.wxml +1 -1
  8. package/miniprogram_dist/Task/TaskIcon/index.wxss +3 -0
  9. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.js +19 -0
  10. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.scss +1 -0
  11. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxml +14 -18
  12. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxs +48 -0
  13. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxss +3 -0
  14. package/miniprogram_dist/Task/taskReceivePopup/index.js +4 -8
  15. package/miniprogram_dist/Task/taskReceivePopup/index.wxml +9 -7
  16. package/miniprogram_dist/Task/taskReceivePopup/integral/index.js +4 -0
  17. package/miniprogram_dist/Task/taskReceivePopup/integral/index.wxml +1 -1
  18. package/package.json +1 -1
  19. package/src/Task/TaskBubble/index.js +47 -1
  20. package/src/Task/TaskBubble/index.scss +2 -1
  21. package/src/Task/TaskBubble/index.wxml +22 -24
  22. package/src/Task/TaskBubble/index.wxss +1 -1
  23. package/src/Task/TaskIcon/index.js +5 -1
  24. package/src/Task/TaskIcon/index.scss +1 -0
  25. package/src/Task/TaskIcon/index.wxml +1 -1
  26. package/src/Task/TaskIcon/index.wxss +1 -127
  27. package/src/Task/taskReceivePopup/coupon/index.js +19 -0
  28. package/src/Task/taskReceivePopup/coupon/index.scss +1 -0
  29. package/src/Task/taskReceivePopup/coupon/index.wxml +14 -18
  30. package/src/Task/taskReceivePopup/coupon/index.wxs +48 -0
  31. package/src/Task/taskReceivePopup/coupon/index.wxss +1 -163
  32. package/src/Task/taskReceivePopup/index.js +4 -8
  33. package/src/Task/taskReceivePopup/index.wxml +9 -7
  34. package/src/Task/taskReceivePopup/integral/index.js +4 -0
  35. package/src/Task/taskReceivePopup/integral/index.wxml +1 -1
@@ -1,9 +1,11 @@
1
+ const computedBehavior = require('miniprogram-computed').behavior
1
2
  Component({
3
+ behaviors: [computedBehavior],
2
4
  /**
3
5
  * 组件的属性列表
4
6
  */
5
7
  properties: {
6
- messageContent: {
8
+ taskMsg: {
7
9
  type: Object,
8
10
  value: {},
9
11
  },
@@ -14,6 +16,25 @@ Component({
14
16
  */
15
17
  data: {
16
18
  animationData: {},
19
+ taskIcon: {
20
+ 1: "https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0v93.png",
21
+ 2: "https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1w0t4k.png"
22
+ }
23
+ },
24
+
25
+ computed: {
26
+ // 奖品类型
27
+ rewardValue(data){
28
+ return data.taskMsg.live_task?.task_type === 1? this.convertMinutesToHoursAndMinutes(data.taskMsg.live_task?.reward_value) : ['', '发表评论', '转发直播间', '完成点赞'][data.taskMsg.live_task?.task_condition] || ''
29
+ },
30
+ // 奖品icon
31
+ taskIconImg(data){
32
+ return data.taskIcon[data.taskMsg.live_task?.reward_type]
33
+ },
34
+ // 奖品数量
35
+ prizeNum(data){
36
+ return data.taskMsg.live_task?.reward_type === 1? data.taskMsg.live_task?.reward_value: data.taskMsg.coupon_list?.length
37
+ }
17
38
  },
18
39
 
19
40
  lifetimes: {},
@@ -22,6 +43,12 @@ Component({
22
43
  * 组件的方法列表
23
44
  */
24
45
  methods: {
46
+ // 气泡点击事件
47
+ bubbleClick(){
48
+ this.triggerEvent("bubbleClick")
49
+ },
50
+
51
+ // 显示气泡动画
25
52
  showBubble() {
26
53
  const animation = wx.createAnimation({
27
54
  duration: 1500,
@@ -38,6 +65,7 @@ Component({
38
65
  }, 1500)
39
66
  },
40
67
 
68
+ // 隐藏气泡动画
41
69
  hideBubble() {
42
70
  const animation = wx.createAnimation({
43
71
  duration: 1500,
@@ -56,6 +84,7 @@ Component({
56
84
  }, 1500) // 设置延时与动画时长一致
57
85
  },
58
86
 
87
+ // 重置气泡位置
59
88
  restoreElement() {
60
89
  const animation = wx.createAnimation({
61
90
  duration: 0, // 立即执行,无过渡效果
@@ -67,5 +96,22 @@ Component({
67
96
  animationData: animation.export(),
68
97
  })
69
98
  },
99
+
100
+ convertMinutesToHoursAndMinutes(minutes) {
101
+ if (isNaN(minutes) || minutes < 0) {
102
+ return;
103
+ }
104
+
105
+ const hours = Math.floor(minutes / 60);
106
+ const remainingMinutes = minutes % 60;
107
+
108
+ if (hours === 0) {
109
+ return `达${remainingMinutes}分钟`;
110
+ } else if (remainingMinutes === 0) {
111
+ return `达${hours}小时`;
112
+ } else {
113
+ return `达${hours}小时${remainingMinutes}分钟`;
114
+ }
115
+ },
70
116
  },
71
117
  })
@@ -29,12 +29,13 @@ $deviceWidth: 750;
29
29
  height: vmin(48);
30
30
  border-radius: 50%;
31
31
  margin-left: vmin(10);
32
+ margin-right: vmin(8);
32
33
  flex-shrink: 0;
33
34
  }
34
35
  .task-type {
35
36
  display: flex;
36
37
  flex-direction: column;
37
- margin-left: vmin(8);
38
+ margin-right: vmin(8);
38
39
  overflow: hidden;
39
40
  text-overflow: ellipsis;
40
41
  white-space: nowrap;
@@ -1,27 +1,25 @@
1
- <view>
2
- <view class="barrage-container">
3
- <view class="barrage-wrap">
4
- <view class="barrage-item" animation="{{animationData}}">
5
- <view class="barrage-content">
6
- <image
7
- class="task-completion-icon"
8
- src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0c73.png"
9
- alt
10
- />
11
- <view class="task-type">{{messageContent.id}}</view>
12
- <view>达1小时</view>
13
- <image
14
- class="prize-icon"
15
- src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0v93.png"
16
- alt="奖励"
17
- />
18
- <view class="prize-num">+1</view>
19
- <image
20
- class="right-arrow-icon"
21
- src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1k0dzj.png"
22
- alt
23
- />
24
- </view>
1
+ <view class="barrage-container" catch:tap="bubbleClick">
2
+ <view class="barrage-wrap">
3
+ <view class="barrage-item" animation="{{animationData}}">
4
+ <view class="barrage-content">
5
+ <image
6
+ class="task-completion-icon"
7
+ src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0c73.png"
8
+ alt
9
+ />
10
+ <view wx:if="{{taskMsg.live_task.task_type === 1}}" class="task-type">观看时长</view>
11
+ <view>{{ rewardValue }}</view>
12
+ <image
13
+ class="prize-icon"
14
+ src="{{taskIconImg}}"
15
+ alt="奖励"
16
+ />
17
+ <view class="prize-num">+{{ prizeNum }}</view>
18
+ <image
19
+ class="right-arrow-icon"
20
+ src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1k0dzj.png"
21
+ alt
22
+ />
25
23
  </view>
26
24
  </view>
27
25
  </view>
@@ -24,12 +24,13 @@
24
24
  height: 6.4vmin;
25
25
  border-radius: 50%;
26
26
  margin-left: 1.33333vmin;
27
+ margin-right: 1.06667vmin;
27
28
  flex-shrink: 0;
28
29
  }
29
30
  .barrage-container .barrage-wrap .barrage-item .task-type {
30
31
  display: flex;
31
32
  flex-direction: column;
32
- margin-left: 1.06667vmin;
33
+ margin-right: 1.06667vmin;
33
34
  overflow: hidden;
34
35
  text-overflow: ellipsis;
35
36
  white-space: nowrap;
@@ -119,12 +120,13 @@
119
120
  height: 3.125vmin;
120
121
  border-radius: 50%;
121
122
  margin-left: 0.65104vmin;
123
+ margin-right: 0.52083vmin;
122
124
  flex-shrink: 0;
123
125
  }
124
126
  .barrage-container .barrage-wrap .barrage-item .task-type {
125
127
  display: flex;
126
128
  flex-direction: column;
127
- margin-left: 0.52083vmin;
129
+ margin-right: 0.52083vmin;
128
130
  overflow: hidden;
129
131
  text-overflow: ellipsis;
130
132
  white-space: nowrap;
@@ -215,12 +217,13 @@
215
217
  height: 3.125vmin;
216
218
  border-radius: 50%;
217
219
  margin-left: 0.65104vmin;
220
+ margin-right: 0.52083vmin;
218
221
  flex-shrink: 0;
219
222
  }
220
223
  .barrage-container .barrage-wrap .barrage-item .task-type {
221
224
  display: flex;
222
225
  flex-direction: column;
223
- margin-left: 0.52083vmin;
226
+ margin-right: 0.52083vmin;
224
227
  overflow: hidden;
225
228
  text-overflow: ellipsis;
226
229
  white-space: nowrap;
@@ -17,5 +17,9 @@ Component({
17
17
  /**
18
18
  * 组件的方法列表
19
19
  */
20
- methods: {},
20
+ methods: {
21
+ iconClick(){
22
+ this.triggerEvent("iconClick")
23
+ }
24
+ },
21
25
  })
@@ -19,6 +19,7 @@ $deviceWidth: 750;
19
19
  height: 100%;
20
20
  border-radius: vmin(16);
21
21
  margin: 0 vmin(32) vmin(24) 0;
22
+ pointer-events: auto;
22
23
  .task-icon {
23
24
  flex-shrink: 0;
24
25
  display: block;
@@ -1,4 +1,4 @@
1
- <view class="taskIcon {{aliveMode === 1? 'verticalStyle' : ''}}">
1
+ <view class="taskIcon {{aliveMode === 1? 'verticalStyle' : ''}}" catch:tap="iconClick">
2
2
  <view class="task-icon" />
3
3
  <view class="task-text">得奖励</view>
4
4
  </view>
@@ -13,6 +13,7 @@
13
13
  height: 100%;
14
14
  border-radius: 2.13333vmin;
15
15
  margin: 0 4.26667vmin 3.2vmin 0;
16
+ pointer-events: auto;
16
17
  }
17
18
  .taskIcon .task-icon {
18
19
  flex-shrink: 0;
@@ -55,6 +56,7 @@
55
56
  height: 100%;
56
57
  border-radius: 1.04167vmin;
57
58
  margin: 0 2.08333vmin 1.5625vmin 0;
59
+ pointer-events: auto;
58
60
  }
59
61
  .taskIcon .task-icon {
60
62
  flex-shrink: 0;
@@ -98,6 +100,7 @@
98
100
  height: 100%;
99
101
  border-radius: 1.04167vmin;
100
102
  margin: 0 2.08333vmin 1.5625vmin 0;
103
+ pointer-events: auto;
101
104
  }
102
105
  .taskIcon .task-icon {
103
106
  flex-shrink: 0;
@@ -1,4 +1,6 @@
1
+ const computedBehavior = require('miniprogram-computed').behavior
1
2
  Component({
3
+ behaviors: [computedBehavior],
2
4
  /**
3
5
  * 组件的属性列表
4
6
  */
@@ -12,12 +14,29 @@ Component({
12
14
  type: Boolean,
13
15
  value: false,
14
16
  },
17
+ rewardData: {
18
+ type: Object,
19
+ value: {},
20
+ }
15
21
  },
16
22
 
17
23
  /**
18
24
  * 组件的初始数据
19
25
  */
20
26
  data: {},
27
+ computed: {
28
+ receiveCouponNowMsg(data){
29
+ return data.rewardData.coupon_list[0]
30
+ },
31
+ isShowPoint(data) {
32
+ let tempPrice = data.receiveCouponNowMsg.price;
33
+ if (tempPrice % 100 == 0) {
34
+ return false;
35
+ } else {
36
+ return true;
37
+ }
38
+ },
39
+ },
21
40
 
22
41
  /**
23
42
  * 组件的方法列表
@@ -28,6 +28,7 @@ $deviceWidth: 750;
28
28
  color: #fd2b54;
29
29
  font-size: vmin(40);
30
30
  line-height: vmin(40);
31
+ margin-right: vmin(4);
31
32
  }
32
33
  .boldIcon {
33
34
  color: #fd2b54;
@@ -1,3 +1,4 @@
1
+ <wxs src="./index.wxs" module="couponReceivePopup" />
1
2
  <van-popup
2
3
  show="{{showCouponReceivePopup}}"
3
4
  round
@@ -10,38 +11,33 @@
10
11
  <view class="receive-container__content">
11
12
  <view class="receive-container__content-price">
12
13
  <text class="smallIcon">¥</text>
13
- <text class="boldIcon">6257</text>
14
- <text class="smallIcon">.50</text>
14
+ <text class="boldIcon">{{ couponReceivePopup.filterPrice(receiveCouponNowMsg.price) }}</text>
15
+ <text class="smallIcon" wx:if="{{isShowPoint}}">.{{ couponReceivePopup.fixedFont(receiveCouponNowMsg.price) }}</text>
15
16
  </view>
16
17
  <view class="receive-container__content-describe">
17
18
  <!-- 无门槛 -->
18
- <!-- <text v-if="receiveCouponNowMsg.require_price == 0">{{ $t("coupon.no_threshold") }}</text> -->
19
- <view>无门槛</view>
19
+ <view wx:if="{{receiveCouponNowMsg.require_price == 0}}">无门槛</view>
20
20
  <!-- 满xx元可用 -->
21
- <!-- <text v-else>{{
22
- $t("coupon.over_available", { num: receiveCouponNowMsg.require_price / 100 })
23
- }}</text> -->
21
+ <view wx:else>满{{ receiveCouponNowMsg.require_price / 100 }}元可用</view>
24
22
  <!-- 全部商品可用 -->
25
- <!-- <text v-if="receiveCouponNowMsg.type == 1">{{ $t("coupon.all_available") }}</text> -->
23
+ <view wx:if="{{receiveCouponNowMsg.type == 1}}">全部商品可用</view>
26
24
  <!-- 部分商品可用 -->
27
- <!-- <text v-else>{{ $t("coupon.part_available") }}</text> -->
25
+ <view wx:else>部分商品可用</view>
28
26
  <!-- 领取次日x天内有效 / 自领取起x天内有效-->
29
- <!-- <text v-if="+receiveCouponNowMsg.valid_day">{{
30
- receiveCouponNowMsg.valid_after == 1
31
- ? $t("coupon.receive_next", { num: receiveCouponNowMsg.valid_day })
32
- : $t("coupon.since_receive", { num: receiveCouponNowMsg.valid_day })
33
- }}</text> -->
34
- <view>限指定商品使用</view>
27
+ <view wx:if="{{receiveCouponNowMsg.valid_day}}">
28
+ <view wx:if="{{receiveCouponNowMsg.valid_after == 1}}">领取次日{{receiveCouponNowMsg.valid_day}}天内有效</view>
29
+ <view wx:else>自领取起{{receiveCouponNowMsg.valid_day}}天内有效</view>
30
+ </view>
35
31
  <!-- 有效期至 -->
36
- <view>
37
- 有效期至:2023-08-31 16:00
32
+ <view wx:if="{{!receiveCouponNowMsg.valid_day && receiveCouponNowMsg.valid_at && receiveCouponNowMsg.invalid_at}}">
33
+ 有效期至:{{ couponReceivePopup.formatDateToMinte(receiveCouponNowMsg.invalid_at) }}
38
34
  </view>
39
35
  </view>
40
36
  </view>
41
37
  </view>
42
38
  <image
43
39
  src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lmimm9mb0q88.png"
44
- alt=""
40
+ alt
45
41
  class="receive-container__close"
46
42
  catchtap="closePopup"
47
43
  />
@@ -0,0 +1,48 @@
1
+ /*
2
+ 使用目的:
3
+ 这里定义的函数,用在页面中, 类似于 Vue 里的 computed
4
+
5
+ 注意点:
6
+ 1. wxs中不支持 let , const
7
+ 2. 导出的时候,即使 key 和 value 相同, 也不能简写。
8
+ */
9
+
10
+ // 做数值过滤,value-要处理的数字 ToFix2-默认保留两位,默认转分转元,除以100。其他除以10(如折扣)
11
+ var filterPrice = function (value, ToFix2 = true) {
12
+ var result = (value / 100).toString();
13
+ if (!ToFix2) {
14
+ result = (value / 10).toString();
15
+ }
16
+ if (result.indexOf(".") > 0) {
17
+ return result.split(".")[0];
18
+ } else {
19
+ return result;
20
+ }
21
+ }
22
+
23
+ // 小数点后的样式补充 ToFix2-默认保留2位,其他保留1位
24
+ var fixedFont = function (value, ToFix2 = true) {
25
+ if (value) {
26
+ var result = (value / 100).toString();
27
+ if (!ToFix2) {
28
+ result = (value / 10).toString();
29
+ }
30
+ if (result.toString().indexOf(".") > -1) {
31
+ return result.split(".")[1];
32
+ } else {
33
+ return "";
34
+ }
35
+ }
36
+ }
37
+
38
+ // 时间精确到分
39
+ var formatDateToMinte = function (date) {
40
+ var lastIndex = date.lastIndexOf(":");
41
+ return date.substring(0, lastIndex).replace(getRegExp('-', 'g'), ".");
42
+ }
43
+
44
+ module.exports = {
45
+ filterPrice: filterPrice,
46
+ fixedFont: fixedFont,
47
+ formatDateToMinte: formatDateToMinte
48
+ }
@@ -23,6 +23,7 @@
23
23
  color: #fd2b54;
24
24
  font-size: 5.33333vmin;
25
25
  line-height: 5.33333vmin;
26
+ margin-right: 0.53333vmin;
26
27
  }
27
28
  .coupon-receive-popup .receive-container__content-price .boldIcon {
28
29
  color: #fd2b54;
@@ -77,6 +78,7 @@
77
78
  color: #fd2b54;
78
79
  font-size: 2.60417vmin;
79
80
  line-height: 2.60417vmin;
81
+ margin-right: 0.26042vmin;
80
82
  }
81
83
  .coupon-receive-popup .receive-container__content-price .boldIcon {
82
84
  color: #fd2b54;
@@ -132,6 +134,7 @@
132
134
  color: #fd2b54;
133
135
  font-size: 2.60417vmin;
134
136
  line-height: 2.60417vmin;
137
+ margin-right: 0.26042vmin;
135
138
  }
136
139
  .coupon-receive-popup .receive-container__content-price .boldIcon {
137
140
  color: #fd2b54;
@@ -8,14 +8,10 @@ Component({
8
8
  type: Boolean,
9
9
  value: false,
10
10
  },
11
- showCouponReceivePopup: {
12
- type: Boolean,
13
- value: false,
14
- },
15
- showIntegralReceivePopup: {
16
- type: Boolean,
17
- value: false,
18
- },
11
+ rewardData: {
12
+ type: Object,
13
+ value: {},
14
+ }
19
15
  },
20
16
 
21
17
  /**
@@ -1,15 +1,17 @@
1
1
  <view>
2
- <!-- 优惠券奖励弹窗 -->
3
- <coupon-popup
4
- showCouponReceivePopup="{{showCouponReceivePopup}}"
5
- isFullScreen="{{isFullcreen}}"
6
- bind:close="handleClose"
7
- ></coupon-popup>
8
2
  <!-- 积分奖励弹窗 -->
9
3
  <integral-popup
10
- showIntegralReceivePopup="{{showIntegralReceivePopup}}"
4
+ rewardData="{{rewardData}}"
5
+ showIntegralReceivePopup="{{rewardData.live_task.reward_type === 1}}"
11
6
  isFullScreen="{{isFullScreen}}"
12
7
  bind:close="handleClose"
13
8
  ></integral-popup>
9
+ <!-- 优惠券奖励弹窗 -->
10
+ <coupon-popup
11
+ rewardData="{{rewardData}}"
12
+ showCouponReceivePopup="{{rewardData.live_task.reward_type === 2}}"
13
+ isFullScreen="{{isFullcreen}}"
14
+ bind:close="handleClose"
15
+ ></coupon-popup>
14
16
  </view>
15
17
 
@@ -12,6 +12,10 @@ Component({
12
12
  type: Boolean,
13
13
  value: false,
14
14
  },
15
+ rewardData: {
16
+ type: Object,
17
+ value: {},
18
+ }
15
19
  },
16
20
 
17
21
  /**
@@ -7,7 +7,7 @@
7
7
  >
8
8
  <view class="receive-container">
9
9
  <view class="receive-container__content-number">
10
- +6257
10
+ +{{rewardData.live_task.reward_value}}
11
11
  </view>
12
12
  </view>
13
13
  <view class="receive-container__btn" catchtap="closePopup">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "1.0.0-live5",
3
+ "version": "1.0.0-live7",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -1,9 +1,11 @@
1
+ const computedBehavior = require('miniprogram-computed').behavior
1
2
  Component({
3
+ behaviors: [computedBehavior],
2
4
  /**
3
5
  * 组件的属性列表
4
6
  */
5
7
  properties: {
6
- messageContent: {
8
+ taskMsg: {
7
9
  type: Object,
8
10
  value: {},
9
11
  },
@@ -14,6 +16,25 @@ Component({
14
16
  */
15
17
  data: {
16
18
  animationData: {},
19
+ taskIcon: {
20
+ 1: "https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0v93.png",
21
+ 2: "https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1w0t4k.png"
22
+ }
23
+ },
24
+
25
+ computed: {
26
+ // 奖品类型
27
+ rewardValue(data){
28
+ return data.taskMsg.live_task?.task_type === 1? this.convertMinutesToHoursAndMinutes(data.taskMsg.live_task?.reward_value) : ['', '发表评论', '转发直播间', '完成点赞'][data.taskMsg.live_task?.task_condition] || ''
29
+ },
30
+ // 奖品icon
31
+ taskIconImg(data){
32
+ return data.taskIcon[data.taskMsg.live_task?.reward_type]
33
+ },
34
+ // 奖品数量
35
+ prizeNum(data){
36
+ return data.taskMsg.live_task?.reward_type === 1? data.taskMsg.live_task?.reward_value: data.taskMsg.coupon_list?.length
37
+ }
17
38
  },
18
39
 
19
40
  lifetimes: {},
@@ -22,6 +43,12 @@ Component({
22
43
  * 组件的方法列表
23
44
  */
24
45
  methods: {
46
+ // 气泡点击事件
47
+ bubbleClick(){
48
+ this.triggerEvent("bubbleClick")
49
+ },
50
+
51
+ // 显示气泡动画
25
52
  showBubble() {
26
53
  const animation = wx.createAnimation({
27
54
  duration: 1500,
@@ -38,6 +65,7 @@ Component({
38
65
  }, 1500)
39
66
  },
40
67
 
68
+ // 隐藏气泡动画
41
69
  hideBubble() {
42
70
  const animation = wx.createAnimation({
43
71
  duration: 1500,
@@ -56,6 +84,7 @@ Component({
56
84
  }, 1500) // 设置延时与动画时长一致
57
85
  },
58
86
 
87
+ // 重置气泡位置
59
88
  restoreElement() {
60
89
  const animation = wx.createAnimation({
61
90
  duration: 0, // 立即执行,无过渡效果
@@ -67,5 +96,22 @@ Component({
67
96
  animationData: animation.export(),
68
97
  })
69
98
  },
99
+
100
+ convertMinutesToHoursAndMinutes(minutes) {
101
+ if (isNaN(minutes) || minutes < 0) {
102
+ return;
103
+ }
104
+
105
+ const hours = Math.floor(minutes / 60);
106
+ const remainingMinutes = minutes % 60;
107
+
108
+ if (hours === 0) {
109
+ return `达${remainingMinutes}分钟`;
110
+ } else if (remainingMinutes === 0) {
111
+ return `达${hours}小时`;
112
+ } else {
113
+ return `达${hours}小时${remainingMinutes}分钟`;
114
+ }
115
+ },
70
116
  },
71
117
  })
@@ -29,12 +29,13 @@ $deviceWidth: 750;
29
29
  height: vmin(48);
30
30
  border-radius: 50%;
31
31
  margin-left: vmin(10);
32
+ margin-right: vmin(8);
32
33
  flex-shrink: 0;
33
34
  }
34
35
  .task-type {
35
36
  display: flex;
36
37
  flex-direction: column;
37
- margin-left: vmin(8);
38
+ margin-right: vmin(8);
38
39
  overflow: hidden;
39
40
  text-overflow: ellipsis;
40
41
  white-space: nowrap;
@@ -1,27 +1,25 @@
1
- <view>
2
- <view class="barrage-container">
3
- <view class="barrage-wrap">
4
- <view class="barrage-item" animation="{{animationData}}">
5
- <view class="barrage-content">
6
- <image
7
- class="task-completion-icon"
8
- src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0c73.png"
9
- alt
10
- />
11
- <view class="task-type">{{messageContent.id}}</view>
12
- <view>达1小时</view>
13
- <image
14
- class="prize-icon"
15
- src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0v93.png"
16
- alt="奖励"
17
- />
18
- <view class="prize-num">+1</view>
19
- <image
20
- class="right-arrow-icon"
21
- src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1k0dzj.png"
22
- alt
23
- />
24
- </view>
1
+ <view class="barrage-container" catch:tap="bubbleClick">
2
+ <view class="barrage-wrap">
3
+ <view class="barrage-item" animation="{{animationData}}">
4
+ <view class="barrage-content">
5
+ <image
6
+ class="task-completion-icon"
7
+ src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1y0c73.png"
8
+ alt
9
+ />
10
+ <view wx:if="{{taskMsg.live_task.task_type === 1}}" class="task-type">观看时长</view>
11
+ <view>{{ rewardValue }}</view>
12
+ <image
13
+ class="prize-icon"
14
+ src="{{taskIconImg}}"
15
+ alt="奖励"
16
+ />
17
+ <view class="prize-num">+{{ prizeNum }}</view>
18
+ <image
19
+ class="right-arrow-icon"
20
+ src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopitz1k0dzj.png"
21
+ alt
22
+ />
25
23
  </view>
26
24
  </view>
27
25
  </view>
@@ -1 +1 @@
1
- .barrage-container{color:#fff;font-size:2.66667vmin}.barrage-container .barrage-wrap{display:flex}.barrage-container .barrage-wrap .barrage-item{position:relative;background:linear-gradient(270deg, #ff781f00 0%, #ff8619c7 21.42%, #ff9a0feb 46.71%, #FC0 100%);height:8.53333vmin;font-size:3.2vmin;line-height:8.53333vmin;border-radius:12.26667vmin;transition:0.3s;transform:translateX(-66.66667vmin)}.barrage-container .barrage-wrap .barrage-item .barrage-content{display:flex;align-items:center}.barrage-container .barrage-wrap .barrage-item .task-completion-icon{width:6.4vmin;height:6.4vmin;border-radius:50%;margin-left:1.33333vmin;flex-shrink:0}.barrage-container .barrage-wrap .barrage-item .task-type{display:flex;flex-direction:column;margin-left:1.06667vmin;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .task-type view{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .prize-icon{width:7.46667vmin;height:7.46667vmin;display:flex;justify-content:center;align-items:center;margin:0 1.06667vmin}.barrage-container .barrage-wrap .barrage-item .prize-num{color:#FFF5CC;font-weight:500;margin-right:1.06667vmin}.barrage-container .barrage-wrap .barrage-item .right-arrow-icon{height:5.33333vmin;width:5.33333vmin;margin-right:6.93333vmin}.barrage-container .barrage-wrap .barrage-item.barrage-item-show{animation:taskFadeInLeft 1.5s both}.barrage-container .barrage-wrap .barrage-item.barrage-item-hide{animation:taskFadeOut 1.5s both}@keyframes taskFadeInLeft{0%{transform:translateX(-66.66667vmin);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes taskFadeOut{0%{transform:translateX(0);opacity:1}100%{transform:translateX(0);opacity:0}}@keyframes moveRight{from{transform:translateX(-100%)}to{transform:translateX(0)}}@media screen and (min-width: 768px) and (orientation: portrait){.barrage-container{color:#fff;font-size:1.30208vmin}.barrage-container .barrage-wrap{display:flex}.barrage-container .barrage-wrap .barrage-item{position:relative;background:linear-gradient(270deg, #ff781f00 0%, #ff8619c7 21.42%, #ff9a0feb 46.71%, #FC0 100%);height:4.16667vmin;font-size:1.5625vmin;line-height:4.16667vmin;border-radius:5.98958vmin;transition:0.3s;transform:translateX(-32.55208vmin)}.barrage-container .barrage-wrap .barrage-item .barrage-content{display:flex;align-items:center}.barrage-container .barrage-wrap .barrage-item .task-completion-icon{width:3.125vmin;height:3.125vmin;border-radius:50%;margin-left:.65104vmin;flex-shrink:0}.barrage-container .barrage-wrap .barrage-item .task-type{display:flex;flex-direction:column;margin-left:.52083vmin;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .task-type view{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .prize-icon{width:3.64583vmin;height:3.64583vmin;display:flex;justify-content:center;align-items:center;margin:0 .52083vmin}.barrage-container .barrage-wrap .barrage-item .prize-num{color:#FFF5CC;font-weight:500;margin-right:.52083vmin}.barrage-container .barrage-wrap .barrage-item .right-arrow-icon{height:2.60417vmin;width:2.60417vmin;margin-right:3.38542vmin}.barrage-container .barrage-wrap .barrage-item.barrage-item-show{animation:taskFadeInLeft 1.5s both}.barrage-container .barrage-wrap .barrage-item.barrage-item-hide{animation:taskFadeOut 1.5s both}@keyframes taskFadeInLeft{0%{transform:translateX(-32.55208vmin);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes taskFadeOut{0%{transform:translateX(0);opacity:1}100%{transform:translateX(0);opacity:0}}@keyframes moveRight{from{transform:translateX(-100%)}to{transform:translateX(0)}}}@media screen and (min-height: 768px) and (orientation: landscape){.barrage-container{color:#fff;font-size:1.30208vmin}.barrage-container .barrage-wrap{display:flex}.barrage-container .barrage-wrap .barrage-item{position:relative;background:linear-gradient(270deg, #ff781f00 0%, #ff8619c7 21.42%, #ff9a0feb 46.71%, #FC0 100%);height:4.16667vmin;font-size:1.5625vmin;line-height:4.16667vmin;border-radius:5.98958vmin;transition:0.3s;transform:translateX(-32.55208vmin)}.barrage-container .barrage-wrap .barrage-item .barrage-content{display:flex;align-items:center}.barrage-container .barrage-wrap .barrage-item .task-completion-icon{width:3.125vmin;height:3.125vmin;border-radius:50%;margin-left:.65104vmin;flex-shrink:0}.barrage-container .barrage-wrap .barrage-item .task-type{display:flex;flex-direction:column;margin-left:.52083vmin;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .task-type view{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .prize-icon{width:3.64583vmin;height:3.64583vmin;display:flex;justify-content:center;align-items:center;margin:0 .52083vmin}.barrage-container .barrage-wrap .barrage-item .prize-num{color:#FFF5CC;font-weight:500;margin-right:.52083vmin}.barrage-container .barrage-wrap .barrage-item .right-arrow-icon{height:2.60417vmin;width:2.60417vmin;margin-right:3.38542vmin}.barrage-container .barrage-wrap .barrage-item.barrage-item-show{animation:taskFadeInLeft 1.5s both}.barrage-container .barrage-wrap .barrage-item.barrage-item-hide{animation:taskFadeOut 1.5s both}@keyframes taskFadeInLeft{0%{transform:translateX(-32.55208vmin);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes taskFadeOut{0%{transform:translateX(0);opacity:1}100%{transform:translateX(0);opacity:0}}@keyframes moveRight{from{transform:translateX(-100%)}to{transform:translateX(0)}}}
1
+ .barrage-container{color:#fff;font-size:2.66667vmin}.barrage-container .barrage-wrap{display:flex}.barrage-container .barrage-wrap .barrage-item{position:relative;background:linear-gradient(270deg, #ff781f00 0%, #ff8619c7 21.42%, #ff9a0feb 46.71%, #FC0 100%);height:8.53333vmin;font-size:3.2vmin;line-height:8.53333vmin;border-radius:12.26667vmin;transition:0.3s;transform:translateX(-66.66667vmin)}.barrage-container .barrage-wrap .barrage-item .barrage-content{display:flex;align-items:center}.barrage-container .barrage-wrap .barrage-item .task-completion-icon{width:6.4vmin;height:6.4vmin;border-radius:50%;margin-left:1.33333vmin;margin-right:1.06667vmin;flex-shrink:0}.barrage-container .barrage-wrap .barrage-item .task-type{display:flex;flex-direction:column;margin-right:1.06667vmin;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .task-type view{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .prize-icon{width:7.46667vmin;height:7.46667vmin;display:flex;justify-content:center;align-items:center;margin:0 1.06667vmin}.barrage-container .barrage-wrap .barrage-item .prize-num{color:#FFF5CC;font-weight:500;margin-right:1.06667vmin}.barrage-container .barrage-wrap .barrage-item .right-arrow-icon{height:5.33333vmin;width:5.33333vmin;margin-right:6.93333vmin}.barrage-container .barrage-wrap .barrage-item.barrage-item-show{animation:taskFadeInLeft 1.5s both}.barrage-container .barrage-wrap .barrage-item.barrage-item-hide{animation:taskFadeOut 1.5s both}@keyframes taskFadeInLeft{0%{transform:translateX(-66.66667vmin);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes taskFadeOut{0%{transform:translateX(0);opacity:1}100%{transform:translateX(0);opacity:0}}@keyframes moveRight{from{transform:translateX(-100%)}to{transform:translateX(0)}}@media screen and (min-width: 768px) and (orientation: portrait){.barrage-container{color:#fff;font-size:1.30208vmin}.barrage-container .barrage-wrap{display:flex}.barrage-container .barrage-wrap .barrage-item{position:relative;background:linear-gradient(270deg, #ff781f00 0%, #ff8619c7 21.42%, #ff9a0feb 46.71%, #FC0 100%);height:4.16667vmin;font-size:1.5625vmin;line-height:4.16667vmin;border-radius:5.98958vmin;transition:0.3s;transform:translateX(-32.55208vmin)}.barrage-container .barrage-wrap .barrage-item .barrage-content{display:flex;align-items:center}.barrage-container .barrage-wrap .barrage-item .task-completion-icon{width:3.125vmin;height:3.125vmin;border-radius:50%;margin-left:.65104vmin;margin-right:.52083vmin;flex-shrink:0}.barrage-container .barrage-wrap .barrage-item .task-type{display:flex;flex-direction:column;margin-right:.52083vmin;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .task-type view{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .prize-icon{width:3.64583vmin;height:3.64583vmin;display:flex;justify-content:center;align-items:center;margin:0 .52083vmin}.barrage-container .barrage-wrap .barrage-item .prize-num{color:#FFF5CC;font-weight:500;margin-right:.52083vmin}.barrage-container .barrage-wrap .barrage-item .right-arrow-icon{height:2.60417vmin;width:2.60417vmin;margin-right:3.38542vmin}.barrage-container .barrage-wrap .barrage-item.barrage-item-show{animation:taskFadeInLeft 1.5s both}.barrage-container .barrage-wrap .barrage-item.barrage-item-hide{animation:taskFadeOut 1.5s both}@keyframes taskFadeInLeft{0%{transform:translateX(-32.55208vmin);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes taskFadeOut{0%{transform:translateX(0);opacity:1}100%{transform:translateX(0);opacity:0}}@keyframes moveRight{from{transform:translateX(-100%)}to{transform:translateX(0)}}}@media screen and (min-height: 768px) and (orientation: landscape){.barrage-container{color:#fff;font-size:1.30208vmin}.barrage-container .barrage-wrap{display:flex}.barrage-container .barrage-wrap .barrage-item{position:relative;background:linear-gradient(270deg, #ff781f00 0%, #ff8619c7 21.42%, #ff9a0feb 46.71%, #FC0 100%);height:4.16667vmin;font-size:1.5625vmin;line-height:4.16667vmin;border-radius:5.98958vmin;transition:0.3s;transform:translateX(-32.55208vmin)}.barrage-container .barrage-wrap .barrage-item .barrage-content{display:flex;align-items:center}.barrage-container .barrage-wrap .barrage-item .task-completion-icon{width:3.125vmin;height:3.125vmin;border-radius:50%;margin-left:.65104vmin;margin-right:.52083vmin;flex-shrink:0}.barrage-container .barrage-wrap .barrage-item .task-type{display:flex;flex-direction:column;margin-right:.52083vmin;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .task-type view{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.barrage-container .barrage-wrap .barrage-item .prize-icon{width:3.64583vmin;height:3.64583vmin;display:flex;justify-content:center;align-items:center;margin:0 .52083vmin}.barrage-container .barrage-wrap .barrage-item .prize-num{color:#FFF5CC;font-weight:500;margin-right:.52083vmin}.barrage-container .barrage-wrap .barrage-item .right-arrow-icon{height:2.60417vmin;width:2.60417vmin;margin-right:3.38542vmin}.barrage-container .barrage-wrap .barrage-item.barrage-item-show{animation:taskFadeInLeft 1.5s both}.barrage-container .barrage-wrap .barrage-item.barrage-item-hide{animation:taskFadeOut 1.5s both}@keyframes taskFadeInLeft{0%{transform:translateX(-32.55208vmin);opacity:1}100%{transform:translateX(0);opacity:1}}@keyframes taskFadeOut{0%{transform:translateX(0);opacity:1}100%{transform:translateX(0);opacity:0}}@keyframes moveRight{from{transform:translateX(-100%)}to{transform:translateX(0)}}}
@@ -17,5 +17,9 @@ Component({
17
17
  /**
18
18
  * 组件的方法列表
19
19
  */
20
- methods: {},
20
+ methods: {
21
+ iconClick(){
22
+ this.triggerEvent("iconClick")
23
+ }
24
+ },
21
25
  })
@@ -19,6 +19,7 @@ $deviceWidth: 750;
19
19
  height: 100%;
20
20
  border-radius: vmin(16);
21
21
  margin: 0 vmin(32) vmin(24) 0;
22
+ pointer-events: auto;
22
23
  .task-icon {
23
24
  flex-shrink: 0;
24
25
  display: block;
@@ -1,4 +1,4 @@
1
- <view class="taskIcon {{aliveMode === 1? 'verticalStyle' : ''}}">
1
+ <view class="taskIcon {{aliveMode === 1? 'verticalStyle' : ''}}" catch:tap="iconClick">
2
2
  <view class="task-icon" />
3
3
  <view class="task-text">得奖励</view>
4
4
  </view>
@@ -1,127 +1 @@
1
- .taskIcon {
2
- z-index: 9;
3
- box-sizing: border-box;
4
- width: 9.6vmin;
5
- height: 9.6vmin;
6
- text-align: center;
7
- padding: 0;
8
- position: relative;
9
- display: flex;
10
- flex-direction: column;
11
- align-items: center;
12
- font-size: 2.13333vmin;
13
- height: 100%;
14
- border-radius: 2.13333vmin;
15
- margin: 0 4.26667vmin 3.2vmin 0;
16
- }
17
- .taskIcon .task-icon {
18
- flex-shrink: 0;
19
- display: block;
20
- width: 8.53333vmin;
21
- height: 8.53333vmin;
22
- background-image: url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopok62p0l77.png");
23
- background-size: 100% 100%;
24
- }
25
- .taskIcon .task-text {
26
- width: 8.53333vmin;
27
- height: 3.2vmin;
28
- line-height: 3.2vmin;
29
- border-radius: 1.6vmin;
30
- font-size: 2.13333vmin;
31
- background: rgba(0, 0, 0, 0.4);
32
- color: #fff;
33
- }
34
- .taskIcon.verticalStyle {
35
- margin: 0;
36
- background: rgba(0, 0, 0, 0.2);
37
- }
38
- .taskIcon.verticalStyle .task-text {
39
- position: absolute;
40
- bottom: -0.26667vmin;
41
- }
42
- @media screen and (min-width: 768px) and (orientation: portrait) {
43
- .taskIcon {
44
- z-index: 9;
45
- box-sizing: border-box;
46
- width: 4.6875vmin;
47
- height: 4.6875vmin;
48
- text-align: center;
49
- padding: 0;
50
- position: relative;
51
- display: flex;
52
- flex-direction: column;
53
- align-items: center;
54
- font-size: 1.04167vmin;
55
- height: 100%;
56
- border-radius: 1.04167vmin;
57
- margin: 0 2.08333vmin 1.5625vmin 0;
58
- }
59
- .taskIcon .task-icon {
60
- flex-shrink: 0;
61
- display: block;
62
- width: 4.16667vmin;
63
- height: 4.16667vmin;
64
- background-image: url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopok62p0l77.png");
65
- background-size: 100% 100%;
66
- }
67
- .taskIcon .task-text {
68
- width: 4.16667vmin;
69
- height: 1.5625vmin;
70
- line-height: 1.5625vmin;
71
- border-radius: 0.78125vmin;
72
- font-size: 1.04167vmin;
73
- background: rgba(0, 0, 0, 0.4);
74
- color: #fff;
75
- }
76
- .taskIcon.verticalStyle {
77
- margin: 0;
78
- background: rgba(0, 0, 0, 0.2);
79
- }
80
- .taskIcon.verticalStyle .task-text {
81
- position: absolute;
82
- bottom: -0.13021vmin;
83
- }
84
- }
85
- @media screen and (min-height: 768px) and (orientation: landscape) {
86
- .taskIcon {
87
- z-index: 9;
88
- box-sizing: border-box;
89
- width: 4.6875vmin;
90
- height: 4.6875vmin;
91
- text-align: center;
92
- padding: 0;
93
- position: relative;
94
- display: flex;
95
- flex-direction: column;
96
- align-items: center;
97
- font-size: 1.04167vmin;
98
- height: 100%;
99
- border-radius: 1.04167vmin;
100
- margin: 0 2.08333vmin 1.5625vmin 0;
101
- }
102
- .taskIcon .task-icon {
103
- flex-shrink: 0;
104
- display: block;
105
- width: 4.16667vmin;
106
- height: 4.16667vmin;
107
- background-image: url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopok62p0l77.png");
108
- background-size: 100% 100%;
109
- }
110
- .taskIcon .task-text {
111
- width: 4.16667vmin;
112
- height: 1.5625vmin;
113
- line-height: 1.5625vmin;
114
- border-radius: 0.78125vmin;
115
- font-size: 1.04167vmin;
116
- background: rgba(0, 0, 0, 0.4);
117
- color: #fff;
118
- }
119
- .taskIcon.verticalStyle {
120
- margin: 0;
121
- background: rgba(0, 0, 0, 0.2);
122
- }
123
- .taskIcon.verticalStyle .task-text {
124
- position: absolute;
125
- bottom: -0.13021vmin;
126
- }
127
- }
1
+ .taskIcon{z-index:9;box-sizing:border-box;width:9.6vmin;height:9.6vmin;text-align:center;padding:0;position:relative;display:flex;flex-direction:column;align-items:center;font-size:2.13333vmin;height:100%;border-radius:2.13333vmin;margin:0 4.26667vmin 3.2vmin 0;pointer-events:auto}.taskIcon .task-icon{flex-shrink:0;display:block;width:8.53333vmin;height:8.53333vmin;background-image:url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopok62p0l77.png");background-size:100% 100%}.taskIcon .task-text{width:8.53333vmin;height:3.2vmin;line-height:3.2vmin;border-radius:1.6vmin;font-size:2.13333vmin;background:rgba(0,0,0,0.4);color:#fff}.taskIcon.verticalStyle{margin:0;background:rgba(0,0,0,0.2)}.taskIcon.verticalStyle .task-text{position:absolute;bottom:-.26667vmin}@media screen and (min-width: 768px) and (orientation: portrait){.taskIcon{z-index:9;box-sizing:border-box;width:4.6875vmin;height:4.6875vmin;text-align:center;padding:0;position:relative;display:flex;flex-direction:column;align-items:center;font-size:1.04167vmin;height:100%;border-radius:1.04167vmin;margin:0 2.08333vmin 1.5625vmin 0;pointer-events:auto}.taskIcon .task-icon{flex-shrink:0;display:block;width:4.16667vmin;height:4.16667vmin;background-image:url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopok62p0l77.png");background-size:100% 100%}.taskIcon .task-text{width:4.16667vmin;height:1.5625vmin;line-height:1.5625vmin;border-radius:.78125vmin;font-size:1.04167vmin;background:rgba(0,0,0,0.4);color:#fff}.taskIcon.verticalStyle{margin:0;background:rgba(0,0,0,0.2)}.taskIcon.verticalStyle .task-text{position:absolute;bottom:-.13021vmin}}@media screen and (min-height: 768px) and (orientation: landscape){.taskIcon{z-index:9;box-sizing:border-box;width:4.6875vmin;height:4.6875vmin;text-align:center;padding:0;position:relative;display:flex;flex-direction:column;align-items:center;font-size:1.04167vmin;height:100%;border-radius:1.04167vmin;margin:0 2.08333vmin 1.5625vmin 0;pointer-events:auto}.taskIcon .task-icon{flex-shrink:0;display:block;width:4.16667vmin;height:4.16667vmin;background-image:url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/lopok62p0l77.png");background-size:100% 100%}.taskIcon .task-text{width:4.16667vmin;height:1.5625vmin;line-height:1.5625vmin;border-radius:.78125vmin;font-size:1.04167vmin;background:rgba(0,0,0,0.4);color:#fff}.taskIcon.verticalStyle{margin:0;background:rgba(0,0,0,0.2)}.taskIcon.verticalStyle .task-text{position:absolute;bottom:-.13021vmin}}
@@ -1,4 +1,6 @@
1
+ const computedBehavior = require('miniprogram-computed').behavior
1
2
  Component({
3
+ behaviors: [computedBehavior],
2
4
  /**
3
5
  * 组件的属性列表
4
6
  */
@@ -12,12 +14,29 @@ Component({
12
14
  type: Boolean,
13
15
  value: false,
14
16
  },
17
+ rewardData: {
18
+ type: Object,
19
+ value: {},
20
+ }
15
21
  },
16
22
 
17
23
  /**
18
24
  * 组件的初始数据
19
25
  */
20
26
  data: {},
27
+ computed: {
28
+ receiveCouponNowMsg(data){
29
+ return data.rewardData.coupon_list[0]
30
+ },
31
+ isShowPoint(data) {
32
+ let tempPrice = data.receiveCouponNowMsg.price;
33
+ if (tempPrice % 100 == 0) {
34
+ return false;
35
+ } else {
36
+ return true;
37
+ }
38
+ },
39
+ },
21
40
 
22
41
  /**
23
42
  * 组件的方法列表
@@ -28,6 +28,7 @@ $deviceWidth: 750;
28
28
  color: #fd2b54;
29
29
  font-size: vmin(40);
30
30
  line-height: vmin(40);
31
+ margin-right: vmin(4);
31
32
  }
32
33
  .boldIcon {
33
34
  color: #fd2b54;
@@ -1,3 +1,4 @@
1
+ <wxs src="./index.wxs" module="couponReceivePopup" />
1
2
  <van-popup
2
3
  show="{{showCouponReceivePopup}}"
3
4
  round
@@ -10,38 +11,33 @@
10
11
  <view class="receive-container__content">
11
12
  <view class="receive-container__content-price">
12
13
  <text class="smallIcon">¥</text>
13
- <text class="boldIcon">6257</text>
14
- <text class="smallIcon">.50</text>
14
+ <text class="boldIcon">{{ couponReceivePopup.filterPrice(receiveCouponNowMsg.price) }}</text>
15
+ <text class="smallIcon" wx:if="{{isShowPoint}}">.{{ couponReceivePopup.fixedFont(receiveCouponNowMsg.price) }}</text>
15
16
  </view>
16
17
  <view class="receive-container__content-describe">
17
18
  <!-- 无门槛 -->
18
- <!-- <text v-if="receiveCouponNowMsg.require_price == 0">{{ $t("coupon.no_threshold") }}</text> -->
19
- <view>无门槛</view>
19
+ <view wx:if="{{receiveCouponNowMsg.require_price == 0}}">无门槛</view>
20
20
  <!-- 满xx元可用 -->
21
- <!-- <text v-else>{{
22
- $t("coupon.over_available", { num: receiveCouponNowMsg.require_price / 100 })
23
- }}</text> -->
21
+ <view wx:else>满{{ receiveCouponNowMsg.require_price / 100 }}元可用</view>
24
22
  <!-- 全部商品可用 -->
25
- <!-- <text v-if="receiveCouponNowMsg.type == 1">{{ $t("coupon.all_available") }}</text> -->
23
+ <view wx:if="{{receiveCouponNowMsg.type == 1}}">全部商品可用</view>
26
24
  <!-- 部分商品可用 -->
27
- <!-- <text v-else>{{ $t("coupon.part_available") }}</text> -->
25
+ <view wx:else>部分商品可用</view>
28
26
  <!-- 领取次日x天内有效 / 自领取起x天内有效-->
29
- <!-- <text v-if="+receiveCouponNowMsg.valid_day">{{
30
- receiveCouponNowMsg.valid_after == 1
31
- ? $t("coupon.receive_next", { num: receiveCouponNowMsg.valid_day })
32
- : $t("coupon.since_receive", { num: receiveCouponNowMsg.valid_day })
33
- }}</text> -->
34
- <view>限指定商品使用</view>
27
+ <view wx:if="{{receiveCouponNowMsg.valid_day}}">
28
+ <view wx:if="{{receiveCouponNowMsg.valid_after == 1}}">领取次日{{receiveCouponNowMsg.valid_day}}天内有效</view>
29
+ <view wx:else>自领取起{{receiveCouponNowMsg.valid_day}}天内有效</view>
30
+ </view>
35
31
  <!-- 有效期至 -->
36
- <view>
37
- 有效期至:2023-08-31 16:00
32
+ <view wx:if="{{!receiveCouponNowMsg.valid_day && receiveCouponNowMsg.valid_at && receiveCouponNowMsg.invalid_at}}">
33
+ 有效期至:{{ couponReceivePopup.formatDateToMinte(receiveCouponNowMsg.invalid_at) }}
38
34
  </view>
39
35
  </view>
40
36
  </view>
41
37
  </view>
42
38
  <image
43
39
  src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lmimm9mb0q88.png"
44
- alt=""
40
+ alt
45
41
  class="receive-container__close"
46
42
  catchtap="closePopup"
47
43
  />
@@ -0,0 +1,48 @@
1
+ /*
2
+ 使用目的:
3
+ 这里定义的函数,用在页面中, 类似于 Vue 里的 computed
4
+
5
+ 注意点:
6
+ 1. wxs中不支持 let , const
7
+ 2. 导出的时候,即使 key 和 value 相同, 也不能简写。
8
+ */
9
+
10
+ // 做数值过滤,value-要处理的数字 ToFix2-默认保留两位,默认转分转元,除以100。其他除以10(如折扣)
11
+ var filterPrice = function (value, ToFix2 = true) {
12
+ var result = (value / 100).toString();
13
+ if (!ToFix2) {
14
+ result = (value / 10).toString();
15
+ }
16
+ if (result.indexOf(".") > 0) {
17
+ return result.split(".")[0];
18
+ } else {
19
+ return result;
20
+ }
21
+ }
22
+
23
+ // 小数点后的样式补充 ToFix2-默认保留2位,其他保留1位
24
+ var fixedFont = function (value, ToFix2 = true) {
25
+ if (value) {
26
+ var result = (value / 100).toString();
27
+ if (!ToFix2) {
28
+ result = (value / 10).toString();
29
+ }
30
+ if (result.toString().indexOf(".") > -1) {
31
+ return result.split(".")[1];
32
+ } else {
33
+ return "";
34
+ }
35
+ }
36
+ }
37
+
38
+ // 时间精确到分
39
+ var formatDateToMinte = function (date) {
40
+ var lastIndex = date.lastIndexOf(":");
41
+ return date.substring(0, lastIndex).replace(getRegExp('-', 'g'), ".");
42
+ }
43
+
44
+ module.exports = {
45
+ filterPrice: filterPrice,
46
+ fixedFont: fixedFont,
47
+ formatDateToMinte: formatDateToMinte
48
+ }
@@ -1,163 +1 @@
1
- .coupon-receive-popup .receive-container {
2
- width: 68.26667vmin;
3
- height: 93.06667vmin;
4
- background-size: 100% 100%;
5
- background-image: url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/loqj5jrx0grc.png");
6
- overflow: hidden;
7
- }
8
- .coupon-receive-popup .receive-container__content {
9
- display: flex;
10
- flex-direction: column;
11
- margin: 36.26667vmin 4.26667vmin 4.26667vmin;
12
- padding: 0 3.2vmin;
13
- }
14
- .coupon-receive-popup .receive-container__content-price {
15
- font-weight: 500;
16
- font-family: "PingFang SC";
17
- text-align: left;
18
- display: flex;
19
- align-items: baseline;
20
- margin-top: 6.4vmin;
21
- }
22
- .coupon-receive-popup .receive-container__content-price .smallIcon {
23
- color: #fd2b54;
24
- font-size: 5.33333vmin;
25
- line-height: 5.33333vmin;
26
- }
27
- .coupon-receive-popup .receive-container__content-price .boldIcon {
28
- color: #fd2b54;
29
- font-size: 10.66667vmin;
30
- line-height: 10.66667vmin;
31
- }
32
- .coupon-receive-popup .receive-container__content-describe {
33
- color: #333333;
34
- font-size: 3.73333vmin;
35
- font-weight: 400;
36
- font-family: "PingFang SC";
37
- text-align: left;
38
- line-height: 5.33333vmin;
39
- margin-top: 10.13333vmin;
40
- }
41
- .coupon-receive-popup .receive-container__content-describe view {
42
- display: block;
43
- margin-bottom: 1.06667vmin;
44
- }
45
- .coupon-receive-popup .receive-container__close {
46
- display: block;
47
- width: 8.53333vmin;
48
- height: 8.53333vmin;
49
- margin: 4.26667vmin auto 0;
50
- }
51
- .coupon-receive-popup.coupon-receive-popup-full .receive-container-wrapper {
52
- transform: scale(0.8);
53
- }
54
- @media screen and (min-width: 768px) and (orientation: portrait) {
55
- .coupon-receive-popup .receive-container {
56
- width: 33.33333vmin;
57
- height: 45.44271vmin;
58
- background-size: 100% 100%;
59
- background-image: url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/loqj5jrx0grc.png");
60
- overflow: hidden;
61
- }
62
- .coupon-receive-popup .receive-container__content {
63
- display: flex;
64
- flex-direction: column;
65
- margin: 17.70833vmin 2.08333vmin 2.08333vmin;
66
- padding: 0 1.5625vmin;
67
- }
68
- .coupon-receive-popup .receive-container__content-price {
69
- font-weight: 500;
70
- font-family: "PingFang SC";
71
- text-align: left;
72
- display: flex;
73
- align-items: baseline;
74
- margin-top: 3.125vmin;
75
- }
76
- .coupon-receive-popup .receive-container__content-price .smallIcon {
77
- color: #fd2b54;
78
- font-size: 2.60417vmin;
79
- line-height: 2.60417vmin;
80
- }
81
- .coupon-receive-popup .receive-container__content-price .boldIcon {
82
- color: #fd2b54;
83
- font-size: 5.20833vmin;
84
- line-height: 5.20833vmin;
85
- }
86
- .coupon-receive-popup .receive-container__content-describe {
87
- color: #333333;
88
- font-size: 1.82292vmin;
89
- font-weight: 400;
90
- font-family: "PingFang SC";
91
- text-align: left;
92
- line-height: 2.60417vmin;
93
- margin-top: 4.94792vmin;
94
- }
95
- .coupon-receive-popup .receive-container__content-describe view {
96
- display: block;
97
- margin-bottom: 0.52083vmin;
98
- }
99
- .coupon-receive-popup .receive-container__close {
100
- display: block;
101
- width: 4.16667vmin;
102
- height: 4.16667vmin;
103
- margin: 2.08333vmin auto 0;
104
- }
105
- .coupon-receive-popup.coupon-receive-popup-full .receive-container-wrapper {
106
- transform: scale(0.8);
107
- }
108
- }
109
- @media screen and (min-height: 768px) and (orientation: landscape) {
110
- .coupon-receive-popup .receive-container {
111
- width: 33.33333vmin;
112
- height: 45.44271vmin;
113
- background-size: 100% 100%;
114
- background-image: url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/loqj5jrx0grc.png");
115
- overflow: hidden;
116
- }
117
- .coupon-receive-popup .receive-container__content {
118
- display: flex;
119
- flex-direction: column;
120
- margin: 17.70833vmin 2.08333vmin 2.08333vmin;
121
- padding: 0 1.5625vmin;
122
- }
123
- .coupon-receive-popup .receive-container__content-price {
124
- font-weight: 500;
125
- font-family: "PingFang SC";
126
- text-align: left;
127
- display: flex;
128
- align-items: baseline;
129
- margin-top: 3.125vmin;
130
- }
131
- .coupon-receive-popup .receive-container__content-price .smallIcon {
132
- color: #fd2b54;
133
- font-size: 2.60417vmin;
134
- line-height: 2.60417vmin;
135
- }
136
- .coupon-receive-popup .receive-container__content-price .boldIcon {
137
- color: #fd2b54;
138
- font-size: 5.20833vmin;
139
- line-height: 5.20833vmin;
140
- }
141
- .coupon-receive-popup .receive-container__content-describe {
142
- color: #333333;
143
- font-size: 1.82292vmin;
144
- font-weight: 400;
145
- font-family: "PingFang SC";
146
- text-align: left;
147
- line-height: 2.60417vmin;
148
- margin-top: 4.94792vmin;
149
- }
150
- .coupon-receive-popup .receive-container__content-describe view {
151
- display: block;
152
- margin-bottom: 0.52083vmin;
153
- }
154
- .coupon-receive-popup .receive-container__close {
155
- display: block;
156
- width: 4.16667vmin;
157
- height: 4.16667vmin;
158
- margin: 2.08333vmin auto 0;
159
- }
160
- .coupon-receive-popup.coupon-receive-popup-full .receive-container-wrapper {
161
- transform: scale(0.8);
162
- }
163
- }
1
+ .coupon-receive-popup .receive-container{width:68.26667vmin;height:93.06667vmin;background-size:100% 100%;background-image:url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/loqj5jrx0grc.png");overflow:hidden}.coupon-receive-popup .receive-container__content{display:flex;flex-direction:column;margin:36.26667vmin 4.26667vmin 4.26667vmin;padding:0 3.2vmin}.coupon-receive-popup .receive-container__content-price{font-weight:500;font-family:"PingFang SC";text-align:left;display:flex;align-items:baseline;margin-top:6.4vmin}.coupon-receive-popup .receive-container__content-price .smallIcon{color:#fd2b54;font-size:5.33333vmin;line-height:5.33333vmin;margin-right:.53333vmin}.coupon-receive-popup .receive-container__content-price .boldIcon{color:#fd2b54;font-size:10.66667vmin;line-height:10.66667vmin}.coupon-receive-popup .receive-container__content-describe{color:#333333;font-size:3.73333vmin;font-weight:400;font-family:"PingFang SC";text-align:left;line-height:5.33333vmin;margin-top:10.13333vmin}.coupon-receive-popup .receive-container__content-describe view{display:block;margin-bottom:1.06667vmin}.coupon-receive-popup .receive-container__close{display:block;width:8.53333vmin;height:8.53333vmin;margin:4.26667vmin auto 0}.coupon-receive-popup.coupon-receive-popup-full .receive-container-wrapper{transform:scale(0.8)}@media screen and (min-width: 768px) and (orientation: portrait){.coupon-receive-popup .receive-container{width:33.33333vmin;height:45.44271vmin;background-size:100% 100%;background-image:url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/loqj5jrx0grc.png");overflow:hidden}.coupon-receive-popup .receive-container__content{display:flex;flex-direction:column;margin:17.70833vmin 2.08333vmin 2.08333vmin;padding:0 1.5625vmin}.coupon-receive-popup .receive-container__content-price{font-weight:500;font-family:"PingFang SC";text-align:left;display:flex;align-items:baseline;margin-top:3.125vmin}.coupon-receive-popup .receive-container__content-price .smallIcon{color:#fd2b54;font-size:2.60417vmin;line-height:2.60417vmin;margin-right:.26042vmin}.coupon-receive-popup .receive-container__content-price .boldIcon{color:#fd2b54;font-size:5.20833vmin;line-height:5.20833vmin}.coupon-receive-popup .receive-container__content-describe{color:#333333;font-size:1.82292vmin;font-weight:400;font-family:"PingFang SC";text-align:left;line-height:2.60417vmin;margin-top:4.94792vmin}.coupon-receive-popup .receive-container__content-describe view{display:block;margin-bottom:.52083vmin}.coupon-receive-popup .receive-container__close{display:block;width:4.16667vmin;height:4.16667vmin;margin:2.08333vmin auto 0}.coupon-receive-popup.coupon-receive-popup-full .receive-container-wrapper{transform:scale(0.8)}}@media screen and (min-height: 768px) and (orientation: landscape){.coupon-receive-popup .receive-container{width:33.33333vmin;height:45.44271vmin;background-size:100% 100%;background-image:url("https://commonresource-1252524126.cdn.xiaoeknow.com/image/loqj5jrx0grc.png");overflow:hidden}.coupon-receive-popup .receive-container__content{display:flex;flex-direction:column;margin:17.70833vmin 2.08333vmin 2.08333vmin;padding:0 1.5625vmin}.coupon-receive-popup .receive-container__content-price{font-weight:500;font-family:"PingFang SC";text-align:left;display:flex;align-items:baseline;margin-top:3.125vmin}.coupon-receive-popup .receive-container__content-price .smallIcon{color:#fd2b54;font-size:2.60417vmin;line-height:2.60417vmin;margin-right:.26042vmin}.coupon-receive-popup .receive-container__content-price .boldIcon{color:#fd2b54;font-size:5.20833vmin;line-height:5.20833vmin}.coupon-receive-popup .receive-container__content-describe{color:#333333;font-size:1.82292vmin;font-weight:400;font-family:"PingFang SC";text-align:left;line-height:2.60417vmin;margin-top:4.94792vmin}.coupon-receive-popup .receive-container__content-describe view{display:block;margin-bottom:.52083vmin}.coupon-receive-popup .receive-container__close{display:block;width:4.16667vmin;height:4.16667vmin;margin:2.08333vmin auto 0}.coupon-receive-popup.coupon-receive-popup-full .receive-container-wrapper{transform:scale(0.8)}}
@@ -8,14 +8,10 @@ Component({
8
8
  type: Boolean,
9
9
  value: false,
10
10
  },
11
- showCouponReceivePopup: {
12
- type: Boolean,
13
- value: false,
14
- },
15
- showIntegralReceivePopup: {
16
- type: Boolean,
17
- value: false,
18
- },
11
+ rewardData: {
12
+ type: Object,
13
+ value: {},
14
+ }
19
15
  },
20
16
 
21
17
  /**
@@ -1,15 +1,17 @@
1
1
  <view>
2
- <!-- 优惠券奖励弹窗 -->
3
- <coupon-popup
4
- showCouponReceivePopup="{{showCouponReceivePopup}}"
5
- isFullScreen="{{isFullcreen}}"
6
- bind:close="handleClose"
7
- ></coupon-popup>
8
2
  <!-- 积分奖励弹窗 -->
9
3
  <integral-popup
10
- showIntegralReceivePopup="{{showIntegralReceivePopup}}"
4
+ rewardData="{{rewardData}}"
5
+ showIntegralReceivePopup="{{rewardData.live_task.reward_type === 1}}"
11
6
  isFullScreen="{{isFullScreen}}"
12
7
  bind:close="handleClose"
13
8
  ></integral-popup>
9
+ <!-- 优惠券奖励弹窗 -->
10
+ <coupon-popup
11
+ rewardData="{{rewardData}}"
12
+ showCouponReceivePopup="{{rewardData.live_task.reward_type === 2}}"
13
+ isFullScreen="{{isFullcreen}}"
14
+ bind:close="handleClose"
15
+ ></coupon-popup>
14
16
  </view>
15
17
 
@@ -12,6 +12,10 @@ Component({
12
12
  type: Boolean,
13
13
  value: false,
14
14
  },
15
+ rewardData: {
16
+ type: Object,
17
+ value: {},
18
+ }
15
19
  },
16
20
 
17
21
  /**
@@ -7,7 +7,7 @@
7
7
  >
8
8
  <view class="receive-container">
9
9
  <view class="receive-container__content-number">
10
- +6257
10
+ +{{rewardData.live_task.reward_value}}
11
11
  </view>
12
12
  </view>
13
13
  <view class="receive-container__btn" catchtap="closePopup">