会员模块
This commit is contained in:
105
pages/index/index.js
Normal file
105
pages/index/index.js
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
videoState : true, //第一个视频是否加载
|
||||
videoFlx : false, //视频定位
|
||||
videos : '',
|
||||
isFixedTop : 0,
|
||||
barHeight : getApp().globalData.statusBarHeight, // 状态栏高度
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {
|
||||
// 邀请码
|
||||
if(options.invite) {
|
||||
this.setData({
|
||||
inviteCode : options.invite
|
||||
})
|
||||
wx.setStorage({
|
||||
key : 'inviteData',
|
||||
data : options.invite
|
||||
})
|
||||
}
|
||||
console.log(wx.getStorageSync("inviteData"))
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow () {
|
||||
// 获取首页数据
|
||||
this.indexInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
*/
|
||||
indexInfo () {
|
||||
wx.$api.index.home().then(res => {
|
||||
this.setData({
|
||||
goodsArr : res.data.goods,
|
||||
videos : res.data.videos[0],
|
||||
healthsArr : res.data.healths,
|
||||
datas : res.data.memories,
|
||||
categories : res.data.categories
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听页面滚动
|
||||
*/
|
||||
bestScroll(e){
|
||||
if(e.detail.scrollTop >= this.data.systInfo.safeArea.width && !this.data.videoFlx){
|
||||
this.setData({
|
||||
videoFlx: true
|
||||
})
|
||||
}else if(e.detail.scrollTop < this.data.systInfo.safeArea.width && this.data.videoFlx){
|
||||
this.setData({
|
||||
videoFlx: false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 第一个播放进度变化时触发
|
||||
bindloadedOne() {
|
||||
this.setData({
|
||||
videoState: false
|
||||
})
|
||||
},
|
||||
|
||||
// 第二个播放进度变化时触发
|
||||
bindloadedTwo() {
|
||||
this.setData({
|
||||
videoFilex: false
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听页面滑动事件
|
||||
*/
|
||||
onPageScroll(e) {
|
||||
this.setData({
|
||||
isFixedTop: parseInt(e.scrollTop)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转文章列表
|
||||
*/
|
||||
tapMore(e){
|
||||
wx.navigateTo({
|
||||
url: '/pages/article/index?type=' + e.currentTarget.dataset.type
|
||||
})
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user