From 2c08a98f7e85ec7c9376f27a7933e75e44d672f7 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 27 八月 2024 15:52:59 +0800
Subject: [PATCH] ll
---
wechat_staff/pages/index/index.js | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/wechat_staff/pages/index/index.js b/wechat_staff/pages/index/index.js
index 39f047c..8507d8d 100644
--- a/wechat_staff/pages/index/index.js
+++ b/wechat_staff/pages/index/index.js
@@ -19,6 +19,10 @@
serviceHeight: 0,
serviceList: [],
+ videoTop: 0,
+ windowHeight: 0,
+ videoPlay: true,
+
bannerSwiperOption: {
indicatorDots: true,
vertical: false,
@@ -37,13 +41,25 @@
onShow() {
this.initData()
},
+ onReady() {
+ const windowInfo = wx.getWindowInfo()
+ setTimeout(() => {
+ const query = wx.createSelectorQuery()
+ query.select('.product_video').boundingClientRect(function (rect) {
+ rect.top // 鑺傜偣鐨勪笂杈圭晫鍧愭爣
+ rect.bottom // 鑺傜偣鐨勪笅杈圭晫鍧愭爣
+ }).exec(res => {
+ this.setData({ videoTop: res[0].top,windowHeight: windowInfo.windowHeight})
+ })
+ }, 2000)
+ },
initData() {
// 姣忔棩涓婃柊
getDailyUpdates({
fileType: '0'
}).then(res => {
this.setData({
- DailyUpdates: res.data
+ DailyUpdates: res.data || {}
})
})
// 浜у搧瑙嗛
@@ -51,7 +67,7 @@
pageSize: 1,
pageNum: 1
}).then(res => {
- if (res.data.records && res.data.records.length > 0) {
+ if (res.data && res.data.records && res.data.records.length > 0) {
this.setData({
productVideo: res.data.records
})
@@ -102,6 +118,21 @@
})
})
},
+ bindVideoPlay() {
+ const { id } = this.data.productVideo[0]
+ actionDo({
+ actionType: 'view',
+ id
+ })
+ },
+ onPageScroll(e) {
+ const { videoTop, windowHeight, videoPlay } = this.data
+ if(e.scrollTop + 60 > videoTop - (windowHeight / 2) && videoPlay ){
+ this.setData({ videoPlay: false })
+ let videoplay = wx.createVideoContext('myvideo', this)
+ videoplay.play();
+ }
+ },
promotionClick() {
wx.navigateTo({
url: '/pages/promotion/index',
--
Gitblit v1.9.3