Compare commits

...

5 Commits

Author SHA1 Message Date
高健
293510ccb3 评论、收藏、点赞完成修复页面显示bug 2021-09-24 14:30:14 +08:00
高健
f5e9b71775 评论 2021-09-23 17:33:09 +08:00
高健
463532b0f8 评论 2021-09-15 10:15:17 +08:00
高健
9a5a5a188d 栏目内容评论点赞等-目前做评论 2021-09-07 14:44:34 +08:00
高健
1e86f1a0f0 内容发布新版内容编辑 2021-09-06 16:06:51 +08:00
30 changed files with 2127 additions and 573 deletions

1
app.js
View File

@ -30,5 +30,6 @@ App({
token: '',
userId: '',
showUserId: '', //当前浏览的人的ID
currentUserId: '', //当前登录人的UserID
},
})

View File

@ -4162,6 +4162,347 @@ l .text-depblack {
}
/* 自定义 */
/* 单文本评论框 */
.comment-line-box {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
background-color: #ffffff;
width: 100%;
padding: 15rpx;
}
.comment-line-input-box {
color: #000000;
border-radius: 5rpx;
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 15rpx;
background-color: #ffffff;
}
.comment-line-input-box text {
display: block;
visibility: hidden;
word-break: break-all;
word-wrap: break-word;
font-size: 28rpx;
color: #000000;
}
.comment-line-input-box .weui-textarea {
height: 180rpx;
width: 80%;
text-align: left;
padding: 15rpx;
background-color: #f2f2f2;
border-radius: 10rpx;
}
.comment-line-input {
flex-grow: 0.8;
background-color: #f0f0f0;
padding: 15rpx;
font-size: 28rpx;
line-height: 70rpx;
text-align: left;
height: 70rpx;
}
.comment-line-btn {
background-color: #E6B980;
color: #ffffff;
font-size: 28rpx;
padding: 15rpx;
text-align: center;
margin-left: 15rpx;
width: 20%;
border-radius: 5rpx;
}
/*多媒体 评论发布框 */
.comment-box {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
background-color: #ffffff;
width: 100%;
}
/* 评论输入框按钮 */
.comment-box .input {
background-color: #f0f0f0;
border-radius: 15rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 15rpx 0rpx;
flex: 6;
}
.click-white {
background-color: #ffffff;
}
/* 评论输入框 */
.comment-content-box {
display: flex;
flex-direction: row;
justify-content: center;
align-items: flex-end;
width: 100%;
padding: 15rpx;
}
.comment-content-box .btn {
font-size: 32rpx;
color: #ff0000;
text-align: center;
flex-grow: 0.1;
}
.comment-content-input {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
min-height: 200rpx;
background-color: #f0f0f0;
padding: 15rpx;
font-size: 28rpx;
flex-grow: 0.9;
border-radius: 10rpx;
}
.comment-content-input textarea {
font-size: 28rpx;
height: 180rpx;
width: 100%;
}
.comment-content-funcs {
display: flex;
width: 100%;
flex-direction: row;
justify-content: flex-end;
align-items: center;
padding: 0rpx 15rpx 15rpx 15rpx;
}
.comment-comment-funcs .icons {
font-size: 50rpx;
padding: 0rpx 15rpx;
}
.icon-comment {
font-size: 50rpx;
flex: 2;
text-align: center;
}
.icon-comment:nth-child(1) {
margin-left: 15rpx;
}
.comment-list-box {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
width: 100%;
background-color: #ffffff;
padding: 15rpx;
min-height: 1000rpx;
margin-bottom: 100rpx;
margin-top: 15rpx;
}
.comment-list-title {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
font-size: 32rpx;
color: #000000;
}
.comment-list-item-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
width: 100%;
margin: 15rpx 0rpx;
}
.comment-list-item-box:nth-child(1) {
margin: 25rpx 0rpx 15rpx 0rpx;
}
.comment-list-item-content {
font-size: 28rpx;
padding: 15rpx 0rpx 15rpx 0rpx;
margin-left: 64rpx;
width: 90%;
}
.comment-count {
background-color: #f0f0f0;
padding: 0rpx 15rpx 0rpx 15rpx;
border-radius: 10rpx;
font-size: 24rpx;
}
/* 评论的回复 */
.restore-content-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
padding: 0rpx 15rpx 15rpx 15rpx;
border-bottom: 1rpx solid #f3f3f3;
}
.line {
width: 100%;
height: 1rpx;
background-color: #f3f3f3;
padding: 0rpx 15rpx 0rpx 15rpx;
}
.restore-content-title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
width: 100%;
}
.restore-content-title text {
margin: 0rpx 0rpx 0rpx 15rpx;
color: #000000;
font-size: 32rpx;
}
.restore-content-title image {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
}
.dialog-content {
width: 100%;
height: 50%;
}
.restore-content {
font-size: 28rpx;
padding: 15rpx 0rpx 15rpx 0rpx;
margin-left: 75rpx;
width: 90%;
}
.item-title-box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 100%;
padding-right: 30rpx;
}
.restore-box {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 100%;
align-items: center;
padding: 15rpx 30rpx 15rpx 64rpx;
}
.comment-input {
width: 80%;
background-color: #f3f3f3;
line-height: 70rpx;
height: 70rpx;
text-align: left;
padding: 0rpx 15rpx 0rpx 15rpx;
border-radius: 5rpx;
}
.comment-item-title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
width: 100%;
}
.comment-item-title image {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
}
.comment-item-title .comment-user-name {
font-size: 28rpx;
color: #000000;
text-align: center;
line-height: 48rpx;
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;
@ -4345,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;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 B

View File

@ -18,6 +18,7 @@ Page({
isRefresh: false,
isShowCodeInput: false, //测试true
code: '', //邀请码
contentHeight: app.globalData.windowHeight
},
/**
* 生命周期函数--监听页面加载
@ -56,8 +57,7 @@ Page({
if (res.data.length > 0) {
_self.setData({
optionsList: res.data,
curTypeId: res.data[0].dataId,
currentIndex: 0
curTypeId: res.data[_self.data.currentIndex].dataId
})
//根据第一条获取数据
_self.getList()
@ -80,7 +80,9 @@ Page({
token: app.globalData.token
},
data: {
templateType: self.data.curTypeId
templateType: self.data.curTypeId,
page: '1',
rows: '2'
}
}).then(res => {
wx.hideLoading({})
@ -214,5 +216,9 @@ Page({
wx.navigateTo({
url: '/packagecard/paypage/paypage?price=' + _self.data.needPayPrice + '&teamprice=' + _self.data.needPayTeamPrice + '&displayTreaty=1&type=1',
})
},
//加载更多
loadMore() {
console.log('触底了')
}
})

View File

@ -11,9 +11,11 @@
</block>
</van-tabs>
</view>
<scroll-view style="margin-top: 70rpx;" refresher-enabled="true" refresher-threshold="{{50}}"
refresher-background="#fff" enhanced="{{true}}" scroll-y bindrefresherrefresh="dorefreshList"
<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">

View File

@ -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

View File

@ -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">

View File

@ -2,25 +2,72 @@ const app = getApp()
var innerAudioContext = wx.createInnerAudioContext()
Page({
data: {
actions: [{
className: 'dialog-content'
}],
dataList: [],
isShowCommentInput: false, //是否显示评论等
collectSwitch: '1', //收藏的开关默认关闭
likeSwitch: '1', //点赞的开关
commentSwitch: '1', //评论的开关
shareSwitch: '1', //转发的开关
speedStep: 5, //快进快退秒数
waitFlag: false,
avatarUrl: app.globalData.userInfo.avatarUrl,
imgUrl: app.urls.baseImgUrl,
uId: '',
columnId: '',
publishTime: ''
publishTime: '',
isShowComment: false, //是否显示评论输入框
maxVideo: 1, //评论最大可以上传的视频数量
maxPhoto: 1, //评论最大可以上传的图片数量
commentValue: '', //评论输入的内容
mediaBean: null, //评论图片或视频bean {id:'',type:'video or image',coverPath:'图片路径'}
uploadCount: 0, //上传图片的次数
uploadVideoCount: 0, //上传视频的次数
maxDuration: 60, //上传视频时长限制
dataId: '', //当前评论Id
commentList: [], //评论列表
commentCount: 0,
currentPage: 1, //当前评论页数
curUserId: app.globalData.currentUserId,
isShowRestore: false,
restoreList: [],
currentCommentItem: undefined, //当前评论条目
currentType: 2, //当前评论类型
restorePage: 1, //当前回复的页数
restoreCount: 0,
likeStatus: false, //点赞
collectStatus: false, //收藏,
restoreLikeStatus: false, //评论点赞
contentHeight: app.globalData.windowHeight
},
onLoad(options) {
var _self = this
this.setData({
uId: options.uId,
columnId: options.cId
columnId: options.cId,
dataId: options.uId,
collectSwitch: options.collectSwitch, //收藏的开关
likeSwitch: options.likeSwitch, //点赞的开关
commentSwitch: options.commentSwitch, //评论的开关
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'
if (isShow) {
_self.setData({
isShowCommentInput: true
})
} else {
_self.setData({
isShowCommentInput: false
})
}
_self.getMainMoment()
_self.getCommentList()
_self.getColumnContentHandle(this.data.uId, 2)
},
// 获取栏目内容
getMainMoment() {
wx.showLoading({
title: '加载中...',
@ -44,6 +91,66 @@ Page({
console.log(err)
})
},
//获取栏目内容点赞 收藏 评论
getColumnContentHandle(ids, type) {
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({})
if (res.data.length > 0) {
if (type == 2) {
//栏目
_self.setData({
likeStatus: res.data[0].likeStatus,
collectStatus: res.data[0].collectStatus
})
} else {
if (_self.data.currentType == 2) {
//评论
_self.data.commentList.forEach(it => {
res.data.forEach(item => {
if (it.contentCommentId == item.businessId) {
it.likeStatus = item.likeStatus
it.contentCommentLike = item.likeCount
it.contentCommentSubCount = item.commentCount
}
})
})
_self.setData({
commentList: _self.data.commentList
})
} else {
//回复
_self.data.restoreList.forEach(it => {
res.data.forEach(item => {
if (it.contentCommentId == item.businessId) {
it.likeStatus = item.likeStatus
it.contentCommentLike = item.likeCount
it.contentCommentSubCount = item.commentCount
}
})
})
_self.setData({
restoreList: _self.data.restoreList
})
}
}
}
})
.catch(err => {
})
},
//构建展示数据
buildDetail(data) {
var _self = this
@ -53,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) {
@ -155,7 +269,75 @@ Page({
dataList: data.list
})
},
//获取评论列表
getCommentList() {
var _self = this
app.http.get(app.urls.getCommentList.format({
projectId: 'column',
businessId: _self.data.dataId
}), {
header: {
token: app.globalData.token
},
data: {
page: _self.data.currentPage
}
})
.then(res => {
wx.hideLoading({})
var ids = ''
res.data.rows.forEach(it => {
it.likeStatus = false
ids += it.contentCommentId + ','
})
_self.data.commentList = _self.data.commentList.concat(res.data.rows)
_self.setData({
commentList: _self.data.commentList,
commentCount: res.data.total
})
if (ids.length > 0) {
_self.getColumnContentHandle(ids, 3)
}
})
.catch(err => {
console.log(res)
})
},
//获取评论的回复
getRestoreList() {
var _self = this
app.http.get(app.urls.getCommentList.format({
projectId: 'column',
businessId: _self.data.dataId
}), {
header: {
token: app.globalData.token
},
data: {
page: _self.data.restorePage
}
})
.then(res => {
wx.hideLoading({})
var ids = ''
res.data.rows.forEach(it => {
it.likeStatus = false
ids += it.contentCommentId + ','
})
_self.data.restoreList = _self.data.restoreList.concat(res.data.rows)
_self.setData({
restoreList: _self.data.restoreList,
restoreCount: res.data.total,
isShowRestore: true
})
if (ids.length > 0) {
_self.getColumnContentHandle(ids, 3)
}
})
.catch(err => {
console.log(res)
})
},
//预览图片
viewImg(e) {
wx.previewImage({
@ -324,302 +506,6 @@ Page({
innerAudioContext.seek(e.detail.value)
}
},
// 跳转模板列表
goList: function () {
wx.navigateTo({
url: 'packagecard/cardList/cardList',
})
},
// 获取个人简介
getPersonIntro: function () {
var self = this
app.restAjax.get(app.restAjax.path('{personIntroUrl}app/userexpand/get/' + app.globalData.userInfo.userId, [app.personIntroUrl]), {}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
self.setData({
personIntro: data
})
}, function (code, data) {
app.dialog.msg(data.msg);
});
},
// 获取用户信息
getUserInfo: function () {
var self = this
app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
app.globalData.userInfo = data
self.getList()
}, function (code, data) {
app.dialog.msg(data.msg);
});
},
// 获取默认名片
getDefault: function () {
var self = this
app.http.get(app.urls.getDefaultCard, {
header: {
token: app.globalData.token
},
data: {}
}).then(res => {
var area = res.data.areaList
for (let i = 0; i < area.length; i++) {
if (area[i].templateAreaFontCenter == '1') {
area[i].templateAreaFontCenter = 'left'
} else if (area[i].templateAreaFontCenter == '2') {
area[i].templateAreaFontCenter = 'center'
} else {
area[i].templateAreaFontCenter = 'right'
}
if (area[i].templateAreaFontBold == '0') {
area[i].templateAreaFontBold = 'normal'
} else if (area[i].templateAreaFontBold == '1') {
area[i].templateAreaFontBold = 'bold'
} else {
area[i]['templateAreaFontStyle'] = 'italic'
}
if (area[i].templateAreaSource == 'phone') {
self.setData({
phoneTxt: area[i].templateAreaFontValue
})
} else if (area[i].templateAreaSource == 'wechat') {
self.setData({
wechatTxt: area[i].templateAreaFontValue
})
} else if (area[i].templateAreaSource == 'email') {
self.setData({
emailTxt: area[i].templateAreaFontValue
})
} else if (area[i].templateAreaSource == 'address') {
self.setData({
addressTxt: area[i].templateAreaFontValue
})
} else if (area[i].templateAreaSource == 'name') {
self.setData({
nameTxt: area[i].templateAreaFontValue
})
}
}
self.setData({
cardInfo: res.data,
areaList: area,
dataList: []
})
if (res.data) {
self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto)
self.getBrowCardUserList(res.data.cardTemplateUseId)
self.getMainColumn(res.data.creator)
}
}).catch(res => {
})
},
//获取浏览当前名片的用户头像列表
getBrowCardUserList(id) {
var _self = this
app.http.get(app.urls.getCardBrowUserList, {
header: {
token: app.globalData.token
},
data: {
page: '1',
rows: '7',
cardTemplateUseId: id
}
})
.then(res => {
if (res.data) {
_self.setData({
browUserList: res.data.rows
})
}
})
.catch(err => {
console.log(err)
})
},
// 存入通讯录
addContact: function () {
var self = this
wx.addPhoneContact({
firstName: self.data.nameTxt,
mobilePhoneNumber: self.data.phoneNum
})
},
// 加入卡包
includedCard: function () {
var self = this
app.http.post(app.urls.includedCard, {
header: {
token: self.data.token
},
data: {
cardTemplateUseBagId: "",
cardTemplateUseId: self.data.cardInfo.cardTemplateUseId,
cardTemplateUseStar: "",
cardTemplateUseTag: "",
cardTemplateUseTop: ""
}
}).then(res => {
console.log(res.data)
if (res.statusCode == '200') {
wx.showToast({
title: '加入卡包成功!',
})
}
})
},
// 拨打电话
makeCall: function () {
var self = this
var phone = self.data.phoneTxt
if (phone) {
wx.makePhoneCall({
phoneNumber: phone,
})
}
},
// 获取浏览数
getViewCount: function () {
var self = this
app.restAjax.get(app.restAjax.path('{cardUrl}app/templateviewrecord/getByTemplateUseId/' + self.data.cardInfo.cardPersonId, [app.cardUrl]), {}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
self.setData({
viewInfo: data
})
}, function (code, data) {
if (data.msg) {
app.dialog.msg(data.msg);
}
});
},
// 获取转发数
getForwardCount: function () {
var self = this
app.restAjax.get(app.restAjax.path('{cardUrl}app/templateforwardingrecord/count', [app.cardUrl]), {
templateUseId: self.data.cardInfo.cardPersonId
}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
self.setData({
forwardCount: data.data
})
}, function (code, data) {
app.dialog.msg(data.msg);
});
},
// 复制文本
copyText: function (e) {
var self = this
var text = e.currentTarget.dataset.text
if (text) {
wx.setClipboardData({
data: text,
success: function () {}
})
}
},
// 获取头像
checkPermission() {
var _self = this
try {
var names = wx.getStorageSync('name')
var icon = wx.getStorageSync('userIcon')
if (names) {
this.setData({
name: names,
userIcon: icon
})
} else {
wx.showModal({
title: '提示',
content: '小程序需要您微信头像以及昵称用于展示,请授权.',
showCancel: false,
success(res) {
if (res.confirm) {
_self.getUserProfile(3)
}
}
})
}
} catch (error) {
wx.showToast({
title: '获取信息失败',
icon: 'error'
})
}
},
getUserProfile(e) {
let _self = this
wx.getUserProfile({
desc: '获取微信头像以及昵称用于展示',
success: (res) => {
wx.setStorage({
data: res.userInfo.nickName,
key: 'name',
})
wx.setStorage({
data: res.userInfo.avatarUrl,
key: 'userIcon',
})
_self.setData({
name: res.userInfo.nickName,
userIcon: res.userInfo.avatarUrl
})
app.globalData.userIcon = res.userInfo.avatarUrl
app.globalData.userInfo = res.userInfo
_self.selectComponent('#head').refreshCart()
},
fail(err) {
//判断是否绑定手机号
wx.showToast({
title: '获取个人信息失败',
icon: 'error',
})
}
})
},
// 生成随机id
buildId: function () {
var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
var nums = "";
for (var i = 0; i < 36; i++) {
var id = parseInt(Math.random() * 61);
nums += chars[id];
}
return nums
},
// 展示名片码
showBarCode: function () {
this.setData({
isShowBarCode: true
})
wx.hideTabBar()
},
// 隐藏名片码
hideBarCode: function () {
this.setData({
isShowBarCode: false
})
wx.showTabBar()
},
// 转发记录
shareRecord: function (cardTemplateDispatchId) {
var self = this
@ -665,4 +551,417 @@ Page({
// // return返回 title 转发标题 path 路径 imageUrl 自定义图片,可以本地路径 代码包文件路径 支持png jpg 显示长宽比5:4
// }
// },
inputWatch(e) {
this.setData({
commentValue: e.detail.value
})
},
delMedia() {
var _self = this
wx.showModal({
title: '警告',
content: '确定要删除该数据吗?',
success(res) {
if (res.confirm) {
_self.setData({
mediaBean: null
})
}
}
})
},
//删除评论
delComment(e) {
var _self = this
var id = e.currentTarget.dataset.id
var index = e.currentTarget.dataset.idx
wx.showModal({
title: '提示',
content: '确定要删除该评论吗?',
success(res) {
if (res.confirm) {
//删除评论,刷新列表
_self.doDelComment(id, index)
}
}
})
},
//删除评论或回复
doDelComment(id, index) {
var _self = this
wx.showLoading({
title: '删除中...',
})
app.http.delete(app.urls.doDelComment.format({
ids: id
}), {
header: {
token: app.globalData.token
}
})
.then(res => {
wx.hideLoading({})
wx.showToast({
title: '删除成功',
})
//删除成功 刷新列表
if (_self.data.currentType == 2) {
//评论
_self.data.commentList.splice(index, 1)
_self.setData({
commentList: _self.data.commentList
})
} else {
//回复
_self.data.restoreList.splice(index, 1)
_self.data.commentList.forEach(it => {
if (it.contentCommentId == _self.data.dataId) {
it.contentCommentSubCount--
}
})
_self.setData({
restoreList: _self.data.restoreList,
commentList: _self.data.commentList
})
}
})
.catch(err => {
})
},
//评论的评论
doCommentToComment(e) {
var _self = this
var id = e.currentTarget.dataset.id
var item = e.currentTarget.dataset.item
_self.setData({
dataId: id,
currentPage: 1,
restoreList: [],
currentCommentItem: item,
currentType: 3
})
_self.getRestoreList()
},
//显示评论输入框
showComment() {
this.setData({
isShowComment: true
})
},
//关闭评论输入框
onCloseDialog(e) {
this.setData({
isShowComment: false
})
},
onCloseRestore(e) {
var _self = this
_self.setData({
isShowRestore: false,
currentType: 2,
dataId: _self.data.uId,
restoreList: [],
currentCommentItem: undefined
})
},
//选择图片
chooseImg() {
var _self = this
wx.chooseImage({
count: _self.data.maxPhoto,
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 0) {
_self.doUploadImg(res.tempFilePaths)
}
},
fail: (err) => {
}
})
},
doUploadImg(paths) {
wx.showLoading({
title: '上传中...',
})
let _self = this
app.http.upload(app.urls.doUploadImg, {
path: paths[0],
name: 'image',
header: {
token: app.globalData.token
}
})
.then(res => {
wx.hideLoading({})
//插入到集合中
var id = JSON.parse(res).data
var pathStr = app.urls.baseImgUrl + id
var item = {
id: id,
type: 'image',
coverPath: pathStr,
path: pathStr
}
_self.setData({
mediaBean: item
})
})
.catch(err => {
wx.hideLoading({})
_self.setData({
mediaBean: null
})
})
},
//选择视频
chooseVideo() {
var _self = this
wx.chooseMedia({
count: _self.data.maxVideo,
mediaType: ['video'],
sourceType: ['camera', 'album'],
maxDuration: 60,
success: (res) => {
console.log(res)
if (res.tempFiles.length > 0) {
if (res.tempFiles[0].duration <= _self.data.maxDuration) {
_self.doUploadVideo(res.tempFiles)
} else {
wx.showToast({
title: '视频最长60秒',
icon: 'none'
})
}
}
},
fail: (err) => {}
})
},
//上传视频
doUploadVideo(paths) {
wx.showLoading({
title: '上传中...',
})
let _self = this
app.http.upload(app.urls.doUploadVideo, {
path: paths[0].tempFilePath,
name: 'video',
header: {
token: app.globalData.token
}
})
.then(res => {
wx.hideLoading({})
var id = JSON.parse(res).data
var pathStr = app.urls.baseImgUrl + id
var item = {
id: id,
type: 'video',
coverPath: paths[0].thumbTempFilePath,
path: pathStr
}
_self.setData({
mediaBean: item
})
})
.catch(err => {
wx.hideLoading({})
_self.setData({
mediaBean: null
})
})
},
//校验评论参数
doSubmitComment(e) {
var _self = this
console.log(e)
var id = e.currentTarget.dataset.id
if (_self.data.commentValue.length > 0) {
_self.doSaveComment(id)
} else {
wx.showToast({
title: '请输入要发布的内容',
icon: 'none'
})
}
},
//保存评论
doSaveComment(id) {
var _self = this
wx.showLoading({
title: '保存中...',
})
app.http.post(app.urls.doSaveComment, {
header: {
token: app.globalData.token
},
data: {
businessId: id,
projectId: 'column',
contentCommentContent: _self.data.commentValue
}
})
.then(res => {
wx.hideLoading({})
wx.showToast({
title: '评论成功',
})
if (_self.data.currentType == 2) {
_self.setData({
commentValue: '',
isShowComment: false,
currentPage: 1, //重置评论列表
commentList: [],
commentCount: 0
})
//刷新列表
_self.getCommentList()
} else {
_self.data.commentList.forEach(it => {
if (it.contentCommentId == id) {
it.contentCommentSubCount++
}
})
_self.setData({
commentValue: '',
isShowComment: false,
restorePage: 1,
restoreList: [],
restoreCount: 0,
commentList: _self.data.commentList
})
_self.getRestoreList()
}
})
.catch(err => {
wx.hideLoading({})
_self.setData({
isShowComment: false
})
})
},
//点赞
doLike(e) {
var _self = this
var type = e.currentTarget.dataset.type //用来判断是栏目内容或评论与回复
var id = type == '2' ? _self.data.uId : e.currentTarget.dataset.id
var index = -1
if (type == '4') {
_self.data.commentList.forEach((item, idx) => {
if (item.contentCommentId == id) {
index = idx
}
})
} else {
index = e.currentTarget.dataset.idx //索引
}
var favor = type == '2' ? _self.data.likeStatus : e.currentTarget.dataset.like //当前的状态
var msg = ''
if (favor) {
msg = '取消中...'
} else {
msg = '保存中...'
}
wx.showLoading({
title: msg,
})
app.http.post(app.urls.doSaveLike, {
header: {
token: app.globalData.token
},
data: {
businessId: id,
projectId: 'column'
}
})
.then(res => {
wx.hideLoading({})
if (type == '2') {
//栏目
_self.setData({
likeStatus: !favor
})
} else {
//评论与回复
if (_self.data.currentType == 2) {
//评论
if (favor) {
_self.data.commentList[index].contentCommentLike--
_self.data.commentList[index].likeStatus = false
} else {
_self.data.commentList[index].contentCommentLike++
_self.data.commentList[index].likeStatus = true
}
_self.setData({
commentList: _self.data.commentList
})
} else {
if (type == '4') {
if (favor) {
_self.data.commentList[index].contentCommentLike--
_self.data.commentList[index].likeStatus = false
_self.data.currentCommentItem.likeStatus = false
} else {
_self.data.commentList[index].contentCommentLike++
_self.data.commentList[index].likeStatus = true
_self.data.currentCommentItem.likeStatus = true
}
_self.setData({
commentList: _self.data.commentList,
currentCommentItem: _self.data.currentCommentItem
})
} else {
//回复
if (favor) {
_self.data.restoreList[index].contentCommentLike--
_self.data.restoreList[index].likeStatus = false
} else {
_self.data.restoreList[index].contentCommentLike++
_self.data.restoreList[index].likeStatus = true
}
_self.setData({
restoreList: _self.data.restoreList
})
}
}
}
})
.catch(err => {})
},
//收藏
doCollect(e) {
var _self = this
var favor = _self.data.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: _self.data.uId,
projectId: 'column'
}
})
.then(res => {
wx.hideLoading({})
_self.data.collectStatus = !_self.data.collectStatus
_self.setData({
collectStatus: _self.data.collectStatus
})
})
.catch(err => {})
}
})

View File

@ -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,13 +188,168 @@
</view>
</view>
<!-- 评论信息 -->
<!-- <view class="comment-box">
<view>评论内容({{10}})</view>
<view class="comment-item">
<image></image>
<view class="comment-content">
<view class="comment-list-box" style="height: {{contentHeight}}px;">
<view class="comment-list-title">
<view>评论{{commentCount}}</view>
</view>
<block wx:if="{{commentList.length>0}}">
<view wx:for="{{commentList}}" wx:key="index" class="comment-list-item-box">
<view class="item-title-box">
<view class="comment-item-title">
<image src="{{item.contentCommentUserIcon}}"></image>
<view class="comment-user-name">{{item.contentCommentUserName}}</view>
</view>
<!-- 点赞 -->
<view catchtap="doLike" data-id="{{item.contentCommentId}}" data-idx="{{index}}" data-type="3"
data-like="{{item.likeStatus}}">
<text style="margin-right: 15rpx;">{{item.contentCommentLike}}</text>
<text
class="{{item.likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
style="font-size: 32rpx;"></text>
</view>
</view>
<!-- 评论内容 -->
<view class="comment-list-item-content">
{{item.contentCommentContent}}
</view>
<!-- 评论删除与回复 -->
<view class="restore-box">
<view class="comment-count" catchtap="doCommentToComment" data-id="{{item.contentCommentId}}"
data-item="{{item}}">
{{item.contentCommentSubCount}} 回复
</view>
<text class="cuIcon-close" style="font-size: 32rpx;color: #5d5d5d;" catchtap="delComment"
data-idx="{{index}}" data-id="{{item.contentCommentId}}"
wx:if="{{curUserId== item.creator}}"></text>
</view>
</view>
</block>
<view wx:else style="margin-top:200rpx;width:100%;">
<van-empty description="暂无评论" />
</view>
</view>
<!-- 评论底部输入 -->
<view class="foot bg-white" style="padding: 15rpx;" wx:if="{{isShowCommentInput}}">
<view class="comment-box">
<view class="input" hover-class="click-white" catchtap="showComment"
wx:if="{{commentSwitch != '1' && commentSwitch !='2'}}">
<text class="cuIcon-write"></text>
<text>写评论...</text>
</view>
<text wx:if="{{collectSwitch != '1' && collectSwitch != '2'}}"
class="icon-comment {{collectStatus ? 'cuIcon-favorfill line-yellowlight2': 'cuIcon-favor text-gray'}}"
catchtap="doCollect" style="font-size: 50rpx;"></text>
<text wx:if="{{likeSwitch != '1' && likeSwitch != '2'}}"
class="icon-comment {{likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
catchtap="doLike" data-type="2" style="font-size: 50rpx;"></text>
<button class="icon-comment" wx:if="{{shareSwitch != '1' && shareSwitch != '2'}}"
style="width: 0rpx;padding: 0rpx;background-color: #fff;line-height: 50rpx;margin:0rpx;">
<text class="cuIcon-share text-gray" style="font-size: 50rpx;"></text>
</button>
</view>
</view>
<!-- 评论回复底部输入 -->
<view class="foot bg-white" style="padding: 15rpx;z-index: 101;" wx:if="{{isShowRestore && isShowCommentInput}}">
<view class="comment-box">
<view class="input" hover-class="click-white" catchtap="showComment"
wx:if="{{commentSwitch != '1' && commentSwitch !='2'}}">
<text class="cuIcon-write"></text>
<text>写评论...</text>
</view>
<text wx:if="{{likeSwitch != '1' && likeSwitch != '2'}}"
class="icon-comment {{currentCommentItem.likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
style="font-size: 50rpx;" data-id="{{currentCommentItem.contentCommentId}}" data-type="4"
catchtap="doLike" data-like="{{currentCommentItem.likeStatus}}"></text>
<button class="icon-comment" wx:if="{{shareSwitch != '1' && shareSwitch != '2'}}"
style="width: 0rpx;padding: 0rpx;background-color: #fff;line-height: 50rpx;margin:0rpx;">
<text class="cuIcon-share text-gray" style="font-size: 50rpx;"></text>
</button>
</view>
</view>
</view>
<!-- 单文本内容评论 -->
<van-action-sheet show="{{isShowComment}}" round="{{false}}" bind:close="onCloseDialog" z-index="102">
<view class="comment-line-input-box">
<input placeholder="请输入评论内容" cursor-spacing="100" value="{{commentValue}}" class="comment-input"
bindinput="inputWatch" />
<view class="comment-line-btn" catchtap="doSubmitComment" data-id="{{dataId}}">
发布
</view>
</view>
</van-action-sheet>
<!-- 评论的回复 -->
<van-action-sheet show="{{isShowRestore}}" round="{{true}}" bind:close="onCloseRestore"
title="{{restoreList.length}}条回复">
<!-- 楼主 -->
<view class="restore-content-box">
<view class="restore-content-title">
<image src="{{currentCommentItem.contentCommentUserIcon}}" mode="scaleToFill"></image>
<text>{{currentCommentItem.contentCommentUserName}}</text>
</view>
<view class="restore-content">{{currentCommentItem.contentCommentContent}}</view>
</view>
<!-- 回复的内容 -->
<block wx:if="{{restoreList.length>0}}">
<scroll-view style="height: 600rpx;width: 100%;padding: 15rpx;margin-bottom: 100rpx;" scroll-y>
<view style="padding: 15rpx 15rpx 25rpx 15rpx;color: #000000;font-size: 32rpx;">全部回复</view>
<block wx:if="{{restoreList.length>0}}">
<view wx:for="{{restoreList}}" wx:key="index" class="comment-list-item-box">
<view class="item-title-box">
<view class="comment-item-title">
<image src="{{item.contentCommentUserIcon}}"></image>
<view class="comment-user-name">{{item.contentCommentUserName}}</view>
</view>
<view catchtap="doLike" data-id="{{item.contentCommentId}}" data-idx="{{index}}" data-type="3"
data-like="{{item.likeStatus}}">
<text style="margin-right: 15rpx;">{{item.contentCommentLike}}</text>
<text
class="{{item.likeStatus ? 'cuIcon-appreciatefill line-yellowlight2' :'cuIcon-appreciate text-gray'}}"
style="font-size: 32rpx;"></text>
</view>
</view>
<view class="comment-list-item-content">
{{item.contentCommentContent}}
</view>
<view class="restore-box">
<view></view>
<text class="cuIcon-close" style="font-size: 32rpx;color: #5d5d5d;" catchtap="delComment"
data-idx="{{index}}" data-id="{{item.contentCommentId}}"
wx:if="{{curUserId== item.creator}}"></text>
</view>
</view>
</block>
</scroll-view>
</block>
<view wx:else style="height: 500rpx;width:100%;">
<van-empty description="暂无回复" />
</view>
</van-action-sheet>
<!-- 文本加多媒体评论内容 -->
<!-- <van-action-sheet show="{{isShowComment}}" round="{{false}}" bind:close="onCloseDialog">
<view class="comment-content-box">
<view class="comment-content-input">
<textarea placeholder="请输入评论内容" placeholder-style="font-size:28rpx;" cursor-spacing="200"
value="{{inputWatch}}" bindinput="inputWatch"></textarea>
<view wx:if="{{mediaBean != null}}"
style="display: flex;flex-direction: row;justify-content: center;align-items: center;width: 128rpx;height: 128rpx;position: relative;">
<image src="{{mediaBean.coverPath}}" mode="aspectFill" style="width: 100%;height: 100%;"></image>
<text class="cuIcon-close" catchtap="delMedia"
style="font-size: 38rpx;position: absolute;top:-15rpx;right:-15rpx;background:rgba(130,130,130, 0.8);border-radius: 50%;text-align: center;opacity: 0.8;color:#ffffff;"></text>
<image src="/images/ic_video_play.png" mode="scaleToFill" wx:if="{{mediaBean.type=='video'}}"
style="width: 30rpx;height: 30rpx;position: absolute;top: 40%;left: 40%;">
</image>
</view>
</view>
</view> -->
</view>
<view class="btn">
发布
</view>
</view>
<view class="comment-content-funcs">
<text class="cuIcon-pic" style="margin: 0rpx 30rpx;font-size: 50rpx;" catchtap="chooseImg"></text>
<text class="cuIcon-record" style="margin: 0rpx 30rpx;font-size: 50rpx;" catchtap="chooseVideo"></text>
</view>
</van-action-sheet> -->

View File

@ -395,7 +395,7 @@
}
.top-box {
padding: 15rpx 15rpx 20rpx 15rpx;
width: 100%;
}
.good {
@ -645,13 +645,6 @@
line-height: 50rpx;
}
.comment-box {
width: 95%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.movie-item {
height: 280rpx;

View File

@ -49,13 +49,17 @@ Page({
curSelPhotoDisplay: '1', //图片的显示方式 1.九宫格 2.轮播 3.轮播(自动) 4.平铺
curVideoDisplay: '1', //视频展示方式 1.九宫格 2.平铺
curTextAlign: '1', //文字显示排列 1.居左 2.居中 3.居右
curFieldType: '0', //编辑选择的文件类型
curFieldTypeIndex: 0, //编辑选择的文件类型
curFieldType: 'text', //编辑选择的文件类型
selDirection: '1', //选中的插入方向 1.插入到下面 2.插入的上面
isInsert: false, //是否显示插入选项
topBoxHeight: 100, //顶部类型选择框的高度
audioFile: null, //当前的录音文件
audioDuration: 0, //录音文件的时长
isRecording: false, //是否正在录音
speedStep: 5, //快进快退的时间
sourceType: 'add', //用来标识是添加还是编辑 add添加 edit编辑 insert插入
insertIndex: -1, //插入的索引
optionsList: [{
id: '1',
name: '选项一',
@ -112,7 +116,11 @@ Page({
var tempItem = {}
tempItem['type'] = 'map'
tempItem['value'] = item
_self.data.valueList.push(tempItem)
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempItem)
} else {
_self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempItem)
}
_self.setData({
valueList: _self.data.valueList
})
@ -266,8 +274,10 @@ Page({
},
//编辑选择出入的类型
chooseFieldType(e) {
var idx = e.currentTarget.dataset.idx
var type = e.currentTarget.dataset.type
this.setData({
curFieldTypeIndex: idx,
curFieldType: type
})
},
@ -286,7 +296,11 @@ Page({
tempPhoto['type'] = 'photo'
tempPhoto['valueList'] = tempList
tempPhoto['displayType'] = _self.data.curSelPhotoDisplay
_self.data.valueList.push(tempPhoto)
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempPhoto)
} else {
_self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempPhoto)
}
_self.setData({
valueList: _self.data.valueList,
photoList: [],
@ -315,12 +329,18 @@ Page({
tempVideo['type'] = 'video'
tempVideo['valueList'] = tempList
tempVideo['displayType'] = _self.data.curVideoDisplay
_self.data.valueList.push(tempVideo)
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempVideo)
} else {
_self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempVideo)
}
_self.setData({
valueList: _self.data.valueList,
videoList: [],
curVideoDisplay: 1,
isShowVideo: false
isShowVideo: false,
currentIndex: -1,
sourceType: 'add'
})
} else {
wx.showToast({
@ -332,6 +352,49 @@ Page({
//确定插入数据
doInsert() {
//根据选择的类型与方向插入数据
var _self = this
var inIndex = -1
//selDirection 1是上面 2是下面
if (_self.data.selDirection == 1) {
inIndex = _self.data.currentIndex
} else {
inIndex = ++_self.data.currentIndex
}
_self.setData({
insertIndex: inIndex,
sourceType: 'insert',
isInsert: false,
})
switch (_self.data.curFieldType) {
case 'text':
case 'textarea': //文本域
this.setData({
isShowInput: true
})
break
case 'video': //视频
_self.chooseVideo()
break
case 'audio': //音频
_self.checkRecordPermission()
break
case 'photo': //图片
_self.chooseImg()
break
case 'map': //地图
_self.doChooseLocation()
break
case 'select': //选项
_self.setData({
isShowSelect: true
})
break
case 'link': //链接
_self.setData({
isShowLink: true
})
break
}
},
hideEditBox() {
//隐藏编辑框
@ -343,7 +406,8 @@ Page({
this.setData({
isShowInput: false,
isShowLink: false,
isShowSelect: false
isShowSelect: false,
sourceType: 'add' //重置状态
})
},
//输入框监听
@ -373,7 +437,11 @@ Page({
var tempText = {}
tempText['type'] = 'link'
tempText['value'] = _self.data.curLinkText
_self.data.valueList.push(tempText)
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempText)
} else {
_self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempText)
}
_self.setData({
valueList: _self.data.valueList,
curLinkText: '',
@ -395,7 +463,6 @@ Page({
tempText['type'] = 'text'
tempText['value'] = _self.data.curTextValue
var textAlign = 'left'
console.log(_self.data.curTextAlign)
switch (_self.data.curTextAlign) {
case '1':
textAlign = 'left'
@ -408,11 +475,16 @@ Page({
break
}
tempText['textAlign'] = textAlign
_self.data.valueList.push(tempText)
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempText)
} else {
_self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempText)
}
_self.setData({
valueList: _self.data.valueList,
curTextValue: '',
isShowInput: false
isShowInput: false,
curTextAlign: '1'
})
}
},
@ -482,12 +554,38 @@ Page({
}
})
},
//预览视频
viewVideo(e) {
var _self = this
var idx = e.currentTarget.dataset.idx
var index = e.currentTarget.dataset.index
var url = _self.data.valueList[index].valueList[idx].path
var tempItem = {}
tempItem['url'] = url
tempItem['type'] = 'video'
wx.previewMedia({
sources: [tempItem],
})
},
//删除视频
delVideo(e) {
var _self = this
var idx = e.currentTarget.dataset.index
wx.showModal({
title: '提示',
content: '确定要删除该视频吗?',
success(res) {
if (res.confirm) {
_self.data.videoList.splice(idx, 1)
_self.setData({
videoList: _self.data.videoList
})
}
}
})
},
//选择定位点
doChooseLocation(e) {
// var index = e.currentTarget.dataset.index
// this.setData({
// curMapIndex: index
// })
var curLoc = JSON.stringify(location)
wx.navigateTo({
url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${curLoc}&category=${category}`
@ -495,7 +593,60 @@ Page({
},
//编辑条目
editItem(e) {
var _self = this
var idx = e.currentTarget.dataset.index
_self.setData({
sourceType: 'edit'
})
switch (_self.data.valueList[idx].type) {
case 'text':
case 'textarea': //文本域
var align = '1'
if (_self.data.valueList[idx].textAlign == 'left') {
align = '1'
} else if (_self.data.valueList[idx].textAlign == 'center') {
align = '2'
} else {
align = '3'
}
this.setData({
isShowInput: true,
curTextValue: _self.data.valueList[idx].value,
curTextAlign: align
})
break
case 'video': //视频
//构建视频数据
_self.setData({
curVideoDisplay: _self.data.valueList[idx].displayType,
videoList: _self.data.valueList[idx].valueList,
isShowVideo: true
})
break
case 'audio': //音频
_self.checkRecordPermission()
break
case 'photo': //图片
_self.setData({
curSelPhotoDisplay: _self.data.valueList[idx].displayType,
photoList: _self.data.valueList[idx].valueList,
isShowPhoto: true
})
break
case 'map': //地图
location.latitude = _self.data.valueList[idx].value.latitude
location.longitude = _self.data.valueList[idx].value.longitude
_self.doChooseLocation()
break
case 'select': //选项
break
case 'link': //链接
_self.setData({
curLinkText: _self.data.valueList[idx].value,
isShowLink: true
})
break
}
},
//插入条目
insertItem(e) {
@ -506,12 +657,17 @@ Page({
},
//删除条目
delItem(e) {
var _self = this
wx.showModal({
title: '提示',
content: '确定要删除该条数据吗?',
success(res) {
if (res.confirm) {
_self.data.valueList.splice(_self.data.currentIndex, 1)
_self.setData({
valueList: _self.data.valueList,
currentIndex: -1
})
}
}
})
@ -551,10 +707,21 @@ Page({
//确定音频
doConfirmAudio() {
var _self = this
if (_self.data.audioFile.isPlay) {
innerAudioContext.stop()
}
var tempAudio = {}
tempAudio['type'] = 'audio'
tempAudio['value'] = _self.data.audioFile
_self.data.valueList.push(tempAudio)
//重置文件的状态
_self.data.audioFile.curDurationStr = '00:00'
_self.data.audioFile.curDuration = 0
_self.data.audioFile.isPlay = false
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempAudio)
} else {
_self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempAudio)
}
_self.setData({
valueList: _self.data.valueList,
audioFile: null,
@ -671,6 +838,9 @@ Page({
var _self = this
if (type && type == 'audio') {
if (_self.data.audioFile != null) {
if (_self.data.audioFile.isPlay) {
innerAudioContext.stop()
}
wx.showModal({
title: '警告',
content: '关闭录音弹窗将清除当前录制的音频文件,确定要关闭吗?',
@ -694,21 +864,43 @@ Page({
isShowEdit: false,
isShowVideo: false,
isShowSelect: false,
sourceType: 'add'
})
},
//音频拖动
slider4change(e) {
var _self = this
var audio = e.currentTarget.dataset.item
var type = e.currentTarget.dataset.type
var idx = e.currentTarget.dataset.idx
var time = Number.parseInt(e.detail.value)
if (audio.isPlay) {
innerAudioContext.seek(e.detail.value)
innerAudioContext.pause()
innerAudioContext.seek(time)
setTimeout(() => {
innerAudioContext.play()
}, 500)
if (type == 'record') {
_self.data.audioFile.curDuration = time
_self.data.audioFile.curDurationStr = '00:' + (time > 9 ? time : '0' + time)
console.log(_self.data.audioFile)
_self.setData({
audioFile: _self.data.audioFile
})
} else {
_self.data.valueList[idx].value.curDuration = time
_self.data.valueList[idx].value.curDurationStr = '00:' + (time > 9 ? time : '0' + time)
_self.setData({
valueList: _self.data.valueList
})
}
}
},
play(e) {
//进行播放
var audio = e.currentTarget.dataset.item
var _self = this
var type = e.currentTarget.dataset.type
var type = e.currentTarget.dataset.type //show展示列表 record录音弹框
var idx = e.currentTarget.dataset.idx
if (audio.isPlay) {
innerAudioContext.stop()
@ -721,76 +913,129 @@ Page({
}
//先需要停止其他录音文件的播放
innerAudioContext.onPlay(() => {
_self.data.audioFile.isPlay = true
_self.setData({
audioFile: _self.data.audioFile
})
if (type == 'record') {
_self.data.audioFile.isPlay = true
_self.setData({
audioFile: _self.data.audioFile
})
} else {
_self.data.valueList[idx].value.isPlay = true
_self.setData({
valueList: _self.data.valueList
})
}
});
innerAudioContext.onStop((res) => {
console.log('停止播放')
//重置文件的状态
_self.setAudioDefault()
if (type == 'record') {
_self.setAudioDefault()
} else {
_self.setShowAudioDefault(idx)
}
})
innerAudioContext.onEnded((res) => {
console.log('播放结束')
//重置文件的状态
_self.setAudioDefault()
if (type == 'record') {
_self.setAudioDefault()
} else {
_self.setShowAudioDefault(idx)
}
})
innerAudioContext.onError((res) => {
wx.showToast({
title: '播放失败',
icon: 'error'
})
_self.setAudioDefault()
if (type == 'record') {
_self.setAudioDefault()
} else {
_self.setShowAudioDefault(idx)
}
})
innerAudioContext.onTimeUpdate(() => {
_self.data.audioFile.curDuration = innerAudioContext.currentTime
var time = Number.parseInt(_self.data.audioFile.curDuration)
_self.data.audioFile.curDurationStr = '00:' + (time > 9 ? time : '0' + time)
_self.setData({
audioFile: _self.data.audioFile
})
var curTime = innerAudioContext.currentTime
if (type == 'record') {
_self.data.audioFile.curDuration = curTime
var time = Number.parseInt(_self.data.audioFile.curDuration)
_self.data.audioFile.curDurationStr = '00:' + (time > 9 ? time : '0' + time)
_self.setData({
audioFile: _self.data.audioFile
})
} else {
_self.data.valueList[idx].value.curDuration = curTime
var timeTemp = Number.parseInt(_self.data.valueList[idx].value.curDuration)
_self.data.valueList[idx].value.curDurationStr = '00:' + (timeTemp > 9 ? time : '0' + timeTemp)
_self.setData({
valueList: _self.data.valueList
})
}
})
},
//设置录音文件恢复初始
setAudioDefault() {
var _self = this
//重置文件的状态
_self.data.audioFile.curDurationStr = '00:00'
_self.data.audioFile.curDuration = 0
_self.data.audioFile.isPlay = false
if (_self.data.audioFile != null) {
//重置文件的状态
_self.data.audioFile.curDurationStr = '00:00'
_self.data.audioFile.curDuration = 0
_self.data.audioFile.isPlay = false
_self.setData({
audioFile: _self.data.audioFile
})
}
},
//重置录音文件状态
setShowAudioDefault(idx) {
var _self = this
_self.data.valueList[idx].value.curDurationStr = '00:00'
_self.data.valueList[idx].value.curDuration = 0
_self.data.valueList[idx].value.isPlay = false
_self.setData({
audioFile: _self.data.audioFile
valueList: _self.data.valueList
})
},
//倒退5秒
rewind(e) {
var _self = this
var index = e.currentTarget.dataset.index
var item = e.currentTarget.dataset.item
var idx = e.currentTarget.dataset.idx
var ix = e.currentTarget.dataset.i
var type = e.currentTarget.dataset.type
if (item.isPlay) {
_self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix].curDuration - _self.data.speedStep
innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration)
_self.setData({
dataList: _self.data.dataList
})
if (type == 'record') {
_self.data.audioFile.curDuration = _self.data.audioFile.curDuration - _self.data.speedStep
innerAudioContext.seek(_self.data.audioFile.curDuration)
_self.setData({
audioFile: _self.data.audioFile
})
} else {
_self.data.valueList[idx].value.curDuration = _self.data.valueList[idx].value.curDuration - _self.data.speedStep
innerAudioContext.seek(_self.data.valueList[idx].value.curDuration)
_self.setData({
valueList: _self.data.valueList
})
}
}
},
//快进5秒
speed(e) {
var _self = this
var index = e.currentTarget.dataset.index
var item = e.currentTarget.dataset.item
var idx = e.currentTarget.dataset.idx
var ix = e.currentTarget.dataset.i
var type = e.currentTarget.dataset.type
if (item.isPlay) {
_self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix].curDuration + _self.data.speedStep
innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration)
_self.setData({
dataList: _self.data.dataList
})
if (type == 'record') {
_self.data.audioFile.curDuration = _self.data.audioFile.curDuration + _self.data.speedStep
innerAudioContext.seek(_self.data.audioFile.curDuration)
_self.setData({
audioFile: _self.data.audioFile
})
} else {
_self.data.valueList[idx].value.curDuration = _self.data.valueList[idx].value.curDuration + _self.data.speedStep
innerAudioContext.seek(_self.data.valueList[idx].value.curDuration)
_self.setData({
valueList: _self.data.valueList
})
}
}
},
onUnload() {

View File

@ -47,12 +47,14 @@
<block wx:if="{{valueList.length>0}}">
<view wx:for="{{valueList}}" wx:key="index" style="margin-top: 15rpx;width: 100%;">
<!-- 文本域 -->
<view wx:if="{{item.type=='text' || item.type=='textarea'}}" catchtap="showEditBox" class="item-box"
data-idx="{{index}}">
<view style="width: 100%;text-align: {{item.textAlign}};font-size: 32rpx;">{{item.value}}</view>
<view wx:if="{{item.type=='text' || item.type=='textarea'}}" catchtap="showEditBox"
class="item-box {{currentIndex==index ? 'sel-border':''}}" data-idx="{{index}}">
<view style="width: 100%;text-align: {{item.textAlign}};font-size: 32rpx;overflow-wrap: break-word;">
{{item.value}}</view>
</view>
<!-- 图片 -->
<view wx:if="{{item.type=='photo'}}" catchtap="showEditBox" class="item-box" data-idx="{{index}}">
<view wx:if="{{item.type=='photo'}}" catchtap="showEditBox"
class="item-box {{currentIndex==index ? 'sel-border':''}}" data-idx="{{index}}">
<!-- 九宫格 -->
<view class="grid col-3 grid-square flex-sub" wx:if="{{item.displayType=='1'}}" style="width: 100%;">
<view class="bg-img" wx:for="{{item.valueList}}" wx:key="idx" wx:for-item="photo">
@ -79,52 +81,60 @@
</view>
</view>
<!-- 视频 -->
<view wx:if="{{item.type=='video'}}" catchtap="showEditBox" class="item-box" data-idx="{{index}}">
<view wx:if="{{item.type=='video'}}" catchtap="showEditBox"
class="item-box {{currentIndex==index ? 'sel-border':''}}" data-idx="{{index}}">
<!-- 九宫格 -->
<view class="grid col-3 grid-square flex-sub" wx:if="{{item.displayType=='1'}}" style="width: 100%;">
<view class="bg-img" wx:for="{{item.valueList}}" wx:key="idx" wx:for-item="video">
<view class="bg-img" wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx"
wx:for-item="video">
<image src='{{video.coverPath}}' mode='aspectFill'></image>
<image src="/images/ic_video_play.png" mode="scaleToFill"
<image src="/images/ic_video_play.png" mode="scaleToFill" catchtap="viewVideo"
data-idx="{{idx}}" data-index="{{index}}"
style="width: 48rpx;height:48rpx;position: absolute;top:40%;left:40%;">
</image>
</view>
</view>
<block wx:if="{{item.displayType=='2'}}">
<view class="movie-box" wx:for="{{item.valueList}}" wx:key="index" wx:for-item="video">
<view class="movie-box" wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx"
wx:for-item="video">
<image src='{{video.coverPath}}' mode='scaleToFill'></image>
<view class="play-box-arrow-flex">
<image src="/images/ic_video_play.png" mode="scaleToFill"
style="width: 96rpx;height:96rpx;">
<image src="/images/ic_video_play.png" mode="scaleToFill" catchtap="viewVideo"
data-idx="{{idx}}" data-index="{{index}}" style="width: 96rpx;height:96rpx;">
</image>
</view>
</view>
</block>
</view>
<!-- 音频 -->
<view wx:if="{{item.type=='audio'}}" catchtap="showEditBox" class="item-box" data-idx="{{index}}">
<view wx:if="{{item.type=='audio'}}" catchtap="showEditBox"
class="item-box {{currentIndex == index ? 'sel-border': ''}}" data-idx="{{index}}">
<view class="play-box-shadow-little">
<view class="flex justify-between align-center" style="width:80%;">
<text>{{item.value.curDurationStr}}</text>
<slider class="flex-sub" bindchange="slider4change" min="{{0}}" max="{{item.value.duration}}"
value="{{item.value.curDuration}}" backgroundColor="#cacaca" activeColor="#1296db"
block-size="14" data-item="{{item.value}}" block-color="#1296db" data-idx="{{index}}" />
data-type="show" block-size="14" data-item="{{item.value}}" block-color="#1296db"
data-idx="{{index}}" />
<text>{{item.value.totalDurationStr}}</text>
</view>
<view class="flex justify-between" style="width:80%;">
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" catchtap="rewind"
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" catchtap="rewind" data-type="show"
data-idx="{{index}}" data-item="{{item.value}}">
</image>
<image src="{{item.value.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
data-idx="{{index}}" mode="scaleToFill" catchtap="play" data-item="{{item.value}}">
data-type="show" data-idx="{{index}}" mode="scaleToFill" catchtap="play"
data-item="{{item.value}}">
</image>
<image src="/images/ic_audio_speed.png" mode="scaleToFill" catchtap="speed" data-idx="{{index}}"
data-item="{{item.value}}">
data-type="show" data-item="{{item.value}}">
</image>
</view>
</view>
</view>
<!-- 地图 -->
<view wx:if="{{item.type=='map'}}" catchtap="showEditBox" class="item-box" data-idx="{{index}}">
<view wx:if="{{item.type=='map'}}" catchtap="showEditBox"
class="item-box {{currentIndex == index ? 'sel-border':''}}" data-idx="{{index}}">
<view class="flex flex-direction align-center bg-white radius item-padding">
<view style="width: 100%;">
<view class="flex justify-between">
@ -141,7 +151,8 @@
</view>
</view>
<!-- 链接 -->
<view wx:if="{{item.type=='link'}}" catchtap="showEditBox" class="item-box" data-idx="{{index}}">
<view wx:if="{{item.type=='link'}}" catchtap="showEditBox"
class="item-box {{currentIndex == index ? 'sel-border':''}}" data-idx="{{index}}">
<view style="width: 100%;font-size: 32rpx;">{{item.value}}</view>
</view>
<!-- 选项 -->
@ -150,7 +161,7 @@
<view
style="display: flex;flex-direction: row;justify-content: flex-start;align-items: center;flex-wrap: wrap;width: 100%;">
<block wx:for="{{item.valueList}}" wx:key="index" wx:for-item="options">
<view class="cu-tag bg-blue" style="margin:15rpx 15rpx 0rpx 15rpx;">
<view class="cu-tag bg-blue">
{{options.name}}
</view>
</block>
@ -158,7 +169,8 @@
</view>
<view wx:if="{{currentIndex == index}}">
<view class="control-box">
<view class="item" catchtap="editItem" data-index="{{index}}" data-type="{{item.type}}">
<view class="item" catchtap="editItem" data-index="{{index}}" data-type="{{item.type}}"
wx:if="{{item.type != 'audio'}}">
<text class="cuIcon-edit bg-yellow-light"></text>
<text style="margin-left: 15rpx;">编辑</text>
</view>
@ -178,19 +190,19 @@
<view class="dir-box">
<view class="cu-capsule radius" catchtap="chooseDirection" data-idx="1">
<view class="cu-tag {{selDirection=='1' ? 'bg-yellowlight':'bg-grey'}}">
<text class="{{selDirection=='1' ? 'cuIcon-apps':'cuIcon-apps'}}"></text>
<text class="{{selDirection=='1' ? 'cuIcon-radiobox':'cuIcon-round'}}"></text>
</view>
<view class="cu-tag {{selDirection=='1' ? 'line-yellowlight2':'line-black'}}">
插入到下面
内容上
</view>
</view>
<view class="cu-capsule radius" style="margin-left: 15rpx;" catchtap="chooseDirection"
data-idx="2">
<view class="cu-tag {{selDirection== '2' ? 'bg-yellowlight':'bg-grey'}}">
<text class="{{selDirection== '2' ? 'cuIcon-apps':'cuIcon-apps'}}"></text>
<text class="{{selDirection== '2' ? 'cuIcon-radiobox':'cuIcon-round'}}"></text>
</view>
<view class="cu-tag {{selDirection=='2' ? 'line-yellowlight2':'line-black'}}">
插入到上面
内容下
</view>
</view>
</view>
@ -198,12 +210,13 @@
<view class="dir-parent-box">
<view class="title">类型:</view>
<view class="choose-box">
<block wx:for="{{fieldList}}" wx:for-index="idx" wx:key="idx">
<view catchtap="chooseFieldType" data-type="{{idx}}" class="item">
<block wx:for="{{fieldList}}" wx:for-index="idx" wx:key="idx" wx:for-item="it">
<view catchtap="chooseFieldType" data-type="{{it.type}}" data-idx="{{idx}}"
class="item">
<text
class="{{curFieldType == idx ? 'bg-yellow-light cuIcon-roundcheck' : 'text-gray2 cuIcon-round'}}"></text>
<text class="{{curFieldType == idx ? 'bg-yellow-light' : 'text-gray2'}}"
style="margin-left: 6rpx;">{{item.type}}</text>
class="{{curFieldTypeIndex == idx ? 'bg-yellow-light cuIcon-roundcheck' : 'text-gray2 cuIcon-round'}}"></text>
<text class="{{curFieldTypeIndex == idx ? 'bg-yellow-light' : 'text-gray2'}}"
style="margin-left: 6rpx;">{{it.type}}</text>
</view>
</block>
</view>
@ -249,7 +262,8 @@
<textarea placeholder="请输入内容" bindinput="inputWatch" value="{{curTextValue}}"
placeholder-style="color:#333333;"></textarea>
<view style="width: 100%;margin-top: 15rpx;">
<button class="cu-btn bg-blue" style="width:100%" bindtap="doConfirmInput">确定</button>
<button class="cu-btn bg-blue" style="width:100%" bindtap="doConfirmInput"
data-type="{{sourceType}}">确定</button>
</view>
</view>
</van-popup>
@ -277,7 +291,7 @@
style="width:300rpx;height:300rpx;"></image>
<text>00:{{audioDuration > 9 ? audioDuration : '0'+ audioDuration}}</text>
<view class="cu-btn bg-blue radius margin-top-sm" style="width:70%;" bindtouchstart="startRecord"
bindtouchend="doEndRecord">长按录音</view>
bindtouchend="doEndRecord">{{isRecording ? '正在录音' : '长按录音'}}</view>
</view>
<!-- 存在录音文件 -->
<view style="width: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;"
@ -287,17 +301,17 @@
<text>{{audioFile.curDurationStr}}</text>
<slider class="flex-sub" bindchange="slider4change" min="{{0}}" max="{{audioFile.duration}}"
value="{{audioFile.curDuration}}" backgroundColor="#cacaca" activeColor="#1296db"
block-size="14" data-item="{{audioFile}}" block-color="#1296db" />
data-type="record" block-size="14" data-item="{{audioFile}}" block-color="#1296db" />
<text>{{audioFile.totalDurationStr}}</text>
</view>
<view class="flex justify-between" style="width:80%;">
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" bindtap="rewind"
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" bindtap="rewind" data-type="record"
data-item="{{audioFile}}">
</image>
<image src="{{audioFile.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
mode="scaleToFill" bindtap="play" data-item="{{audioFile}}">
data-type="record" mode="scaleToFill" bindtap="play" data-item="{{audioFile}}">
</image>
<image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed"
<image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed" data-type="record"
data-item="{{audioFile}}">
</image>
</view>
@ -395,7 +409,7 @@
<view class="grid col-3 grid-square flex-sub">
<view class="bg-img" wx:for="{{videoList}}" wx:for-index="idx" wx:key="idx" wx:for-item="video">
<image src='{{video.coverPath}}' mode='aspectFill'></image>
<view class="cu-tag bg-red" catchtap="delImg" data-index="{{idx}}" data-itemIndex="{{index}}">
<view class="cu-tag bg-red" catchtap="delVideo" data-index="{{idx}}" data-itemIndex="{{index}}">
<text class="cuIcon-close"></text>
</view>
</view>

View File

@ -156,6 +156,11 @@ van-action-sheet .noline:active {
flex-direction: row;
align-items: center;
justify-content: center;
margin-top: 15rpx;
}
.movie-box:nth-child(1) {
margin-top: 0rpx;
}
.movie-box image {
@ -225,7 +230,7 @@ van-action-sheet .noline:active {
.sel-border {
border: 1rpx solid #E6B980;
border-radius: 10rpx;
padding-bottom: 15rpx;
padding: 15rpx;
}
/* 语音弹框 */

View File

@ -994,6 +994,13 @@ Page({
isShowType: true
})
},
//图片展示方式
chooseDisplayType(e) {
var id = e.currentTarget.dataset.id
this.setData({
selDisplayType: id
})
},
showMutliSel(e) {
this.setData({
isShowTags: true,

View File

@ -36,13 +36,24 @@
<text>{{item.comment}}{{item.valueList.length}}/{{item.maxCount}}</text>
</view>
</view>
<view class="cu-bar bg-white" catchtap="showDisplayType">
<view style="font-size: 32rpx;color:#000; padding:0rpx 15rpx;">
<view class="cu-bar bg-white">
<block wx:for="{{displayType}}" wx:key="idx" wx:for-index="idx" wx:for-item="it">
<view class="cu-capsule radius" style="margin-left: 15rpx;" catchtap="chooseDisplayType"
data-id="{{it.id}}">
<view class="cu-tag {{selDisplayType == it.id ? 'bg-yellowlight':'bg-grey'}}">
<text class="{{selDisplayType == it.id ? 'cuIcon-radiobox':'cuIcon-round'}}"></text>
</view>
<view class="cu-tag {{selDisplayType == it.id ? 'line-yellowlight2':'line-black'}}">
{{it.name}}
</view>
</view>
</block>
<!-- <view style="font-size: 32rpx;color:#000; padding:0rpx 15rpx;">
{{displayTypeStr}}
</view>
<view class="action">
<text class="cuIcon-right"></text>
</view>
</view> -->
</view>
<view class="cu-form-group item-padding">
<view class="grid col-3 grid-square flex-sub">

View File

@ -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 => {})
}
})

