评论、收藏、点赞完成修复页面显示bug
This commit is contained in:
parent
f5e9b71775
commit
293510ccb3
@ -4326,6 +4326,7 @@ l .text-depblack {
|
||||
padding: 15rpx;
|
||||
min-height: 1000rpx;
|
||||
margin-bottom: 100rpx;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.comment-list-title {
|
||||
@ -4464,6 +4465,44 @@ l .text-depblack {
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
.func-items {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.func-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
color: #000;
|
||||
width: 23%;
|
||||
border-right: 1rpx solid #f8f8f8;
|
||||
}
|
||||
|
||||
.func-item:last-child {
|
||||
border-right: 0rpx;
|
||||
}
|
||||
|
||||
.func-item:active {
|
||||
background-color: #f3f3f3;
|
||||
color: #dfdfdf;
|
||||
}
|
||||
|
||||
.func-item image {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.func-item text {
|
||||
margin-left: 10rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.tab {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
@ -4647,7 +4686,7 @@ l .text-depblack {
|
||||
}
|
||||
|
||||
.line-gray-ssm {
|
||||
background-color: rgb(243, 243, 243);
|
||||
background-color: #f8f8f8;
|
||||
height: 2rpx;
|
||||
width: 95%;
|
||||
align-self: center;
|
||||
|
@ -11,9 +11,11 @@
|
||||
</block>
|
||||
</van-tabs>
|
||||
</view>
|
||||
<scroll-view style="margin-top: 70rpx;height: {{contentHeight}}px;" refresher-enabled="true" enable-flex="{{true}}"
|
||||
lower-threshold="5rpx" refresher-background="#fff" scroll-y bindscrolltolower="loadMore"
|
||||
bindrefresherrefresh="dorefreshList" refresher-triggered="{{isRefreshing}}">
|
||||
|
||||
<scroll-view style="height: {{contentHeight}}px;" refresher-enabled="true" enable-flex="{{true}}" lower-threshold="5rpx"
|
||||
refresher-background="#fff" scroll-y bindscrolltolower="loadMore" bindrefresherrefresh="dorefreshList"
|
||||
refresher-triggered="{{isRefreshing}}">
|
||||
<view style="height: 90rpx;"></view>
|
||||
<block wx:if="{{cardList.length>0}}">
|
||||
<view class="page-box">
|
||||
<block wx:for="{{cardList}}" wx:key="index">
|
||||
|
@ -27,7 +27,8 @@ Page({
|
||||
curTypeId: '',
|
||||
isShowOptions: false, //是否显示选项
|
||||
curItemIndex: -1, //点击分享按钮弹出的
|
||||
curTypeName: '全部'
|
||||
curTypeName: '全部',
|
||||
contentHeight: app.globalData.windowHeight
|
||||
},
|
||||
|
||||
/**
|
||||
@ -95,7 +96,7 @@ Page({
|
||||
_self.setData({
|
||||
currentTypeIndex: idx,
|
||||
curTypeId: id,
|
||||
curTypeName:name ,
|
||||
curTypeName: name,
|
||||
posterHistoryList: [],
|
||||
posterTempleteList: [],
|
||||
isShowOptions: false
|
||||
|
@ -29,9 +29,10 @@
|
||||
</view>
|
||||
|
||||
<!-- 模板 -->
|
||||
<scroll-view style="margin-top: 70rpx;" refresher-enabled="true" refresher-threshold="{{50}}"
|
||||
<scroll-view style="height: {{contentHeight}}px;" refresher-enabled="true" refresher-threshold="{{50}}"
|
||||
wx:if="{{currentIndex == 0}}" refresher-background="#fff" enhanced="{{true}}" scroll-y
|
||||
bindrefresherrefresh="dorefreshList" refresher-triggered="{{isRefreshing}}">
|
||||
<view style="height: 90rpx;"></view>
|
||||
<block wx:if="{{posterTempleteList.length>0}}">
|
||||
<view class="img-box">
|
||||
<block wx:for="{{posterTempleteList}}" wx:key="index">
|
||||
@ -63,9 +64,10 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 发布历史 -->
|
||||
<scroll-view style="margin-top: 70rpx;" refresher-enabled="true" refresher-threshold="{{50}}"
|
||||
<scroll-view style="height: {{contentHeight}}px;" refresher-enabled="true" refresher-threshold="{{50}}"
|
||||
refresher-background="#fff" enhanced="{{true}}" scroll-y bindrefresherrefresh="dorefreshList"
|
||||
refresher-triggered="{{isRefreshing}}" wx:else>
|
||||
<view style="height: 90rpx;"></view>
|
||||
<block wx:if="{{posterHistoryList.length>0}}">
|
||||
<view class="img-box">
|
||||
<block wx:for="{{posterHistoryList}}" wx:key="index">
|
||||
|
@ -40,6 +40,7 @@ Page({
|
||||
likeStatus: false, //点赞
|
||||
collectStatus: false, //收藏,
|
||||
restoreLikeStatus: false, //评论点赞
|
||||
contentHeight: app.globalData.windowHeight
|
||||
},
|
||||
onLoad(options) {
|
||||
var _self = this
|
||||
@ -53,7 +54,6 @@ Page({
|
||||
shareSwitch: options.shareSwitch, //转发的开关
|
||||
})
|
||||
var isShow = options.collectSwitch == '3' || options.collectSwitch == '4' || options.likeSwitch == '3' && options.likeSwitch == '4' || options.shareSwitch == '3' || options.shareSwitch == '4' || options.commentSwitch == '3' || options.commentSwitch == '4'
|
||||
console.log(isShow)
|
||||
if (isShow) {
|
||||
_self.setData({
|
||||
isShowCommentInput: true
|
||||
@ -160,7 +160,14 @@ Page({
|
||||
data.list.forEach(it => {
|
||||
switch (it.dataType) {
|
||||
case '2': //图片
|
||||
var items = it.value.split(',')
|
||||
var photoIds = it.value.split('@')
|
||||
if (photoIds.length > 1) {
|
||||
//展示方式
|
||||
it.dataMode = photoIds[1]
|
||||
} else {
|
||||
it.dataMode = '1'
|
||||
}
|
||||
var items = photoIds[0].split(',')
|
||||
var tempList = []
|
||||
items.forEach(item => {
|
||||
if (item.length > 0) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<cu-custom id="head" isCustom="{{false}}" isBack="{{true}}" isIndex="{{false}}">
|
||||
<view slot="content">详情</view>
|
||||
</cu-custom>
|
||||
<view>
|
||||
<view class="page-box">
|
||||
<view class="top-box">
|
||||
<view class="flex flex-direction">
|
||||
<view wx:if="{{dataList.length>0}}" style="background-color: #fff;border-radius: 5rpx;">
|
||||
@ -31,9 +31,8 @@
|
||||
<!-- 图片 -->
|
||||
<view wx:if="{{child.dataType=='2' && child.valueList.length>0}}">
|
||||
<!-- 九宫格 -->
|
||||
<view wx:if="{{child.dataMode == '95bef6e2-0ab8-442f-b53d-b1f18130bae1'}}"
|
||||
class="cu-form-group">
|
||||
<view class="grid grid-square flex-sub">
|
||||
<view wx:if="{{child.dataMode == '1'}}" class="cu-form-group">
|
||||
<view class="grid col-3 grid-square flex-sub">
|
||||
<view class="bg-img" wx:for="{{child.valueList}}" wx:key="d" wx:for-item="photo"
|
||||
catchtap="viewImg" data-url="{{photo.path}}">
|
||||
<image src='{{photo.path}}' mode='scaleToFill'></image>
|
||||
@ -41,10 +40,9 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 左右滑动 -->
|
||||
<view
|
||||
wx:elif="{{child.dataMode=='bae3d6c1-8f6e-4e27-bba2-e42860758db7' || child.dataMode=='179441e3-5ad1-485b-b5af-421bdc383b5e'}}">
|
||||
<view wx:elif="{{child.dataMode=='2' || child.dataMode=='3'}}">
|
||||
<swiper style="width:100%;height:400rpx;background-color:#fff" indicator-dots="{{true}}"
|
||||
autoplay="{{child.dataMode=='179441e3-5ad1-485b-b5af-421bdc383b5e'}}">
|
||||
autoplay="{{child.dataMode=='3'}}">
|
||||
<block wx:for="{{child.valueList}}" wx:key="pIndex" wx:for-index="pIndex"
|
||||
wx:for-item="photo">
|
||||
<swiper-item style="width:100%;">
|
||||
@ -56,8 +54,7 @@
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 上下 -->
|
||||
<view wx:elif="{{child.dataMode=='121133b0-3596-46f4-a35f-7aaae79cf47a'}}"
|
||||
style="background-color:#fff">
|
||||
<view wx:elif="{{child.dataMode=='4'}}" style="background-color:#fff">
|
||||
<block wx:for="{{child.valueList}}" wx:key="pIndex" wx:for-index="pIndex"
|
||||
wx:for-item="photo">
|
||||
<image style="width:100%;border-radius:5rpx;" src="{{photo.path}}" mode="widthFix">
|
||||
@ -191,7 +188,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论信息 -->
|
||||
<view class="comment-list-box">
|
||||
<view class="comment-list-box" style="height: {{contentHeight}}px;">
|
||||
<view class="comment-list-title">
|
||||
<view>评论{{commentCount}}</view>
|
||||
</view>
|
||||
@ -275,7 +272,7 @@
|
||||
<!-- 单文本内容评论 -->
|
||||
<van-action-sheet show="{{isShowComment}}" round="{{false}}" bind:close="onCloseDialog" z-index="102">
|
||||
<view class="comment-line-input-box">
|
||||
<input placeholder="请输入评论内容" focus="true" cursor-spacing="100" value="{{commentValue}}" class="comment-input"
|
||||
<input placeholder="请输入评论内容" cursor-spacing="100" value="{{commentValue}}" class="comment-input"
|
||||
bindinput="inputWatch" />
|
||||
<view class="comment-line-btn" catchtap="doSubmitComment" data-id="{{dataId}}">
|
||||
发布
|
||||
|
@ -395,7 +395,7 @@
|
||||
}
|
||||
|
||||
.top-box {
|
||||
padding: 15rpx 15rpx 20rpx 15rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.good {
|
||||
|
@ -91,7 +91,26 @@ Page({
|
||||
},
|
||||
buildMainData(datas) {
|
||||
var _self = this
|
||||
var ids = ''
|
||||
datas.forEach(it => {
|
||||
var options = _self.data.tabList[_self.data.currentIndex]
|
||||
var isOpen = options.configColumnCollect == '2' || options.configColumnCollect == '4' || options.configColumnLike == '2' && options.configColumnLike == '4' || options.configColumnDispatch == '2' || options.configColumnDispatch == '4' || options.configColumnComment == '2' || options.configColumnComment == '4'
|
||||
|
||||
it.cId = _self.data.tabList[_self.data.currentIndex].configColumnId
|
||||
it.collectSwitch = _self.data.tabList[_self.data.currentIndex].configColumnCollect //收藏开关
|
||||
it.commentSwitch = _self.data.tabList[_self.data.currentIndex].configColumnComment //评论开关
|
||||
it.shareSwitch = _self.data.tabList[_self.data.currentIndex].configColumnDispatch //转发开关
|
||||
it.likeSwitch = _self.data.tabList[_self.data.currentIndex].configColumnLike //点赞开关
|
||||
it.funcSwitch = isOpen
|
||||
ids += it.uid + ','
|
||||
// 初始化评论 点赞 收藏状态
|
||||
it.collectCount = 0
|
||||
it.collectStatus = false
|
||||
it.commentCount = 0
|
||||
it.dispatchCount = 0
|
||||
it.likeCount = 0
|
||||
it.likeStatus = false
|
||||
it.scansCount = 0
|
||||
it.list.forEach(iem => {
|
||||
switch (iem.dataType) {
|
||||
case '2': //图片
|
||||
@ -200,6 +219,44 @@ Page({
|
||||
_self.setData({
|
||||
dataList: datas
|
||||
})
|
||||
_self.getColumnContentHandle(ids)
|
||||
},
|
||||
//获取栏目内容点赞 收藏 评论
|
||||
getColumnContentHandle(ids) {
|
||||
var _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.http.get(app.urls.getColumnContentHandle.format({
|
||||
projectId: 'column',
|
||||
businessIds: ids
|
||||
}), {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
res.data.forEach(it => {
|
||||
_self.data.dataList.forEach(item => {
|
||||
if (item.uid == it.businessId) {
|
||||
item.collectCount = it.collectCount
|
||||
item.collectStatus = it.collectStatus
|
||||
item.commentCount = it.commentCount
|
||||
item.dispatchCount = it.dispatchCount
|
||||
item.likeCount = it.likeCount
|
||||
item.likeStatus = it.likeStatus
|
||||
item.scansCount = it.scansCount
|
||||
}
|
||||
})
|
||||
})
|
||||
_self.setData({
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
})
|
||||
},
|
||||
//预览图片
|
||||
viewImg(e) {
|
||||
@ -361,14 +418,102 @@ Page({
|
||||
innerAudioContext.stop()
|
||||
}
|
||||
},
|
||||
// 显示详情
|
||||
showDetail(e) {
|
||||
if (this.data.currentTab.configColumnType.indexOf('dda5007c-5fb7-48f2-8537-3cb8ea298242') != -1) {
|
||||
//需要跳详情
|
||||
var cId = this.data.currentTab.configColumnId
|
||||
var uId = e.currentTarget.dataset.uid
|
||||
console.log(e)
|
||||
wx.navigateTo({
|
||||
url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId,
|
||||
})
|
||||
}
|
||||
},
|
||||
//显示评论
|
||||
showComment(e) {
|
||||
//需要跳详情
|
||||
var cId = e.currentTarget.dataset.cid
|
||||
var uId = e.currentTarget.dataset.uid
|
||||
var like = e.currentTarget.dataset.like
|
||||
var collect = e.currentTarget.dataset.collect
|
||||
var comment = e.currentTarget.dataset.comment
|
||||
var share = e.currentTarget.dataset.share
|
||||
var params = '&collectSwitch=' + collect + '&likeSwitch=' + like + '&commentSwitch=' + comment + '&shareSwitch=' + share
|
||||
console.log(params)
|
||||
wx.navigateTo({
|
||||
url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId + params,
|
||||
})
|
||||
},
|
||||
//点赞
|
||||
doLike(e) {
|
||||
var _self = this
|
||||
var item = e.currentTarget.dataset.item
|
||||
var index = e.currentTarget.dataset.index //栏目索引
|
||||
var favor = item.likeStatus
|
||||
var msg = ''
|
||||
if (favor) {
|
||||
msg = '取消中...'
|
||||
} else {
|
||||
msg = '保存中...'
|
||||
}
|
||||
wx.showLoading({
|
||||
title: msg,
|
||||
})
|
||||
app.http.post(app.urls.doSaveLike, {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {
|
||||
businessId: item.uid,
|
||||
projectId: 'column'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
_self.data.dataList[index].likeStatus = !item.likeStatus
|
||||
if (item.likeStatus) {
|
||||
--_self.data.dataList[index].likeCount
|
||||
} else {
|
||||
++_self.data.dataList[index].likeCount
|
||||
}
|
||||
_self.setData({
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
})
|
||||
.catch(err => {})
|
||||
},
|
||||
//收藏
|
||||
doCollect(e) {
|
||||
var _self = this
|
||||
var item = e.currentTarget.dataset.item
|
||||
var index = e.currentTarget.dataset.index //栏目索引
|
||||
var favor = item.collectStatus
|
||||
var msg = ''
|
||||
if (favor) {
|
||||
msg = '取消收藏...'
|
||||
} else {
|
||||
msg = '收藏中...'
|
||||
}
|
||||
wx.showLoading({
|
||||
title: msg,
|
||||
})
|
||||
app.http.post(app.urls.doSaveCollect, {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {
|
||||
businessId: item.uid,
|
||||
projectId: 'column'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
_self.data.dataList[index].collectStatus = !item.collectStatus
|
||||
_self.setData({
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
})
|
||||
.catch(err => {})
|
||||
}
|
||||
})
|
@ -23,7 +23,10 @@
|
||||
<view wx:for="{{item.list}}" wx:for-index="idx" wx:key="idx" wx:for-item="it"
|
||||
class="column-box-row">
|
||||
<view wx:for="{{it.list}}" wx:for-index="i" wx:for-item="child" wx:key="i" bindtap="showDetail"
|
||||
data-ctype="{{item.type}}" data-cid="{{item.cId}}" data-id="{{it.uid}}">
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}"
|
||||
data-ctype="{{item.type}}" data-ctype="{{item.type}}" data-cid="{{item.cId}}"
|
||||
data-id="{{it.uid}}">
|
||||
<!-- 文本 -->
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList}}" class="align-center">
|
||||
<view class="bg-white">
|
||||
@ -59,11 +62,15 @@
|
||||
<view class="column-box">
|
||||
<!-- 栏目数据 -->
|
||||
<view wx:for="{{item.list}}" wx:for-index="i" wx:for-item="child" wx:key="i" data-item="{{child}}"
|
||||
data-uid="{{item.uid}}" bindtap="showDetail"
|
||||
data-uid="{{item.uid}}" bindtap="showDetail" data-like="{{item.likeSwitch}}"
|
||||
data-share="{{item.shareSwitch}}" data-collect="{{item.collectSwitch}}"
|
||||
data-comment="{{item.commentSwitch}}" data-ctype="{{item.type}}" data-ctype="{{item.type}}"
|
||||
data-cid="{{item.cId}}" data-id="{{item.uid}}"
|
||||
class="{{child.valueList.length>0 || child.value.length>0 ? 'column-item' : ''}}">
|
||||
<!-- 具体数据 -->
|
||||
<!-- 文本 -->
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList}}" class="align-center">
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList && child.value.length>0}}"
|
||||
class="align-center">
|
||||
<view class="bg-white">
|
||||
<view class="cu-form-group">
|
||||
<view id="content" style="line-height:40rpx;">
|
||||
@ -220,6 +227,45 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论 收藏 点赞 -->
|
||||
<view class="func-box" wx:if="{{item.funcSwitch}}">
|
||||
<view class="line-gray-ssm">
|
||||
</view>
|
||||
<view class="func-items">
|
||||
<!-- 转发 -->
|
||||
<button class="func-item" open-type="share" data-sharetype="2" data-item="{{item}}"
|
||||
data-index="{{index}}" wx:if="{{item.shareSwitch != '1' && item.shareSwitch != '3'}}"
|
||||
style="font-size: 28rpx;font-weight: normal;text-align: center;background-color: #ffffff;width: 0rpx;margin: 0rpx;padding: 0rpx;border-radius: 0rpx;">
|
||||
<text class="cuIcon-share text-gray" style="font-size: 38rpx;"></text>
|
||||
<text style="text-align: center;line-height:28rpx;">转发</text>
|
||||
</button>
|
||||
<!-- 收藏 -->
|
||||
<view class="func-item" wx:if="{{item.collectSwitch != '1' && item.collectSwitch != '3'}}"
|
||||
data-item="{{item}}" data-index="{{index}}" catchtap="doCollect">
|
||||
<text
|
||||
class="{{item.collectStatus ? 'cuIcon-favorfill line-yellowlight2': 'cuIcon-favor text-gray'}}"
|
||||
style="font-size: 38rpx;"></text>
|
||||
<text>收藏</text>
|
||||
</view>
|
||||
<!-- 评论 -->
|
||||
<view class="func-item" wx:if="{{item.commentSwitch != '1' && item.commentSwitch != '3'}}"
|
||||
catchtap="showComment" data-uid="{{item.uid}}" data-cid="{{item.cId}}"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}">
|
||||
<text class="cuIcon-comment text-gray" style="font-size: 38rpx;"></text>
|
||||
<text style="font-size: 30rpx;">{{item.commentCount>1000 ?
|
||||
'1000+':item.commentCount}}</text>
|
||||
</view>
|
||||
<!-- 点赞 -->
|
||||
<view class="func-item" wx:if="{{item.likeSwitch != '1' && item.likeSwitch != '3'}}"
|
||||
catchtap="doLike" data-item="{{item}}" data-index="{{index}}">
|
||||
<text
|
||||
class="{{item.likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
|
||||
style="font-size: 38rpx;"></text>
|
||||
<text style="font-size:30rpx;">{{item.likeCount>1000? '1000+':item.likeCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -156,6 +156,7 @@
|
||||
letter-spacing: 2rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.column-item {
|
||||
margin: 0rpx;
|
||||
padding: 7.5rpx 15rpx 7.5rpx 15rpx;
|
||||
@ -181,6 +182,7 @@
|
||||
.img-item:last-child {
|
||||
padding: 7.5rpx 0rpx 7.5rpx 0rpx;
|
||||
}
|
||||
|
||||
.movie-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
@ -249,7 +249,10 @@ Page({
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.length > 0) {
|
||||
var options = datas[_self.data.curIndex]
|
||||
var isOpen = options.configColumnCollect == '2' || options.configColumnCollect == '4' || options.configColumnLike == '2' && options.configColumnLike == '4' || options.configColumnDispatch == '2' || options.configColumnDispatch == '4' || options.configColumnComment == '2' || options.configColumnComment == '4'
|
||||
var tempItem = {
|
||||
funcSwitch: isOpen,
|
||||
collectSwitch: datas[_self.data.curIndex].configColumnCollect, //收藏开关
|
||||
commentSwitch: datas[_self.data.curIndex].configColumnComment, //评论开关
|
||||
shareSwitch: datas[_self.data.curIndex].configColumnDispatch, //转发开关
|
||||
|
@ -156,13 +156,14 @@
|
||||
<view wx:for="{{it.list}}" wx:for-index="i" wx:for-item="child" wx:key="i" bindtap="showDetail"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}" data-collect="{{item.collectSwitch}}"
|
||||
data-comment="{{item.commentSwitch}}"
|
||||
class="{{child.valueList.length>0 || child.value.length>0 ? 'column-item' : ''}}"
|
||||
class="{{(child.valueList.length>0 || child.value.length>0) && child.displayList ? 'column-item' : ''}}"
|
||||
data-ctype="{{item.type}}" data-cid="{{item.cId}}" data-id="{{it.uid}}">
|
||||
<!-- 栏目样式1或3 -->
|
||||
<view>
|
||||
<!-- 具体数据 -->
|
||||
<!-- 文本 -->
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList}}" class="align-center">
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList && child.value.length>0}}"
|
||||
class="align-center">
|
||||
<view class=" bg-white">
|
||||
<view class="cu-form-group">
|
||||
<view id="content" style="line-height:40rpx;width: 100%;">
|
||||
@ -311,7 +312,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论 收藏 点赞 -->
|
||||
<view class="func-box">
|
||||
<view class="func-box" wx:if="{{item.funcSwitch}}">
|
||||
<view class="line-gray-ssm">
|
||||
</view>
|
||||
<view class="func-items">
|
||||
|
@ -745,42 +745,3 @@
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.func-items {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.func-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
color: #000;
|
||||
width: 23%;
|
||||
border-right: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.func-item:last-child {
|
||||
border-right: 0rpx;
|
||||
}
|
||||
|
||||
.func-item:active {
|
||||
background-color: #f3f3f3;
|
||||
color: #dfdfdf;
|
||||
}
|
||||
|
||||
.func-item image {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.func-item text {
|
||||
margin-left: 10rpx;
|
||||
text-align: center;
|
||||
}
|
@ -118,7 +118,6 @@ Page({
|
||||
},
|
||||
//获取首页展示的栏目
|
||||
getMainColumn(id) {
|
||||
console.log(id)
|
||||
var _self = this
|
||||
_self.setData({
|
||||
dataList: []
|
||||
@ -158,7 +157,10 @@ Page({
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.length > 0) {
|
||||
var options = datas[_self.data.curIndex]
|
||||
var isOpen = options.configColumnCollect == '2' || options.configColumnCollect == '4' || options.configColumnLike == '2' && options.configColumnLike == '4' || options.configColumnDispatch == '2' || options.configColumnDispatch == '4' || options.configColumnComment == '2' || options.configColumnComment == '4'
|
||||
var tempItem = {
|
||||
funcSwitch: isOpen,
|
||||
collectSwitch: datas[_self.data.curIndex].configColumnCollect, //收藏开关
|
||||
commentSwitch: datas[_self.data.curIndex].configColumnComment, //评论开关
|
||||
shareSwitch: datas[_self.data.curIndex].configColumnDispatch, //转发开关
|
||||
@ -194,28 +196,40 @@ Page({
|
||||
//构建主页显示数据
|
||||
buildMainData() {
|
||||
var _self = this
|
||||
var ids = ''
|
||||
_self.data.dataList.forEach(it => {
|
||||
it.list.forEach(item => {
|
||||
ids += item.uid + ','
|
||||
// 初始化评论 点赞 收藏状态
|
||||
item.collectCount = 0
|
||||
item.collectStatus = false
|
||||
item.commentCount = 0
|
||||
item.dispatchCount = 0
|
||||
item.likeCount = 0
|
||||
item.likeStatus = false
|
||||
item.scansCount = 0
|
||||
item.list.forEach(iem => {
|
||||
switch (iem.dataType) {
|
||||
case '2': //图片
|
||||
var photoIds = iem.value.split('@')
|
||||
if (photoIds.length > 1) {
|
||||
//展示方式
|
||||
iem.dataMode = photoIds[1]
|
||||
} else {
|
||||
iem.dataMode = '1'
|
||||
}
|
||||
var items = photoIds[0].split(',')
|
||||
var tempList = []
|
||||
items.forEach(item => {
|
||||
var tempItem = {
|
||||
id: item,
|
||||
path: app.urls.baseImgUrl + item,
|
||||
if (iem.value.length > 0) {
|
||||
var photoIds = iem.value.split('@')
|
||||
if (photoIds.length > 1) {
|
||||
//展示方式
|
||||
iem.dataMode = photoIds[1]
|
||||
} else {
|
||||
iem.dataMode = '1'
|
||||
}
|
||||
tempList.push(tempItem)
|
||||
})
|
||||
iem.valueList = tempList
|
||||
var items = photoIds[0].split(',')
|
||||
var tempList = []
|
||||
items.forEach(item => {
|
||||
var tempItem = {
|
||||
id: item,
|
||||
path: app.urls.baseImgUrl + item,
|
||||
}
|
||||
tempList.push(tempItem)
|
||||
})
|
||||
iem.valueList = tempList
|
||||
}
|
||||
break
|
||||
case '3': //音频
|
||||
var items = iem.value.split(',')
|
||||
@ -304,6 +318,47 @@ Page({
|
||||
curIndex: 0,
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
_self.getColumnContentHandle(ids)
|
||||
},
|
||||
//获取栏目内容点赞 收藏 评论
|
||||
getColumnContentHandle(ids) {
|
||||
var _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.http.get(app.urls.getColumnContentHandle.format({
|
||||
projectId: 'column',
|
||||
businessIds: ids
|
||||
}), {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
res.data.forEach(it => {
|
||||
_self.data.dataList.forEach(item => {
|
||||
item.list.forEach(iem => {
|
||||
if (iem.uid == it.businessId) {
|
||||
iem.collectCount = it.collectCount
|
||||
iem.collectStatus = it.collectStatus
|
||||
iem.commentCount = it.commentCount
|
||||
iem.dispatchCount = it.dispatchCount
|
||||
iem.likeCount = it.likeCount
|
||||
iem.likeStatus = it.likeStatus
|
||||
iem.scansCount = it.scansCount
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
_self.setData({
|
||||
curIndex: 0,
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
})
|
||||
},
|
||||
//获取首页基础数据 电话 微信号 地址 邮箱
|
||||
getMainBaseUserInfo(userid) {
|
||||
@ -377,8 +432,13 @@ Page({
|
||||
//需要跳详情
|
||||
var cId = e.currentTarget.dataset.cid
|
||||
var uId = e.currentTarget.dataset.id
|
||||
var like = e.currentTarget.dataset.like
|
||||
var collect = e.currentTarget.dataset.collect
|
||||
var comment = e.currentTarget.dataset.comment
|
||||
var share = e.currentTarget.dataset.share
|
||||
var params = '&collectSwitch=' + collect + '&likeSwitch=' + like + '&commentSwitch=' + comment + '&shareSwitch=' + share
|
||||
wx.navigateTo({
|
||||
url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId,
|
||||
url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId + params,
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -714,4 +774,92 @@ Page({
|
||||
})
|
||||
}
|
||||
},
|
||||
//显示评论
|
||||
showComment(e) {
|
||||
//需要跳详情
|
||||
var cId = e.currentTarget.dataset.cid
|
||||
var uId = e.currentTarget.dataset.uid
|
||||
var like = e.currentTarget.dataset.like
|
||||
var collect = e.currentTarget.dataset.collect
|
||||
var comment = e.currentTarget.dataset.comment
|
||||
var share = e.currentTarget.dataset.share
|
||||
var params = '&collectSwitch=' + collect + '&likeSwitch=' + like + '&commentSwitch=' + comment + '&shareSwitch=' + share
|
||||
console.log(params)
|
||||
wx.navigateTo({
|
||||
url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId + params,
|
||||
})
|
||||
},
|
||||
//点赞
|
||||
doLike(e) {
|
||||
var _self = this
|
||||
var item = e.currentTarget.dataset.item
|
||||
var idx = e.currentTarget.dataset.idx //内容索引
|
||||
var index = e.currentTarget.dataset.index //栏目索引
|
||||
var favor = item.likeStatus
|
||||
var msg = ''
|
||||
if (favor) {
|
||||
msg = '取消中...'
|
||||
} else {
|
||||
msg = '保存中...'
|
||||
}
|
||||
wx.showLoading({
|
||||
title: msg,
|
||||
})
|
||||
app.http.post(app.urls.doSaveLike, {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {
|
||||
businessId: item.uid,
|
||||
projectId: 'column'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
_self.data.dataList[index].list[idx].likeStatus = !item.likeStatus
|
||||
if (item.likeStatus) {
|
||||
--_self.data.dataList[index].list[idx].likeCount
|
||||
} else {
|
||||
++_self.data.dataList[index].list[idx].likeCount
|
||||
}
|
||||
_self.setData({
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
})
|
||||
.catch(err => {})
|
||||
},
|
||||
//收藏
|
||||
doCollect(e) {
|
||||
var _self = this
|
||||
var item = e.currentTarget.dataset.item
|
||||
var idx = e.currentTarget.dataset.idx //内容索引
|
||||
var index = e.currentTarget.dataset.index //栏目索引
|
||||
var favor = item.collectStatus
|
||||
var msg = ''
|
||||
if (favor) {
|
||||
msg = '取消收藏...'
|
||||
} else {
|
||||
msg = '收藏中...'
|
||||
}
|
||||
wx.showLoading({
|
||||
title: msg,
|
||||
})
|
||||
app.http.post(app.urls.doSaveCollect, {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {
|
||||
businessId: item.uid,
|
||||
projectId: 'column'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
_self.data.dataList[index].list[idx].collectStatus = !item.collectStatus
|
||||
_self.setData({
|
||||
dataList: _self.data.dataList
|
||||
})
|
||||
})
|
||||
.catch(err => {})
|
||||
}
|
||||
})
|
@ -147,13 +147,16 @@
|
||||
<view wx:for="{{item.list}}" wx:for-index="idx" wx:key="idx" wx:for-item="it" class="column-box">
|
||||
<!-- 栏目数据 -->
|
||||
<view wx:for="{{it.list}}" wx:for-index="i" wx:for-item="child" wx:key="i" bindtap="showDetail"
|
||||
class="{{child.valueList.length>0 || child.value.length>0 ? 'column-item' : ''}}"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}"
|
||||
class="{{(child.valueList.length>0 || child.value.length > 0) && child.displayList ? 'column-item' : ''}}"
|
||||
data-ctype="{{item.type}}" data-cid="{{item.cId}}" data-id="{{it.uid}}">
|
||||
<!-- 栏目样式1或3 -->
|
||||
<view>
|
||||
<!-- 具体数据 -->
|
||||
<!-- 文本 -->
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList}}" class="align-center">
|
||||
<view wx:if="{{child.dataType=='1' && child.displayList && child.value.length>0}}"
|
||||
class="align-center">
|
||||
<view class=" bg-white">
|
||||
<view class="cu-form-group">
|
||||
<view id="content" style="line-height:40rpx;width: 100%;">
|
||||
@ -198,6 +201,9 @@
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 视频 -->
|
||||
<view wx:if="{{child.dataType=='4' && child.displayList && child.valueList.length>0}}"
|
||||
style="width: 100%;">
|
||||
@ -302,39 +308,48 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论 收藏 点赞 -->
|
||||
<view class="func-box">
|
||||
<view class="line-gray-ssm">
|
||||
</view>
|
||||
<view class="func-items">
|
||||
<!-- 转发 -->
|
||||
<button class="func-item" open-type="share" data-sharetype="2" data-item="{{it}}" data-idx="{{idx}}"
|
||||
data-index="{{index}}" wx:if="{{item.shareSwitch != '1' && item.shareSwitch != '3'}}"
|
||||
style="font-size: 28rpx;font-weight: normal;text-align: center;background-color: #ffffff;width: 0rpx;margin: 0rpx;padding: 0rpx;border-radius: 0rpx;">
|
||||
<text class="cuIcon-share text-gray" style="font-size: 38rpx;"></text>
|
||||
<text style="text-align: center;line-height:28rpx;">转发</text>
|
||||
</button>
|
||||
<!-- 收藏 -->
|
||||
<view class="func-item" wx:if="{{item.collectSwitch != '1' && item.collectSwitch != '3'}}"
|
||||
data-item="{{it}}" data-idx="{{idx}}" data-index="{{index}}" catchtap="doCollect">
|
||||
<text class="{{it.collectStatus ? 'cuIcon-favorfill line-yellowlight2': 'cuIcon-favor text-gray'}}"
|
||||
style="font-size: 38rpx;"></text>
|
||||
<text>收藏</text>
|
||||
<!-- 评论 收藏 点赞 -->
|
||||
<view class="func-box" wx:if="{{item.funcSwitch}}">
|
||||
<view class="line-gray-ssm">
|
||||
</view>
|
||||
<!-- 评论 -->
|
||||
<view class="func-item" wx:if="{{item.commentSwitch != '1' && item.commentSwitch != '3'}}"
|
||||
catchtap="showComment" data-uid="{{it.uid}}" data-cid="{{item.cId}}">
|
||||
<text class="cuIcon-comment text-gray" style="font-size: 38rpx;"></text>
|
||||
<text style="font-size: 30rpx;">{{it.commentCount>1000 ? '1000+':it.commentCount}}</text>
|
||||
</view>
|
||||
<!-- 点赞 -->
|
||||
<view class="func-item" wx:if="{{item.likeSwitch != '1' && item.likeSwitch != '3'}}" catchtap="doLike"
|
||||
data-item="{{it}}" data-idx="{{idx}}" data-index="{{index}}">
|
||||
<text
|
||||
class="{{it.likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
|
||||
style="font-size: 38rpx;"></text>
|
||||
<text style="font-size:30rpx;">{{it.likeCount>1000? '1000+':it.likeCount}}</text>
|
||||
<view class="func-items">
|
||||
<!-- 转发 -->
|
||||
<button class="func-item" open-type="share" data-sharetype="2" data-item="{{it}}" data-idx="{{idx}}"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}" data-index="{{index}}"
|
||||
wx:if="{{item.shareSwitch != '1' && item.shareSwitch != '3'}}"
|
||||
style="font-size: 28rpx;font-weight: normal;text-align: center;background-color: #ffffff;width: 0rpx;margin: 0rpx;padding: 0rpx;border-radius: 0rpx;">
|
||||
<text class="cuIcon-share text-gray" style="font-size: 38rpx;"></text>
|
||||
<text style="text-align: center;line-height:28rpx;">转发</text>
|
||||
</button>
|
||||
<!-- 收藏 -->
|
||||
<view class="func-item" wx:if="{{item.collectSwitch != '1' && item.collectSwitch != '3'}}"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}" data-item="{{it}}"
|
||||
data-idx="{{idx}}" data-index="{{index}}" catchtap="doCollect">
|
||||
<text
|
||||
class="{{it.collectStatus ? 'cuIcon-favorfill line-yellowlight2': 'cuIcon-favor text-gray'}}"
|
||||
style="font-size: 38rpx;"></text>
|
||||
<text>收藏</text>
|
||||
</view>
|
||||
<!-- 评论 -->
|
||||
<view class="func-item" wx:if="{{item.commentSwitch != '1' && item.commentSwitch != '3'}}"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}" catchtap="showComment"
|
||||
data-uid="{{it.uid}}" data-cid="{{item.cId}}">
|
||||
<text class="cuIcon-comment text-gray" style="font-size: 38rpx;"></text>
|
||||
<text style="font-size: 30rpx;">{{it.commentCount>1000 ? '1000+':it.commentCount}}</text>
|
||||
</view>
|
||||
<!-- 点赞 -->
|
||||
<view class="func-item" wx:if="{{item.likeSwitch != '1' && item.likeSwitch != '3'}}"
|
||||
data-like="{{item.likeSwitch}}" data-share="{{item.shareSwitch}}"
|
||||
data-collect="{{item.collectSwitch}}" data-comment="{{item.commentSwitch}}" catchtap="doLike"
|
||||
data-item="{{it}}" data-idx="{{idx}}" data-index="{{index}}">
|
||||
<text
|
||||
class="{{it.likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
|
||||
style="font-size: 38rpx;"></text>
|
||||
<text style="font-size:30rpx;">{{it.likeCount>1000? '1000+':it.likeCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -712,38 +712,4 @@
|
||||
.bar-code image {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.func-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.func-items {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.func-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.func-item image {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.func-item text {
|
||||
margin-left: 10rpx;
|
||||
}
|
Loading…
Reference in New Issue
Block a user