vhall-mini-sdk 0.1.0 → 0.1.2

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 (280) hide show
  1. package/lib/components/chat/chat-edit/chat-edit.js +7 -4
  2. package/lib/components/chat/chat-list/chat-list.js +1 -1
  3. package/lib/components/live-landscape/live-landscape.js +11 -7
  4. package/lib/components/live-landscape/live-landscape.wxml +2 -2
  5. package/lib/components/live-portrait/live-portrait.js +11 -7
  6. package/lib/components/live-portrait/live-portrait.wxml +3 -3
  7. package/lib/components/live-portrait/live-portrait.wxss +1 -1
  8. package/lib/components/lottery/lottery.wxml +2 -2
  9. package/lib/components/player/components/online-hot/index.js +2 -2
  10. package/lib/components/player/extensions/observers.js +5 -5
  11. package/lib/components/player/player.js +5 -0
  12. package/lib/components/player/player.wxml +3 -3
  13. package/lib/components/product/product-list/product-list.wxml +3 -11
  14. package/lib/components/signin/signin-dialog.js +1 -0
  15. package/lib/sdk/main/index.js +2 -1
  16. package/lib/sdk/player/index.js +1 -1
  17. package/lib/sdk/plugins/InviteCardServer.js +1 -1
  18. package/lib/sdk/plugins/MallRewardServer.js +1 -1
  19. package/lib/sdk/plugins/ProductServer.js +1 -1
  20. package/lib/shared/RequestUtil.js +1 -1
  21. package/lib/shared/logger.js +1 -1
  22. package/package.json +2 -4
  23. package/postinstall.js +21 -51
  24. package/dist/components/chat/chat-edit/chat-edit.js +0 -127
  25. package/dist/components/chat/chat-edit/chat-edit.json +0 -4
  26. package/dist/components/chat/chat-edit/chat-edit.wxml +0 -7
  27. package/dist/components/chat/chat-edit/chat-edit.wxss +0 -1
  28. package/dist/components/chat/chat-item/chat-item.js +0 -253
  29. package/dist/components/chat/chat-item/chat-item.json +0 -3
  30. package/dist/components/chat/chat-item/chat-item.wxml +0 -96
  31. package/dist/components/chat/chat-item/chat-item.wxss +0 -1
  32. package/dist/components/chat/chat-list/chat-list.js +0 -216
  33. package/dist/components/chat/chat-list/chat-list.json +0 -6
  34. package/dist/components/chat/chat-list/chat-list.wxml +0 -9
  35. package/dist/components/chat/chat-list/chat-list.wxss +0 -1
  36. package/dist/components/chat/chat.js +0 -98
  37. package/dist/components/chat/chat.json +0 -7
  38. package/dist/components/chat/chat.wxml +0 -7
  39. package/dist/components/chat/chat.wxss +0 -1
  40. package/dist/components/gift/gift-display/gift-display.js +0 -118
  41. package/dist/components/gift/gift-display/gift-display.json +0 -3
  42. package/dist/components/gift/gift-display/gift-display.wxml +0 -16
  43. package/dist/components/gift/gift-display/gift-display.wxss +0 -1
  44. package/dist/components/gift/gift-sender/gift-sender.js +0 -63
  45. package/dist/components/gift/gift-sender/gift-sender.json +0 -6
  46. package/dist/components/gift/gift-sender/gift-sender.wxml +0 -19
  47. package/dist/components/gift/gift-sender/gift-sender.wxss +0 -1
  48. package/dist/components/introduction/introduction.js +0 -43
  49. package/dist/components/introduction/introduction.json +0 -3
  50. package/dist/components/introduction/introduction.wxml +0 -8
  51. package/dist/components/introduction/introduction.wxss +0 -1
  52. package/dist/components/invite-rank/img/bronze.png +0 -0
  53. package/dist/components/invite-rank/img/gold.png +0 -0
  54. package/dist/components/invite-rank/img/silver.png +0 -0
  55. package/dist/components/invite-rank/index.js +0 -135
  56. package/dist/components/invite-rank/index.json +0 -8
  57. package/dist/components/invite-rank/index.wxml +0 -42
  58. package/dist/components/invite-rank/index.wxss +0 -1
  59. package/dist/components/invite-rank/invite-rank-item.js +0 -12
  60. package/dist/components/invite-rank/invite-rank-item.json +0 -4
  61. package/dist/components/invite-rank/invite-rank-item.wxml +0 -21
  62. package/dist/components/invite-rank/invite-rank-item.wxss +0 -1
  63. package/dist/components/invite-rank/my-invite-detail.js +0 -82
  64. package/dist/components/invite-rank/my-invite-detail.json +0 -7
  65. package/dist/components/invite-rank/my-invite-detail.wxml +0 -27
  66. package/dist/components/invite-rank/my-invite-detail.wxss +0 -1
  67. package/dist/components/invite-rank/util.wxs +0 -21
  68. package/dist/components/live-landscape/live-landscape.js +0 -216
  69. package/dist/components/live-landscape/live-landscape.json +0 -39
  70. package/dist/components/live-landscape/live-landscape.wxml +0 -73
  71. package/dist/components/live-landscape/live-landscape.wxss +0 -1
  72. package/dist/components/live-portrait/live-portrait.js +0 -274
  73. package/dist/components/live-portrait/live-portrait.json +0 -38
  74. package/dist/components/live-portrait/live-portrait.wxml +0 -106
  75. package/dist/components/live-portrait/live-portrait.wxss +0 -1
  76. package/dist/components/lottery/lottery-accept/index.js +0 -249
  77. package/dist/components/lottery/lottery-accept/index.json +0 -4
  78. package/dist/components/lottery/lottery-accept/index.wxml +0 -49
  79. package/dist/components/lottery/lottery-accept/index.wxss +0 -1
  80. package/dist/components/lottery/lottery-history/index.js +0 -36
  81. package/dist/components/lottery/lottery-history/index.json +0 -3
  82. package/dist/components/lottery/lottery-history/index.wxml +0 -28
  83. package/dist/components/lottery/lottery-history/index.wxss +0 -1
  84. package/dist/components/lottery/lottery-shake/lottery-shake.js +0 -328
  85. package/dist/components/lottery/lottery-shake/lottery-shake.json +0 -1
  86. package/dist/components/lottery/lottery-shake/lottery-shake.wxml +0 -52
  87. package/dist/components/lottery/lottery-shake/lottery-shake.wxss +0 -1
  88. package/dist/components/lottery/lottery-slot/lottery-slot.js +0 -230
  89. package/dist/components/lottery/lottery-slot/lottery-slot.json +0 -1
  90. package/dist/components/lottery/lottery-slot/lottery-slot.wxml +0 -62
  91. package/dist/components/lottery/lottery-slot/lottery-slot.wxss +0 -1
  92. package/dist/components/lottery/lottery-wheel/lottery-wheel.js +0 -153
  93. package/dist/components/lottery/lottery-wheel/lottery-wheel.json +0 -4
  94. package/dist/components/lottery/lottery-wheel/lottery-wheel.wxml +0 -91
  95. package/dist/components/lottery/lottery-wheel/lottery-wheel.wxss +0 -1
  96. package/dist/components/lottery/lottery-winners/index.js +0 -101
  97. package/dist/components/lottery/lottery-winners/index.json +0 -4
  98. package/dist/components/lottery/lottery-winners/index.wxml +0 -39
  99. package/dist/components/lottery/lottery-winners/index.wxss +0 -1
  100. package/dist/components/lottery/lottery.js +0 -388
  101. package/dist/components/lottery/lottery.json +0 -11
  102. package/dist/components/lottery/lottery.wxml +0 -78
  103. package/dist/components/lottery/lottery.wxss +0 -1
  104. package/dist/components/lottery/wheel.json +0 -49
  105. package/dist/components/mall-reward/common/reward-card.wxss +0 -0
  106. package/dist/components/mall-reward/duration-icon/index.js +0 -101
  107. package/dist/components/mall-reward/duration-icon/index.json +0 -3
  108. package/dist/components/mall-reward/duration-icon/index.wxml +0 -7
  109. package/dist/components/mall-reward/duration-icon/index.wxss +0 -1
  110. package/dist/components/mall-reward/f-count-down/index.js +0 -61
  111. package/dist/components/mall-reward/f-count-down/index.json +0 -3
  112. package/dist/components/mall-reward/f-count-down/index.wxml +0 -9
  113. package/dist/components/mall-reward/f-count-down/index.wxss +0 -1
  114. package/dist/components/mall-reward/f-empty/index.js +0 -11
  115. package/dist/components/mall-reward/f-empty/index.json +0 -3
  116. package/dist/components/mall-reward/f-empty/index.wxml +0 -8
  117. package/dist/components/mall-reward/f-empty/index.wxss +0 -1
  118. package/dist/components/mall-reward/f-history/index.js +0 -84
  119. package/dist/components/mall-reward/f-history/index.json +0 -4
  120. package/dist/components/mall-reward/f-history/index.wxml +0 -38
  121. package/dist/components/mall-reward/f-history/index.wxss +0 -1
  122. package/dist/components/mall-reward/f-open/index.js +0 -36
  123. package/dist/components/mall-reward/f-open/index.json +0 -3
  124. package/dist/components/mall-reward/f-open/index.wxml +0 -10
  125. package/dist/components/mall-reward/f-open/index.wxss +0 -1
  126. package/dist/components/mall-reward/f-receive/index.js +0 -36
  127. package/dist/components/mall-reward/f-receive/index.json +0 -3
  128. package/dist/components/mall-reward/f-receive/index.wxml +0 -9
  129. package/dist/components/mall-reward/f-receive/index.wxss +0 -1
  130. package/dist/components/mall-reward/index.js +0 -374
  131. package/dist/components/mall-reward/index.json +0 -8
  132. package/dist/components/mall-reward/index.wxml +0 -4
  133. package/dist/components/mall-reward/index.wxss +0 -0
  134. package/dist/components/mall-reward/main-popup/index.js +0 -46
  135. package/dist/components/mall-reward/main-popup/index.json +0 -12
  136. package/dist/components/mall-reward/main-popup/index.wxml +0 -16
  137. package/dist/components/mall-reward/main-popup/index.wxss +0 -1
  138. package/dist/components/player/assets/image/arrow-left.png +0 -0
  139. package/dist/components/player/assets/image/arrow-right.png +0 -0
  140. package/dist/components/player/assets/image/enterFullScreen.png +0 -0
  141. package/dist/components/player/assets/image/exitFullScreen.png +0 -0
  142. package/dist/components/player/assets/image/fullscreen_1.png +0 -0
  143. package/dist/components/player/assets/image/fullscreen_2.png +0 -0
  144. package/dist/components/player/assets/image/pause.png +0 -0
  145. package/dist/components/player/assets/image/pause_1.png +0 -0
  146. package/dist/components/player/assets/image/play.png +0 -0
  147. package/dist/components/player/assets/image/play_1.png +0 -0
  148. package/dist/components/player/assets/image/refresh.png +0 -0
  149. package/dist/components/player/assets/image/refresh_1.png +0 -0
  150. package/dist/components/player/assets/image/subtitle_close.png +0 -0
  151. package/dist/components/player/assets/image/subtitle_default.png +0 -0
  152. package/dist/components/player/assets/image/volume-off.png +0 -0
  153. package/dist/components/player/assets/image/volume-on.png +0 -0
  154. package/dist/components/player/common/config.js +0 -7
  155. package/dist/components/player/common/veComponent.js +0 -4
  156. package/dist/components/player/components/barrage/barrage-canvas.js +0 -488
  157. package/dist/components/player/components/barrage/barrage-dom.js +0 -471
  158. package/dist/components/player/components/barrage/index.js +0 -62
  159. package/dist/components/player/components/barrage/index.json +0 -4
  160. package/dist/components/player/components/barrage/index.wxml +0 -39
  161. package/dist/components/player/components/barrage/index.wxss +0 -1
  162. package/dist/components/player/components/barrage/utils.js +0 -71
  163. package/dist/components/player/components/controls/controls.js +0 -93
  164. package/dist/components/player/components/controls/controls.json +0 -6
  165. package/dist/components/player/components/controls/controls.wxml +0 -60
  166. package/dist/components/player/components/controls/controls.wxss +0 -1
  167. package/dist/components/player/components/danmaku/danmaku.js +0 -23
  168. package/dist/components/player/components/danmaku/danmaku.json +0 -4
  169. package/dist/components/player/components/danmaku/danmaku.wxml +0 -1
  170. package/dist/components/player/components/danmaku/danmaku.wxss +0 -0
  171. package/dist/components/player/components/error/error.js +0 -15
  172. package/dist/components/player/components/error/error.json +0 -3
  173. package/dist/components/player/components/error/error.wxml +0 -6
  174. package/dist/components/player/components/error/error.wxss +0 -1
  175. package/dist/components/player/components/loading/loading.js +0 -9
  176. package/dist/components/player/components/loading/loading.json +0 -3
  177. package/dist/components/player/components/loading/loading.wxml +0 -4
  178. package/dist/components/player/components/loading/loading.wxss +0 -1
  179. package/dist/components/player/components/main/extensions/data.js +0 -8
  180. package/dist/components/player/components/main/extensions/export.js +0 -83
  181. package/dist/components/player/components/main/extensions/methods.js +0 -110
  182. package/dist/components/player/components/main/extensions/observers.js +0 -41
  183. package/dist/components/player/components/main/extensions/props.js +0 -177
  184. package/dist/components/player/components/main/index.js +0 -44
  185. package/dist/components/player/components/main/index.json +0 -4
  186. package/dist/components/player/components/main/index.wxml +0 -7
  187. package/dist/components/player/components/main/index.wxss +0 -1
  188. package/dist/components/player/components/marquee/marquee.js +0 -304
  189. package/dist/components/player/components/marquee/marquee.json +0 -4
  190. package/dist/components/player/components/marquee/marquee.wxml +0 -14
  191. package/dist/components/player/components/marquee/marquee.wxss +0 -1
  192. package/dist/components/player/components/online-hot/assets/line-hot.png +0 -0
  193. package/dist/components/player/components/online-hot/assets/line-user.png +0 -0
  194. package/dist/components/player/components/online-hot/index.js +0 -66
  195. package/dist/components/player/components/online-hot/index.json +0 -3
  196. package/dist/components/player/components/online-hot/index.wxml +0 -15
  197. package/dist/components/player/components/online-hot/index.wxss +0 -1
  198. package/dist/components/player/components/poster/poster.js +0 -12
  199. package/dist/components/player/components/poster/poster.json +0 -3
  200. package/dist/components/player/components/poster/poster.wxml +0 -5
  201. package/dist/components/player/components/poster/poster.wxss +0 -1
  202. package/dist/components/player/components/watermark/watermark.js +0 -52
  203. package/dist/components/player/components/watermark/watermark.json +0 -4
  204. package/dist/components/player/components/watermark/watermark.wxml +0 -8
  205. package/dist/components/player/components/watermark/watermark.wxss +0 -1
  206. package/dist/components/player/extensions/data.js +0 -63
  207. package/dist/components/player/extensions/export.js +0 -325
  208. package/dist/components/player/extensions/methods.js +0 -406
  209. package/dist/components/player/extensions/observers.js +0 -114
  210. package/dist/components/player/extensions/props.js +0 -162
  211. package/dist/components/player/player.js +0 -83
  212. package/dist/components/player/player.json +0 -33
  213. package/dist/components/player/player.wxml +0 -48
  214. package/dist/components/player/player.wxss +0 -1
  215. package/dist/components/praise/praise.js +0 -150
  216. package/dist/components/praise/praise.json +0 -5
  217. package/dist/components/praise/praise.wxml +0 -17
  218. package/dist/components/praise/praise.wxss +0 -1
  219. package/dist/components/product/product-card/product-card.js +0 -109
  220. package/dist/components/product/product-card/product-card.json +0 -3
  221. package/dist/components/product/product-card/product-card.wxml +0 -47
  222. package/dist/components/product/product-card/product-card.wxss +0 -1
  223. package/dist/components/product/product-detail/product-detail.js +0 -127
  224. package/dist/components/product/product-detail/product-detail.json +0 -3
  225. package/dist/components/product/product-detail/product-detail.wxml +0 -57
  226. package/dist/components/product/product-detail/product-detail.wxss +0 -1
  227. package/dist/components/product/product-item/product-item.js +0 -56
  228. package/dist/components/product/product-item/product-item.json +0 -3
  229. package/dist/components/product/product-item/product-item.wxml +0 -35
  230. package/dist/components/product/product-item/product-item.wxss +0 -1
  231. package/dist/components/product/product-list/product-list.js +0 -67
  232. package/dist/components/product/product-list/product-list.json +0 -6
  233. package/dist/components/product/product-list/product-list.wxml +0 -16
  234. package/dist/components/product/product-list/product-list.wxss +0 -1
  235. package/dist/components/product/product-order/product-order.js +0 -394
  236. package/dist/components/product/product-order/product-order.json +0 -3
  237. package/dist/components/product/product-order/product-order.wxml +0 -75
  238. package/dist/components/product/product-order/product-order.wxss +0 -1
  239. package/dist/components/signin/signin-dialog.js +0 -305
  240. package/dist/components/signin/signin-dialog.json +0 -7
  241. package/dist/components/signin/signin-dialog.wxml +0 -19
  242. package/dist/components/signin/signin-dialog.wxss +0 -1
  243. package/dist/components/top-notify/index.js +0 -14
  244. package/dist/components/top-notify/index.json +0 -3
  245. package/dist/components/top-notify/index.wxml +0 -2
  246. package/dist/components/top-notify/index.wxss +0 -1
  247. package/dist/pubComponents/countdown/countdown.js +0 -97
  248. package/dist/pubComponents/countdown/countdown.json +0 -5
  249. package/dist/pubComponents/countdown/countdown.wxml +0 -19
  250. package/dist/pubComponents/countdown/countdown.wxss +0 -1
  251. package/dist/pubComponents/error-page/index.js +0 -146
  252. package/dist/pubComponents/error-page/index.json +0 -5
  253. package/dist/pubComponents/error-page/index.wxml +0 -37
  254. package/dist/pubComponents/error-page/index.wxss +0 -1
  255. package/dist/pubComponents/popup/popup.js +0 -161
  256. package/dist/pubComponents/popup/popup.json +0 -5
  257. package/dist/pubComponents/popup/popup.wxml +0 -17
  258. package/dist/pubComponents/popup/popup.wxss +0 -1
  259. package/dist/pubComponents/tabs/index.js +0 -95
  260. package/dist/pubComponents/tabs/index.json +0 -4
  261. package/dist/pubComponents/tabs/index.wxml +0 -22
  262. package/dist/pubComponents/tabs/index.wxss +0 -1
  263. package/dist/sdk/config/index.js +0 -1
  264. package/dist/sdk/main/index.js +0 -1
  265. package/dist/sdk/player/index.js +0 -1
  266. package/dist/sdk/plugins/ChatServer.js +0 -1
  267. package/dist/sdk/plugins/CustomMenuServer.js +0 -1
  268. package/dist/sdk/plugins/InteractServer.js +0 -1
  269. package/dist/sdk/plugins/InviteCardServer.js +0 -1
  270. package/dist/sdk/plugins/LotteryServer.js +0 -1
  271. package/dist/sdk/plugins/MallRewardServer.js +0 -1
  272. package/dist/sdk/plugins/ProductServer.js +0 -1
  273. package/dist/shared/RequestUtil.js +0 -1
  274. package/dist/shared/SerializableMap.js +0 -1
  275. package/dist/shared/base.server.js +0 -1
  276. package/dist/shared/cacheUtil.js +0 -1
  277. package/dist/shared/dateUtil.js +0 -1
  278. package/dist/shared/logger.js +0 -1
  279. package/dist/shared/mpUtils.js +0 -1
  280. package/dist/shared/utils.js +0 -1
