|
|
|
// 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: [] , // 分类列表
|
|
|
|
cName:'', //筛选企业/个人
|
|
|
|
resourceCagetoryId: '' //筛选分类
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
loading: true,
|
|
|
|
page: 1,
|
|
|
|
size: 10
|
|
|
|
})
|
|
|
|
if(e.currentTarget.dataset.i == 2){
|
|
|
|
this.getCompanyList()
|
|
|
|
} else{
|
|
|
|
this.getPageData()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showDialog(){
|
|
|
|
this.setData({
|
|
|
|
showScreenDialog: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
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,
|
|
|
|
resourceCagetoryId: item.id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
businessChange(e){
|
|
|
|
let type = e.currentTarget.dataset.type
|
|
|
|
this.setData({cName: type})
|
|
|
|
},
|
|
|
|
finishClick(){
|
|
|
|
this.setData({loading: true,page: 1, size: 10})
|
|
|
|
this.getPageData()
|
|
|
|
this.setData({
|
|
|
|
showScreenDialog: false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
resetClick(){
|
|
|
|
this.setData({
|
|
|
|
cName: '',
|
|
|
|
cagetoryActive: null,
|
|
|
|
resourceCagetoryId:''
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getPageData(){
|
|
|
|
if(this.data.loading){
|
|
|
|
app.http('post','Resources/listResources',{
|
|
|
|
resourceType: this.data.active,
|
|
|
|
page: this.data.page,
|
|
|
|
pagesize:this.data.pagesize,
|
|
|
|
resourceCagetoryId:this.data.resourceCagetoryId,
|
|
|
|
cName: this.data.cName,
|
|
|
|
}).then((res)=>{
|
|
|
|
if(res.data.success){
|
|
|
|
if(res.data.data.content.length < this.data.pagesize){
|
|
|
|
this.setData({
|
|
|
|
loading: false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if(this.data.page > 1){
|
|
|
|
this.setData({
|
|
|
|
list: this.data.list.concat(res.data.data.content)
|
|
|
|
})
|
|
|
|
} else{
|
|
|
|
this.setData({
|
|
|
|
list: 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 () {
|
|
|
|
this.getPageData()
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|