安徽骏飞影业有限公司 - 微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

163 lines
3.7 KiB

// pages/home/home.js
var app = getApp()
import { getHome } from "../../api/home"
let that
Page({
/**
* 页面的初始数据
*/
data: {
bannerList: [],
yspList:[],
sjpcList:[],
ptssList:[],
kpxsList:[],
moreId:'',
},
// 获取首页数据
getHomeList() {
getHome({}).then(res => {
console.log(res)
if(res.code ==1) {
console.log(res.data.ad)
that.setData({
bannerList: res.data.ad,
yspList:res.data.yinshidapeng,
sjpcList:res.data.shijingpianchang,
ptssList:res.data.peitaosheshi,
kpxsList:res.data.kepianxinshang,
})
}
})
},
moretap(e){
// const id = e.currentTarget.dataset.id
that.setData({
moreId:e.currentTarget.dataset.id
})
app.globalData.id = that.data.moreId
wx.switchTab({
url: '/pages/setDisplay/setDisplay'
})
},
contactUs(e){
wx.switchTab({
url: '/pages/contactUs/contactUs'
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
that = this
wx.setNavigationBarTitle({
title: '首页',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
that.getTabBar().init();
that.getHomeList()
/* that.getList({
page: that.data.page,
limit: that.data.limit
})
that.getBannerList()
that.getTypeList()
that.setData({
minDate: new Date(new Date().getFullYear(), new Date().getMonth(), 1).getTime(),
maxDate: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).getTime(),
today: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()).getTime()
}) */
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// console.log("下拉刷新")
// that.setData({
// page: 1, // 每次触发下拉事件page=1
// })
// that.getList({
// page: 1,
// limit: that.data.limit,
// adCode: that.data.address ? that.data.address[1].code : '',
// labelId: that.data.curCate
// })
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// console.log("上拉加载")
// if(that.data.list.length < that.data.total) {
// that.setData({
// page: that.data.page + 1
// })
// that.getList({
// page: that.data.page,
// limit: that.data.limit,
// adCode: that.data.address ? that.data.address[1].code : '',
// labelId: value.detail ? value.detail : ''
// })
// }else {
// Toast('没有更多数据了')
// }
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
// 下拉
onPageScroll: function(e) {
if (e.scrollTop < 0) {
wx.pageScrollTo({
scrollTop: 0
})
}
}
})