@@ -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,16 @@ 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, | |||
listData:[], | |||
}) | |||
this.getListData(); | |||
} | |||
} | |||
}).catch(err => { | |||
console.log(err, 'error appletLogin') | |||
@@ -175,15 +155,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 +195,15 @@ Page({ | |||
}) | |||
} | |||
} | |||
this.setData({ | |||
hotLoading: false, | |||
}) | |||
}).catch(error => { | |||
console.log(error, 'error appletLogin') | |||
this.setData({ | |||
hotLoading: false, | |||
}) | |||
}) | |||
}, | |||
/* |
@@ -5,24 +5,29 @@ | |||
</view> | |||
<view wx:else> | |||
<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 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> |
@@ -79,7 +79,6 @@ Page({ | |||
this.setData({ | |||
currentIndex: 0 | |||
}) | |||
this.toSearch(); | |||
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; | |||
if (businessCommunicationCustomer) { | |||
let attentionTypeIds = businessCommunicationCustomer.attentionTypeIds; | |||
@@ -93,9 +92,26 @@ Page({ | |||
customerId: businessCommunicationCustomer.customerId | |||
}) | |||
} | |||
this.toSearch(); | |||
}, | |||
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() { | |||
this.selectComponent('#item').toggle(); |
@@ -9,7 +9,8 @@ Page({ | |||
pageLoading: true, | |||
customerId: "", | |||
// 前往关注公众号 | |||
topShow: true, | |||
topShow: false, | |||
showAccount:true, | |||
msgData: [], | |||
page: 1, | |||
size: 10, | |||
@@ -132,7 +133,8 @@ Page({ | |||
// 关闭顶部关注 | |||
closeTopShow() { | |||
this.setData({ | |||
topShow: false | |||
topShow: false, | |||
showAccount:false, | |||
}) | |||
}, | |||
// 聊一聊 | |||
@@ -267,6 +269,23 @@ Page({ | |||
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 | |||
}) | |||
} | |||
}, | |||
/** | |||
* 用户点击右上角分享给朋友 | |||
*/ |
@@ -4,14 +4,11 @@ | |||
<van-loading size="24px">加载中...</van-loading> | |||
</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 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" /> |
@@ -1,21 +1,15 @@ | |||
/* pages/msgPage/msgPage.wxss */ | |||
.msg-page { | |||
box-sizing: border-box; | |||
min-height: calc(100vh - 150rpx); | |||
} | |||
.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; | |||
} | |||
.top-view.topShow { | |||
margin-bottom: 20rpx; | |||
} | |||
.top-view .msg-colse-img{ | |||
.top-view .msg-colse-img { | |||
position: absolute; | |||
width: 30rpx; | |||
height: 30rpx; | |||
@@ -29,21 +23,21 @@ | |||
border-radius: 20rpx; | |||
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; | |||
box-sizing: border-box; | |||
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; | |||
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; | |||
color: #b3bfcb; | |||
margin-top: 20rpx; | |||
@@ -56,7 +50,7 @@ | |||
border-top: 1rpx solid #d9dde5; | |||
} | |||
.msg-li-item-first{ | |||
.msg-li-item-first { | |||
border-top: 0; | |||
} | |||
@@ -64,7 +58,7 @@ | |||
border-bottom: 1rpx solid #d9dde5; | |||
} | |||
.msg-li-item .chatheads-view{ | |||
.msg-li-item .chatheads-view { | |||
width: 88rpx; | |||
height: 88rpx; | |||
margin: 0 20rpx; | |||
@@ -72,7 +66,7 @@ | |||
margin-top: 7rpx; | |||
position: relative; | |||
} | |||
.msg-li-item .chatheads-view .other-head-img{ | |||
.msg-li-item .chatheads-view .other-head-img { | |||
width: 100%; | |||
height: 100%; | |||
border-radius: 50%; | |||
@@ -80,13 +74,13 @@ | |||
.msg-li-item .msg-content { | |||
width: calc(100% - 140rpx); | |||
} | |||
.msg-li-item .msg-content .msg-nickName{ | |||
.msg-li-item .msg-content .msg-nickName { | |||
font-size: 30rpx; | |||
line-height: 56rpx; | |||
width: 100%; | |||
} | |||
.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; | |||
color: #999; | |||
} | |||
@@ -111,4 +105,4 @@ | |||
height: 30rpx; | |||
line-height: 30rpx; | |||
text-align: center; | |||
} | |||
} |
@@ -143,20 +143,31 @@ Page({ | |||
let that = this; | |||
if (res.status == 0) { | |||
if (!businessCommunicationDemandId) { | |||
wx.showModal({ | |||
wx.showLoading({ | |||
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 { | |||
wx.showLoading({ | |||
title: '修改成功', | |||
@@ -173,13 +184,13 @@ Page({ | |||
tempListData.forEach(el => { | |||
if (el.businessCommunicationDemandId == businessCommunicationDemandId) { | |||
el.info = Page.data.detailValue; | |||
if(el.state != 0){ | |||
if (el.state != 0) { | |||
el.state = 0; | |||
str = 'needRefresh'; | |||
} | |||
} | |||
}) | |||
prevPage.setData({ listData: tempListData ,currentTab : str})//设置数据 | |||
prevPage.setData({ listData: tempListData, currentTab: str })//设置数据 | |||
wx.navigateBack() | |||
}, 1000); | |||
} |