|
|
|
// pages/demandHall/index.js
|
|
|
|
const app = getApp();
|
|
|
|
Page({
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
tabbar: {},
|
|
|
|
active: '1', // 1资源供应,2需求广场
|
|
|
|
tabActive: '1', // 1资源列表,2企业列表
|
|
|
|
list: [],
|
|
|
|
showScreenDialog: false,
|
|
|
|
companyList: [],
|
|
|
|
pagesize: 10,
|
|
|
|
page: 1,
|
|
|
|
loading: true, //是否加载更多
|
|
|
|
cagetoryList: [] , // 分类列表
|
|
|
|
},
|
|
|
|
topTabClick(e){
|
|
|
|
this.setData({
|
|
|
|
active: e.currentTarget.dataset.i,
|
|
|
|
loading: true,
|
|
|
|
pagesize: 10,
|
|
|
|
page: 1,
|
|
|
|
list: []
|
|
|
|
})
|
|
|
|
this.getPageData()
|
|
|
|
},
|
|
|
|
tabClick(e){
|
|
|
|
this.setData({
|
|
|
|
tabActive: e.currentTarget.dataset.i
|
|
|
|
})
|
|
|
|
if(e.currentTarget.dataset.i == 2){
|
|
|
|
this.getCompanyList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showDialog(){
|
|
|
|
this.setData({
|
|
|
|
showScreenDialog: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
finishClick(){
|
|
|
|
this.setData({
|
|
|
|
showScreenDialog: false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toResourceDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/demandHall/resourcesDetail/index?id='+id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toCompanyDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/demandHall/companyDetail/index?id='+id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toNeedsDetail(e){
|
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/demandHall/needsDetail/index?id='+id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
app.editTabbar()
|
|
|
|
this.getPageData()
|
|
|
|
this.getCagetoryList()
|
|
|
|
},
|
|
|
|
getCagetoryList(){
|
|
|
|
app.http('get','ResourcesCagetory/listResourcesCagetory').then((res)=>{
|
|
|
|
if(res.data.success){
|
|
|
|
this.setData({
|
|
|
|
cagetoryList: res.data.data
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
cagetoryClick(e){
|
|
|
|
let item = e.currentTarget.dataset.item
|
|
|
|
let i = e.currentTarget.dataset.i
|
|
|
|
this.setData({
|
|
|
|
cagetoryActive: i
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getPageData(){
|
|
|
|
if(this.data.loading){
|
|
|
|
app.http('post','Resources/listResources',{
|
|
|
|
resourceType: this.data.active,
|
|
|
|
page: this.data.page,
|
|
|
|
pagesize:this.data.pagesize
|
|
|
|
}).then((res)=>{
|
|
|
|
if(res.data.success){
|
|
|
|
if(res.data.data.content.length < this.data.pagesize){
|
|
|
|
this.setData({
|
|
|
|
loading: false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
list: this.data.list.concat(res.data.data.content)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
getCompanyList(){
|
|
|
|
app.http('post','Enterprise/listEnterprise',{}).then((res)=>{
|
|
|
|
if(res.data.success){
|
|
|
|
this.setData({
|
|
|
|
companyList: res.data.data.content
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
this.setData({
|
|
|
|
page: this.data.page + 1
|
|
|
|
})
|
|
|
|
this.getPageData()
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|