View File

@ -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>

View File

@ -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%;

View File

@ -223,10 +223,10 @@ Page({
}
})
.catch(err => {
wx.showToast({
title: '获取订单失败',
icon: 'err'
})
// wx.showToast({
// title: '获取订单失败',
// icon: 'err'
// })
})
},
//用户协议

View File

@ -249,11 +249,14 @@ Page({
})
.then(res => {
if (res.data.length > 0) {
// collectSwitch: datas[_self.data.curIndex].configColumnCollect, //收藏开关
// commentSwitch: datas[_self.data.curIndex].configColumnComment, //评论开关
// shareSwitch: datas[_self.data.curIndex].configColumnDispatch, //转发开关
// likeSwitch: datas[_self.data.curIndex].configColumnLike, //点赞开关
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, //转发开关
likeSwitch: datas[_self.data.curIndex].configColumnLike, //点赞开关
cId: datas[_self.data.curIndex].configColumnId,
type: datas[_self.data.curIndex].configColumnType,
name: datas[_self.data.curIndex].configColumnName,
@ -285,8 +288,18 @@ 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': //图片
@ -397,6 +410,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 => {
})
},
//显示更多栏目数据
showMore(e) {
@ -614,6 +668,7 @@ Page({
})
.then(res => {
wx.setStorageSync('usercode', res.data.userCode)
app.globalData.currentUserId = res.data.userId
})
.catch(err => {
console.log(err)
@ -889,10 +944,6 @@ Page({
},
// 展示名片码
showBarCode: function () {
// TODO 测试
// wx.navigateTo({
// url: '/packagecard/moments/publish/momentpublish',
// })
this.setData({
isNeedRefresh: false
})
@ -941,7 +992,12 @@ Page({
var type = res.target.dataset.sharetype
if (type && type == '2') {
//转发个人动态
// data-item="{{it}}" data-idx="{{idx}}"
// data-index="{{index}}"
var item = res.target.dataset.item
var idx = res.target.dataset.idx
var index = res.target.dataset.index
console.log(item)
} else {
var postId = self.buildId()
self.shareRecord(postId)
@ -972,8 +1028,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,
})
}
},
@ -1179,16 +1240,94 @@ Page({
},
//显示评论
showComment(e) {
this.setData({
isShowComment: true
//需要跳详情
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
// collectSwitch: options.collectSwitch,//收藏的开关
// likeSwitch:options.likeSwitch,//点赞的开关
// commentSwitch:options.commentSwitch,//评论的开关
// shareSwitch:options.shareSwitch,//转发的开关
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 => {})
}
})

View File

@ -119,7 +119,9 @@
style="width:100%;">
<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-cid="{{item.cId}}"
data-id="{{it.uid}}">
<!-- 文本 -->
<view wx:if="{{child.dataType=='1' && child.displayList}}" class="align-center">
<view class="bg-white">
@ -152,13 +154,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%;">
@ -307,37 +312,42 @@
</view>
</view>
<!-- 评论 收藏 点赞 -->
<!-- collectSwitch: datas[_self.data.curIndex].configColumnCollect, //收藏开关
commentSwitch: datas[_self.data.curIndex].configColumnComment, //评论开关
shareSwitch: datas[_self.data.curIndex].configColumnDispatch, //转发开关
likeSwitch: datas[_self.data.curIndex].configColumnLike, //点赞开关 -->
<!-- <view class="func-box">
<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"
wx:if="{{item.shareSwitch != '1' && item.shareSwitch != '3'}}"
<!-- 转发 -->
<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;">
<image src="/images/share_count.png" mode="scaleToFill"></image>
<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'}}"
catchtap="doCollect">
<image src="/images/ic_collect_icon.png" mode="scaleToFill"></image>
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'}}"
catchtap="showComment">
<image src="/images/ic_comment_icon.png" mode="scaleToFill"></image>
<text>10</text>
catchtap="showComment" data-uid="{{it.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;">{{it.commentCount>1000 ? '1000+':it.commentCount}}</text>
</view>
<view class="func-item" wx:if="{{item.likeSwitch != '1' && item.likeSwitch != '3'}}"
catchtap="doLike">
<image src="/images/ic_unfavour.png" mode="scaleToFill"></image>
<text>12</text>
<!-- 点赞 -->
<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>
</view>
</view> -->
</view>
</view>
</view>
</view>
@ -349,9 +359,6 @@
</view>
</view>
<!-- 创建名片 -->
<!-- -->
@ -438,6 +445,7 @@
</view>
</van-action-sheet>
<!-- 显示海报 -->
<van-popup show="{{ isShowPoster }}" bind:close="onClose"
custom-style="background-color:transparent;height:100%;width:100%;" round>
<view bindtap="onClose"

View File

@ -745,41 +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 #d8d8d8;
}
.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;
}

View File

@ -118,7 +118,6 @@ Page({
},
//获取首页展示的栏目
getMainColumn(id) {
console.log(id)
var _self = this
_self.setData({
dataList: []
@ -158,7 +157,14 @@ 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, //转发开关
likeSwitch: datas[_self.data.curIndex].configColumnLike, //点赞开关
cId: datas[_self.data.curIndex].configColumnId,
type: datas[_self.data.curIndex].configColumnType,
name: datas[_self.data.curIndex].configColumnName,
@ -190,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(',')
@ -300,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) {
@ -373,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,
})
}
},
@ -710,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 => {})
}
})