@@ -1,253 +0,0 @@
1
- const faceArr = {
2
- '[微笑]': '1',
3
- '[撇嘴]': '2',
4
- '[色]': '3',
5
- '[发呆]': '4',
6
- '[得意]': '5',
7
- '[流泪]': '6',
8
- '[害羞]': '7',
9
- '[闭嘴]': '8',
10
- '[睡]': '9',
11
- '[哭]': '10',
12
- '[尴尬]': '11',
13
- '[发怒]': '12',
14
- '[调皮]': '13',
15
- '[呲牙]': '14',
16
- '[惊讶]': '15',
17
- '[难过]': '16',
18
- '[酷]': '17',
19
- '[汗]': '18',
20
- '[抓狂]': '19',
21
- '[吐]': '20',
22
- '[偷笑]': '21',
23
- '[愉快]': '22',
24
- '[白眼]': '23',
25
- '[傲慢]': '24',
26
- '[饥饿]': '25',
27
- '[困]': '26',
28
- '[惊恐]': '27',
29
- '[流汗]': '28',
30
- '[憨笑]': '29',
31
- '[悠闲]': '30',
32
- '[奋斗]': '31',
33
- '[咒骂]': '32',
34
- '[疑问]': '33',
35
- '[嘘]': '34',
36
- '[晕]': '35',
37
- '[疯了]': '36',
38
- '[衰]': '37',
39
- '[骷髅]': '38',
40
- '[敲打]': '39',
41
- '[再见]': '40',
42
- '[擦汗]': '41',
43
- '[抠鼻]': '42',
44
- '[鼓掌]': '43',
45
- '[糗大了]': '44',
46
- '[坏笑]': '45',
47
- '[左哼哼]': '46',
48
- '[右哼哼]': '47',
49
- '[哈欠]': '48',
50
- '[鄙视]': '49',
51
- '[委屈]': '50',
52
- '[快哭了]': '51',
53
- '[阴险]': '52',
54
- '[亲亲]': '53',
55
- '[吓]': '54',
56
- '[可怜]': '55',
57
- '[菜刀]': '56',
58
- '[西瓜]': '57',
59
- '[啤酒]': '58',
60
- '[篮球]': '59',
61
- '[乒乓]': '60',
62
- '[咖啡]': '61',
63
- '[饭]': '62',
64
- '[猪头]': '63',
65
- '[玫瑰]': '64',
66
- '[凋谢]': '65',
67
- '[嘴唇]': '66',
68
- '[爱心]': '67',
69
- '[心碎]': '68',
70
- '[蛋糕]': '69',
71
- '[闪电]': '70',
72
- '[炸弹]': '71',
73
- '[刀]': '72',
74
- '[足球]': '73',
75
- '[瓢虫]': '74',
76
- '[便便]': '75',
77
- '[月亮]': '76',
78
- '[太阳]': '77',
79
- '[礼物]': '78',
80
- '[拥抱]': '79',
81
- '[强]': '80',
82
- '[弱]': '81',
83
- '[握手]': '82',
84
- '[胜利]': '83',
85
- '[抱拳]': '84',
86
- '[勾引]': '85',
87
- '[拳头]': '86',
88
- '[差劲]': '87',
89
- '[爱你]': '88',
90
- '[NO]': '89',
91
- '[OK]': '90',
92
- };
93
-
94
- Component({
95
- properties: {
96
- chatItem: {
97
- type: Object,
98
- value: null,
99
- },
100
- mode: {
101
- type: Number,
102
- value: 1,
103
- },
104
- memberLevel: {
105
- type: Object,
106
- value: null,
107
- },
108
- },
109
- data: {
110
- roleName: {
111
- 1: '主持人',
112
- 2: '观众',
113
- 3: '助理',
114
- 4: '嘉宾',
115
- },
116
- textContent: '',
117
- memberLevelIcon: '',
118
- },
119
- lifetimes: {
120
- attached() {
121
- this._updateContent();
122
- this._updateMemberLevelIcon();
123
- },
124
- detached: function detached() {},
125
- },
126
- observers: {
127
- 'chatItem, memberLevel'(chatItem, memberLevel) {
128
- this._updateContent();
129
- this._updateMemberLevelIcon();
130
- },
131
- },
132
- methods: {
133
- _updateContent() {
134
- if (!['text', 'image'].includes(this.data.chatItem?.type || this.data.chatItem?.data?.type))
135
- return;
136
- this.setData({
137
- textContent: this._wrapMatchedString(this.data.chatItem),
138
- });
139
- },
140
- _updateMemberLevelIcon() {
141
- const memberLevel = this.data.memberLevel;
142
- const level = this.data.chatItem?.context?.member_level;
143
-
144
- /* prettier-ignore */ // 开启或等级无效时不显示图标
145
- if (!memberLevel || memberLevel.status != 1 || !Number.isInteger(level) || level < 1 || level > 21) {
146
- this.setData({ memberLevelIcon: '' });
147
- return;
148
- }
149
-
150
- let icon = '';
151
- if (memberLevel.type === 'custom') {
152
- const item = (memberLevel.custom_list || []).find((item) => item.level == level);
153
- icon = item?.icon || '';
154
- } else {
155
- icon = `https://t-alistatic01.e.vhall.com/common-static/images/mp/vip/vip${level}.png`;
156
- }
157
-
158
- this.setData({ memberLevelIcon: icon });
159
- },
160
- preview(event) {
161
- const index = event.currentTarget.dataset.index;
162
- const imgList = this.data.chatItem.data.image_urls;
163
- const currentUrl = imgList[index];
164
- wx.previewImage({
165
- current: currentUrl,
166
- urls: imgList,
167
- });
168
- },
169
- // 辅助函数:转义正则表达式中的特殊字符
170
- _escapeRegExp(string) {
171
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
172
- },
173
- _wrapMatchedString(chatItem) {
174
- const {
175
- context: {
176
- atList = []
177
- } = {}, // 关键:= {}
178
- data: {
179
- text_content: text
180
- } = {},
181
- } = chatItem;
182
- const atNames = atList.map(
183
- (item) => `@${item.nick_name || item.nickname || item.nickName}`
184
- );
185
-
186
- // 构建正则表达式来匹配 @ 昵称和表情
187
- const atPattern =
188
- atNames.length > 0 ?
189
- atNames.map((name) => this._escapeRegExp(name)).join('|') :
190
- '';
191
- const facePattern = Object.keys(faceArr)
192
- .map(this._escapeRegExp)
193
- .join('|');
194
- const validPatterns = [atPattern, facePattern].filter(
195
- (pattern) => pattern
196
- );
197
- const combinedPattern =
198
- validPatterns.length > 0 ? `(${validPatterns.join('|')})` : null;
199
-
200
- if (!combinedPattern) {
201
- return [{
202
- text,
203
- isHighlight: false
204
- }];
205
- }
206
-
207
- const regex = new RegExp(combinedPattern, 'g');
208
-
209
- const result = [];
210
- let lastIndex = 0;
211
-
212
- let match;
213
- while ((match = regex.exec(text)) !== null) {
214
- const matchIndex = match.index;
215
- const matchedText = match[0];
216
-
217
- // 处理匹配之前的普通文本
218
- if (matchIndex > lastIndex) {
219
- result.push({
220
- text: text.slice(lastIndex, matchIndex),
221
- isHighlight: false,
222
- });
223
- }
224
-
225
- if (atNames.includes(matchedText)) {
226
- // 处理匹配的 @ 昵称
227
- result.push({
228
- text: matchedText,
229
- isHighlight: true,
230
- });
231
- } else {
232
- // 处理匹配的表情
233
- result.push({
234
- type: 'image',
235
- text: matchedText,
236
- imageSrc: `https://cnstatic01.e.vhall.com/static/img/arclist/Expression_${faceArr[matchedText]}@2x.png`,
237
- isHighlight: false,
238
- });
239
- }
240
- lastIndex = regex.lastIndex;
241
- }
242
-
243
- // 处理剩余的普通文本
244
- if (lastIndex < text.length) {
245
- result.push({
246
- text: text.slice(lastIndex),
247
- isHighlight: false,
248
- });
249
- }
250
- return result;
251
- },
252
- },
253
- });
@@ -1,3 +0,0 @@
1
- {
2
- "component": true
3
- }
@@ -1,96 +0,0 @@
1
- <view>
2
- <!-- 横屏消息 -->
3
- <view class="chat-item mode{{ mode }}" wx:if="{{ mode == 1 }}">
4
- <!-- 礼物消息 -->
5
- <block wx:if="{{chatItem.type=='gift_send_success'}}">
6
- <view class="gift-msg">
7
- {{chatItem.gift_user_name}}送出了一个 {{chatItem.gift_name}}
8
- <image class="gift-img" src="{{chatItem.gift_image_url}}" />
9
- </view>
10
- </block>
11
- <block wx:else>
12
- <view class="chat-item_left">
13
- <image class="chat-item_left_avatar" src="{{chatItem.context.avatar ||'https://cnstatic01.e.vhall.com/common-static/images/default_avatar.png'}}"></image>
14
- </view>
15
- <view class="chat-item_right">
16
- <view class="chat-item_right_user">
17
- <!-- 会员等级 -->
18
- <view class="chat-item_right_user_level" wx:if="{{memberLevelIcon}}">
19
- <image class="chat-item_vip-icon" mode="heightFix" src="{{memberLevelIcon}}"></image>
20
- </view>
21
- <view class="chat-item_right_user_name">
22
- {{ chatItem.context.nick_name || chatItem.context.nickname }}
23
- </view>
24
- <view class="chat-item_right_user_role role_{{ chatItem.context.role_name }}" wx:if="{{ chatItem.context.role_name != 2 }}">
25
- {{ roleName[chatItem.context.role_name] }}
26
- </view>
27
- </view>
28
- <view class="chat-item_right_content">
29
- <view class="chat-item_content_reply" wx:if="{{ chatItem.context.replyMsg.content }}">
30
- <view class="chat-item_content_reply_username">
31
- {{ chatItem.context.replyMsg.nick_name || chatItem.context.replyMsg.nickname }}:
32
- </view>
33
- <text class="chat-item_reply_text">
34
- {{chatItem.context.replyMsg.content.text_content ||chatItem.context.replyMsg.content.text_content}}
35
- </text>
36
- </view>
37
- <view>
38
- <text class="relpy_icon" wx:if="{{ chatItem.context.replyMsg.content }}">回复</text>
39
- <block wx:for="{{ textContent }}" wx:key="*this">
40
- <image class="face_img" src="{{ item.imageSrc }}" wx:if="{{ item.type === 'image' }}"></image>
41
- <text class="{{ item.isHighlight ? 'highlight' : '' }}" wx:else>{{ item.text }}</text>
42
- </block>
43
- </view>
44
- <view class="chat-item_right_content_img_box" wx:if="{{ chatItem.data.image_urls }}">
45
- <image class="chat-item_right_content_img" bindtap="preview" wx:for="{{ chatItem.data.image_urls }}" wx:for-index="index" wx:for-item="item" data-index="{{ index }}" wx:key="index" src="{{ item }}"></image>
46
- </view>
47
- </view>
48
- </view>
49
- </block>
50
- </view>
51
- <!-- 竖屏消息 -->
52
- <view class="chat-item mode{{ mode }}" wx:if="{{ mode == 0 }}">
53
- <!-- 礼物消息 -->
54
- <block wx:if="{{chatItem.type=='gift_send_success'}}">
55
- <view class="gift-msg">
56
- <text>{{chatItem.gift_user_name}}送出了一个 {{chatItem.gift_name}}</text>
57
- <image class="gift-img" src="{{chatItem.gift_image_url}}" />
58
- </view>
59
- </block>
60
- <block wx:else>
61
- <view class="chat-item_content_reply" wx:if="{{ chatItem.context.replyMsg.content }}">
62
- <view class="chat-item_content_reply_username">
63
- {{ chatItem.context.replyMsg.nick_name || chatItem.context.replyMsg.nickname }}:
64
- </view>
65
- <text>
66
- {{chatItem.context.replyMsg.content.text_content ||chatItem.context.replyMsg.content.text_content}}
67
- </text>
68
- </view>
69
- <!-- 会员等级 / 昵称 / 角色 一行显示 -->
70
- <view class="chat-item_right_user">
71
- <!-- 会员等级 -->
72
- <view class="chat-item_right_user_level" wx:if="{{memberLevelIcon}}">
73
- <image class="chat-item_vip-icon" mode="heightFix" src="{{memberLevelIcon}}"></image>
74
- </view>
75
- <view class="chat-item_user_name">
76
- {{ chatItem.context.nick_name || chatItem.context.nickname }}:
77
- </view>
78
- <view class="chat-item_role role_{{ chatItem.context.role_name }}" wx:if="{{ chatItem.context.role_name != 2 }}">
79
- {{ roleName[chatItem.context.role_name] }}
80
- </view>
81
- </view>
82
- <view class="chat-item_content">
83
- <view>
84
- <text class="relpy_icon" wx:if="{{ chatItem.context.replyMsg.content }}">回复</text>
85
- <block wx:for="{{ textContent }}" wx:key="*this">
86
- <image class="face_img" src="{{ item.imageSrc }}" wx:if="{{ item.type === 'image' }}"></image>
87
- <text class="{{ item.isHighlight ? 'highlight' : '' }}" wx:else>{{ item.text }}</text>
88
- </block>
89
- </view>
90
- <view class="chat-item_right_content_img_box" wx:if="{{ chatItem.data.image_urls }}">
91
- <image class="chat-item_right_content_img" bindtap="preview" wx:for="{{ chatItem.data.image_urls }}" wx:for-index="index" wx:for-item="item" data-index="{{ index }}" wx:key="index" src="{{ item }}"></image>
92
- </view>
93
- </view>
94
- </block>
95
- </view>
96
- </view>
@@ -1 +0,0 @@
1
- .chat-item{display:flex;margin-bottom:24rpx}.chat-item_left{margin-right:16rpx}.chat-item_left_avatar{border-radius:50%;height:2rem;width:2rem}.chat-item_right{flex:1}.chat-item_right_user{align-items:center;display:flex;line-height:2rem}.chat-item_right_user_level{align-items:center;display:flex;margin-right:8rpx}.chat-item_right_user_level .chat-item_vip-icon{height:1rem;width:auto}.chat-item_right_user_name{align-items:center;color:#8c8c8c;display:flex;font-size:1rem;margin-right:8rpx;max-width:340rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all}.chat-item_right_user_role{align-items:center;border-radius:.6rem;display:flex;font-size:.8rem;height:1.2rem;line-height:1;padding:0 .3rem}.chat-item_right_user_role.role_1{background-color:rgba(251,38,38,.15);color:#fb2626}.chat-item_right_user_role.role_3,.chat-item_right_user_role.role_4{background-color:rgba(10,127,245,.15);color:#0a7ff5}.chat-item_right_content{background-color:#fff;border-radius:0 16rpx 16rpx 16rpx;font-size:1rem;line-height:1.25rem;margin-top:10rpx;max-width:460rpx;overflow-wrap:break-word;padding:12rpx 16rpx;width:-webkit-fit-content;width:fit-content;word-break:break-word}.chat-item_right_content .chat-item_reply_text{vertical-align:middle}.chat-item_right_content .face_img{height:1.2rem;vertical-align:middle;width:1.2rem}.chat-item_right_content_img{border-radius:12rpx;height:100rpx;margin-right:10rpx;object-fit:contain;width:100rpx}.chat-item_right_content_img:last-child{margin-right:0}.chat-item .chat-item_content_reply{color:#999;font-size:.93rem;padding-left:20rpx;position:relative}.chat-item .chat-item_content_reply:before{background:#bfbfbf;border-radius:3rpx;content:" ";height:100%;left:0;position:absolute;top:0;width:6rpx}.chat-item .chat-item_content_reply_username{color:#8c8c8c;display:inline}.chat-item .relpy_icon{color:#fc9600;margin-right:8rpx}.chat-item.mode0{background:rgba(0,0,0,.35);border-radius:26rpx;color:#fff;display:block;font-size:1rem;margin-bottom:16rpx;max-width:520rpx;padding:8rpx 24rpx;width:-webkit-fit-content;width:fit-content;word-break:break-all}.chat-item.mode0 .chat-item_right_user{align-items:baseline;display:inline-flex;flex-wrap:nowrap;vertical-align:top}.chat-item.mode0 .chat-item_right_user .chat-item_right_user_level{align-items:center;align-self:center;display:flex;flex:none;margin-right:8rpx}.chat-item.mode0 .chat-item_right_user .chat-item_right_user_level .chat-item_vip-icon{height:1.1rem;width:auto}.chat-item.mode0 .chat-item_right_user .chat-item_user_name{color:#8ce7ff;flex:none;font-size:1rem;line-height:1.25rem;margin-right:0;white-space:nowrap}.chat-item.mode0 .chat-item_right_user .chat-item_role{flex:none}.chat-item.mode0 .chat-item_role{border-radius:.5rem;display:inline-block;font-size:.68rem;height:1rem;line-height:1rem;margin-right:12rpx;padding:0 10rpx;vertical-align:middle}.chat-item.mode0 .chat-item_role.role_1{background-color:rgba(251,38,38,.15);color:#fb2626}.chat-item.mode0 .chat-item_role.role_3,.chat-item.mode0 .chat-item_role.role_4{background-color:rgba(10,127,245,.15);color:#0a7ff5}.chat-item.mode0 .chat-item_content{display:inline-block;font-size:1rem;line-height:1.25rem;vertical-align:top}.chat-item.mode0 .gift-msg{background:transparent;color:#fff;height:auto;margin:0}.chat-item .highlight{color:#0a7ff5}.chat-item .gift-msg{background-color:hsla(9,100%,89%,.2);border-radius:24rpx;color:#262626;height:48rpx;margin:0 auto;padding:0 50rpx 0 24rpx;width:-webkit-fit-content;width:fit-content}.chat-item .gift-msg .gift-img{display:inline-block;height:40rpx;transform:scale(1.8);transform-origin:left center;vertical-align:text-bottom;width:40rpx}.face_img{display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}
@@ -1,216 +0,0 @@
1
- import { throttle } from '../../../shared/utils.js';
2
- const MSGQUEUE = []; //消息队列,缓存500ms内的消息, 然后批量加入渲染列表
3
- let LastMsgList = []; //最新的50-100条消息,用于查看最新消息
4
- let count = 0; //缓存新消息数量
5
- let clientMsgId = 0; //消息id,定增,用于前端渲染消息列表,防止消息重复导致key重复
6
- Component({
7
- properties: {
8
- sdkInstance: {
9
- type: Object,
10
- value: null,
11
- },
12
- mode: {
13
- type: Number,
14
- value: 1,
15
- },
16
- },
17
- data: {
18
- chatList: [],
19
- scrollIntoViewId: '',
20
- loading: false,
21
- newCount: 0,
22
- isShowMoreNote: false,
23
- scrollHeight: 0,
24
- scrollViewHeight: 0, //scrollview的高度
25
- animationFlag: false, //动画开关
26
- memberLevel: null,
27
- },
28
- lifetimes: {
29
- ready() {
30
- this.createSelectorQuery()
31
- .select('#chat-scrollview')
32
- .boundingClientRect((rect) => {
33
- if (rect) {
34
- // 获取 scroll-view 的高度
35
- const height = rect.height;
36
- // 更新组件数据
37
- this.setData({
38
- scrollViewHeight: height,
39
- });
40
- }
41
- })
42
- .exec();
43
- },
44
- attached() {
45
- this.getLatestList();
46
- },
47
- detached: function detached() {
48
- this.unChatListener && this.unChatListener();
49
- },
50
- },
51
- observers: {
52
- sdkInstance: function sdkInstance(_sdkInstance) {
53
- if (!_sdkInstance) return;
54
- this.sdkInstance = _sdkInstance;
55
- this.store = _sdkInstance.store;
56
- this.unsub && this.unsub();
57
- this.unsub = this.store.get({
58
- liveInfo: (val) => {
59
- this.setData({
60
- liveInfo: val,
61
- });
62
- if (val.status != 2 && val.status != 3) {
63
- this.chatInstance = this.sdkInstance.get('chatServer');
64
- this.listenerMsg();
65
- }
66
- },
67
- memberLevel: (val) => {
68
- console.log('memberLevel:', val);
69
- this.setData({
70
- memberLevel: val,
71
- });
72
- },
73
- });
74
- },
75
- },
76
- methods: {
77
- async listenerMsg() {
78
- this.unChatListener && this.unChatListener();
79
- const user = this.sdkInstance.store.get('user');
80
- let eventObj = {};
81
- eventObj[this.sdkInstance.EVENT.CHAT_MSG] = (message) => {
82
- if (!['text', 'image'].includes(message.type)) {
83
- return;
84
- }
85
- this._handleMsg(message);
86
- };
87
- eventObj[this.sdkInstance.EVENT.GIFT_MSG] = (message) => {
88
- this._handleMsg(message);
89
- };
90
- eventObj[this.sdkInstance.EVENT.DELETE_MSG] = (message) => {
91
- const msgIds = message.msg_ids.split(',');
92
- LastMsgList = LastMsgList.filter((item) => !msgIds.includes(item.msg_id));
93
- this.setData({
94
- chatList: this.data.chatList.filter((item) => !msgIds.includes(item.msg_id)),
95
- });
96
- };
97
- this.unChatListener = this.sdkInstance.on(eventObj);
98
- },
99
- _handleMsg(message) {
100
- message.id = clientMsgId++;
101
- LastMsgList.push(message);
102
- if (LastMsgList.length > 100) {
103
- LastMsgList.splice(0, Math.max(0, LastMsgList.length - 50));
104
- }
105
- if (this.data.scrollHeight < 40 || this.data.isScrolling) {
106
- MSGQUEUE.push(message);
107
- this.addChatMsg();
108
- } else {
109
- count++;
110
- this.addNewCount();
111
- }
112
- },
113
- // 添加聊天消息
114
- addChatMsg: throttle(function () {
115
- this.setData({
116
- chatList: this.data.chatList.concat(MSGQUEUE).slice(-20),
117
- });
118
- MSGQUEUE.length = 0;
119
- this.scrollToBottom();
120
- }, 500),
121
- // 累加新消息数量
122
- addNewCount: throttle(function () {
123
- this.setData({
124
- newCount: this.data.newCount + count,
125
- isShowMoreNote: !0
126
- });
127
- count = 0;
128
- }),
129
- // 点击未读新消息
130
- newCountClick() {
131
- this.setData({
132
- chatList: LastMsgList.slice(-50),
133
- });
134
- this.scrollToBottom();
135
- },
136
- scrollToBottom() {
137
- this.data.isScrolling = true;
138
- this.data.chatList[this.data.chatList.length - 1] &&
139
- setTimeout(() => {
140
- this.setData({
141
- scrollIntoViewId: 'chat-bottom' || `view${this.data.chatList[this.data.chatList.length - 1]?.id}`,
142
- });
143
- this.data.isScrolling = false
144
- this.data.scrollHeight = 0;
145
- }, 300);
146
- },
147
- scrollToTarget(msg) {
148
- setTimeout(() => {
149
- this.setData({
150
- scrollIntoViewId: `view${msg.id}`,
151
- });
152
- });
153
- },
154
- async getLatestList() {
155
- if (!this.chatInstance) return;
156
- const res = await this.chatInstance.getHistoryList({ limit: 20 });
157
- if (res.code == 200) {
158
- const reversedArr = [];
159
- for (let i = res.data.list.length - 1; i >= 0; i--) {
160
- const msg = res.data.list[i];
161
- msg.context.atList = msg.context.at_list;
162
- msg.context.replyMsg = msg.context.reply_msg;
163
- reversedArr.push(Object.assign(res.data.list[i], { id: clientMsgId++ }));
164
- }
165
- this.setData({
166
- chatList: reversedArr,
167
- });
168
- LastMsgList = [...reversedArr];
169
- this.scrollToBottom();
170
- }
171
- },
172
- async getHistoryList() {
173
- const curMsg = this.data.chatList.find((el) => el.msg_id);
174
- if (!curMsg) {
175
- return;
176
- }
177
- if (!this.chatInstance) return;
178
- const res = await this.chatInstance.getHistoryList({
179
- limit: 20,
180
- anchor_path: 'down',
181
- msg_id: curMsg.msg_id,
182
- });
183
- if (res.code == 200) {
184
- const reversedArr = [];
185
- for (let i = res.data.list.length - 1; i >= 0; i--) {
186
- reversedArr.push(Object.assign(res.data.list[i], { id: clientMsgId++ }));
187
- }
188
- this.setData({
189
- chatList: reversedArr.concat(this.data.chatList),
190
- });
191
- }
192
- this.scrollToTarget(curMsg);
193
- },
194
- bindscroll(t) {
195
- var e = t.detail || {},
196
- o = e.scrollHeight,
197
- r = e.scrollTop;
198
- this.data.scrollHeight = o - r - this.data.scrollViewHeight;
199
- this.data.scrollHeight < 40 &&
200
- this.data.newCount &&
201
- this.setData({ newCount: 0, isShowMoreNote: !1 });
202
- },
203
- bindscrolltolower() {
204
- //当前有新消息去更新最新的50条消息
205
- if (this.data.newCount > 0) {
206
- this.setData({
207
- chatList: LastMsgList.slice(-50),
208
- });
209
- this.scrollToBottom();
210
- this.setData({ newCount: 0, isShowMoreNote: !1 });
211
- }
212
- console.log('滚动条在最底部');
213
- },
214
- },
215
- });
216
-
@@ -1,6 +0,0 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "chat-item": "../chat-item/chat-item"
5
- }
6
- }
@@ -1,9 +0,0 @@
1
- <scroll-view id="chat-scrollview" reverse="{{ true }}" enable-flex="{{ true }}" class="chat-scroll-view" scroll-y enhanced scroll-with-animation="{{ animationFlag }}" scroll-into-view="{{ scrollIntoViewId }}" show-scrollbar="{{ false }}" bindscroll="bindscroll" bindscrolltolower="bindscrolltolower" bindscrolltoupper="getHistoryList">
2
- <view id="chat-list-list" class="chat-list-list mode{{ mode }}">
3
- <chat-item mode="{{ mode }}" memberLevel="{{ memberLevel }}" id="view{{ item.id }}" wx:for="{{ chatList }}" wx:for-index="index" wx:for-item="item" wx:key="id" chatItem="{{ item }}"></chat-item>
4
- </view>
5
- <view id="chat-bottom"></view>
6
- </scroll-view>
7
- <view class="chat-more-notice" wx:if="{{ newCount > 0 && isShowMoreNote }}" bind:tap="newCountClick">
8
- 有 {{ newCount }} 条消息
9
- </view>
@@ -1 +0,0 @@
1
- .chat-scroll-view{color:#282f38;display:flex;flex-direction:column;font-size:1rem;height:100%;position:relative;width:100%}.chat-more-notice{background-color:hsla(0,0%,100%,.9);border-radius:32rpx;bottom:0rpx;box-shadow:0 4rpx 24rpx 0 rgba(0,0,0,.3);color:#181038;display:inline-block;font-size:.93rem;left:50%;padding:12rpx 20rpx;pointer-events:auto;position:absolute;text-align:center;transform:translateX(-50%);word-break:break-word;z-index:102}.chat-more-notice-icon{height:25rpx;margin-right:5rpx;position:relative;top:4rpx;width:25rpx}.chat-list-list{display:flex;flex:1;flex-direction:column;font-size:1rem;justify-content:flex-start;padding:0 24rpx}.chat-list-list.mode0{justify-content:flex-end}.chat-list-item{color:#fff;flex:0 0 auto;justify-content:space-between;margin:0 28rpx 12rpx;min-height:28rpx;text-align:left;width:auto}