|
|
@@ -10,7 +10,6 @@ Page({ |
|
|
|
data: { |
|
|
|
// 页面Loading |
|
|
|
pageLoading: true, |
|
|
|
customerId: null, |
|
|
|
// 路由接受的参数 |
|
|
|
currentData: {}, |
|
|
|
// 感兴趣的需求---- |
|
|
@@ -26,8 +25,10 @@ Page({ |
|
|
|
onRefresh: true, |
|
|
|
currentIndex: -1, |
|
|
|
// 当前登录器用户登录ID |
|
|
|
userCustomerId: null, |
|
|
|
customerId: null, |
|
|
|
businessCommunicationDemandId: "", |
|
|
|
// 热门加载loading |
|
|
|
hotLoading: false, |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@@ -45,29 +46,21 @@ Page({ |
|
|
|
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; |
|
|
|
if (businessCommunicationCustomer) { |
|
|
|
this.setData({ |
|
|
|
userCustomerId: businessCommunicationCustomer.customerId |
|
|
|
customerId: businessCommunicationCustomer.customerId |
|
|
|
}) |
|
|
|
} |
|
|
|
// 获取当前数据 |
|
|
|
this.getCurrentData(); |
|
|
|
if (app.globalData.customerId) { |
|
|
|
this.setData({ |
|
|
|
customerId: app.globalData.customerId |
|
|
|
}) |
|
|
|
// this.getIsCollect(); |
|
|
|
} else { |
|
|
|
this.getListData(); |
|
|
|
} |
|
|
|
// 设置当前访问量 |
|
|
|
this.setDemandCollect(); |
|
|
|
this.setDemandCollect(); |
|
|
|
}, |
|
|
|
setDemandCollect(){ |
|
|
|
setDemandCollect() { |
|
|
|
let businessCommunicationDemandId = this.data.businessCommunicationDemandId; |
|
|
|
$request.post('/statisticsBusinessCommunicationDemand/saveDemandCollect.action', |
|
|
|
{ businessCommunicationDemandId } |
|
|
|
).then(res => { }).catch(err => { console.log(err) }) |
|
|
|
$request.post('/statisticsBusinessCommunicationDemand/demandPageView.action', |
|
|
|
{ businessCommunicationDemandId,customerId: app.globalData.customerId } |
|
|
|
{ businessCommunicationDemandId, customerId: this.data.customerId } |
|
|
|
).then(res => { }).catch(err => { console.log(err) }) |
|
|
|
}, |
|
|
|
// 热门详情点击 |
|
|
@@ -88,12 +81,14 @@ Page({ |
|
|
|
}); |
|
|
|
}, |
|
|
|
getCurrentData() { |
|
|
|
let { businessCommunicationDemandId } = this.data; |
|
|
|
let { businessCommunicationDemandId, customerId } = this.data; |
|
|
|
let paramCustomerId = customerId ? customerId * 1 : null; |
|
|
|
console.log(paramCustomerId, 'paramCustomerId') |
|
|
|
$request.get('/businessCommunicationDemand/getDemandByDemandId.action', |
|
|
|
{ demandId: businessCommunicationDemandId } |
|
|
|
{ demandId: businessCommunicationDemandId, customerId: paramCustomerId } |
|
|
|
).then(res => { |
|
|
|
if (res.status == 0) { |
|
|
|
let listDetail = res.data; |
|
|
|
let listDetail = res.data.demandByDemandId; |
|
|
|
listDetail.createdOn = $util.formatTime(new Date(listDetail.createdOn), true); |
|
|
|
listDetail.createdOn = listDetail.createdOn.replaceAll('/', '-'); |
|
|
|
if (typeof listDetail.type == 'string') { |
|
|
@@ -102,31 +97,15 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
currentData: listDetail, |
|
|
|
type: listDetail.type, |
|
|
|
}) |
|
|
|
this.getIsCollect(); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err, 'error appletLogin') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 判断是否收藏 |
|
|
|
getIsCollect() { |
|
|
|
let { currentData, customerId } = this.data; |
|
|
|
$request.get('/businessCommunicationCollect/booleanIsCollect.action', |
|
|
|
{ customerId, businessCommunicationDemandId: currentData.businessCommunicationDemandId } |
|
|
|
).then(res => { |
|
|
|
if (res.status == 0) { |
|
|
|
this.setData({ |
|
|
|
isCollect: res.data == 0 ? false : true, |
|
|
|
pageLoading: true, |
|
|
|
}) |
|
|
|
} |
|
|
|
if(this.data.currentData.customerId == this.data.userCustomerId){ |
|
|
|
this.setData({ |
|
|
|
pageLoading: false, |
|
|
|
isCollect: res.data.booleanIsCollect == 0 ? false : true, |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
this.getListData(); |
|
|
|
if (this.data.currentData.customerId != this.data.userCustomerId) { |
|
|
|
this.setData({ |
|
|
|
hotLoading: true, |
|
|
|
}) |
|
|
|
this.getListData(); |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err, 'error appletLogin') |
|
|
@@ -175,15 +154,12 @@ Page({ |
|
|
|
// 获取list数据 |
|
|
|
getListData() { |
|
|
|
let { page, size, type, currentData } = this.data; |
|
|
|
if(typeof type == 'object'){ |
|
|
|
if (typeof type == 'object') { |
|
|
|
type = type.join(','); |
|
|
|
} |
|
|
|
$request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action', |
|
|
|
{ page, size, type, isInterest: 1, demandId: currentData.businessCommunicationDemandId } |
|
|
|
).then(res => { |
|
|
|
this.setData({ |
|
|
|
pageLoading: false, |
|
|
|
}) |
|
|
|
let tempListData = this.data.listData; |
|
|
|
if (res.status == 0) { |
|
|
|
let datas = res.data; |
|
|
@@ -218,8 +194,15 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
hotLoading: false, |
|
|
|
}) |
|
|
|
}).catch(error => { |
|
|
|
console.log(error, 'error appletLogin') |
|
|
|
this.setData({ |
|
|
|
hotLoading: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
/* |