View File

@ -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%;">
@ -176,13 +179,13 @@
</view>
</view>
<!-- 左右滑动 -->
<view
wx:elif="{{child.dataMode=='2' || child.dataMode=='3'}}">
<view wx:elif="{{child.dataMode=='2' || child.dataMode=='3'}}">
<swiper style="width:100%;height:400rpx;" indicator-dots="{{true}}"
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%;">
<image style="width:100%;border-radius:5rpx;height:400rpx;" src="{{photo.path}}" data-values="{{child.valueList}}" catchtap="viewImg" data-url="{{photo.path}}"
<image style="width:100%;border-radius:5rpx;height:400rpx;" src="{{photo.path}}"
data-values="{{child.valueList}}" catchtap="viewImg" data-url="{{photo.path}}"
mode="aspectFill">
</image>
</swiper-item>
@ -192,11 +195,15 @@
<!-- 上下 -->
<view wx:elif="{{child.dataMode=='4'}}">
<block wx:for="{{child.valueList}}" wx:key="pIndex" wx:for-index="pIndex" wx:for-item="photo">
<image class="img-item" src="{{photo.path}}" mode="widthFix" data-values="{{child.valueList}}" catchtap="viewImg" data-url="{{photo.path}}">
<image class="img-item" src="{{photo.path}}" mode="widthFix" data-values="{{child.valueList}}"
catchtap="viewImg" data-url="{{photo.path}}">
</image>
</block>
</view>
</view>
<!-- 视频 -->
<view wx:if="{{child.dataType=='4' && child.displayList && child.valueList.length>0}}"
style="width: 100%;">
@ -301,6 +308,50 @@
</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="{{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>
</view>
</view>

