diff --git a/pages/plugins/live/pull/components/like-button/like-button.vue b/pages/plugins/live/pull/components/like-button/like-button.vue index adfa2fe3..0c5e0f4a 100644 --- a/pages/plugins/live/pull/components/like-button/like-button.vue +++ b/pages/plugins/live/pull/components/like-button/like-button.vue @@ -15,7 +15,7 @@ - + @@ -33,13 +33,7 @@ showImgs: { // 显示图标路径 type: Array, default: () => { - return [ - 'https://new.shopxo.vip/static/plugins/live/images/like/like1.png', - 'https://new.shopxo.vip/static/plugins/live/images/like/like2.png', - 'https://new.shopxo.vip/static/plugins/live/images/like/like3.png', - 'https://new.shopxo.vip/static/plugins/live/images/like/like4.png', - 'https://new.shopxo.vip/static/plugins/live/images/like/like5.png', - ] + return [] } }, duration: { // 动画效果时间 @@ -52,7 +46,7 @@ }, high: { type: Number, - default: 360 + default: 200 }, width: { // 图标宽度 type: Number || String, @@ -77,9 +71,9 @@ site: { // x y 坐标 [x, y] type: Array || Object, default: () => { - return [122, 120] || { + return [122, 95] || { x: 122, - y: 100 + y: 95 } } }, @@ -134,7 +128,6 @@ timingFunction: 'ease-out', }) setTimeout(() => { - console.log('animation finished.') // 完成后事件回调 this.$emit('finished') // 逐渐消失 diff --git a/pages/plugins/live/pull/components/like-effect/like-effect.vue b/pages/plugins/live/pull/components/like-effect/like-effect.vue index 934cb236..cd585a41 100644 --- a/pages/plugins/live/pull/components/like-effect/like-effect.vue +++ b/pages/plugins/live/pull/components/like-effect/like-effect.vue @@ -1,9 +1,9 @@ @@ -169,6 +169,10 @@ liveConfig: { type: Object, default: () => {} + }, + liveShowImgs: { + type: Array, + default: () => [] } }, data() { @@ -176,6 +180,8 @@ application_client_type: app.globalData.application_client_type(), application_client_brand: app.globalData.application_client_brand(), goods_popup_status: false, + // 点赞计数 + like_count: 0, // 直播间配置信息 live_data: {}, userAvatar: '/static/images/common/user.png', @@ -277,7 +283,7 @@ watch: { liveConfig: { handler(new_value) { - if (new_value.data != null) { + if (new_value != null) { // 获取配置信息 this.live_data = new_value; } @@ -576,11 +582,23 @@ }); } }, + // 点击上边的时候会触发下边的按钮点击事件 + like_click(e) { + this.$refs.likeButton.handleClick(e); + }, + // 点赞计数 + like_button_click(e) { + this.like_count++; + }, handle_touch_end(event) { + //#ifdef APP-NVUE this.$emit("handleTouchEnd", event); + //#endif }, handle_double_click(event) { + //#ifdef APP-NVUE this.$emit("handleDoubleClick", event); + //#endif } } } diff --git a/pages/plugins/live/pull/mixins/mixins.js b/pages/plugins/live/pull/mixins/mixins.js index 9809f427..11c2387a 100644 --- a/pages/plugins/live/pull/mixins/mixins.js +++ b/pages/plugins/live/pull/mixins/mixins.js @@ -47,13 +47,15 @@ export default { methods: { init() { uni.showLoading({ - title: '直播间数据加载中...', + title: '直播数据加载中...', mask: true }); uni.request({ - url: app.globalData.get_request_url('index', 'room', 'live'), + url: app.globalData.get_request_url('detail', 'index', 'live'), method: 'POST', - data: {}, + data: { + live_room_id: 1 + }, dataType: 'json', success: (res) => { // 隐藏加载提示 @@ -62,9 +64,10 @@ export default { // 显示直播内容 this.is_loading = false; // 判断是否有数据 - if(res.data.code == 0) { + if(new_data.code == 0) { + this.like_show_imgs = new_data.data.like_icon_list || []; // 获取直播间信息 - this.live_config = new_data.data || {}; + this.live_config = new_data.data.room || {}; // 如果不存在拉流地址则认为直播已结束,避免因为报错导致的页面异常 // if (isEmpty(new_data.data.pull_flv_url)) { // this.is_live_ended = true; @@ -74,6 +77,7 @@ export default { title: new_data.msg || '获取直播间信息失败', icon: 'none' }); + this.is_live_ended = true; } }, fail: (err) => { @@ -85,14 +89,13 @@ export default { }); }, ended() { - console.log('1111'); this.is_live_ended = true; }, live_back() { app.globalData.page_back_prev_event(); }, // 处理鼠标双击事件 - handleDoubleClick(event) { + handle_double_click(event) { if (event.target.dataset.ignore) { return; } @@ -105,12 +108,16 @@ export default { this.lastLikeTime = currentTime; if (this.$refs.likeEffect) { - this.$refs.likeEffect.addLike(event); + this.$refs.likeEffect.add_like(event); + } + + if (this.$refs.liveContent) { + this.$refs.liveContent.like_click(event); } }, // 处理触屏双击事件 - handleTouchEnd(event) { + handle_touch_end(event) { if (event.target.dataset.ignore) { return; } @@ -143,7 +150,11 @@ export default { this.lastLikeTime = currentTime; if (this.$refs.likeEffect) { - this.$refs.likeEffect.addLike(event); + this.$refs.likeEffect.add_like(event); + } + + if (this.$refs.liveContent) { + this.$refs.liveContent.like_click(event); } } this.lastTapTime = currentTime; diff --git a/pages/plugins/live/pull/pull.nvue b/pages/plugins/live/pull/pull.nvue index 23e6da71..e42b1b2b 100644 --- a/pages/plugins/live/pull/pull.nvue +++ b/pages/plugins/live/pull/pull.nvue @@ -3,14 +3,14 @@ - +