Files
AGuestSaas/pages/home/index.js
2020-12-28 10:38:29 +08:00

81 lines
1.9 KiB
JavaScript

Page({
/**
* 页面的初始数据
*/
data: {
selectMenuId: 0, //默认是企业信息0 视频1 活动2 项目筹集3
company_id: wx.getStorageSync('company_id'), //企业Id,
info: '', //企业信息
},
onLoad(e) {
console.log(e)
if(e.id){
this.company(e.id)
wx.setStorageSync('company_id', e.id)
}else{
this.company(this.company_id)
}
},
onShow() {
},
onUnload: function () {
wx.removeStorageSync('company_id')
},
/**
* 点击按钮触发事件
*/
menuSelect: function (e) {
console.log(e.currentTarget.dataset.id);
if (this.data.selectMenuId != e.currentTarget.dataset.id) {
this.setData({
selectMenuId: e.currentTarget.dataset.id
})
if (e.currentTarget.dataset.id == 3) {
this.selectComponent('#categoryTypeList').crowdfundcategory(this.data.company_id);
} else if (e.currentTarget.dataset.id == 2) {
this.selectComponent('#activeList').actives();
} else if (e.currentTarget.dataset.id == 4) {
this.selectComponent('#noticeList').actives();
}
}
},
/**
* 上拉触底事件
*/
onReachBottom() {
if (this.data.selectMenuId == 3) {
console.log('项目筹集触底')
this.selectComponent('#categoryTypeList').crowdfunds();
}
if (this.data.selectMenuId == 2) {
console.log('活动触底')
this.selectComponent('#activeList').actives();
}
if (this.data.selectMenuId == 4) {
console.log('动态触底')
this.selectComponent('#noticeList').actives();
}
},
/**
* 请求项目筹集分类接口
*/
company() {
wx.$api.companyModule.company(this.data.company_id, this.data.page).then(res => {
console.log(res)
this.setData({
info: res
})
})
},
/**
* 拨打电话
*/
call() {
wx.makePhoneCall({
phoneNumber: this.data.info.certification.phone,
})
}
})