131 lines
2.6 KiB
JavaScript
131 lines
2.6 KiB
JavaScript
import _ from '../../commons/js/commons'
|
|
const app = getApp()
|
|
Page({
|
|
|
|
//页面的初始数据
|
|
data: {
|
|
imgUrl:_.config.imgUrl,
|
|
swiperOptions: {
|
|
indicatorDots: false,
|
|
vertical: false,
|
|
autoplay: false,
|
|
interval: 4000,
|
|
duration: 1000,
|
|
items: 1,
|
|
circular: false,
|
|
current: 0
|
|
},
|
|
swiperCurrent: 0,
|
|
list: [],
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
},
|
|
|
|
//生命周期函数--监听页面加载
|
|
onLoad: function (options) {
|
|
|
|
for (let key in options) {
|
|
this.setData({
|
|
[key]: options[key]
|
|
})
|
|
}
|
|
|
|
this.getAppSytactivityTabs()
|
|
this.getAppSytactivityList()
|
|
|
|
},
|
|
|
|
//私域通_tab
|
|
getAppSytactivityTabs(){
|
|
_.apiQuery.getAppSytactivityTabs().then(res => {
|
|
this.setData({
|
|
bg_img:res.data.bg_img,
|
|
menus:res.data.menus,
|
|
})
|
|
wx.setNavigationBarTitle({
|
|
title:res.data.title,
|
|
})
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//活动列表
|
|
getAppSytactivityList(){
|
|
this.setData({
|
|
load: false,
|
|
loading: true,
|
|
})
|
|
let params = {};
|
|
params['page'] = this.data.pageNo;
|
|
params['size'] = 10;
|
|
_.apiQuery.getAppSytactivityList(params).then(res => {
|
|
this.setData({
|
|
pageNo: this.data.pageNo + 1,
|
|
list: this.data.list.concat(res.data.list),
|
|
load: true,
|
|
loading: false,
|
|
})
|
|
if (res.data.total == 0) {
|
|
this.setData({
|
|
noData: true
|
|
})
|
|
} else if (this.data.list.length == res.data.total) {
|
|
this.setData({
|
|
end: true
|
|
})
|
|
}
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//数据分组
|
|
getIconByGroup(list) {
|
|
let arr = []
|
|
if (list.length > 3) {
|
|
for (var i = 0; i < list.length; i += 3) {
|
|
arr.push(list.slice(i, i + 3));
|
|
}
|
|
} else {
|
|
arr.push(list)
|
|
}
|
|
return arr
|
|
},
|
|
|
|
//切换icon轮播
|
|
swiperChange: function (e) {
|
|
this.setData({
|
|
swiperCurrent: e.detail.current // current 改变时会触发 change 事件
|
|
})
|
|
},
|
|
|
|
//推送链接
|
|
pushLink(e) {
|
|
if(e.currentTarget.dataset.url){
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
}
|
|
},
|
|
|
|
//页面相关事件处理函数--监听用户下拉动作
|
|
onPullDownRefresh(){
|
|
this.setData({
|
|
list: [],
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
})
|
|
this.getAppSytactivityTabs()
|
|
this.getAppSytactivityList()
|
|
},
|
|
|
|
//页面上拉触底事件的处理函数
|
|
onReachBottom(){
|
|
if (this.data.noData || this.data.end||!this.data.load) return;
|
|
this.getAppSytactivityList()
|
|
},
|
|
|
|
}) |