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.
265 lines
6.8 KiB
265 lines
6.8 KiB
// 获取应用实例 |
|
var Api = require('../../utils/common.js'); |
|
var re = require('../../utils/request.js'); |
|
const app = getApp() |
|
|
|
Page({ |
|
data: { |
|
logo:'../../images/logo.jpg', |
|
imgUrls:[ '/images/logo.jpg'], |
|
twoImages:[], |
|
fiveImages:[], |
|
fourImages:[], |
|
youlike:[], |
|
threeImages:[], |
|
wonderPerson:[ |
|
{img:'/images/ava.png',user:'1',name:'Boonas',intro:'行在路上乐在其中!行在路上乐在其中!'}, |
|
{img:'/images/ava.png',user:'1',name:'Boonas',intro:'行在路上乐在其中!行在路上乐在其中!'}, |
|
{img:'/images/ava.png',user:'1',name:'Boonas',intro:'行在路上乐在其中!行在路上乐在其中!'} |
|
], |
|
clubpage:'1' |
|
}, |
|
toSearch:function(){ |
|
wx.navigateTo({ |
|
url: './search/search' |
|
}) |
|
}, |
|
toTypeList:function(e){ |
|
// wx.navigateTo({ |
|
// url: './activeList/activeList?id='+e.currentTarget.dataset.id+'' |
|
// }) |
|
wx.navigateTo({ |
|
url: '../club/clublist/clublist?id='+e.currentTarget.dataset.id+'' |
|
}) |
|
}, |
|
toactiveing:function(){ |
|
wx.navigateTo({ |
|
url: './activeing/activeing?pid=1' |
|
}) |
|
}, |
|
torank:function(){ |
|
wx.navigateTo({ |
|
url: './rank/rank' |
|
}) |
|
}, |
|
toactiveDetail:function(e){ |
|
wx.navigateTo({ |
|
url: './activeDetail/activeDetail?id='+e.currentTarget.dataset.id+'' |
|
}) |
|
}, |
|
// 事件处理函数 |
|
bindViewTap() { |
|
wx.navigateTo({ |
|
url: '../logs/logs' |
|
}) |
|
}, |
|
onLoad() { |
|
this.getbanner(); |
|
}, |
|
onShow: function () { |
|
this.hotActive(); |
|
this.getLike(); |
|
this.getRankActive(); |
|
this.getRecommendActive(); |
|
this.getclubCircle(); |
|
this.getClubing(); |
|
}, |
|
getbanner:function(){ |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
re.request(Api.getbanner(), '', header).then((res) => { |
|
let datas = res.data.data; |
|
that.setData({ |
|
imgUrls:datas |
|
}) |
|
console.log(this.data.imgUrls,'logloglog'); |
|
}) |
|
}, |
|
hotActive:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData = { |
|
pageSize: 4, |
|
pageNum: 1 |
|
} |
|
re.request(Api.hotActive(), postData, header).then((res) => { |
|
let datas = res.data.rows; |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].activityLogo){ |
|
datas[i].activityLogo = imgUrl + datas[i].activityLogo |
|
} |
|
datas[i].startTime = datas[i].startTime.slice(5,10) |
|
} |
|
that.setData({ |
|
fourImages:datas |
|
}) |
|
}) |
|
}, |
|
getLike:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData = { |
|
pageSize: 8, |
|
pageNum: 1 |
|
} |
|
re.request(Api.getLike(), postData, header).then((res) => { |
|
let datas = res.data.rows; |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].activityLogo){ |
|
datas[i].activityLogo = imgUrl + datas[i].activityLogo |
|
} |
|
datas[i].startTime = datas[i].startTime.slice(5,10) |
|
} |
|
that.setData({ |
|
youlike:datas |
|
}) |
|
}) |
|
}, |
|
getRankActive:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData = { |
|
pageSize: 10, |
|
pageNum: 1 |
|
} |
|
re.request(Api.getRankActive(), postData, header).then((res) => { |
|
let datas = res.data.rows; |
|
console.log(datas.length,1111111111) |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].activityLogo){ |
|
datas[i].activityLogo = imgUrl + datas[i].activityLogo |
|
} |
|
datas[i].startTime = datas[i].startTime.slice(5,10) |
|
} |
|
that.setData({ |
|
threeImages:datas |
|
}) |
|
}) |
|
}, |
|
getRecommendActive:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData = { |
|
pageSize: 2, |
|
pageNum: 1 |
|
} |
|
re.request(Api.getRecommendActive(), postData, header).then((res) => { |
|
let datas = res.data.rows; |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].activityLogo){ |
|
datas[i].activityLogo = imgUrl + datas[i].activityLogo |
|
datas[i].coverFirstImage = imgUrl + datas[i].coverFirstImage |
|
} |
|
} |
|
console.log(datas) |
|
that.setData({ |
|
twoImages:datas |
|
}) |
|
}) |
|
}, |
|
getClubing:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData = { |
|
pageSize: 3, |
|
pageNum: 1 |
|
} |
|
re.request(Api.getClubing(), postData, header).then((res) => { |
|
let datas = res.data.rows; |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].clubLogo){ |
|
datas[i].clubLogo = imgUrl + datas[i].clubLogo |
|
} |
|
} |
|
that.setData({ |
|
wonderPerson:datas |
|
}) |
|
}) |
|
}, |
|
changeing:function(){ |
|
var that = this; |
|
var page = that.data.clubpage; |
|
page++; |
|
const imgUrl = wx.getStorageSync('imgUrl'); |
|
|
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData = { |
|
pageSize: 3, |
|
pageNum: page |
|
} |
|
re.request(Api.getClubing(), postData, header).then((res) => { |
|
let datas = res.data.rows; |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].clubLogo){ |
|
datas[i].clubLogo = imgUrl + datas[i].clubLogo |
|
} |
|
} |
|
|
|
if(datas.length==0){ |
|
wx.showToast({ |
|
title: '已经没有数据了', |
|
icon:'error' |
|
}) |
|
return |
|
} |
|
that.setData({ |
|
wonderPerson:datas, |
|
clubpage: page, |
|
}) |
|
console.log(this.data.wonderPerson,this.data.clubpage); |
|
}) |
|
}, |
|
gotojulebu(e){ |
|
wx.navigateTo({ |
|
url: '../club/clubDetail/clubDetail?id='+e.currentTarget.dataset.id, |
|
}) |
|
}, |
|
getclubCircle:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
re.request(Api.getclubCircle(), '', header).then((res) => { |
|
let datas = res.data.data; |
|
for(let i=0;i<datas.length;i++){ |
|
if(datas[i].typeImg){ |
|
datas[i].typeImg = imgUrl + datas[i].typeImg |
|
} |
|
} |
|
console.log(datas) |
|
that.setData({ |
|
fiveImages:datas |
|
}) |
|
}) |
|
}, |
|
// clubCircle |
|
|
|
})
|
|
|