View File

@ -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;
}

View File

@ -21,9 +21,9 @@
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": false,
"useApiHostProcess": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],

View File

@ -124,8 +124,12 @@ var apis = {
doOrderColumn: `app/configcolumnset/saveorder`, //保存栏目排序, post {configColumnId, configColumnOrder}
//评论 点赞 收藏
doSaveCollect: `app/contentcollect/save`, //保存取消收藏 businessId=xxx&projectId=poster
doSaveLike: `app/contentlike/save`, //保存取消点赞 ?businessId
doSaveLike: `app/contentlike/save`, //保存取消点赞 ?businessId=xx& projectId=xx
getPosterFavorList: `app/cardtemplate/mylistposter`, //获取我的海报收藏列表
getColumnContentHandle: `app/contentcomment/countlist/{projectId}/{businessIds}`, //获取栏目内容评论 点赞 收藏数量
doSaveComment: `app/contentcomment/save`, //?businessId=xx&projectId=columnComment&contentCommentContent=xxx 保存评论
getCommentList: `app/contentcomment/listpagerelease/{projectId}/{businessId}`, // ?contentCommentParentId=xxx 获取评论列表
doDelComment: `app/contentcomment/remove/{ids}`, //删除评论
//名片信息
getCardList: `app/cardtemplate/list`, //获取名片列表
getCardDetail: `app/cardtemplate/get/{cardTemplateId}`, //获取名片详情