From 7b950f425d01b74febcebb9a6506e1607c3a2a0f Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 06 八月 2024 09:44:21 +0800
Subject: [PATCH] ''
---
wechat_jiaxuan/pages/index/index.js | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/wechat_jiaxuan/pages/index/index.js b/wechat_jiaxuan/pages/index/index.js
index 710f6ed..d6602fa 100644
--- a/wechat_jiaxuan/pages/index/index.js
+++ b/wechat_jiaxuan/pages/index/index.js
@@ -12,6 +12,7 @@
eventBus
} from '../../utils/eventBus'
const app = getApp()
+var touchDot = 0; //瑙︽懜鏃剁殑鍘熺偣
Page({
/**
@@ -21,6 +22,8 @@
// 椤堕儴nav
topHeadStyle: 1,
top: 0,
+ open: false,
+ desc: true,
font_color: '#ffffff',
ZSZXCata: {},
@@ -56,6 +59,10 @@
// 宸茬粡鐧诲綍锛屽彲浠ヨ蛋渚濊禆token鐨勯�昏緫浜�
console.log('棣栭〉鐨刼nLoadLogin', options, `{"token":"${app.globalData.token}"}`);
this.initData()
+ const member = wx.getStorageSync('member')
+ this.setData({
+ member
+ })
},
onReady() {
const windowInfo = wx.getWindowInfo()
@@ -75,7 +82,6 @@
this.setData({
member
})
-
eventBus.once("reloadHome", () => {
console.log('reloadHome');
this.onLoad()
@@ -85,7 +91,7 @@
onLoad(options) {
console.log(options)
this.initDictData()
- this.initData()
+ // this.initData()
},
changePath(e) {
let index = e.currentTarget.dataset.type
@@ -121,6 +127,7 @@
url: '/pages/design/design'
})
} else {
+ wx.setStorageSync('tempPath', '/pages/design/design')
wx.navigateTo({
url: '/pages/auth/auth',
})
@@ -149,16 +156,16 @@
initData() {
// 杞挱
getHomeBanner().then(res => {
- this.setData({
- bannerList: res.data
- })
+ if(res.data){
+ this.setData({ bannerList: res.data })
+ }
})
// 浜у搧瑙嗛
getZhongTaiVideoPage({
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
})
@@ -175,7 +182,7 @@
pageSize: 6,
pageNum: 1
}).then(res => {
- if (res.data) {
+ if (res.data && res.data.records) {
this.setData({
consultList: res.data.records
})
@@ -375,13 +382,32 @@
id
})
},
+ hdBtn() {
+ this.setData({ showWhiteHead: true, open: true,font_color: "#000000", sty: '',topHeadStyle: 1, desc: false })
+ },
+ touchStart: function (e) {
+ touchDot = e.touches[0].pageY;
+ },
+ touchMove: function (e) {
+ var touchMove = e.touches[0].pageY;
+ if (touchMove - touchDot <= 0 && this.data.top <= 1 && this.data.desc) {
+ this.setData({ showWhiteHead: true, open: false, desc: false })
+ setTimeout(() => {
+ this.setData({ open: true, sty: '' })
+ }, 1000)
+ }
+ if (touchMove - touchDot >= 50 && this.data.top <= 1 && !this.data.desc) {
+ this.setData({ showWhiteHead: false, open: false, desc: true, sty: 'overflow: hidden;' })
+ }
+ },
onPageScroll(e) {
const { videoTop, windowHeight, videoPlay } = this.data
- if(e.scrollTop - 100 > videoTop - (windowHeight / 2) && videoPlay ){
+ 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