vhall-mini-sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/player/components/online-hot/index.js +2 -2
- package/lib/sdk/main/index.js +1 -0
- package/package.json +2 -4
- package/postinstall.js +21 -51
- package/dist/components/chat/chat-edit/chat-edit.js +0 -127
- package/dist/components/chat/chat-edit/chat-edit.json +0 -4
- package/dist/components/chat/chat-edit/chat-edit.wxml +0 -7
- package/dist/components/chat/chat-edit/chat-edit.wxss +0 -1
- package/dist/components/chat/chat-item/chat-item.js +0 -253
- package/dist/components/chat/chat-item/chat-item.json +0 -3
- package/dist/components/chat/chat-item/chat-item.wxml +0 -96
- package/dist/components/chat/chat-item/chat-item.wxss +0 -1
- package/dist/components/chat/chat-list/chat-list.js +0 -216
- package/dist/components/chat/chat-list/chat-list.json +0 -6
- package/dist/components/chat/chat-list/chat-list.wxml +0 -9
- package/dist/components/chat/chat-list/chat-list.wxss +0 -1
- package/dist/components/chat/chat.js +0 -98
- package/dist/components/chat/chat.json +0 -7
- package/dist/components/chat/chat.wxml +0 -7
- package/dist/components/chat/chat.wxss +0 -1
- package/dist/components/gift/gift-display/gift-display.js +0 -118
- package/dist/components/gift/gift-display/gift-display.json +0 -3
- package/dist/components/gift/gift-display/gift-display.wxml +0 -16
- package/dist/components/gift/gift-display/gift-display.wxss +0 -1
- package/dist/components/gift/gift-sender/gift-sender.js +0 -63
- package/dist/components/gift/gift-sender/gift-sender.json +0 -6
- package/dist/components/gift/gift-sender/gift-sender.wxml +0 -19
- package/dist/components/gift/gift-sender/gift-sender.wxss +0 -1
- package/dist/components/introduction/introduction.js +0 -43
- package/dist/components/introduction/introduction.json +0 -3
- package/dist/components/introduction/introduction.wxml +0 -8
- package/dist/components/introduction/introduction.wxss +0 -1
- package/dist/components/invite-rank/img/bronze.png +0 -0
- package/dist/components/invite-rank/img/gold.png +0 -0
- package/dist/components/invite-rank/img/silver.png +0 -0
- package/dist/components/invite-rank/index.js +0 -135
- package/dist/components/invite-rank/index.json +0 -8
- package/dist/components/invite-rank/index.wxml +0 -42
- package/dist/components/invite-rank/index.wxss +0 -1
- package/dist/components/invite-rank/invite-rank-item.js +0 -12
- package/dist/components/invite-rank/invite-rank-item.json +0 -4
- package/dist/components/invite-rank/invite-rank-item.wxml +0 -21
- package/dist/components/invite-rank/invite-rank-item.wxss +0 -1
- package/dist/components/invite-rank/my-invite-detail.js +0 -82
- package/dist/components/invite-rank/my-invite-detail.json +0 -7
- package/dist/components/invite-rank/my-invite-detail.wxml +0 -27
- package/dist/components/invite-rank/my-invite-detail.wxss +0 -1
- package/dist/components/invite-rank/util.wxs +0 -21
- package/dist/components/live-landscape/live-landscape.js +0 -216
- package/dist/components/live-landscape/live-landscape.json +0 -39
- package/dist/components/live-landscape/live-landscape.wxml +0 -73
- package/dist/components/live-landscape/live-landscape.wxss +0 -1
- package/dist/components/live-portrait/live-portrait.js +0 -274
- package/dist/components/live-portrait/live-portrait.json +0 -38
- package/dist/components/live-portrait/live-portrait.wxml +0 -106
- package/dist/components/live-portrait/live-portrait.wxss +0 -1
- package/dist/components/lottery/lottery-accept/index.js +0 -249
- package/dist/components/lottery/lottery-accept/index.json +0 -4
- package/dist/components/lottery/lottery-accept/index.wxml +0 -49
- package/dist/components/lottery/lottery-accept/index.wxss +0 -1
- package/dist/components/lottery/lottery-history/index.js +0 -36
- package/dist/components/lottery/lottery-history/index.json +0 -3
- package/dist/components/lottery/lottery-history/index.wxml +0 -28
- package/dist/components/lottery/lottery-history/index.wxss +0 -1
- package/dist/components/lottery/lottery-shake/lottery-shake.js +0 -328
- package/dist/components/lottery/lottery-shake/lottery-shake.json +0 -1
- package/dist/components/lottery/lottery-shake/lottery-shake.wxml +0 -52
- package/dist/components/lottery/lottery-shake/lottery-shake.wxss +0 -1
- package/dist/components/lottery/lottery-slot/lottery-slot.js +0 -230
- package/dist/components/lottery/lottery-slot/lottery-slot.json +0 -1
- package/dist/components/lottery/lottery-slot/lottery-slot.wxml +0 -62
- package/dist/components/lottery/lottery-slot/lottery-slot.wxss +0 -1
- package/dist/components/lottery/lottery-wheel/lottery-wheel.js +0 -153
- package/dist/components/lottery/lottery-wheel/lottery-wheel.json +0 -4
- package/dist/components/lottery/lottery-wheel/lottery-wheel.wxml +0 -91
- package/dist/components/lottery/lottery-wheel/lottery-wheel.wxss +0 -1
- package/dist/components/lottery/lottery-winners/index.js +0 -101
- package/dist/components/lottery/lottery-winners/index.json +0 -4
- package/dist/components/lottery/lottery-winners/index.wxml +0 -39
- package/dist/components/lottery/lottery-winners/index.wxss +0 -1
- package/dist/components/lottery/lottery.js +0 -388
- package/dist/components/lottery/lottery.json +0 -11
- package/dist/components/lottery/lottery.wxml +0 -78
- package/dist/components/lottery/lottery.wxss +0 -1
- package/dist/components/lottery/wheel.json +0 -49
- package/dist/components/mall-reward/common/reward-card.wxss +0 -0
- package/dist/components/mall-reward/duration-icon/index.js +0 -101
- package/dist/components/mall-reward/duration-icon/index.json +0 -3
- package/dist/components/mall-reward/duration-icon/index.wxml +0 -7
- package/dist/components/mall-reward/duration-icon/index.wxss +0 -1
- package/dist/components/mall-reward/f-count-down/index.js +0 -61
- package/dist/components/mall-reward/f-count-down/index.json +0 -3
- package/dist/components/mall-reward/f-count-down/index.wxml +0 -9
- package/dist/components/mall-reward/f-count-down/index.wxss +0 -1
- package/dist/components/mall-reward/f-empty/index.js +0 -11
- package/dist/components/mall-reward/f-empty/index.json +0 -3
- package/dist/components/mall-reward/f-empty/index.wxml +0 -8
- package/dist/components/mall-reward/f-empty/index.wxss +0 -1
- package/dist/components/mall-reward/f-history/index.js +0 -84
- package/dist/components/mall-reward/f-history/index.json +0 -4
- package/dist/components/mall-reward/f-history/index.wxml +0 -38
- package/dist/components/mall-reward/f-history/index.wxss +0 -1
- package/dist/components/mall-reward/f-open/index.js +0 -36
- package/dist/components/mall-reward/f-open/index.json +0 -3
- package/dist/components/mall-reward/f-open/index.wxml +0 -10
- package/dist/components/mall-reward/f-open/index.wxss +0 -1
- package/dist/components/mall-reward/f-receive/index.js +0 -36
- package/dist/components/mall-reward/f-receive/index.json +0 -3
- package/dist/components/mall-reward/f-receive/index.wxml +0 -9
- package/dist/components/mall-reward/f-receive/index.wxss +0 -1
- package/dist/components/mall-reward/index.js +0 -374
- package/dist/components/mall-reward/index.json +0 -8
- package/dist/components/mall-reward/index.wxml +0 -4
- package/dist/components/mall-reward/index.wxss +0 -0
- package/dist/components/mall-reward/main-popup/index.js +0 -46
- package/dist/components/mall-reward/main-popup/index.json +0 -12
- package/dist/components/mall-reward/main-popup/index.wxml +0 -16
- package/dist/components/mall-reward/main-popup/index.wxss +0 -1
- package/dist/components/player/assets/image/arrow-left.png +0 -0
- package/dist/components/player/assets/image/arrow-right.png +0 -0
- package/dist/components/player/assets/image/enterFullScreen.png +0 -0
- package/dist/components/player/assets/image/exitFullScreen.png +0 -0
- package/dist/components/player/assets/image/fullscreen_1.png +0 -0
- package/dist/components/player/assets/image/fullscreen_2.png +0 -0
- package/dist/components/player/assets/image/pause.png +0 -0
- package/dist/components/player/assets/image/pause_1.png +0 -0
- package/dist/components/player/assets/image/play.png +0 -0
- package/dist/components/player/assets/image/play_1.png +0 -0
- package/dist/components/player/assets/image/refresh.png +0 -0
- package/dist/components/player/assets/image/refresh_1.png +0 -0
- package/dist/components/player/assets/image/subtitle_close.png +0 -0
- package/dist/components/player/assets/image/subtitle_default.png +0 -0
- package/dist/components/player/assets/image/volume-off.png +0 -0
- package/dist/components/player/assets/image/volume-on.png +0 -0
- package/dist/components/player/common/config.js +0 -7
- package/dist/components/player/common/veComponent.js +0 -4
- package/dist/components/player/components/barrage/barrage-canvas.js +0 -488
- package/dist/components/player/components/barrage/barrage-dom.js +0 -471
- package/dist/components/player/components/barrage/index.js +0 -62
- package/dist/components/player/components/barrage/index.json +0 -4
- package/dist/components/player/components/barrage/index.wxml +0 -39
- package/dist/components/player/components/barrage/index.wxss +0 -1
- package/dist/components/player/components/barrage/utils.js +0 -71
- package/dist/components/player/components/controls/controls.js +0 -93
- package/dist/components/player/components/controls/controls.json +0 -6
- package/dist/components/player/components/controls/controls.wxml +0 -60
- package/dist/components/player/components/controls/controls.wxss +0 -1
- package/dist/components/player/components/danmaku/danmaku.js +0 -23
- package/dist/components/player/components/danmaku/danmaku.json +0 -4
- package/dist/components/player/components/danmaku/danmaku.wxml +0 -1
- package/dist/components/player/components/danmaku/danmaku.wxss +0 -0
- package/dist/components/player/components/error/error.js +0 -15
- package/dist/components/player/components/error/error.json +0 -3
- package/dist/components/player/components/error/error.wxml +0 -6
- package/dist/components/player/components/error/error.wxss +0 -1
- package/dist/components/player/components/loading/loading.js +0 -9
- package/dist/components/player/components/loading/loading.json +0 -3
- package/dist/components/player/components/loading/loading.wxml +0 -4
- package/dist/components/player/components/loading/loading.wxss +0 -1
- package/dist/components/player/components/main/extensions/data.js +0 -8
- package/dist/components/player/components/main/extensions/export.js +0 -83
- package/dist/components/player/components/main/extensions/methods.js +0 -110
- package/dist/components/player/components/main/extensions/observers.js +0 -41
- package/dist/components/player/components/main/extensions/props.js +0 -177
- package/dist/components/player/components/main/index.js +0 -44
- package/dist/components/player/components/main/index.json +0 -4
- package/dist/components/player/components/main/index.wxml +0 -7
- package/dist/components/player/components/main/index.wxss +0 -1
- package/dist/components/player/components/marquee/marquee.js +0 -304
- package/dist/components/player/components/marquee/marquee.json +0 -4
- package/dist/components/player/components/marquee/marquee.wxml +0 -14
- package/dist/components/player/components/marquee/marquee.wxss +0 -1
- package/dist/components/player/components/online-hot/assets/line-hot.png +0 -0
- package/dist/components/player/components/online-hot/assets/line-user.png +0 -0
- package/dist/components/player/components/online-hot/index.js +0 -66
- package/dist/components/player/components/online-hot/index.json +0 -3
- package/dist/components/player/components/online-hot/index.wxml +0 -15
- package/dist/components/player/components/online-hot/index.wxss +0 -1
- package/dist/components/player/components/poster/poster.js +0 -12
- package/dist/components/player/components/poster/poster.json +0 -3
- package/dist/components/player/components/poster/poster.wxml +0 -5
- package/dist/components/player/components/poster/poster.wxss +0 -1
- package/dist/components/player/components/watermark/watermark.js +0 -52
- package/dist/components/player/components/watermark/watermark.json +0 -4
- package/dist/components/player/components/watermark/watermark.wxml +0 -8
- package/dist/components/player/components/watermark/watermark.wxss +0 -1
- package/dist/components/player/extensions/data.js +0 -63
- package/dist/components/player/extensions/export.js +0 -325
- package/dist/components/player/extensions/methods.js +0 -406
- package/dist/components/player/extensions/observers.js +0 -114
- package/dist/components/player/extensions/props.js +0 -162
- package/dist/components/player/player.js +0 -83
- package/dist/components/player/player.json +0 -33
- package/dist/components/player/player.wxml +0 -48
- package/dist/components/player/player.wxss +0 -1
- package/dist/components/praise/praise.js +0 -150
- package/dist/components/praise/praise.json +0 -5
- package/dist/components/praise/praise.wxml +0 -17
- package/dist/components/praise/praise.wxss +0 -1
- package/dist/components/product/product-card/product-card.js +0 -109
- package/dist/components/product/product-card/product-card.json +0 -3
- package/dist/components/product/product-card/product-card.wxml +0 -47
- package/dist/components/product/product-card/product-card.wxss +0 -1
- package/dist/components/product/product-detail/product-detail.js +0 -127
- package/dist/components/product/product-detail/product-detail.json +0 -3
- package/dist/components/product/product-detail/product-detail.wxml +0 -57
- package/dist/components/product/product-detail/product-detail.wxss +0 -1
- package/dist/components/product/product-item/product-item.js +0 -56
- package/dist/components/product/product-item/product-item.json +0 -3
- package/dist/components/product/product-item/product-item.wxml +0 -35
- package/dist/components/product/product-item/product-item.wxss +0 -1
- package/dist/components/product/product-list/product-list.js +0 -67
- package/dist/components/product/product-list/product-list.json +0 -6
- package/dist/components/product/product-list/product-list.wxml +0 -16
- package/dist/components/product/product-list/product-list.wxss +0 -1
- package/dist/components/product/product-order/product-order.js +0 -394
- package/dist/components/product/product-order/product-order.json +0 -3
- package/dist/components/product/product-order/product-order.wxml +0 -75
- package/dist/components/product/product-order/product-order.wxss +0 -1
- package/dist/components/signin/signin-dialog.js +0 -305
- package/dist/components/signin/signin-dialog.json +0 -7
- package/dist/components/signin/signin-dialog.wxml +0 -19
- package/dist/components/signin/signin-dialog.wxss +0 -1
- package/dist/components/top-notify/index.js +0 -14
- package/dist/components/top-notify/index.json +0 -3
- package/dist/components/top-notify/index.wxml +0 -2
- package/dist/components/top-notify/index.wxss +0 -1
- package/dist/pubComponents/countdown/countdown.js +0 -97
- package/dist/pubComponents/countdown/countdown.json +0 -5
- package/dist/pubComponents/countdown/countdown.wxml +0 -19
- package/dist/pubComponents/countdown/countdown.wxss +0 -1
- package/dist/pubComponents/error-page/index.js +0 -146
- package/dist/pubComponents/error-page/index.json +0 -5
- package/dist/pubComponents/error-page/index.wxml +0 -37
- package/dist/pubComponents/error-page/index.wxss +0 -1
- package/dist/pubComponents/popup/popup.js +0 -161
- package/dist/pubComponents/popup/popup.json +0 -5
- package/dist/pubComponents/popup/popup.wxml +0 -17
- package/dist/pubComponents/popup/popup.wxss +0 -1
- package/dist/pubComponents/tabs/index.js +0 -95
- package/dist/pubComponents/tabs/index.json +0 -4
- package/dist/pubComponents/tabs/index.wxml +0 -22
- package/dist/pubComponents/tabs/index.wxss +0 -1
- package/dist/sdk/config/index.js +0 -1
- package/dist/sdk/main/index.js +0 -1
- package/dist/sdk/player/index.js +0 -1
- package/dist/sdk/plugins/ChatServer.js +0 -1
- package/dist/sdk/plugins/CustomMenuServer.js +0 -1
- package/dist/sdk/plugins/InteractServer.js +0 -1
- package/dist/sdk/plugins/InviteCardServer.js +0 -1
- package/dist/sdk/plugins/LotteryServer.js +0 -1
- package/dist/sdk/plugins/MallRewardServer.js +0 -1
- package/dist/sdk/plugins/ProductServer.js +0 -1
- package/dist/shared/RequestUtil.js +0 -1
- package/dist/shared/SerializableMap.js +0 -1
- package/dist/shared/base.server.js +0 -1
- package/dist/shared/cacheUtil.js +0 -1
- package/dist/shared/dateUtil.js +0 -1
- package/dist/shared/logger.js +0 -1
- package/dist/shared/mpUtils.js +0 -1
- package/dist/shared/utils.js +0 -1
|
@@ -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,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}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// src/components/vhall-im/vhall-im.js
|
|
2
|
-
import { formatDateTime } from '../../shared/utils';
|
|
3
|
-
Component({
|
|
4
|
-
options: {
|
|
5
|
-
styleIsolation: 'shared',
|
|
6
|
-
},
|
|
7
|
-
/**
|
|
8
|
-
* 组件的属性列表
|
|
9
|
-
*/
|
|
10
|
-
properties: {
|
|
11
|
-
sdkInstance: {
|
|
12
|
-
type: Object,
|
|
13
|
-
value: null,
|
|
14
|
-
},
|
|
15
|
-
mode: {
|
|
16
|
-
type: Number,
|
|
17
|
-
value: 1,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 组件的初始数据
|
|
23
|
-
*/
|
|
24
|
-
data: {
|
|
25
|
-
messages: [], // 存储聊天消息
|
|
26
|
-
inputValue: '', // 输入框的值
|
|
27
|
-
scrollTop: 0,
|
|
28
|
-
vhallImInstance: null, //消息sdk实例
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
lifetimes: {
|
|
32
|
-
created() {
|
|
33
|
-
console.debug('chat-comp created');
|
|
34
|
-
},
|
|
35
|
-
attached() {
|
|
36
|
-
console.debug('chat-comp attached');
|
|
37
|
-
},
|
|
38
|
-
async ready() {
|
|
39
|
-
console.debug('chat-comp ready');
|
|
40
|
-
},
|
|
41
|
-
detached() {
|
|
42
|
-
console.debug('chat-comp detached');
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 组件的方法列表
|
|
48
|
-
*/
|
|
49
|
-
methods: {
|
|
50
|
-
// 显示接收到的消息
|
|
51
|
-
showMessage(type, message) {
|
|
52
|
-
const newMessage = {
|
|
53
|
-
msg_id: message.msg_id || Date.now().toString(),
|
|
54
|
-
type: type,
|
|
55
|
-
user_id: message.user_id || '系统',
|
|
56
|
-
date_time: message.date_time || formatDateTime(new Date()),
|
|
57
|
-
text_content: message.text_content || message.data,
|
|
58
|
-
data: message.data,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
this.setData({
|
|
62
|
-
messages: [...this.data.messages, newMessage],
|
|
63
|
-
scrollTop: 99999, // 滚动到底部
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
// 输入框输入事件
|
|
67
|
-
onInput: function (e) {
|
|
68
|
-
this.setData({
|
|
69
|
-
inputValue: e.detail.value,
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
// 发送消息
|
|
73
|
-
send() {
|
|
74
|
-
// 内容
|
|
75
|
-
const message = this.data.inputValue.trim();
|
|
76
|
-
if (message === '') {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// 按所选类型调用实例方法
|
|
80
|
-
const methodName = this.data.msgTypes[this.data.typeIndex]['value'];
|
|
81
|
-
if (typeof this.vhallImInstance[methodName] === 'function') {
|
|
82
|
-
this.vhallImInstance[methodName]({
|
|
83
|
-
data: message,
|
|
84
|
-
})
|
|
85
|
-
.then((data) => {
|
|
86
|
-
console.log(`${methodName}发送消息success: `, data);
|
|
87
|
-
const rand = this.generateRandomString();
|
|
88
|
-
this.setData({
|
|
89
|
-
inputValue: rand,
|
|
90
|
-
});
|
|
91
|
-
})
|
|
92
|
-
.catch((e) => {
|
|
93
|
-
console.log(`${methodName}发送消息failed: `, e);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.chat-wrap{display:flex;flex-direction:column;font-family:PingFang SC,Helvetica Neue,Helvetica,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Arial,sans-serif;height:100%;width:100%}.chat-wrap .chat-edit{height:3.2rem;padding-bottom:env(safe-area-inset-bottom);width:100%}.chat-wrap.mode1 .chat-edit{background-color:#fff}.chat-wrap.mode0 .comment-wrapper .chat-edit-input-box{flex:1;width:auto}.chat-wrap.mode0 .comment-wrapper .chat-edit-input,.chat-wrap.mode0 .comment-wrapper .chat-edit-input-placeholder{color:#fff}.chat-list{flex:1;height:0;position:relative}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
properties: {
|
|
3
|
-
sdkInstance: {
|
|
4
|
-
type: Object,
|
|
5
|
-
value: null,
|
|
6
|
-
}
|
|
7
|
-
},
|
|
8
|
-
data: {
|
|
9
|
-
giftMessages: []
|
|
10
|
-
},
|
|
11
|
-
observers: {
|
|
12
|
-
sdkInstance: function sdkInstance(_sdkInstance) {
|
|
13
|
-
if (!_sdkInstance) return;
|
|
14
|
-
this.sdkInstance = _sdkInstance;
|
|
15
|
-
this.initListener();
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
lifetimes: {
|
|
19
|
-
detached() {
|
|
20
|
-
// 组件销毁时清除监听
|
|
21
|
-
this.unlistener && this.unlistener();
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
methods: {
|
|
25
|
-
// 初始化事件监听
|
|
26
|
-
initListener() {
|
|
27
|
-
this.unlistener && this.unlistener();
|
|
28
|
-
const obj = {};
|
|
29
|
-
obj[this.sdkInstance.EVENT.GIFT_MSG] = (msg) => {
|
|
30
|
-
this.handleGiftMessage(msg);
|
|
31
|
-
};
|
|
32
|
-
this.unlistener = this.sdkInstance.on(obj);
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
// 处理礼物消息
|
|
36
|
-
handleGiftMessage(data) {
|
|
37
|
-
// 生成唯一ID
|
|
38
|
-
const id = Date.now() + Math.random().toString(36).substr(2, 9);
|
|
39
|
-
|
|
40
|
-
// 构建礼物消息对象
|
|
41
|
-
const giftMessage = {
|
|
42
|
-
id,
|
|
43
|
-
nickname: data.gift_user_name || '匿名用户',
|
|
44
|
-
gift: {
|
|
45
|
-
icon: data.gift_image_url || '',
|
|
46
|
-
name: data.gift_name || '礼物'
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// 添加到礼物消息列表
|
|
51
|
-
const newGiftMessages = [...this.data.giftMessages, giftMessage];
|
|
52
|
-
this.setData({ giftMessages: newGiftMessages });
|
|
53
|
-
|
|
54
|
-
// 触发动画
|
|
55
|
-
this.triggerAnimation(id);
|
|
56
|
-
|
|
57
|
-
// 3秒后移除礼物消息
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
this.removeGiftMessage(id);
|
|
60
|
-
}, 3000);
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
// 触发动画
|
|
64
|
-
triggerAnimation(id) {
|
|
65
|
-
// 创建进入动画
|
|
66
|
-
const animation = wx.createAnimation({
|
|
67
|
-
duration: 500,
|
|
68
|
-
timingFunction: 'ease-out'
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// 从左侧滑入并稍微向上移动
|
|
72
|
-
animation.translateX(0).translateY(-20).opacity(1).step();
|
|
73
|
-
|
|
74
|
-
// 更新动画
|
|
75
|
-
const newGiftMessages = this.data.giftMessages.map(item => {
|
|
76
|
-
if (item.id === id) {
|
|
77
|
-
return { ...item, animation: animation.export() };
|
|
78
|
-
}
|
|
79
|
-
return item;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
this.setData({ giftMessages: newGiftMessages });
|
|
83
|
-
|
|
84
|
-
// 2秒后开始飘出动画
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
this.floatAnimation(id);
|
|
87
|
-
}, 2000);
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
// 飘出动画
|
|
91
|
-
floatAnimation(id) {
|
|
92
|
-
// 创建飘出动画
|
|
93
|
-
const animation = wx.createAnimation({
|
|
94
|
-
duration: 1000,
|
|
95
|
-
timingFunction: 'ease-in-out'
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// 向上飘动并逐渐透明
|
|
99
|
-
animation.translateY(-60).opacity(0).step();
|
|
100
|
-
|
|
101
|
-
// 更新动画
|
|
102
|
-
const newGiftMessages = this.data.giftMessages.map(item => {
|
|
103
|
-
if (item.id === id) {
|
|
104
|
-
return { ...item, animation: animation.export() };
|
|
105
|
-
}
|
|
106
|
-
return item;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
this.setData({ giftMessages: newGiftMessages });
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
// 移除礼物消息
|
|
113
|
-
removeGiftMessage(id) {
|
|
114
|
-
const finalGiftMessages = this.data.giftMessages.filter(item => item.id !== id);
|
|
115
|
-
this.setData({ giftMessages: finalGiftMessages });
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<view class="gift-display">
|
|
2
|
-
<view
|
|
3
|
-
wx:for="{{giftMessages}}"
|
|
4
|
-
wx:key="id"
|
|
5
|
-
class="gift-item"
|
|
6
|
-
style="top: {{index * 80}}rpx;"
|
|
7
|
-
animation="{{item.animation}}"
|
|
8
|
-
>
|
|
9
|
-
<view class="gift-content">
|
|
10
|
-
<text class="gift-user">{{item.nickname}}</text>
|
|
11
|
-
<text class="gift-action">送出了</text>
|
|
12
|
-
<text class="gift-name">{{item.gift.name}}</text>
|
|
13
|
-
<image class="gift-icon" src="{{item.gift.icon}}" mode="aspectFit"></image>
|
|
14
|
-
</view>
|
|
15
|
-
</view>
|
|
16
|
-
</view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.gift-display{left:0;pointer-events:none;position:absolute;top:100rpx;z-index:9999;z-index:100}.gift-item{background:linear-gradient(90deg,#8274ff 2.98%,rgba(249,51,249,.4) 118.57%);border-radius:25rpx;left:20rpx;margin-bottom:10rpx;min-width:300rpx;opacity:0;padding:10rpx 20rpx;position:absolute;transform:translateX(-100%)}.gift-content,.gift-item{align-items:center;display:flex}.gift-content{flex-wrap:nowrap}.gift-action,.gift-user{color:#fff;font-size:.86rem;margin-right:10rpx;white-space:nowrap}.gift-icon{height:40rpx;margin-right:10rpx;transform:scale(2);transform-origin:left center;width:40rpx}.gift-name{color:gold;font-size:.86rem;font-weight:700;white-space:nowrap}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
properties: {
|
|
3
|
-
sdkInstance: {
|
|
4
|
-
type: Object,
|
|
5
|
-
value: null,
|
|
6
|
-
}
|
|
7
|
-
},
|
|
8
|
-
data: {
|
|
9
|
-
giftList: [],
|
|
10
|
-
selectedGift: null
|
|
11
|
-
},
|
|
12
|
-
lifetimes: {
|
|
13
|
-
attached() {
|
|
14
|
-
// 组件挂载时调用获取礼物列表
|
|
15
|
-
if (this.properties.sdkInstance) {
|
|
16
|
-
this.sdkInstance = this.properties.sdkInstance;
|
|
17
|
-
this.getGiftList();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
// 获取礼物列表
|
|
23
|
-
async getGiftList() {
|
|
24
|
-
|
|
25
|
-
const interactServer = this.sdkInstance.get('interactServer');
|
|
26
|
-
if (!interactServer) {
|
|
27
|
-
console.error('InteractServer不存在');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// 调用 InteractServer 的 getGiftList 方法获取礼物列表
|
|
32
|
-
const giftList = await interactServer.getGiftList();
|
|
33
|
-
this.setData({ giftList });
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
// 选择礼物
|
|
37
|
-
selectGift(e) {
|
|
38
|
-
const gift = e.currentTarget.dataset.gift;
|
|
39
|
-
this.setData({ selectedGift: gift });
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
// 发送礼物
|
|
43
|
-
async sendGift(e) {
|
|
44
|
-
|
|
45
|
-
if (!this.data.selectedGift) return;
|
|
46
|
-
|
|
47
|
-
const interactServer = this.sdkInstance.get('interactServer');
|
|
48
|
-
if (interactServer) {
|
|
49
|
-
const res = await interactServer.sendGift(this.data.selectedGift);
|
|
50
|
-
if(res.code==200){
|
|
51
|
-
// 触发关闭事件,通知父组件关闭弹窗
|
|
52
|
-
this.triggerEvent('onSendFinished');
|
|
53
|
-
}else{
|
|
54
|
-
wx.showToast({
|
|
55
|
-
title: res.msg,
|
|
56
|
-
icon: 'none',
|
|
57
|
-
duration: 2000
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<view class="gift-popup-content">
|
|
2
|
-
<view class="gift-popup-header">
|
|
3
|
-
</view>
|
|
4
|
-
<view class="gift-list">
|
|
5
|
-
<view
|
|
6
|
-
wx:for="{{giftList}}"
|
|
7
|
-
wx:key="id"
|
|
8
|
-
class="gift-item {{selectedGift && selectedGift.id == item.id ? 'gift-item-selected' : ''}}"
|
|
9
|
-
bindtap="selectGift"
|
|
10
|
-
data-gift="{{item}}"
|
|
11
|
-
>
|
|
12
|
-
<image class="gift-item-icon" src="{{item.icon}}" mode="aspectFit"></image>
|
|
13
|
-
<text class="gift-item-name" wx:if="{{selectedGift.id != item.id}}">{{item.name}}</text>
|
|
14
|
-
<view class="gift-item-button" wx:if="{{selectedGift && selectedGift.id == item.id}}" catchtap="sendGift">
|
|
15
|
-
<text class="gift-item-button-text">赠送</text>
|
|
16
|
-
</view>
|
|
17
|
-
</view>
|
|
18
|
-
</view>
|
|
19
|
-
</view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.gift-popup-content{background:#fff;border-radius:20rpx 20rpx 0 0;padding:20rpx}.gift-list{display:grid;gap:20rpx;grid-template-columns:repeat(4,1fr);max-height:400rpx;overflow-y:auto;padding:20rpx 0}.gift-item{align-items:center;border-radius:10rpx;box-sizing:border-box;display:flex;flex-direction:column;height:180rpx;justify-content:space-between;position:relative;transition:all .3s}.gift-item:active{background:#f5f5f5;transform:scale(.95)}.gift-item-selected{border:1px solid #ff4d4f}.gift-item-icon{height:120rpx;margin-bottom:10rpx;width:120rpx}.gift-item-name{color:#333;margin-bottom:5rpx}.gift-item-button,.gift-item-name{font-size:.86rem;text-align:center}.gift-item-button{background:#ff4d4f;color:#fff;display:block;line-height:1.71rem;width:100%}.gift-popup-footer{border-top:1rpx solid #f0f0f0;justify-content:space-between;margin-top:20rpx;padding:20rpx 0}.gift-popup-footer,.selected-gift-info{align-items:center;display:flex}.selected-gift-icon{height:40rpx;margin-right:10rpx;width:40rpx}.selected-gift-name{color:#333;font-size:1rem;margin-right:10rpx}.selected-gift-price{color:#ff4d4f;font-size:1rem;font-weight:700}.send-button{background:#ff4d4f;border-radius:25rpx;color:#fff;font-size:1rem;font-weight:700;padding:15rpx 40rpx}.send-button:active{background:#ff7875;transform:scale(.95)}.gift-loading{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:100rpx 0}.gift-loading-spinner{animation:spin 1s linear infinite;border:4rpx solid #f0f0f0;border-radius:50%;border-top-color:#ff4d4f;height:60rpx;margin-bottom:20rpx;width:60rpx}.gift-loading-text{color:#999;font-size:1rem}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
properties: {
|
|
3
|
-
sdkInstance: {
|
|
4
|
-
type: Object,
|
|
5
|
-
value: null,
|
|
6
|
-
},
|
|
7
|
-
},
|
|
8
|
-
data: {
|
|
9
|
-
introduction: '',
|
|
10
|
-
title: '',
|
|
11
|
-
startTime: '',
|
|
12
|
-
},
|
|
13
|
-
lifetimes: {
|
|
14
|
-
detached: function detached() {
|
|
15
|
-
this.unsub && this.unsub();
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
observers: {
|
|
19
|
-
sdkInstance: function sdkInstance(_sdkInstance) {
|
|
20
|
-
if (!_sdkInstance) return;
|
|
21
|
-
|
|
22
|
-
this.sdkInstance = _sdkInstance;
|
|
23
|
-
this.store = _sdkInstance.store;
|
|
24
|
-
const _that = this;
|
|
25
|
-
this.unsub = this.store.get({
|
|
26
|
-
liveInfo: function (liveInfo) {
|
|
27
|
-
liveInfo.introduction &&
|
|
28
|
-
_that.setData({
|
|
29
|
-
introduction: liveInfo.introduction.replace(
|
|
30
|
-
/\<img/gi,
|
|
31
|
-
"<img class='richTextImg' style='max-width:100%; height:auto !important;'"
|
|
32
|
-
),
|
|
33
|
-
});
|
|
34
|
-
_that.setData({
|
|
35
|
-
title: liveInfo.title,
|
|
36
|
-
startTime: liveInfo.startTime.slice(0, -3),
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
methods: {},
|
|
43
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<view class="live-introduction">
|
|
2
|
-
<scroll-view scroll-y="true" style="height: 100%">
|
|
3
|
-
<view class="live-title">{{title}}</view>
|
|
4
|
-
<view class="live-start-time">{{startTime}}</view>
|
|
5
|
-
<rich-text style="overflow-wrap:break-word" nodes="{{introduction}}"></rich-text>
|
|
6
|
-
</scroll-view>
|
|
7
|
-
</view>
|
|
8
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.live-introduction{height:100%}.live-introduction .live-title{-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;color:#262626;display:-webkit-box;font-size:1.14rem;font-weight:500;line-height:1.79rem;overflow:hidden;text-overflow:ellipsis;word-break:break-word}.live-introduction .live-start-time{color:#595959;font-size:1rem;font-weight:400;height:40rpx;line-height:1.43rem;margin-top:8rpx}.live-introduction .rich-text{word-break:break-word}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|