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.
- package/lib/components/chat/chat-edit/chat-edit.js +7 -4
- package/lib/components/chat/chat-list/chat-list.js +1 -1
- package/lib/components/live-landscape/live-landscape.js +11 -7
- package/lib/components/live-landscape/live-landscape.wxml +2 -2
- package/lib/components/live-portrait/live-portrait.js +11 -7
- package/lib/components/live-portrait/live-portrait.wxml +3 -3
- package/lib/components/live-portrait/live-portrait.wxss +1 -1
- package/lib/components/lottery/lottery.wxml +2 -2
- package/lib/components/player/components/online-hot/index.js +2 -2
- package/lib/components/player/extensions/observers.js +5 -5
- package/lib/components/player/player.js +5 -0
- package/lib/components/player/player.wxml +3 -3
- package/lib/components/product/product-list/product-list.wxml +3 -11
- package/lib/components/signin/signin-dialog.js +1 -0
- package/lib/sdk/main/index.js +2 -1
- package/lib/sdk/player/index.js +1 -1
- package/lib/sdk/plugins/InviteCardServer.js +1 -1
- package/lib/sdk/plugins/MallRewardServer.js +1 -1
- package/lib/sdk/plugins/ProductServer.js +1 -1
- package/lib/shared/RequestUtil.js +1 -1
- package/lib/shared/logger.js +1 -1
- 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,274 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
properties: {
|
|
3
|
-
sdkInstance: {
|
|
4
|
-
type: Object,
|
|
5
|
-
value: null,
|
|
6
|
-
},
|
|
7
|
-
},
|
|
8
|
-
data: {
|
|
9
|
-
tabList: [],
|
|
10
|
-
activeTab: 0,
|
|
11
|
-
liveInfo: null,
|
|
12
|
-
showStartDialog: false, // 是否显示开始直播弹窗
|
|
13
|
-
|
|
14
|
-
showRecordWatchExpireDialog: false, // 是否显示回放视频已过观看有效期提示框
|
|
15
|
-
|
|
16
|
-
showChat: false, // 是否显示聊天
|
|
17
|
-
showMenu: false, // 是否显示菜单
|
|
18
|
-
showMenuPopup: false, // 点击菜单弹窗
|
|
19
|
-
|
|
20
|
-
errorResp: null, // 错误响应(错误码/错误详情)
|
|
21
|
-
|
|
22
|
-
// 商品相关
|
|
23
|
-
productList: [], // 商品列表数据
|
|
24
|
-
showProductList: false, // 是否显示商品列表弹窗
|
|
25
|
-
showProductDetail: false,
|
|
26
|
-
selectedProduct: null,
|
|
27
|
-
giftAuth: false,
|
|
28
|
-
// 礼物相关
|
|
29
|
-
showGiftList: false,
|
|
30
|
-
playerObjectFit: 'fillCrop',
|
|
31
|
-
// 下单弹窗
|
|
32
|
-
showOrder: false
|
|
33
|
-
},
|
|
34
|
-
observers: {
|
|
35
|
-
sdkInstance: function sdkInstance(_sdkInstance) {
|
|
36
|
-
if (!_sdkInstance) return;
|
|
37
|
-
this.sdkInstance = _sdkInstance;
|
|
38
|
-
this.store = _sdkInstance.store;
|
|
39
|
-
this.unsub = this.store.get({
|
|
40
|
-
liveInfo: (val) => {
|
|
41
|
-
this.setData({
|
|
42
|
-
liveInfo: val,
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
customMenu: (_customMenu) => {
|
|
46
|
-
if (_customMenu) {
|
|
47
|
-
this.handleCustomMenu(_customMenu);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
errorResp: (val) => {
|
|
51
|
-
if (val !== undefined) {
|
|
52
|
-
this.setData({
|
|
53
|
-
errorResp: val,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
productList: (val) => {
|
|
58
|
-
if (val) {
|
|
59
|
-
this.setData({
|
|
60
|
-
productList: val,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
permissionValue: (val) => {
|
|
65
|
-
if (val !== undefined) {
|
|
66
|
-
this.setData({
|
|
67
|
-
giftAuth: val['ui.hide_gifts'] != 1
|
|
68
|
-
})
|
|
69
|
-
this.setData({
|
|
70
|
-
playerObjectFit: val['video_proportional_scaling_adaptation'] == 1 ? 'fillCrop' : 'contain'
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
this.initListenerEvent();
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
lifetimes: {
|
|
79
|
-
detached() {
|
|
80
|
-
// 组件销毁时清除定时器
|
|
81
|
-
this.unsub && this.unsub();
|
|
82
|
-
this.unlistener && this.unlistener();
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
methods: {
|
|
86
|
-
// 处理自定义菜单
|
|
87
|
-
async handleCustomMenu(cm) {
|
|
88
|
-
// 返回的数组顺序即菜单顺序
|
|
89
|
-
// console.log('cm:', cm)
|
|
90
|
-
const tabList = [];
|
|
91
|
-
for (const tabItem of cm.list || []) {
|
|
92
|
-
// type=2: 文档;3:聊天;4:简介;5:商品;6:推荐;9:文件下载;11:精彩时刻;12:概要总结 13:问答;1:自定义菜单
|
|
93
|
-
if ([4, 5].includes(tabItem.type)) {
|
|
94
|
-
// 简介或商品
|
|
95
|
-
if (tabItem.status == 1) {
|
|
96
|
-
tabList.push({ id: tabItem.id, name: tabItem.name, type: tabItem.type })
|
|
97
|
-
}
|
|
98
|
-
} else if (tabItem.type === 1) {
|
|
99
|
-
const customMenuServer = this.sdkInstance.get('customMenuServer');
|
|
100
|
-
if (customMenuServer) {
|
|
101
|
-
const menuDetail = await customMenuServer.getCustomMenuDetail(tabItem.id);
|
|
102
|
-
if (menuDetail?.components?.[0]?.component_id === 9) {
|
|
103
|
-
// 邀请榜菜单处理
|
|
104
|
-
this.handleInviteRankMenu(tabList, tabItem, menuDetail);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
} else if (tabItem.type == 3) {
|
|
108
|
-
// 聊天 ( 预约页 和 结束 不展示聊天), 竖屏模式聊天不在tab中而是在外面展示
|
|
109
|
-
const liveInfo = this.sdkInstance.store.get('liveInfo');
|
|
110
|
-
if (tabItem.status == 1 && (liveInfo.status !== 2 && liveInfo.status !== 3)) {
|
|
111
|
-
this.setData({ showChat: true })
|
|
112
|
-
} else {
|
|
113
|
-
this.setData({ showChat: false })
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
// TODO: 其它类型暂不支持
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
this.setData({
|
|
120
|
-
tabList: tabList,
|
|
121
|
-
showMenu: tabList.length > 0
|
|
122
|
-
})
|
|
123
|
-
},
|
|
124
|
-
// 邀请榜菜单处理
|
|
125
|
-
async handleInviteRankMenu(tabList, tabItem, menuDetail) {
|
|
126
|
-
const inviteRankMenu = {
|
|
127
|
-
id: tabItem.id,
|
|
128
|
-
name: tabItem.name,
|
|
129
|
-
type: tabItem.type,
|
|
130
|
-
status: tabItem.status, // status 1显示,2隐藏,3预告结束隐藏,4预告结束显示
|
|
131
|
-
cid: menuDetail.components[0].component_id,
|
|
132
|
-
};
|
|
133
|
-
const liveInfo = this.sdkInstance.store.get('liveInfo');
|
|
134
|
-
if (liveInfo?.status && inviteRankMenu.id) {
|
|
135
|
-
// 预告页和结束页不展示
|
|
136
|
-
if (liveInfo.status === 2 && inviteRankMenu.status === 3) return;
|
|
137
|
-
const idx = tabList.findIndex((item) => item.id === inviteRankMenu.id);
|
|
138
|
-
if (idx == -1) {
|
|
139
|
-
tabList.push(inviteRankMenu)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
toWatch() {
|
|
144
|
-
this.setData({
|
|
145
|
-
showStartDialog: false,
|
|
146
|
-
});
|
|
147
|
-
this.sdkInstance.init();
|
|
148
|
-
},
|
|
149
|
-
handleExprie() {
|
|
150
|
-
this.sdkInstance._handleBizErrorCode(512912)
|
|
151
|
-
},
|
|
152
|
-
// 点击菜单icon
|
|
153
|
-
handleMenu() {
|
|
154
|
-
this.setData({
|
|
155
|
-
showMenuPopup: true,
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
// 点击更多icon(三个点)
|
|
159
|
-
handleMore() {
|
|
160
|
-
this.triggerEvent('clickMoreMenu')
|
|
161
|
-
},
|
|
162
|
-
initListenerEvent() {
|
|
163
|
-
this.unlistener && this.unlistener();
|
|
164
|
-
const obj = {};
|
|
165
|
-
obj[this.sdkInstance.EVENT.LIVE_START] = () => {
|
|
166
|
-
this.setData({
|
|
167
|
-
showStartDialog: true,
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
obj[this.sdkInstance.EVENT.LIVE_END] = () => {
|
|
171
|
-
this.sdkInstance.leaveRoom(true);
|
|
172
|
-
this.sdkInstance.store.set('liveInfo.status', 3);
|
|
173
|
-
};
|
|
174
|
-
obj[this.sdkInstance.EVENT.KICKOUT] = () => {};
|
|
175
|
-
obj[this.sdkInstance.EVENT.RECORD_WATCH_EXPIRE_ALERT] = () => {
|
|
176
|
-
this.setData({
|
|
177
|
-
showRecordWatchExpireDialog: true,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
this.unlistener = this.sdkInstance.on(obj);
|
|
181
|
-
},
|
|
182
|
-
onTabClick: function onTabClick(e) {
|
|
183
|
-
var index = e.detail.index;
|
|
184
|
-
this.setData({
|
|
185
|
-
activeTab: index,
|
|
186
|
-
});
|
|
187
|
-
const item = this.data.tabList[index];
|
|
188
|
-
this.sdkInstance.emit('tab:click', item);
|
|
189
|
-
},
|
|
190
|
-
onTabChange: function onTabChange(e) {
|
|
191
|
-
var index = e.detail.index;
|
|
192
|
-
this.setData({
|
|
193
|
-
activeTab: index,
|
|
194
|
-
});
|
|
195
|
-
const item = this.data.tabList[index];
|
|
196
|
-
this.sdkInstance.emit('tab:change', item);
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
// 点击小黄车,显示商品列表弹窗
|
|
200
|
-
showProductList() {
|
|
201
|
-
this.setData({
|
|
202
|
-
showProductList: true
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
// 隐藏商品列表弹窗
|
|
207
|
-
hideProductList() {
|
|
208
|
-
this.setData({
|
|
209
|
-
showProductList: false
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
// 处理商品点击
|
|
214
|
-
handleProductClick(e) {
|
|
215
|
-
this.setData({
|
|
216
|
-
selectedProduct: e.detail,
|
|
217
|
-
showProductDetail: true,
|
|
218
|
-
showProductList: false // 点击商品时关闭商品列表弹窗
|
|
219
|
-
});
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
// 关闭商品详情
|
|
223
|
-
closeProductDetail() {
|
|
224
|
-
this.setData({
|
|
225
|
-
showProductDetail: false,
|
|
226
|
-
selectedProduct: null
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
// 显示礼物列表
|
|
231
|
-
showGiftList() {
|
|
232
|
-
// 只负责显示弹窗,礼物列表由组件内部请求
|
|
233
|
-
this.setData({ showGiftList: true });
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
// 隐藏礼物列表
|
|
237
|
-
hideGiftList() {
|
|
238
|
-
this.setData({ showGiftList: false });
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
// 购买商品
|
|
242
|
-
buyProduct(product) {
|
|
243
|
-
this.setData({
|
|
244
|
-
selectedProduct: product,
|
|
245
|
-
showProductDetail: false,
|
|
246
|
-
showOrder: true,
|
|
247
|
-
});
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
// 显示下单弹窗(统一处理商品卡片和商品详情的购买)
|
|
251
|
-
showOrderDialog(e) {
|
|
252
|
-
const product = e.detail ? e.detail : e;
|
|
253
|
-
this.setData({
|
|
254
|
-
selectedProduct: product,
|
|
255
|
-
showProductDetail: false,
|
|
256
|
-
showOrder: true,
|
|
257
|
-
});
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
// 关闭下单弹窗
|
|
261
|
-
closeOrder() {
|
|
262
|
-
this.setData({
|
|
263
|
-
showOrder: false,
|
|
264
|
-
selectedProduct: null,
|
|
265
|
-
});
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
// 支付成功回调
|
|
269
|
-
onPaySuccess(data) {
|
|
270
|
-
console.log('支付成功:', data);
|
|
271
|
-
// 支付成功后的处理
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"component": true,
|
|
3
|
-
"styleIsolation": "shared",
|
|
4
|
-
"usingComponents": {
|
|
5
|
-
"vhall-tabs": "../../pubComponents/tabs/index",
|
|
6
|
-
"vhall-chat": "../chat/chat",
|
|
7
|
-
"vhall-player": "../player/player",
|
|
8
|
-
"vhall-introduction": "../introduction/introduction",
|
|
9
|
-
"vhall-invite-rank": "../invite-rank/index",
|
|
10
|
-
"vhall-product-list": "../product/product-list/product-list",
|
|
11
|
-
"vhall-product-detail": "../product/product-detail/product-detail",
|
|
12
|
-
"vhall-product-card": "../product/product-card/product-card",
|
|
13
|
-
"vhall-product-order": "../product/product-order/product-order",
|
|
14
|
-
"vhall-lottery": "../lottery/lottery",
|
|
15
|
-
"vhall-mall-reward": "../mall-reward/index",
|
|
16
|
-
"product-detail": "../product/product-detail/product-detail",
|
|
17
|
-
"start-countdown": "../../pubComponents/countdown/countdown",
|
|
18
|
-
"signin-dialog": "../signin/signin-dialog",
|
|
19
|
-
"my-invite-detail": "../invite-rank/my-invite-detail",
|
|
20
|
-
"mp-dialog": "weui-miniprogram/dialog/dialog",
|
|
21
|
-
"mp-half-screen-dialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog",
|
|
22
|
-
"vhall-praise": "../praise/praise",
|
|
23
|
-
"vhall-gift-sender": "../gift/gift-sender/gift-sender",
|
|
24
|
-
"vhall-gift-display": "../gift/gift-display/gift-display",
|
|
25
|
-
"vh-popup": "../../pubComponents/popup/popup",
|
|
26
|
-
"error-page": "../../pubComponents/error-page/index",
|
|
27
|
-
"mp-icon": "weui-miniprogram/icon/icon"
|
|
28
|
-
},
|
|
29
|
-
"componentPlaceholder": {
|
|
30
|
-
"vhall-product-list": "view",
|
|
31
|
-
"vhall-product-detail": "view",
|
|
32
|
-
"vhall-product-card": "view",
|
|
33
|
-
"signin-dialog": "view",
|
|
34
|
-
"vhall-gift-sender": "view",
|
|
35
|
-
"vhall-lottery": "view",
|
|
36
|
-
"vhall-invite-rank": "view"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
<view class="live_portrait" wx:if="{{!errorResp || !errorResp.code}}">
|
|
2
|
-
<view class="live_portrait_player">
|
|
3
|
-
<vhall-player sdkInstance="{{sdkInstance}}" objectFit="{{playerObjectFit}}"></vhall-player>
|
|
4
|
-
</view>
|
|
5
|
-
<view class="count_down_cover" wx:if="{{liveInfo.status==2}}">
|
|
6
|
-
<start-countdown class="count_down" sdkInstance="{{sdkInstance}}"></start-countdown>
|
|
7
|
-
</view>
|
|
8
|
-
<!-- 聊天及其它菜单展示处理 -->
|
|
9
|
-
<vhall-chat class="live_portrait_chat {{liveInfo.status==5?'live_back':''}}" wx:if="{{showChat}}" mode="{{0}}" bind:commentCheck="commentCheck" sdkInstance="{{sdkInstance}}">
|
|
10
|
-
<view class="gift-button" wx:if="{{giftAuth}}" bindtap="showGiftList">
|
|
11
|
-
<image class="gift-icon" src="https://cnstatic01.e.vhall.com/common-static/saas-wap/static/img/icon_gift.020803f8.png" mode="aspectFit"></image>
|
|
12
|
-
</view>
|
|
13
|
-
<!-- 小黄车位置 - 有商品时显示 -->
|
|
14
|
-
<view class="cart-button" wx:if="{{productList && productList.length > 0}}" bindtap="showProductList">
|
|
15
|
-
<image class="cart-icon" src="https://cnstatic01.e.vhall.com/common-static/saas-wap/static/img/icon_good_0.2ad7e4b4.png" mode="aspectFit"></image>
|
|
16
|
-
</view>
|
|
17
|
-
<!-- 不隐藏聊天情况下右侧菜单 -->
|
|
18
|
-
<view class="menu_icon" wx:if="{{showMenu}}" bindtap="handleMenu">
|
|
19
|
-
<image class="menu_icon_image" webp="{{true}}" src="https://cnstatic01.e.vhall.com/common-static/images/mp/icon_menu.png" />
|
|
20
|
-
</view>
|
|
21
|
-
<!-- <view class="menu_icon" bindtap="handleMore">
|
|
22
|
-
<mp-icon type="outline" icon="more" color="#262626" size="{{24}}"></mp-icon>
|
|
23
|
-
</view> -->
|
|
24
|
-
<vhall-praise sdkInstance="{{ sdkInstance }}"></vhall-praise>
|
|
25
|
-
</vhall-chat>
|
|
26
|
-
<!-- 无聊天菜单展示处理 -->
|
|
27
|
-
<view wx:else class="nochat-bar">
|
|
28
|
-
<!-- 隐藏聊天情况,右侧菜单 -->
|
|
29
|
-
<view class="menu_icon" wx:if="{{showMenu}}" bindtap="handleMenu">
|
|
30
|
-
<image class="menu_icon_image" webp="{{true}}" src="https://cnstatic01.e.vhall.com/common-static/images/mp/icon_menu.png" />
|
|
31
|
-
</view>
|
|
32
|
-
</view>
|
|
33
|
-
<mp-half-screen-dialog extClass="menu-dialog" title='' closabled="{{false}}" show="{{showMenuPopup}}" maskClosable="{{true}}">
|
|
34
|
-
<view slot="desc" class="content-box">
|
|
35
|
-
<vhall-tabs class="live-protrait-tab " tab-class="tab-action" swiper-class="menu-swiper" wx:if="{{showMenuPopup&&tabList.length > 0}}" tabs="{{tabList}}" activeTab="{{activeTab}}" bindtabclick="onTabClick" bindchange="onTabChange">
|
|
36
|
-
<block wx:for="{{tabList}}" wx:key="id">
|
|
37
|
-
<view class="tab-content" data-set="{{item}}" slot="tab-content-{{index}}-{{id}}" wx:if="{{activeTab==index}}">
|
|
38
|
-
<vhall-introduction class="tab-introduction" wx:if="{{item.type == '4'}}" sdkInstance="{{sdkInstance}}"></vhall-introduction>
|
|
39
|
-
<vhall-invite-rank class="" item="{{item}}" wx:if="{{item.cid == 9}}" sdkInstance="{{sdkInstance}}"></vhall-invite-rank>
|
|
40
|
-
<vhall-product-list class="tab-product" wx:if="{{item.type == 5}}" sdkInstance="{{sdkInstance}}" bind:productClick="handleProductClick" bind:buyClick="showOrderDialog"></vhall-product-list>
|
|
41
|
-
</view>
|
|
42
|
-
</block>
|
|
43
|
-
</vhall-tabs>
|
|
44
|
-
</view>
|
|
45
|
-
</mp-half-screen-dialog>
|
|
46
|
-
<!-- 我的邀请明细 -->
|
|
47
|
-
<my-invite-detail sdkInstance="{{sdkInstance}}"></my-invite-detail>
|
|
48
|
-
<!-- 直播开始提示弹框 -->
|
|
49
|
-
<vh-popup wx:if="{{liveInfo.status==2||liveInfo.status==3}}" visible="{{showStartDialog}}" showClose="{{false}}">
|
|
50
|
-
<view class="start-dialog dialog-content">
|
|
51
|
-
<view class="dialog-image">
|
|
52
|
-
<image src="https://cnstatic01.e.vhall.com/common-static/images/mp/live_start.png" mode="widthFix" class="start_live_img" alt="开始直播"></image>
|
|
53
|
-
</view>
|
|
54
|
-
<view class="dialog-text">
|
|
55
|
-
<text class="desc">直播已开始,请观看直播吧</text>
|
|
56
|
-
</view>
|
|
57
|
-
<view class="start-dialog-footer">
|
|
58
|
-
<button class="light-button" plain bindtap="toWatch">立即观看</button>
|
|
59
|
-
</view>
|
|
60
|
-
</view>
|
|
61
|
-
</vh-popup>
|
|
62
|
-
<!-- 回放视频已过观看有效期提示框 -->
|
|
63
|
-
<vh-popup visible="{{showRecordWatchExpireDialog}}" showClose="{{false}}">
|
|
64
|
-
<view class="dialog-content dialog-content--expire">
|
|
65
|
-
<view class="dialog-image">
|
|
66
|
-
<image class="image-item" src="https://cnstatic01.e.vhall.com/common-static/images/mp/playback_expire.png" mode="widthFix" alt="开始直播"></image>
|
|
67
|
-
</view>
|
|
68
|
-
<view class="dialog-text">
|
|
69
|
-
<text class="desc">视频已过观看有效期</text>
|
|
70
|
-
</view>
|
|
71
|
-
<view class="dialog-footer">
|
|
72
|
-
<button class="weui-btn" type="primary" bindtap="handleExprie">我知道了</button>
|
|
73
|
-
</view>
|
|
74
|
-
</view>
|
|
75
|
-
</vh-popup>
|
|
76
|
-
<!-- 签到组件 -->
|
|
77
|
-
<signin-dialog sdkInstance="{{ sdkInstance }}"></signin-dialog>
|
|
78
|
-
<!-- 商品卡片 -->
|
|
79
|
-
<vhall-product-card sdkInstance="{{sdkInstance}}" bind:cardClick="handleProductClick"></vhall-product-card>
|
|
80
|
-
<!-- 商品详情 -->
|
|
81
|
-
<vh-popup visible="{{showProductDetail}}" mode="bottom" maskClosable="true" bind:close="closeProductDetail">
|
|
82
|
-
<vhall-product-detail product="{{selectedProduct}}" show="{{showProductDetail}}" sdkInstance="{{sdkInstance}}" bind:close="closeProductDetail" bind:buy="showOrderDialog" />
|
|
83
|
-
</vh-popup>
|
|
84
|
-
<!-- 下单弹窗 -->
|
|
85
|
-
<vh-popup visible="{{showOrder}}" mode="bottom" maskClosable="true" bind:close="closeOrder">
|
|
86
|
-
<vhall-product-order show="{{showOrder}}" product="{{selectedProduct}}" sdkInstance="{{sdkInstance}}" bind:close="closeOrder" bind:paySuccess="onPaySuccess" />
|
|
87
|
-
</vh-popup>
|
|
88
|
-
<!-- 礼物显示组件 -->
|
|
89
|
-
<vhall-gift-display class="gift-display" sdkInstance="{{sdkInstance}}" />
|
|
90
|
-
<!-- 礼物列表弹窗 -->
|
|
91
|
-
<vh-popup visible="{{showGiftList}}" mode="bottom" closeable maskClosable="true" bind:close="hideGiftList">
|
|
92
|
-
<vhall-gift-sender wx:if="{{showGiftList}}" sdkInstance="{{sdkInstance}}" bind:onSendFinished="hideGiftList"></vhall-gift-sender>
|
|
93
|
-
</vh-popup>
|
|
94
|
-
<!-- 商品列表弹窗 -->
|
|
95
|
-
<vh-popup visible="{{showProductList}}" mode="bottom" closeable maskClosable="true" bind:close="hideProductList">
|
|
96
|
-
<view class="product-list-popup">
|
|
97
|
-
<scroll-view scroll-y class="product-scroll">
|
|
98
|
-
<vhall-product-list sdkInstance="{{sdkInstance}}" bind:productClick="handleProductClick" bind:buyClick="showOrderDialog"></vhall-product-list>
|
|
99
|
-
</scroll-view>
|
|
100
|
-
</view>
|
|
101
|
-
</vh-popup>
|
|
102
|
-
<vhall-lottery sdkInstance="{{sdkInstance}}" />
|
|
103
|
-
<!-- 商城奖励 -->
|
|
104
|
-
<vhall-mall-reward sdkInstance="{{sdkInstance}}" />
|
|
105
|
-
</view>
|
|
106
|
-
<error-page wx:else errorResp="{{errorResp}}"></error-page>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.live_portrait{display:flex;flex-direction:column;height:100%}.live_portrait .live_portrait_player{display:block;height:100%;width:100vw;z-index:0}.live_portrait .live_portrait_chat{bottom:0;height:32vh;left:0;position:absolute;right:0;z-index:100}.live_portrait .live_portrait_chat.live_back{bottom:80rpx}.live_portrait .live_portrait_chat.live_back .chat-edit{padding-bottom:0}.live_portrait .nochat-bar{bottom:constant(safe-area-inset-bottom);bottom:env(safe-area-inset-bottom);display:flex;flex-direction:row;height:32px;padding-bottom:10px;padding-right:16px;position:absolute;right:0;z-index:100}.live_portrait .live-portrait-tab{box-sizing:border-box;display:flex;flex:1;height:calc(100vh - 56.25vw);padding-bottom:env(safe-area-inset-bottom);width:100vw}.live_portrait .live-portrait-tab .tab-action{color:#fff!important}.live_portrait .live-portrait-tab .tab-content{height:100%;overflow:auto;width:100%}.live_portrait .live-portrait-tab .tab-chat{display:block;height:100%;width:100%}.live_portrait .live-portrait-tab .tab-introduction{display:block;padding:20rpx}.live_portrait .count_down{color:#fff;height:100vh;left:0;margin-top:-52rpx;position:fixed;top:0;top:50%;width:100vw;z-index:100}.live_portrait .menu_icon{align-items:center;background-color:rgba(0,0,0,.14);border-radius:50%;display:flex;height:2rem;justify-content:center;margin-right:16rpx;width:2rem}.live_portrait .menu_icon .menu_icon_image{height:100%;width:100%}.live_portrait .start_live_img{margin-bottom:20rpx;width:150rpx}.live_portrait .gift-display{left:0;position:fixed;top:60vh}.menu-dialog{box-sizing:border-box;height:70%;padding:20rpx}.menu-dialog .weui-half-screen-dialog__ft,.menu-dialog .weui-half-screen-dialog__hd{display:none}.menu-dialog .content-box{display:flex;height:100%}.menu-dialog .content-box .live-protrait-tab{flex:1}.menu-dialog .content-box .live-protrait-tab .tab-content{box-sizing:border-box;height:100%;overflow:auto}.count_down_cover{background-color:rgba(0,0,0,.5);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:100}.start-dialog{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding-top:24rpx;width:520rpx}.start-dialog .light-button{border:none;color:#fb2626}.start-dialog .start-dialog-footer{margin-top:24rpx}.weui-dialog__btn{color:#fb2626!important}.dialog-content--expire{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding-top:24rpx;width:520rpx}.dialog-content--expire .dialog-image{margin-bottom:24rpx}.dialog-content--expire .dialog-image .image-item{width:200rpx}.dialog-content--expire .dialog-footer{margin-top:36rpx}.gift-button{align-items:center;background:rgba(6,6,6,.25);border-radius:50%;display:flex;justify-content:center;margin-right:16rpx;position:relative}.cart-button,.gift-button,.gift-icon{height:2rem;width:2rem}.cart-button{align-items:center;background:rgba(6,6,6,.25);border-radius:50%;display:flex;justify-content:center;margin-right:16rpx;position:relative}.cart-button .cart-icon{height:2rem;margin-top:-.8rem;width:2rem}.cart-button .cart-badge{align-items:center;background-color:#ff4757;border-radius:16rpx;color:#fff;display:flex;font-size:.79rem;font-weight:700;height:32rpx;justify-content:center;min-width:32rpx;padding:0 8rpx;position:absolute;right:-8rpx;top:-8rpx}.product-list-popup{display:flex;flex-direction:column;max-height:70vh;width:100%}.product-list-popup .popup-header{align-items:center;border-bottom:1rpx solid #f0f0f0;display:flex;justify-content:space-between;padding:24rpx 32rpx}.product-list-popup .popup-header .popup-title{color:#333;font-size:1.14rem;font-weight:700}.product-list-popup .popup-header .popup-count{color:#999;font-size:.93rem}.product-list-popup .product-scroll{flex:1;max-height:calc(70vh - 80rpx)}
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
properties: {
|
|
3
|
-
visible: {
|
|
4
|
-
type: Boolean,
|
|
5
|
-
value: false,
|
|
6
|
-
},
|
|
7
|
-
lotteryId: {
|
|
8
|
-
type: String,
|
|
9
|
-
value: '',
|
|
10
|
-
},
|
|
11
|
-
sdkInstance: {
|
|
12
|
-
type: Object,
|
|
13
|
-
value: null,
|
|
14
|
-
},
|
|
15
|
-
publishWinner: {
|
|
16
|
-
type: Number,
|
|
17
|
-
value: 0,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
data: {
|
|
22
|
-
acceptType: 1, // 1表单,2客服,3无需领奖
|
|
23
|
-
winForm: [], // 中奖信息表单
|
|
24
|
-
customerServiceInfo: {}, // 客服信息
|
|
25
|
-
verified: false, // 表单是否验证通过
|
|
26
|
-
showSuccess: false, // 是否显示提交成功弹框
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
observers: {
|
|
30
|
-
visible: function (visible) {
|
|
31
|
-
if (visible && this.properties.lotteryId && this.properties.sdkInstance) {
|
|
32
|
-
this.initAcceptConfig();
|
|
33
|
-
} else {
|
|
34
|
-
this.setData({ showSuccess: false });
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
methods: {
|
|
40
|
-
// 获取领奖配置
|
|
41
|
-
async initAcceptConfig() {
|
|
42
|
-
try {
|
|
43
|
-
const lotteryServer = this.properties.sdkInstance.get('lotteryServer');
|
|
44
|
-
const webinarId = this.properties.sdkInstance.store.get('webinarId');
|
|
45
|
-
const res = await lotteryServer.getReceiveAwardSetting({
|
|
46
|
-
lottery_id: this.properties.lotteryId || '',
|
|
47
|
-
webinar_id: webinarId || '',
|
|
48
|
-
});
|
|
49
|
-
if (res.code === 200) {
|
|
50
|
-
const data = res.data;
|
|
51
|
-
if (data.receive_award_way === 1) {
|
|
52
|
-
// 表单领奖
|
|
53
|
-
this.setData({
|
|
54
|
-
acceptType: 1,
|
|
55
|
-
winForm: this.paseFormInfo(data.json_data),
|
|
56
|
-
});
|
|
57
|
-
this.fillUserInfo();
|
|
58
|
-
} else if (data.receive_award_way === 2) {
|
|
59
|
-
// 客服领奖
|
|
60
|
-
this.setData({
|
|
61
|
-
acceptType: 2,
|
|
62
|
-
customerServiceInfo: this.paseCustomerServiceInfo(data.json_data),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
} catch (err) {
|
|
67
|
-
console.error('获取领奖配置失败:', err);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
// 解析表单信息
|
|
72
|
-
paseFormInfo(jsonString) {
|
|
73
|
-
let info = [];
|
|
74
|
-
try {
|
|
75
|
-
const jsonObj = JSON.parse(jsonString);
|
|
76
|
-
if (Array.isArray(jsonObj)) {
|
|
77
|
-
jsonObj.map((item) => {
|
|
78
|
-
if (item.field_key == 'phone') {
|
|
79
|
-
item.maxLength = 20;
|
|
80
|
-
} else if (item.field_key == 'name') {
|
|
81
|
-
item.maxLength = 20;
|
|
82
|
-
} else if (item.field_key == 'address') {
|
|
83
|
-
item.maxLength = 50;
|
|
84
|
-
} else {
|
|
85
|
-
item.maxLength = 100;
|
|
86
|
-
}
|
|
87
|
-
item.field_value = '';
|
|
88
|
-
item.error = false;
|
|
89
|
-
info.push(item);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
} catch (e) {
|
|
93
|
-
info = [];
|
|
94
|
-
}
|
|
95
|
-
return info;
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
// 解析客服信息
|
|
99
|
-
paseCustomerServiceInfo(jsonString) {
|
|
100
|
-
let info = {};
|
|
101
|
-
try {
|
|
102
|
-
const jsonObj = JSON.parse(jsonString);
|
|
103
|
-
if (Array.isArray(jsonObj)) {
|
|
104
|
-
jsonObj.forEach((filedItem) => {
|
|
105
|
-
info[filedItem.field_key] = filedItem.placeholder;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
} catch (e) {
|
|
109
|
-
info = {};
|
|
110
|
-
}
|
|
111
|
-
return info;
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
// 验证表单是否可提交
|
|
115
|
-
validateForm() {
|
|
116
|
-
const winForm = this.data.winForm;
|
|
117
|
-
const verified = winForm.every((form) => {
|
|
118
|
-
return !form.is_required || (form.field_value && form.field_value.trim() !== '');
|
|
119
|
-
});
|
|
120
|
-
this.setData({ verified });
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
// 表单输入监听
|
|
124
|
-
onFormInput(e) {
|
|
125
|
-
const { index } = e.currentTarget.dataset;
|
|
126
|
-
const value = e.detail.value;
|
|
127
|
-
const winForm = this.data.winForm;
|
|
128
|
-
winForm[index].field_value = value;
|
|
129
|
-
winForm[index].error = false;
|
|
130
|
-
this.setData({ winForm });
|
|
131
|
-
this.validateForm();
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
// 验证表单
|
|
135
|
-
verify() {
|
|
136
|
-
const winForm = this.data.winForm;
|
|
137
|
-
const errorItem = winForm.find((item) => {
|
|
138
|
-
if (
|
|
139
|
-
item.field_key == 'phone' &&
|
|
140
|
-
((item.field_value != '' && item.field_value != null) || !!item.is_required)
|
|
141
|
-
) {
|
|
142
|
-
const phone = item.field_value.replace(/\s+/g, '');
|
|
143
|
-
// 简单的手机号校验
|
|
144
|
-
if (!/^1[3-9]\d{9}$/.test(phone)) {
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
} else if (!!item.is_required && item.field_value == '') {
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
return false;
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
if (errorItem) {
|
|
154
|
-
errorItem.error = true;
|
|
155
|
-
this.setData({ winForm });
|
|
156
|
-
wx.showToast({
|
|
157
|
-
title: `请输入正确的信息${errorItem.field}`,
|
|
158
|
-
icon: 'none',
|
|
159
|
-
});
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
return true;
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
// 提交领奖信息
|
|
166
|
-
async submit() {
|
|
167
|
-
if (!this.verify()) return;
|
|
168
|
-
|
|
169
|
-
const winForm = this.data.winForm;
|
|
170
|
-
const remark = winForm.map((item) => ({
|
|
171
|
-
field_value: item.field_value,
|
|
172
|
-
field: item.field,
|
|
173
|
-
field_key: item.field_key,
|
|
174
|
-
is_required: item.is_required,
|
|
175
|
-
is_system: item.is_system,
|
|
176
|
-
placeholder: item.placeholder,
|
|
177
|
-
rank: item.rank,
|
|
178
|
-
}));
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
const lotteryServer = this.properties.sdkInstance.get('lotteryServer');
|
|
182
|
-
if (!lotteryServer) return;
|
|
183
|
-
const watchInitData = this.properties.sdkInstance.store.get('watchInitData');
|
|
184
|
-
const roomId = watchInitData?.interact?.room_id || '';
|
|
185
|
-
const res = await lotteryServer.submitLotteryAward({
|
|
186
|
-
lottery_user_name: winForm[0]?.field_value || '',
|
|
187
|
-
lottery_user_phone: winForm[1]?.field_value || '',
|
|
188
|
-
lottery_user_remark: JSON.stringify(remark),
|
|
189
|
-
lottery_id: this.properties.lotteryId || '',
|
|
190
|
-
room_id: roomId,
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
if (res.code === 200) {
|
|
194
|
-
this.setData({ showSuccess: true });
|
|
195
|
-
this.triggerEvent('success');
|
|
196
|
-
} else {
|
|
197
|
-
wx.showToast({
|
|
198
|
-
title: res.msg || '提交失败',
|
|
199
|
-
icon: 'none',
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
} catch (err) {
|
|
203
|
-
wx.showToast({
|
|
204
|
-
title: '提交失败',
|
|
205
|
-
icon: 'none',
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
// 预填用户信息
|
|
211
|
-
async fillUserInfo() {
|
|
212
|
-
try {
|
|
213
|
-
const lotteryServer = this.properties.sdkInstance.get('lotteryServer');
|
|
214
|
-
if (!lotteryServer) return;
|
|
215
|
-
const res = await lotteryServer.getLotteryUserInfo();
|
|
216
|
-
if (res.code === 200 && res.data) {
|
|
217
|
-
const data = res.data;
|
|
218
|
-
const winForm = this.data.winForm;
|
|
219
|
-
winForm.map((item) => {
|
|
220
|
-
if (item.field_key == 'name') {
|
|
221
|
-
item.field_value = data.lottery_user_name || '';
|
|
222
|
-
item.error = false;
|
|
223
|
-
} else if (item.field_key == 'phone') {
|
|
224
|
-
item.field_value = data.lottery_user_phone || '';
|
|
225
|
-
} else if (item.field_key == 'address') {
|
|
226
|
-
item.field_value = data.lottery_user_address || '';
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
this.setData({ winForm });
|
|
230
|
-
this.validateForm();
|
|
231
|
-
}
|
|
232
|
-
} catch (err) {
|
|
233
|
-
console.error('获取用户信息失败:', err);
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
// 关闭弹框
|
|
238
|
-
close() {
|
|
239
|
-
this.setData({ showSuccess: false });
|
|
240
|
-
this.triggerEvent('close');
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
// 查看中奖名单
|
|
244
|
-
viewWinnersList() {
|
|
245
|
-
this.setData({ showSuccess: false });
|
|
246
|
-
this.triggerEvent('viewWinners');
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
});
|