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,83 +0,0 @@
|
|
|
1
|
-
import { VeComponent } from './common/veComponent';
|
|
2
|
-
import { getPlayerMain } from './components/main/extensions/export';
|
|
3
|
-
import { createData } from './extensions/data';
|
|
4
|
-
import { props } from './extensions/props';
|
|
5
|
-
import { createExport } from './extensions/export';
|
|
6
|
-
import { createMethods } from './extensions/methods';
|
|
7
|
-
import { createObservers } from './extensions/observers';
|
|
8
|
-
import VhallPlayerCore from '../../sdk/player/index';
|
|
9
|
-
|
|
10
|
-
import createLogger from '../../shared/logger';
|
|
11
|
-
|
|
12
|
-
const logger = createLogger('playerComp');
|
|
13
|
-
|
|
14
|
-
VeComponent({
|
|
15
|
-
// relations: {
|
|
16
|
-
// '../components/controls/controls': { // 子组件的相对路径
|
|
17
|
-
// type: 'child',
|
|
18
|
-
// linked(target) {
|
|
19
|
-
// // 子组件被插入时触发
|
|
20
|
-
// },
|
|
21
|
-
// unlinked(target) {
|
|
22
|
-
// // 当子组件被移除时触发
|
|
23
|
-
// }
|
|
24
|
-
// }
|
|
25
|
-
// },
|
|
26
|
-
behaviors: ['wx://component-export'],
|
|
27
|
-
properties: props,
|
|
28
|
-
data: createData(),
|
|
29
|
-
observers: createObservers(),
|
|
30
|
-
lifetimes: {
|
|
31
|
-
created() {
|
|
32
|
-
logger.debug('lifetimes created');
|
|
33
|
-
this.vhallPlayerCore = new VhallPlayerCore();
|
|
34
|
-
Object.assign(this, createExport.call(this));
|
|
35
|
-
},
|
|
36
|
-
attached() {
|
|
37
|
-
logger.debug('lifetimes attached');
|
|
38
|
-
// this.playerMain = this.selectComponent(`.${this.data.prefix}-player-root`);
|
|
39
|
-
this.playerMain = getPlayerMain(this, `#${this.data.id}`);
|
|
40
|
-
},
|
|
41
|
-
ready() {
|
|
42
|
-
logger.debug('lifetimes ready');
|
|
43
|
-
// todo: 不延迟会失败
|
|
44
|
-
setTimeout(() => {
|
|
45
|
-
const barrageComp = this.selectComponent('.barrage');
|
|
46
|
-
if (barrageComp) {
|
|
47
|
-
this.barrage = barrageComp.getBarrageInstance({
|
|
48
|
-
font: 'bold 16px sans-serif',
|
|
49
|
-
duration: 10,
|
|
50
|
-
lineHeight: 2,
|
|
51
|
-
mode: 'separate',
|
|
52
|
-
padding: [10, 0, 10, 0],
|
|
53
|
-
range: [0, 0.5],
|
|
54
|
-
});
|
|
55
|
-
// this.barrage.open()
|
|
56
|
-
}
|
|
57
|
-
}, 1000);
|
|
58
|
-
},
|
|
59
|
-
detached() {
|
|
60
|
-
logger.debug('lifetimes detached');
|
|
61
|
-
this.vhallPlayerCore?.destroy();
|
|
62
|
-
this.playerMain = null;
|
|
63
|
-
this.setData({
|
|
64
|
-
videoSrc: '',
|
|
65
|
-
});
|
|
66
|
-
// this.unsub();
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
methods: createMethods(),
|
|
70
|
-
export() {
|
|
71
|
-
return createExport.apply(this);
|
|
72
|
-
},
|
|
73
|
-
pageLifetimes: {
|
|
74
|
-
hide() {
|
|
75
|
-
logger.debug('pageLifetimes hide');
|
|
76
|
-
this.vhallPlayerCore?.destroy();
|
|
77
|
-
},
|
|
78
|
-
show() {
|
|
79
|
-
logger.debug('pageLifetimes show');
|
|
80
|
-
this.vhallPlayerCore?.resume();
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"component": true,
|
|
3
|
-
"usingComponents": {
|
|
4
|
-
"player-main": "./components/main/index",
|
|
5
|
-
"barrage": "./components/barrage/index"
|
|
6
|
-
},
|
|
7
|
-
"componentGenerics": {
|
|
8
|
-
"vhall-player-error": {
|
|
9
|
-
"default": "./components/error/error"
|
|
10
|
-
},
|
|
11
|
-
"vhall-player-loading": {
|
|
12
|
-
"default": "./components/loading/loading"
|
|
13
|
-
},
|
|
14
|
-
"vhall-player-poster": {
|
|
15
|
-
"default": "./components/poster/poster"
|
|
16
|
-
},
|
|
17
|
-
"vhall-player-controls": {
|
|
18
|
-
"default": "./components/controls/controls"
|
|
19
|
-
},
|
|
20
|
-
"vhall-player-watermark": {
|
|
21
|
-
"default": "./components/watermark/watermark"
|
|
22
|
-
},
|
|
23
|
-
"vhall-player-marquee": {
|
|
24
|
-
"default": "./components/marquee/marquee"
|
|
25
|
-
},
|
|
26
|
-
"vhall-player-danmaku": {
|
|
27
|
-
"default": "./components/danmaku/danmaku"
|
|
28
|
-
},
|
|
29
|
-
"online-hot": {
|
|
30
|
-
"default": "./components/online-hot/index"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<wxs module='tools'>
|
|
2
|
-
var canShow = function (ignores, key) {
|
|
3
|
-
return ignores.indexOf(key) === -1
|
|
4
|
-
}
|
|
5
|
-
module.exports = {
|
|
6
|
-
canShow: canShow
|
|
7
|
-
}
|
|
8
|
-
</wxs>
|
|
9
|
-
<view class='vhall-layout-root' style='{{_style}}'>
|
|
10
|
-
<player-main catchtap="onToggleControls" wx:if="{{liveInfo.status!=3}}" id='{{id}}' class='vhall-player-root' src='{{videoSrc}}' type='{{type}}' autoplay='{{autoplay}}' objectFit='{{objectFit}}' muted='{{mutedFlag}}' mode='{{liveDelayMode}}' pictureInPictureMode='{{pictureInPictureMode}}' poster='{{posterUrl}}' controls='{{controls}}' show-progress="{{showProgress}}" loop="{{loop}}" initialSeekTime='{{initialSeekTime}}' bindfullscreenchange='onfullscreenchange' bindpictureinpicturechange='onpictureinpicturechange' bindtimeupdate='ontimeupdate' bindplay='onplay' bindpause='onpause' bindended='onended' bindloadedmetadata='onloadedmetadata' binderror='onerror' bindwaiting='onwaiting' bindloadStart='onloadStart' bindreconnecting='onreconnecting'>
|
|
11
|
-
<block wx:if="{{type=='live'}}">
|
|
12
|
-
<!-- 纯音频播放蒙层图片 -->
|
|
13
|
-
<image wx:if='{{showAudioCover}}' class='vhall-player-audio-cover' mode='scaleToFill' src='https://cnstatic01.e.vhall.com/common-static/saas-watch/static/img/video.110b96d1.gif' />
|
|
14
|
-
<!-- 封面组件 -->
|
|
15
|
-
<!-- 仅直播使用,点播使用video组件的poster属性 -->
|
|
16
|
-
<vhall-player-poster wx:if="{{type=='live' && showPoster && tools.canShow(ignores, 'vhall-player-poster')}}" url='{{posterOption.url}}' />
|
|
17
|
-
<!-- 水印组件 -->
|
|
18
|
-
<vhall-player-watermark wx:if="{{ showWatermark && tools.canShow(ignores, 'vhall-player-watermark') }}" option="{{watermarkOption}}" />
|
|
19
|
-
<!-- 跑马灯组件 -->
|
|
20
|
-
<vhall-player-marquee wx:if="{{ showMarquee && tools.canShow(ignores, 'vhall-player-marquee') }}" option="{{marqueeOption}}" />
|
|
21
|
-
<!-- 弹幕组件 -->
|
|
22
|
-
<!-- <vhall-player-danmaku
|
|
23
|
-
wx:if='{{showDanmaku}}'
|
|
24
|
-
/> -->
|
|
25
|
-
<barrage wx:if='{{showBarrage}}' class="barrage" rendering-mode="dom" z-index="3" />
|
|
26
|
-
<!-- 控制栏组件 -->
|
|
27
|
-
<vhall-player-controls hiddenFlag="{{controlsHiddenFlag}}" wx:if="{{type=='live' && controls && tools.canShow(ignores, 'vhall-player-controls')}}" verticalMode='{{verticalMode}}' playStatus='{{playStatus}}' paused='{{pausedFlag}}' muted='{{mutedFlag}}' fullscreen='{{fullscreenFlag}}' qualityAlias='{{qualityAlias}}' qualitys='{{qualitys}}' currentQuality='{{currentQuality}}' bindcontrolsPlayPause='handleControlsPlayPause' bindcontrolsReplay='handleControlsReplay' bindcontrolsMute='handleControlsMute' bindcontrolsFullScreen='handleControlsFullScreen' bindcontrolsSetQuality='handleControlsSetQuality' />
|
|
28
|
-
<!-- 错误提示组件 -->
|
|
29
|
-
<vhall-player-error wx:if="{{showError && tools.canShow(ignores, 'vhall-player-error')}}" error='{{error}}' binderrorandretry='handleErrorAndRetry' />
|
|
30
|
-
<!-- loading组件 -->
|
|
31
|
-
<vhall-player-loading wx:elif="{{type=='live' && showLoading && tools.canShow(ignores, 'vhall-player-loading')}}" />
|
|
32
|
-
<!-- 直播:在线人数和热度 -->
|
|
33
|
-
<online-hot wx:if="{{!controlsHiddenFlag}}" fullscreen="{{fullscreenFlag}}" showPerson="{{showPerson}}" personValue="{{personValue}}" showHot="{{showHot}}" hotValue="{{hotValue}}"></online-hot>
|
|
34
|
-
</block>
|
|
35
|
-
<block wx:else>
|
|
36
|
-
<!-- 点播:在线人数和热度。 点播使用的video原生控制栏,没法判断展示还是隐藏状态 -->
|
|
37
|
-
<online-hot fullscreen="{{fullscreenFlag}}" showPerson="{{showPerson}}" personValue="{{personValue}}" showHot="{{showHot}}" hotValue="{{hotValue}}"></online-hot>
|
|
38
|
-
</block>
|
|
39
|
-
</player-main>
|
|
40
|
-
<slot name='vhall-player-01' />
|
|
41
|
-
<view wx:if="{{liveInfo.status==2||liveInfo.status==3}}" class="webinar_warn">
|
|
42
|
-
<image class="cover_img" src="{{liveInfo.coverImg}}" />
|
|
43
|
-
<view wx:if="{{liveInfo.status==3}}" class="webinar_status">
|
|
44
|
-
<image class="status-img" mode="widthFix" src="https://cnstatic01.e.vhall.com/common-static/images/mp/live_end.png" />
|
|
45
|
-
<text class="status-text">直播已结束</text>
|
|
46
|
-
</view>
|
|
47
|
-
</view>
|
|
48
|
-
</view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.vhall-layout-root{height:100%;transition:width .3s ease-in-out,height .3s ease-in-out;width:100%}.webinar_warn{align-items:center;background-color:rgba(0,0,0,.9);bottom:0;color:#fff;display:flex;font-size:14px;height:100%;justify-content:center;left:0;position:relative;right:0;top:0}.webinar_warn .cover_img{height:100%;position:absolute;width:100%;z-index:1}.webinar_warn .webinar_status{align-items:center;background-color:rgba(0,0,0,.6);bottom:0;display:flex;flex-direction:column;justify-content:center;left:0;position:absolute;right:0;text-align:center;top:0;z-index:2}.webinar_warn .webinar_status .status-img{display:block;margin-left:-10px;width:140rpx}.webinar_warn .webinar_status .status-text{display:block;font-size:1rem;padding-top:10px}.vhall-player-audio-cover{height:100%;left:0;position:absolute;top:0;width:100%}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
properties: {
|
|
3
|
-
sdkInstance: {
|
|
4
|
-
type: Object,
|
|
5
|
-
value: null,
|
|
6
|
-
},
|
|
7
|
-
},
|
|
8
|
-
data: {
|
|
9
|
-
likeCount: 0, // 点赞数
|
|
10
|
-
eleList: [], // 动画元素列表
|
|
11
|
-
},
|
|
12
|
-
observers: {
|
|
13
|
-
sdkInstance: function sdkInstance(_sdkInstance) {
|
|
14
|
-
if (!_sdkInstance) return;
|
|
15
|
-
this.sdkInstance = _sdkInstance;
|
|
16
|
-
this.initStoreListener();
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
lifetimes: {
|
|
20
|
-
detached() {
|
|
21
|
-
// 组件销毁时清除监听
|
|
22
|
-
this.unsub && this.unsub();
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
methods: {
|
|
26
|
-
// 初始化 store 监听
|
|
27
|
-
initStoreListener() {
|
|
28
|
-
this.unsub = this.sdkInstance.store.get({
|
|
29
|
-
likeCount: (val) => {
|
|
30
|
-
if (val !== undefined) {
|
|
31
|
-
let num = Number(val)
|
|
32
|
-
if (num >= 10000) {
|
|
33
|
-
const n = Math.floor((num / 10000) * 10) / 10;
|
|
34
|
-
if (n > 9999.9) {
|
|
35
|
-
num = '9999.9+w';
|
|
36
|
-
} else {
|
|
37
|
-
num = n + 'w';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this.setData({
|
|
42
|
-
likeCount: num
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
// 处理点赞点击
|
|
49
|
-
handleLike() {
|
|
50
|
-
if (!this.properties.sdkInstance) return;
|
|
51
|
-
const interactServer = this.properties.sdkInstance.get('interactServer');
|
|
52
|
-
if (interactServer) {
|
|
53
|
-
interactServer.like();
|
|
54
|
-
}
|
|
55
|
-
// 触发点赞动画
|
|
56
|
-
this.giveParise();
|
|
57
|
-
},
|
|
58
|
-
// 随机算法闭包生成封装
|
|
59
|
-
randomAlgorithmFactory(array) {
|
|
60
|
-
const randomBase = Math.ceil(array.length / 2); // 随机选择前半边的元素
|
|
61
|
-
return function () {
|
|
62
|
-
const idx = Math.floor(randomBase * Math.random());
|
|
63
|
-
const eleArr = array.splice(idx, 1); // 选中的元素摘除
|
|
64
|
-
const ele = eleArr[0];
|
|
65
|
-
array.push(ele); // 塞到队尾
|
|
66
|
-
return ele;
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
// 单次渲染一个元素的动画
|
|
70
|
-
renderParise() {
|
|
71
|
-
const iconList = [
|
|
72
|
-
{
|
|
73
|
-
name: 'happy',
|
|
74
|
-
url: 'happy.png'
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'balloon',
|
|
78
|
-
url: 'balloon.png'
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'quitegood',
|
|
82
|
-
url: 'quitegood.png'
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'star',
|
|
86
|
-
url: 'star.png'
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: 'microphone',
|
|
90
|
-
url: 'microphone.png'
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'love',
|
|
94
|
-
url: 'love.png'
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'likes2',
|
|
98
|
-
url: 'likes2.png'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'likes',
|
|
102
|
-
url: 'likes.png'
|
|
103
|
-
}
|
|
104
|
-
];
|
|
105
|
-
const toTopAnimations = [
|
|
106
|
-
'zan-animation-01',
|
|
107
|
-
'zan-animation-02',
|
|
108
|
-
'zan-animation-03',
|
|
109
|
-
'zan-animation-04'
|
|
110
|
-
];
|
|
111
|
-
const shakeAnimations = [
|
|
112
|
-
'shake-animation-01',
|
|
113
|
-
'shake-animation-02',
|
|
114
|
-
'shake-animation-03',
|
|
115
|
-
'shake-animation-04'
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
const pickIcon = this.randomAlgorithmFactory([...iconList]); // 挑选图标
|
|
119
|
-
const pick2TopAnimations = this.randomAlgorithmFactory([...toTopAnimations]); // 挑选向上动画
|
|
120
|
-
const pickShakeTopAnimations = this.randomAlgorithmFactory([...shakeAnimations]); // 挑选左右摇摆动画
|
|
121
|
-
|
|
122
|
-
const selectedIcon = pickIcon();
|
|
123
|
-
const uuid = Date.now() + Math.random(); // 唯一id
|
|
124
|
-
const newItem = {
|
|
125
|
-
uuid,
|
|
126
|
-
icon: selectedIcon.name,
|
|
127
|
-
iconUrl: `https://cnstatic01.e.vhall.com/common-static/weapp/praise/img/${selectedIcon.url}`,
|
|
128
|
-
toTopAnimation: pick2TopAnimations(),
|
|
129
|
-
shakeTopAnimations: pickShakeTopAnimations()
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const eleList = this.data.eleList.concat(newItem);
|
|
133
|
-
this.setData({ eleList });
|
|
134
|
-
|
|
135
|
-
// 及时删除第一个被占位的元素
|
|
136
|
-
setTimeout(() => {
|
|
137
|
-
const newEleList = this.data.eleList.filter(item => item.uuid !== uuid);
|
|
138
|
-
this.setData({ eleList: newEleList });
|
|
139
|
-
}, 2000);
|
|
140
|
-
},
|
|
141
|
-
// 对外暴露的点赞函数
|
|
142
|
-
giveParise() {
|
|
143
|
-
const maxCount = 2; // 一次点赞最大渲染元素次数
|
|
144
|
-
const count = Math.ceil(Math.random() * maxCount);
|
|
145
|
-
for (let i = 0; i < count; i++) {
|
|
146
|
-
this.renderParise();
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<view class="praise-container">
|
|
2
|
-
<view class="praise-button" bindtap="handleLike">
|
|
3
|
-
<image class="praise-icon" src="https://cnstatic01.e.vhall.com/common-static/saas-wap/static/img/icon_like0.866359fe.png" mode="aspectFit"></image>
|
|
4
|
-
<view class="praise-count" wx:if="{{likeCount>0}}">{{likeCount}}</view>
|
|
5
|
-
</view>
|
|
6
|
-
|
|
7
|
-
<!-- 点赞动画区域 -->
|
|
8
|
-
<view class="zan-zone">
|
|
9
|
-
<view
|
|
10
|
-
wx:for="{{eleList}}"
|
|
11
|
-
wx:key="uuid"
|
|
12
|
-
class="zan-icon-wrapper {{item.toTopAnimation}}"
|
|
13
|
-
>
|
|
14
|
-
<image class="zan-icon {{item.shakeTopAnimations}}" src="{{item.iconUrl}}" mode="aspectFit"></image>
|
|
15
|
-
</view>
|
|
16
|
-
</view>
|
|
17
|
-
</view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.praise-button,.praise-container{position:relative}.praise-button{align-items:center;background:rgba(6,6,6,.25);border-radius:50%;display:flex;height:2rem;justify-content:center;width:2rem}.praise-button:active{transform:scale(.9)}.praise-icon{height:100%;width:100%}.praise-count{align-items:center;background-color:#ff4d4f;border:2rpx solid #fff;border-radius:16rpx;box-shadow:0 2rpx 8rpx rgba(255,77,79,.2);color:#fff;display:flex;font-size:.71rem;font-weight:700;height:32rpx;justify-content:center;min-width:32rpx;padding:0 8rpx;position:absolute;right:-8rpx;top:-8rpx}.zan-zone{bottom:100rpx;display:block;height:500rpx;pointer-events:none;position:fixed;right:0;width:100rpx;z-index:1000}.zan-icon-wrapper{bottom:0;display:block;left:0;opacity:0;position:absolute}.zan-icon{display:inline-block;height:70rpx;left:0;position:relative;width:70rpx}.zan-animation-01{animation:toTop 2s linear 0s}.zan-animation-02{animation:toTop 1.8s linear 0s}.zan-animation-03{animation:toTop 1.6s linear 0s}.zan-animation-04{animation:toTop 1.4s linear 0s}.zan-icon.shake-animation-01{animation:shake1 2s linear 0s}.zan-icon.shake-animation-02{animation:shake2 2s linear 0s}.zan-icon.shake-animation-03{animation:shake3 2s linear 0s}.zan-icon.shake-animation-04{animation:shake4 2s linear 0s}@keyframes toTop{0%{bottom:-40rpx;opacity:1;transform:scale(0)}10%{bottom:-20rpx;opacity:1;transform:scale(1)}50%{bottom:300rpx}60%{bottom:360rpx;opacity:.8}70%{bottom:420rpx}80%{bottom:480rpx}90%{bottom:600rpx}to{bottom:660rpx;opacity:0}}@keyframes shake1{0%{left:0}25%{left:-20rpx}50%{left:0}75%{left:-20rpx}to{left:0}}@keyframes shake2{0%{left:0}80%{left:-80rpx}to{left:-40rpx}}@keyframes shake3{0%{left:0}65%{left:-20rpx}to{left:30rpx}}@keyframes shake4{0%{left:0}20%{left:-30rpx}70%{left:40rpx}to{left:10rpx}}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { appendParamsToPath } from '../../../shared/utils.js';
|
|
2
|
-
|
|
3
|
-
Component({
|
|
4
|
-
properties: {
|
|
5
|
-
// SDK实例
|
|
6
|
-
sdkInstance: {
|
|
7
|
-
type: Object,
|
|
8
|
-
value: null,
|
|
9
|
-
observer: function(newVal) {
|
|
10
|
-
if (newVal) {
|
|
11
|
-
this.initStoreListener();
|
|
12
|
-
// 初始加载商品数据
|
|
13
|
-
const productServer = newVal.get('productServer');
|
|
14
|
-
if (productServer) {
|
|
15
|
-
productServer.getProductList();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
data: {
|
|
22
|
-
// 商品列表数据
|
|
23
|
-
products: []
|
|
24
|
-
},
|
|
25
|
-
lifetimes: {
|
|
26
|
-
attached() {
|
|
27
|
-
},
|
|
28
|
-
detached() {
|
|
29
|
-
// 组件卸载时移除store监听
|
|
30
|
-
if (this.unsub) {
|
|
31
|
-
this.unsub();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
methods: {
|
|
36
|
-
// 初始化store监听
|
|
37
|
-
initStoreListener() {
|
|
38
|
-
if (this.unsub) {
|
|
39
|
-
this.unsub();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.unsub = this.properties.sdkInstance.store.get({
|
|
43
|
-
productList: (val) => {
|
|
44
|
-
if (val) {
|
|
45
|
-
// 只显示 push_status == 1 的商品
|
|
46
|
-
const filteredProducts = val.filter(product => product.push_status === 1);
|
|
47
|
-
// 最多显示3个商品卡片
|
|
48
|
-
const products = filteredProducts.slice(0, 3);
|
|
49
|
-
this.setData({
|
|
50
|
-
products: products
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
// 点击商品卡片(打开详情)
|
|
57
|
-
onCardClick(e) {
|
|
58
|
-
const index = parseInt(e.currentTarget.dataset.index);
|
|
59
|
-
const product = this.data.products[index];
|
|
60
|
-
if (product) {
|
|
61
|
-
this.triggerEvent('cardClick', product);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
// 点击购买按钮(走购买逻辑)
|
|
65
|
-
onBuyClick(e) {
|
|
66
|
-
const index = parseInt(e.currentTarget.dataset.index);
|
|
67
|
-
const product = this.data.products[index];
|
|
68
|
-
if (!product) {
|
|
69
|
-
console.error('商品数据不存在');
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 检查是否已抢光或待开价
|
|
74
|
-
if (product.sale_status === 0 || product.covered_status === 1) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 检查 buy_type
|
|
79
|
-
if (product.buy_type === 4 && product?.mini_program_config?.mini_program_path) {
|
|
80
|
-
// 跳转到小程序路径
|
|
81
|
-
const webinarId = this.properties.sdkInstance.store.get('webinarId');
|
|
82
|
-
console.log("跳转小程序路径:", appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId }))
|
|
83
|
-
wx.navigateTo({
|
|
84
|
-
url: appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId })
|
|
85
|
-
});
|
|
86
|
-
} else if (product.buy_type === 1) {
|
|
87
|
-
// 触发购买事件,由父组件显示下单弹窗
|
|
88
|
-
this.triggerEvent('buyClick', product);
|
|
89
|
-
} else {
|
|
90
|
-
// 提示无法购买
|
|
91
|
-
wx.showToast({
|
|
92
|
-
title: '无法购买,请联系主办方',
|
|
93
|
-
icon: 'none',
|
|
94
|
-
duration: 2000
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
// 点击关闭按钮(通过改变本地数据关闭卡片)
|
|
99
|
-
onCloseCard(e) {
|
|
100
|
-
const productId = e.currentTarget.dataset.productId;
|
|
101
|
-
|
|
102
|
-
// 从本地数据中移除该商品
|
|
103
|
-
const updatedProducts = this.data.products.filter(product => product.goods_id !== productId);
|
|
104
|
-
this.setData({
|
|
105
|
-
products: updatedProducts
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<view class="product-card-container">
|
|
2
|
-
<block wx:for="{{products}}" wx:key="{{item.goods_id}}">
|
|
3
|
-
<view
|
|
4
|
-
class="product-card {{(item.sale_status === 0 || item.covered_status === 1) ? 'product-card-disabled' : ''}} {{products.length > 1 ? 'product-card-small' : ''}}"
|
|
5
|
-
>
|
|
6
|
-
<!-- 讲解中徽章 -->
|
|
7
|
-
<view class="product-card-badge">
|
|
8
|
-
<image class="product-card-badge-icon" src="https://cnstatic01.e.vhall.com/common-static/saas-wap/static/img/live.b07d13f4.gif" mode="heightFix"></image>
|
|
9
|
-
讲解中
|
|
10
|
-
</view>
|
|
11
|
-
|
|
12
|
-
<!-- 关闭按钮 -->
|
|
13
|
-
<view class="product-card-close" bindtap="onCloseCard" data-product-id="{{item.goods_id}}">x</view>
|
|
14
|
-
|
|
15
|
-
<!-- 商品图片(点击打开详情) -->
|
|
16
|
-
<view class="product-card-image" bindtap="onCardClick" data-index="{{index}}">
|
|
17
|
-
<image class="product-card-img"
|
|
18
|
-
src="{{item.cover_img || 'https://cnstatic01.e.vhall.com/common-static/images/default_avatar.png'}}"
|
|
19
|
-
mode="aspectFill"
|
|
20
|
-
></image>
|
|
21
|
-
<!-- 已抢光遮罩层 -->
|
|
22
|
-
<view wx:if="{{item.sale_status === 0}}" class="product-card-mask">
|
|
23
|
-
<text class="product-card-mask-text">已抢光</text>
|
|
24
|
-
</view>
|
|
25
|
-
</view>
|
|
26
|
-
|
|
27
|
-
<!-- 商品信息 -->
|
|
28
|
-
<view class="product-card-info">
|
|
29
|
-
<!-- 商品名称(点击打开详情) -->
|
|
30
|
-
<text class="product-card-title" bindtap="onCardClick" data-index="{{index}}">{{item.name || '商品名称'}}</text>
|
|
31
|
-
|
|
32
|
-
<!-- 价格和购买按钮 -->
|
|
33
|
-
<view class="product-card-price-container" bindtap="onBuyClick" data-index="{{index}}">
|
|
34
|
-
|
|
35
|
-
<block wx:if="{{item.covered_status === 1}}">
|
|
36
|
-
<text class="product-card-price">¥?</text>
|
|
37
|
-
</block>
|
|
38
|
-
<block wx:else>
|
|
39
|
-
<text class="product-card-price">¥{{item.discount_price || item.price || 0}}</text>
|
|
40
|
-
</block>
|
|
41
|
-
|
|
42
|
-
<image class="buy-icon" src="//cnstatic01.e.vhall.com/common-static/saas-wap/static/img/rob.4306d2b5.png" mode="heightFix" ></image>
|
|
43
|
-
</view>
|
|
44
|
-
</view>
|
|
45
|
-
</view>
|
|
46
|
-
</block>
|
|
47
|
-
</view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.product-card-container{align-items:flex-end;bottom:180rpx;display:flex;flex-direction:column;gap:16rpx;position:fixed;right:20rpx;z-index:999}.product-card{animation:slideIn .3s ease-out forwards;background-color:#fff;border-radius:12rpx;box-shadow:0 4rpx 12rpx rgba(0,0,0,.15);opacity:0;overflow:hidden;position:relative;transform:translateX(100%);width:240rpx}.product-card:first-child{animation-delay:0s}.product-card:nth-child(2){animation-delay:.1s}.product-card:nth-child(3){animation-delay:.2s}@keyframes slideIn{0%{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}.product-card-badge{background-color:rgba(0,0,0,.6);border-radius:30rpx;color:#fff;font-size:.71rem;left:8rpx;padding:4rpx 20rpx;position:absolute;top:8rpx;z-index:10}.product-card-badge .product-card-badge-icon{height:20rpx}.product-card-close{color:#fff;font-size:1.14rem;padding:0 14rpx;position:absolute;right:0rpx;top:0rpx;z-index:10}.product-card-image{height:240rpx;position:relative;width:100%}.product-card-image .product-card-img{height:100%;object-fit:cover;width:100%}.product-card-info{padding:12rpx}.product-card-title{color:#333;display:block;font-size:.86rem;font-weight:500;margin-bottom:12rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.product-card-price-container{align-items:center;background:#fb2626;border-radius:8rpx;color:#fff;display:flex;height:50rpx;justify-content:space-between;margin-top:12rpx;padding-left:10rpx}.product-card-buy{background-color:#ff4d4f;border-radius:6rpx;color:#fff;cursor:pointer;font-size:.71rem;padding:8rpx 16rpx}.product-card-mask{align-items:center;background-color:rgba(0,0,0,.4);bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.product-card-mask-text{border-radius:20rpx;color:#fff;font-size:.86rem;padding:8rpx 16rpx}.product-card-disabled{opacity:.7}.product-card-disabled .product-card-price{color:#fff}.product-card-disabled .product-card-price-container{opacity:.6}.buy-icon{display:block;height:100%}.product-card-small{width:180rpx}.product-card-small .product-card-image{height:180rpx}.product-card-small .product-card-price-container{height:40rpx}.product-card-small .product-card-badge{font-size:.64rem;padding:3rpx 16rpx}.product-card-small .product-card-close{font-size:1rem;padding:0 10rpx}.product-card-small .buy-icon{display:none}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { appendParamsToPath } from '../../../shared/utils.js';
|
|
2
|
-
Component({
|
|
3
|
-
properties: {
|
|
4
|
-
// 商品数据
|
|
5
|
-
product: {
|
|
6
|
-
type: Object,
|
|
7
|
-
value: {}
|
|
8
|
-
},
|
|
9
|
-
// 是否显示
|
|
10
|
-
show: {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
value: false
|
|
13
|
-
},
|
|
14
|
-
// SDK实例
|
|
15
|
-
sdkInstance: {
|
|
16
|
-
type: Object,
|
|
17
|
-
value: null,
|
|
18
|
-
observer: function(newVal) {
|
|
19
|
-
if (newVal) {
|
|
20
|
-
this.initStoreListener();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
data: {
|
|
26
|
-
// 当前显示的图片索引
|
|
27
|
-
currentImageIndex: 0
|
|
28
|
-
},
|
|
29
|
-
lifetimes: {
|
|
30
|
-
attached() {
|
|
31
|
-
// 组件挂载时初始化store监听
|
|
32
|
-
if (this.properties.sdkInstance) {
|
|
33
|
-
this.initStoreListener();
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
detached() {
|
|
37
|
-
// 组件卸载时移除store监听
|
|
38
|
-
if (this.unsub) {
|
|
39
|
-
this.unsub();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
observers: {
|
|
44
|
-
// 监听显示状态变化
|
|
45
|
-
show: function(show) {
|
|
46
|
-
if (show) {
|
|
47
|
-
// 重置数据
|
|
48
|
-
this.setData({
|
|
49
|
-
currentImageIndex: 0
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
methods: {
|
|
55
|
-
// 初始化store监听
|
|
56
|
-
initStoreListener() {
|
|
57
|
-
if (this.unsub) {
|
|
58
|
-
this.unsub();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.unsub = this.properties.sdkInstance.store.get({
|
|
62
|
-
productList: (val) => {
|
|
63
|
-
if (val && this.properties.product && this.properties.product.goods_id) {
|
|
64
|
-
// 检查当前商品是否在列表中
|
|
65
|
-
const currentProduct = val.find(item => item.goods_id === this.properties.product.goods_id);
|
|
66
|
-
if (currentProduct) {
|
|
67
|
-
// 如果商品在列表中,更新商品数据
|
|
68
|
-
this.setData({
|
|
69
|
-
product: currentProduct
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
// 关闭商品详情
|
|
77
|
-
closeDetail() {
|
|
78
|
-
this.setData({
|
|
79
|
-
show: false
|
|
80
|
-
});
|
|
81
|
-
this.triggerEvent('close');
|
|
82
|
-
},
|
|
83
|
-
// 购买商品
|
|
84
|
-
buyProduct() {
|
|
85
|
-
const product = this.data.product;
|
|
86
|
-
|
|
87
|
-
if (!product) {
|
|
88
|
-
console.error('商品数据不存在');
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 检查是否已抢光或待开价
|
|
93
|
-
if (product.sale_status === 0 || product.covered_status === 1) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// 检查 buy_type
|
|
98
|
-
if (product.buy_type === 4 && product?.mini_program_config?.mini_program_path) {
|
|
99
|
-
// 跳转到小程序路径
|
|
100
|
-
const webinarId = this.properties.sdkInstance.store.get('webinarId');
|
|
101
|
-
console.log("跳转小程序路径:", appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId }))
|
|
102
|
-
wx.navigateTo({
|
|
103
|
-
url: appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId })
|
|
104
|
-
});
|
|
105
|
-
this.closeDetail();
|
|
106
|
-
} else if (product.buy_type === 1) {
|
|
107
|
-
// 先关闭详情弹框
|
|
108
|
-
this.closeDetail();
|
|
109
|
-
// 触发购买事件,由父组件显示下单弹窗
|
|
110
|
-
this.triggerEvent('buy', product);
|
|
111
|
-
} else {
|
|
112
|
-
// 提示无法购买
|
|
113
|
-
wx.showToast({
|
|
114
|
-
title: '无法购买,请联系主办方',
|
|
115
|
-
icon: 'none',
|
|
116
|
-
duration: 2000
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
// 图片滑动切换
|
|
121
|
-
bindchange(e) {
|
|
122
|
-
this.setData({
|
|
123
|
-
currentImageIndex: e.detail.current
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|