Bläddra i källkod

1 处理查看详情调接口顺序问题。

hotfix/210830_二组需求分支
王饶冀 3 år sedan
förälder
incheckning
f5c94a9007

+ 27
- 44
pages/index/components/listDetails/Details.js Visa fil

@@ -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,
})
})
},
/*

+ 17
- 12
pages/index/components/listDetails/Details.wxml Visa fil

@@ -7,22 +7,27 @@
<view class="list-view {{ customerId != currentData.customerId ? 'have-hot' : '' }}">
<listItem item="{{ currentData }}" pageStatus="detatil" isCollect="{{ isCollect }}" isShowCollect="{{ customerId != currentData.customerId }}" bind:changeCollect="changeCollect" customerId="{{ userCustomerId }}" />
</view>
<view wx:if="{{ userCustomerId != currentData.customerId }}">
<view wx:if="{{ customerId != currentData.customerId }}">
<view class="view-interested">你可能感兴趣的需求</view>
<view class="not-data" wx:if="{{ listData.length < 1 }}">
<image class="not-data-img" src="/images/home/not-data.png" />
<view class="not-info">没有更多感兴趣的需求</view>
<view class="list-loading text-center" wx:if="{{ hotLoading }}">
<van-loading size="24px">加载中...</van-loading>
</view>
<view wx:else>
<view class="list-view" wx:for="{{ listData }}" wx:key="index">
<listItem item="{{ item }}" bind:getItem="goDetails" customerId="{{ userCustomerId }}" />
<view class="not-data" wx:if="{{ listData.length < 1 }}">
<image class="not-data-img" src="/images/home/not-data.png" />
<view class="not-info">没有更多感兴趣的需求</view>
</view>
<view class="text-center" wx:if="{{ itemLoading }}">
<van-loading size="24px">加载中...</van-loading>
</view>
<view class="list-finished text-center" wx:if="{{ isFinished }}">
<image class="finished-img" src="/images/home/finished-icon.png" />
没有更多啦~
<view wx:else>
<view class="list-view" wx:for="{{ listData }}" wx:key="index">
<listItem item="{{ item }}" bind:getItem="goDetails" customerId="{{ customerId }}" />
</view>
<view class="text-center" wx:if="{{ itemLoading }}">
<van-loading size="24px">加载中...</van-loading>
</view>
<view class="list-finished text-center" wx:if="{{ isFinished }}">
<image class="finished-img" src="/images/home/finished-icon.png" />
没有更多啦~
</view>
</view>
</view>
</view>

Laddar…
Avbryt
Spara