data: { | data: { | ||||
// 页面Loading | // 页面Loading | ||||
pageLoading: true, | pageLoading: true, | ||||
customerId: null, | |||||
// 路由接受的参数 | // 路由接受的参数 | ||||
currentData: {}, | currentData: {}, | ||||
// 感兴趣的需求---- | // 感兴趣的需求---- | ||||
onRefresh: true, | onRefresh: true, | ||||
currentIndex: -1, | currentIndex: -1, | ||||
// 当前登录器用户登录ID | // 当前登录器用户登录ID | ||||
userCustomerId: null, | |||||
customerId: null, | |||||
businessCommunicationDemandId: "", | businessCommunicationDemandId: "", | ||||
// 热门加载loading | |||||
hotLoading: false, | |||||
}, | }, | ||||
/** | /** | ||||
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; | const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; | ||||
if (businessCommunicationCustomer) { | if (businessCommunicationCustomer) { | ||||
this.setData({ | this.setData({ | ||||
userCustomerId: businessCommunicationCustomer.customerId | |||||
customerId: businessCommunicationCustomer.customerId | |||||
}) | }) | ||||
} | } | ||||
// 获取当前数据 | // 获取当前数据 | ||||
this.getCurrentData(); | 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; | let businessCommunicationDemandId = this.data.businessCommunicationDemandId; | ||||
$request.post('/statisticsBusinessCommunicationDemand/saveDemandCollect.action', | $request.post('/statisticsBusinessCommunicationDemand/saveDemandCollect.action', | ||||
{ businessCommunicationDemandId } | { businessCommunicationDemandId } | ||||
).then(res => { }).catch(err => { console.log(err) }) | ).then(res => { }).catch(err => { console.log(err) }) | ||||
$request.post('/statisticsBusinessCommunicationDemand/demandPageView.action', | $request.post('/statisticsBusinessCommunicationDemand/demandPageView.action', | ||||
{ businessCommunicationDemandId,customerId: app.globalData.customerId } | |||||
{ businessCommunicationDemandId, customerId: this.data.customerId } | |||||
).then(res => { }).catch(err => { console.log(err) }) | ).then(res => { }).catch(err => { console.log(err) }) | ||||
}, | }, | ||||
// 热门详情点击 | // 热门详情点击 | ||||
}); | }); | ||||
}, | }, | ||||
getCurrentData() { | 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', | $request.get('/businessCommunicationDemand/getDemandByDemandId.action', | ||||
{ demandId: businessCommunicationDemandId } | |||||
{ demandId: businessCommunicationDemandId, customerId: paramCustomerId } | |||||
).then(res => { | ).then(res => { | ||||
if (res.status == 0) { | if (res.status == 0) { | ||||
let listDetail = res.data; | |||||
let listDetail = res.data.demandByDemandId; | |||||
listDetail.createdOn = $util.formatTime(new Date(listDetail.createdOn), true); | listDetail.createdOn = $util.formatTime(new Date(listDetail.createdOn), true); | ||||
listDetail.createdOn = listDetail.createdOn.replaceAll('/', '-'); | listDetail.createdOn = listDetail.createdOn.replaceAll('/', '-'); | ||||
if (typeof listDetail.type == 'string') { | if (typeof listDetail.type == 'string') { | ||||
this.setData({ | this.setData({ | ||||
currentData: listDetail, | currentData: listDetail, | ||||
type: listDetail.type, | 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, | pageLoading: false, | ||||
isCollect: res.data.booleanIsCollect == 0 ? false : true, | |||||
}) | }) | ||||
}else{ | |||||
this.getListData(); | |||||
if (this.data.currentData.customerId != this.data.userCustomerId) { | |||||
this.setData({ | |||||
hotLoading: true, | |||||
listData:[], | |||||
}) | |||||
this.getListData(); | |||||
} | |||||
} | } | ||||
}).catch(err => { | }).catch(err => { | ||||
console.log(err, 'error appletLogin') | console.log(err, 'error appletLogin') | ||||
// 获取list数据 | // 获取list数据 | ||||
getListData() { | getListData() { | ||||
let { page, size, type, currentData } = this.data; | let { page, size, type, currentData } = this.data; | ||||
if(typeof type == 'object'){ | |||||
if (typeof type == 'object') { | |||||
type = type.join(','); | type = type.join(','); | ||||
} | } | ||||
$request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action', | $request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action', | ||||
{ page, size, type, isInterest: 1, demandId: currentData.businessCommunicationDemandId } | { page, size, type, isInterest: 1, demandId: currentData.businessCommunicationDemandId } | ||||
).then(res => { | ).then(res => { | ||||
this.setData({ | |||||
pageLoading: false, | |||||
}) | |||||
let tempListData = this.data.listData; | let tempListData = this.data.listData; | ||||
if (res.status == 0) { | if (res.status == 0) { | ||||
let datas = res.data; | let datas = res.data; | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
this.setData({ | |||||
hotLoading: false, | |||||
}) | |||||
}).catch(error => { | }).catch(error => { | ||||
console.log(error, 'error appletLogin') | console.log(error, 'error appletLogin') | ||||
this.setData({ | |||||
hotLoading: false, | |||||
}) | |||||
}) | }) | ||||
}, | }, | ||||
/* | /* |
</view> | </view> | ||||
<view wx:else> | <view wx:else> | ||||
<view class="list-view {{ customerId != currentData.customerId ? 'have-hot' : '' }}"> | <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 }}" /> | |||||
<listItem item="{{ currentData }}" pageStatus="detatil" isCollect="{{ isCollect }}" isShowCollect="{{ customerId != currentData.customerId }}" bind:changeCollect="changeCollect" customerId="{{ customerId }}" /> | |||||
</view> | </view> | ||||
<view wx:if="{{ userCustomerId != currentData.customerId }}"> | |||||
<view wx:if="{{ customerId != currentData.customerId }}"> | |||||
<view class="view-interested">你可能感兴趣的需求</view> | <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> | ||||
<view wx:else> | <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> | ||||
<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> | </view> | ||||
</view> | </view> |
this.setData({ | this.setData({ | ||||
currentIndex: 0 | currentIndex: 0 | ||||
}) | }) | ||||
this.toSearch(); | |||||
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; | const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; | ||||
if (businessCommunicationCustomer) { | if (businessCommunicationCustomer) { | ||||
let attentionTypeIds = businessCommunicationCustomer.attentionTypeIds; | let attentionTypeIds = businessCommunicationCustomer.attentionTypeIds; | ||||
customerId: businessCommunicationCustomer.customerId | customerId: businessCommunicationCustomer.customerId | ||||
}) | }) | ||||
} | } | ||||
this.toSearch(); | |||||
}, | }, | ||||
onShow() { | onShow() { | ||||
if(this.data.currentTab == 'my'){ | |||||
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; | |||||
if (businessCommunicationCustomer) { | |||||
let attentionTypeIds = businessCommunicationCustomer.attentionTypeIds; | |||||
if (attentionTypeIds) { | |||||
attentionTypeIds = attentionTypeIds.split(','); | |||||
} else { | |||||
attentionTypeIds = []; | |||||
} | |||||
this.setData({ | |||||
attentionTypeIds, | |||||
customerId: businessCommunicationCustomer.customerId | |||||
}) | |||||
} | |||||
console.log(`刷新页面`); | |||||
this.toSearch(); | |||||
} | |||||
}, | }, | ||||
toggleMore() { | toggleMore() { | ||||
this.selectComponent('#item').toggle(); | this.selectComponent('#item').toggle(); |
pageLoading: true, | pageLoading: true, | ||||
customerId: "", | customerId: "", | ||||
// 前往关注公众号 | // 前往关注公众号 | ||||
topShow: true, | |||||
topShow: false, | |||||
showAccount:true, | |||||
msgData: [], | msgData: [], | ||||
page: 1, | page: 1, | ||||
size: 10, | size: 10, | ||||
// 关闭顶部关注 | // 关闭顶部关注 | ||||
closeTopShow() { | closeTopShow() { | ||||
this.setData({ | this.setData({ | ||||
topShow: false | |||||
topShow: false, | |||||
showAccount:false, | |||||
}) | }) | ||||
}, | }, | ||||
// 聊一聊 | // 聊一聊 | ||||
app.globalData.isOnSocketOpen = false; | app.globalData.isOnSocketOpen = false; | ||||
} | } | ||||
}, | }, | ||||
// 公众号组件加载成功 | |||||
bindload(e){ | |||||
if(e.detail.status == 0){ | |||||
this.setData({ | |||||
topShow:true | |||||
}) | |||||
} | |||||
}, | |||||
// 公众号没有显示原因 | |||||
binderror(e){ | |||||
console.log(e); | |||||
if(e.detail.status != 0){ | |||||
this.setData({ | |||||
topShow:false | |||||
}) | |||||
} | |||||
}, | |||||
/** | /** | ||||
* 用户点击右上角分享给朋友 | * 用户点击右上角分享给朋友 | ||||
*/ | */ |
<van-loading size="24px">加载中...</van-loading> | <van-loading size="24px">加载中...</van-loading> | ||||
</view> | </view> | ||||
<view wx:else class="body-view"> | <view wx:else class="body-view"> | ||||
<view class="top-view" wx:if="{{ topShow }}"> | |||||
<!-- <image class="msg-top-img fl" src="/images/home/msg-top-icon.png" /> | |||||
<view class="msg-text fl">关注公众号可随时接收离线消息~</view> | |||||
<van-button color="#5e73e5" round class="msg-btn-go fl" size="small" bindtap="followApplets"> | |||||
前往关注 | |||||
</van-button> --> | |||||
<official-account></official-account> | |||||
<image class="msg-colse-img" src="/images/home/close.png" bind:tap="closeTopShow" /> | |||||
<view class="top-view {{ topShow ? 'topShow' : '' }}"> | |||||
<view wx:if="{{ showAccount }}"> | |||||
<official-account bindload="bindload" binderror="binderror"></official-account> | |||||
</view> | |||||
<image class="msg-colse-img" src="/images/home/close.png" bind:tap="closeTopShow" wx:if="{{ topShow }}"/> | |||||
</view> | </view> | ||||
<view class="msg-box-view {{ topShow ? 'topShow' : '' }} not-msg-data" wx:if="{{ msgData.length < 1 }}"> | <view class="msg-box-view {{ topShow ? 'topShow' : '' }} not-msg-data" wx:if="{{ msgData.length < 1 }}"> | ||||
<image class="not-msg-data-img " src="/images/home/not-msg-data.png" /> | <image class="not-msg-data-img " src="/images/home/not-msg-data.png" /> |
/* pages/msgPage/msgPage.wxss */ | /* pages/msgPage/msgPage.wxss */ | ||||
.msg-page { | .msg-page { | ||||
box-sizing: border-box; | |||||
min-height: calc(100vh - 150rpx); | min-height: calc(100vh - 150rpx); | ||||
} | } | ||||
.top-view { | .top-view { | ||||
/* background: #fff; | |||||
box-sizing: border-box; | |||||
padding: 0 20rpx; | |||||
height: 88rpx; | |||||
line-height: 88rpx; | |||||
box-shadow: -1px 3px 12px 4px rgba(186, 186, 186, 0.1); | |||||
border-radius: 20rpx; | |||||
margin-bottom: 20rpx; */ | |||||
position: relative; | position: relative; | ||||
} | |||||
.top-view.topShow { | |||||
margin-bottom: 20rpx; | margin-bottom: 20rpx; | ||||
} | } | ||||
.top-view .msg-colse-img{ | |||||
.top-view .msg-colse-img { | |||||
position: absolute; | position: absolute; | ||||
width: 30rpx; | width: 30rpx; | ||||
height: 30rpx; | height: 30rpx; | ||||
border-radius: 20rpx; | border-radius: 20rpx; | ||||
min-height: calc(100vh - 150rpx); | min-height: calc(100vh - 150rpx); | ||||
} | } | ||||
.msg-box-view.topShow{ | |||||
min-height: calc(100vh - 258rpx); | |||||
.msg-box-view.topShow { | |||||
min-height: calc(100vh - 320rpx); | |||||
} | } | ||||
.msg-box-view.not-msg-data{ | |||||
.msg-box-view.not-msg-data { | |||||
text-align: center; | text-align: center; | ||||
box-sizing: border-box; | box-sizing: border-box; | ||||
padding-top: 140rpx; | padding-top: 140rpx; | ||||
} | } | ||||
.msg-box-view.not-msg-data .not-msg-data-img{ | |||||
.msg-box-view.not-msg-data .not-msg-data-img { | |||||
width: 302rpx; | width: 302rpx; | ||||
height: 224rpx; | height: 224rpx; | ||||
} | } | ||||
.msg-box-view.not-msg-data .not-data-msg-info{ | |||||
.msg-box-view.not-msg-data .not-data-msg-info { | |||||
font-size: 24rpx; | font-size: 24rpx; | ||||
color: #b3bfcb; | color: #b3bfcb; | ||||
margin-top: 20rpx; | margin-top: 20rpx; | ||||
border-top: 1rpx solid #d9dde5; | border-top: 1rpx solid #d9dde5; | ||||
} | } | ||||
.msg-li-item-first{ | |||||
.msg-li-item-first { | |||||
border-top: 0; | border-top: 0; | ||||
} | } | ||||
border-bottom: 1rpx solid #d9dde5; | border-bottom: 1rpx solid #d9dde5; | ||||
} | } | ||||
.msg-li-item .chatheads-view{ | |||||
.msg-li-item .chatheads-view { | |||||
width: 88rpx; | width: 88rpx; | ||||
height: 88rpx; | height: 88rpx; | ||||
margin: 0 20rpx; | margin: 0 20rpx; | ||||
margin-top: 7rpx; | margin-top: 7rpx; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
.msg-li-item .chatheads-view .other-head-img{ | |||||
.msg-li-item .chatheads-view .other-head-img { | |||||
width: 100%; | width: 100%; | ||||
height: 100%; | height: 100%; | ||||
border-radius: 50%; | border-radius: 50%; | ||||
.msg-li-item .msg-content { | .msg-li-item .msg-content { | ||||
width: calc(100% - 140rpx); | width: calc(100% - 140rpx); | ||||
} | } | ||||
.msg-li-item .msg-content .msg-nickName{ | |||||
.msg-li-item .msg-content .msg-nickName { | |||||
font-size: 30rpx; | font-size: 30rpx; | ||||
line-height: 56rpx; | line-height: 56rpx; | ||||
width: 100%; | width: 100%; | ||||
} | } | ||||
.msg-li-item .msg-content .msg-last-content, | .msg-li-item .msg-content .msg-last-content, | ||||
.msg-li-item .msg-content .msg-last-content-date{ | |||||
.msg-li-item .msg-content .msg-last-content-date { | |||||
font-size: 24rpx; | font-size: 24rpx; | ||||
color: #999; | color: #999; | ||||
} | } | ||||
height: 30rpx; | height: 30rpx; | ||||
line-height: 30rpx; | line-height: 30rpx; | ||||
text-align: center; | text-align: center; | ||||
} | |||||
} |
let that = this; | let that = this; | ||||
if (res.status == 0) { | if (res.status == 0) { | ||||
if (!businessCommunicationDemandId) { | if (!businessCommunicationDemandId) { | ||||
wx.showModal({ | |||||
wx.showLoading({ | |||||
title: '发布成功', | title: '发布成功', | ||||
content: "请关注平台公众号,如有咨询,可及时接收消息通知!", | |||||
showCancel: false, | |||||
success(res1) { | |||||
if (res1.confirm) { | |||||
that.clearData(); | |||||
let listDetail = res.data; | |||||
wx.reLaunch({ | |||||
url: '/pages/index/components/listDetails/Details?businessCommunicationDemandId=' + listDetail.businessCommunicationDemandId, | |||||
}) | |||||
} | |||||
} | |||||
mask: true | |||||
}) | }) | ||||
setTimeout(() => { | |||||
wx.hideLoading() | |||||
let listDetail = res.data; | |||||
wx.reLaunch({ | |||||
url: '/pages/index/components/listDetails/Details?businessCommunicationDemandId=' + listDetail.businessCommunicationDemandId, | |||||
}) | |||||
}, 1000); | |||||
// wx.showModal({ | |||||
// title: '发布成功', | |||||
// content: "请关注平台公众号,如有咨询,可及时接收消息通知!", | |||||
// showCancel: false, | |||||
// success(res1) { | |||||
// if (res1.confirm) { | |||||
// that.clearData(); | |||||
// let listDetail = res.data; | |||||
// wx.reLaunch({ | |||||
// url: '/pages/index/components/listDetails/Details?businessCommunicationDemandId=' + listDetail.businessCommunicationDemandId, | |||||
// }) | |||||
// } | |||||
// } | |||||
// }) | |||||
} else { | } else { | ||||
wx.showLoading({ | wx.showLoading({ | ||||
title: '修改成功', | title: '修改成功', | ||||
tempListData.forEach(el => { | tempListData.forEach(el => { | ||||
if (el.businessCommunicationDemandId == businessCommunicationDemandId) { | if (el.businessCommunicationDemandId == businessCommunicationDemandId) { | ||||
el.info = Page.data.detailValue; | el.info = Page.data.detailValue; | ||||
if(el.state != 0){ | |||||
if (el.state != 0) { | |||||
el.state = 0; | el.state = 0; | ||||
str = 'needRefresh'; | str = 'needRefresh'; | ||||
} | } | ||||
} | } | ||||
}) | }) | ||||
prevPage.setData({ listData: tempListData ,currentTab : str})//设置数据 | |||||
prevPage.setData({ listData: tempListData, currentTab: str })//设置数据 | |||||
wx.navigateBack() | wx.navigateBack() | ||||
}, 1000); | }, 1000); | ||||
} | } |