From e6e0218a1abd7395d00ade401c6ea6a02e7c3ece Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 01 八月 2024 18:20:28 +0800
Subject: [PATCH] lll
---
wechat_jiaxuan/pages/index/index.js | 78 ++++++++++++++++++++++++++++++---------
1 files changed, 60 insertions(+), 18 deletions(-)
diff --git a/wechat_jiaxuan/pages/index/index.js b/wechat_jiaxuan/pages/index/index.js
index 097386a..02195f8 100644
--- a/wechat_jiaxuan/pages/index/index.js
+++ b/wechat_jiaxuan/pages/index/index.js
@@ -8,7 +8,9 @@
getZhongTaiVideoPage,
getZhongTaiProductNewsPage
} from '../../api/index'
-import { eventBus } from '../../utils/eventBus'
+import {
+ eventBus
+} from '../../utils/eventBus'
const app = getApp()
Page({
@@ -31,6 +33,10 @@
consultList: [],
consultImgHeight: 0,
+ videoTop: 0,
+ windowHeight: 0,
+ videoPlay: true,
+
productVideo: {},
bannerSwiperOption: {
indicatorDots: true,
@@ -46,15 +52,31 @@
HOME_CLASS_B2: '',
HOME_CLASS_C: '',
},
- onLoadLogin(options){
+ onLoadLogin(options) {
// 宸茬粡鐧诲綍锛屽彲浠ヨ蛋渚濊禆token鐨勯�昏緫浜�
- console.log('棣栭〉鐨刼nLoadLogin',options,`{"token":"${app.globalData.token}"}`);
+ console.log('棣栭〉鐨刼nLoadLogin', options, `{"token":"${app.globalData.token}"}`);
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 => {
+ console.log('res', res);
+ console.log(windowInfo.windowHeight)
+ this.setData({ videoTop: res[0].top,windowHeight: windowInfo.windowHeight})
+ })
+ }, 2000)
},
onShow() {
const member = wx.getStorageSync('member')
- this.setData({ member })
-
+ this.setData({
+ member
+ })
+
eventBus.once("reloadHome", () => {
console.log('reloadHome');
this.onLoad()
@@ -88,16 +110,16 @@
})
break;
case '2':
- if(member && member.phone){
+ if (member && member.phone) {
wx.navigateTo({
url: '/pages/design/design'
})
- }else{
+ } else {
wx.navigateTo({
url: '/pages/auth/auth',
})
}
-
+
// wx.navigateTo({
// url: '/pages/wonderful_activity/index',
// success: function(res) {
@@ -209,11 +231,16 @@
},
videoClick(e) {
const {
- videourl
+ videourl,
+ id
} = e.currentTarget.dataset
- let videoPlay = this.selectComponent('.videoPlay');
- if(videoPlay){
- videoPlay.startPlayVideo(videourl,this );
+ actionDo({
+ actionType: 'view',
+ id
+ })
+ let videoPlay = this.selectComponent('.videoPlay');
+ if (videoPlay) {
+ videoPlay.startPlayVideo(videourl, this);
}
// wx.previewMedia({
// sources: [{
@@ -254,17 +281,20 @@
actionType: 'view',
id: item.id
})
- if(item.contentType == 'link'){
+ if (item.contentType == 'link') {
wx.navigateTo({
url: '/pages/webView/index',
- success: function(res) {
+ success: function (res) {
// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
- res.eventChannel.emit('acceptDataFromOpenerPage', { link: item.content, title: item.title })
+ res.eventChannel.emit('acceptDataFromOpenerPage', {
+ link: item.content,
+ title: item.title
+ })
}
})
- }else{
+ } else {
wx.navigateTo({
- url: '/pages/consult/detail?id='+item.id,
+ url: '/pages/consult/detail?id=' + item.id,
})
}
// wx.navigateTo({
@@ -332,8 +362,20 @@
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
*/
-
+ bindVideoPlay() {
+ const { id } = this.data.productVideo[0]
+ actionDo({
+ actionType: 'view',
+ id
+ })
+ },
onPageScroll(e) {
+ const { videoTop, windowHeight, videoPlay } = this.data
+ if(e.scrollTop - 100 > videoTop - (windowHeight / 2) && videoPlay ){
+ this.setData({ videoPlay: false })
+ let videoplay = wx.createVideoContext('myvideo', this)
+ videoplay.play();
+ }
let scrollTop = e.scrollTop / 100
if (scrollTop <= 0.1) {
this.setData({
--
Gitblit v1.9.3