diff --git a/images/ic_collect_icon.png b/images/ic_collect_icon.png
deleted file mode 100644
index 0bdff9b..0000000
Binary files a/images/ic_collect_icon.png and /dev/null differ
diff --git a/images/ic_comment_icon.png b/images/ic_comment_icon.png
deleted file mode 100644
index 6960eaa..0000000
Binary files a/images/ic_comment_icon.png and /dev/null differ
diff --git a/images/ic_favour.png b/images/ic_favour.png
deleted file mode 100644
index c066e8e..0000000
Binary files a/images/ic_favour.png and /dev/null differ
diff --git a/images/ic_unfavour.png b/images/ic_unfavour.png
deleted file mode 100644
index 0cbe712..0000000
Binary files a/images/ic_unfavour.png and /dev/null differ
diff --git a/packagecard/moments/momentsdetail/momentsdetail.wxml b/packagecard/moments/momentsdetail/momentsdetail.wxml
index f7adee3..b15418d 100644
--- a/packagecard/moments/momentsdetail/momentsdetail.wxml
+++ b/packagecard/moments/momentsdetail/momentsdetail.wxml
@@ -191,13 +191,7 @@
-
+
+
+
\ No newline at end of file
diff --git a/packagecard/moments/publish/momentpublish.js b/packagecard/moments/publish/momentpublish.js
index bcf84dc..954b5e0 100644
--- a/packagecard/moments/publish/momentpublish.js
+++ b/packagecard/moments/publish/momentpublish.js
@@ -49,7 +49,8 @@ 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, //顶部类型选择框的高度
@@ -57,7 +58,8 @@ Page({
audioDuration: 0, //录音文件的时长
isRecording: false, //是否正在录音
speedStep: 5, //快进快退的时间
- sourceType: 'add', //用来标识是添加还是编辑 add添加 edit编辑
+ sourceType: 'add', //用来标识是添加还是编辑 add添加 edit编辑 insert插入
+ insertIndex: -1, //插入的索引
optionsList: [{
id: '1',
name: '选项一',
@@ -114,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
})
@@ -268,8 +274,10 @@ Page({
},
//编辑选择出入的类型
chooseFieldType(e) {
+ var idx = e.currentTarget.dataset.idx
var type = e.currentTarget.dataset.type
this.setData({
+ curFieldTypeIndex: idx,
curFieldType: type
})
},
@@ -288,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: [],
@@ -320,7 +332,7 @@ Page({
if (_self.data.sourceType == 'add') {
_self.data.valueList.push(tempVideo)
} else {
- _self.data.valueList.splice(_self.data.currentIndex, 1, tempVideo)
+ _self.data.valueList.splice(_self.data.currentIndex, _self.data.sourceType == 'edit' ? 1 : 0, tempVideo)
}
_self.setData({
valueList: _self.data.valueList,
@@ -340,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() {
//隐藏编辑框
@@ -382,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: '',
@@ -393,41 +452,17 @@ Page({
//保存输入的文本
doConfirmInput() {
var _self = this
- if (_self.data.sourceType == 'add') {
- if (_self.data.curTextValue == '') {
- wx.showToast({
- title: '请输入内容',
- icon: 'error'
- })
- } else {
- //保存
- var tempText = {}
- tempText['type'] = 'text'
- tempText['value'] = _self.data.curTextValue
- var textAlign = 'left'
- switch (_self.data.curTextAlign) {
- case '1':
- textAlign = 'left'
- break
- case '2':
- textAlign = 'center'
- break
- case '3':
- textAlign = 'right'
- break
- }
- tempText['textAlign'] = textAlign
- _self.data.valueList.push(tempText)
- _self.setData({
- valueList: _self.data.valueList,
- curTextValue: '',
- isShowInput: false,
- curTextAlign: '1'
- })
- }
+ if (_self.data.curTextValue == '') {
+ wx.showToast({
+ title: '请输入内容',
+ icon: 'error'
+ })
} else {
- //编辑
- var textAlign = _self.data.valueList[_self.data.currentIndex].textAlign
+ //保存
+ var tempText = {}
+ tempText['type'] = 'text'
+ tempText['value'] = _self.data.curTextValue
+ var textAlign = 'left'
switch (_self.data.curTextAlign) {
case '1':
textAlign = 'left'
@@ -439,12 +474,16 @@ Page({
textAlign = 'right'
break
}
- _self.data.valueList[_self.data.currentIndex].value = _self.data.curTextValue
- _self.data.valueList[_self.data.currentIndex].textAlign = textAlign
+ tempText['textAlign'] = textAlign
+ 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({
- isShowInput: false,
valueList: _self.data.valueList,
curTextValue: '',
+ isShowInput: false,
curTextAlign: '1'
})
}
@@ -547,10 +586,6 @@ Page({
},
//选择定位点
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}`
@@ -592,18 +627,22 @@ Page({
_self.checkRecordPermission()
break
case 'photo': //图片
- console.log(_self.data.valueList[idx])
+ _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': //选项
- _self.setData({
- isShowSelect: true
- })
break
case 'link': //链接
_self.setData({
+ curLinkText: _self.data.valueList[idx].value,
isShowLink: true
})
break
@@ -678,7 +717,11 @@ Page({
_self.data.audioFile.curDurationStr = '00:00'
_self.data.audioFile.curDuration = 0
_self.data.audioFile.isPlay = false
- _self.data.valueList.push(tempAudio)
+ 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,
@@ -821,6 +864,7 @@ Page({
isShowEdit: false,
isShowVideo: false,
isShowSelect: false,
+ sourceType: 'add'
})
},
//音频拖动
diff --git a/packagecard/moments/publish/momentpublish.wxml b/packagecard/moments/publish/momentpublish.wxml
index 154652d..f160e23 100644
--- a/packagecard/moments/publish/momentpublish.wxml
+++ b/packagecard/moments/publish/momentpublish.wxml
@@ -53,7 +53,8 @@
{{item.value}}
-
+
@@ -80,7 +81,8 @@
-
+
-
+
{{item.value.curDurationStr}}
@@ -130,7 +133,8 @@
-
+
@@ -147,7 +151,8 @@
-
+
{{item.value}}
@@ -156,7 +161,7 @@
-
+
{{options.name}}
@@ -164,7 +169,8 @@
-
+
编辑
@@ -187,7 +193,7 @@
- 插入到下面
+ 内容上
- 插入到上面
+ 内容下
@@ -204,12 +210,13 @@
类型:
-
-
+
+
- {{item.type}}
+ class="{{curFieldTypeIndex == idx ? 'bg-yellow-light cuIcon-roundcheck' : 'text-gray2 cuIcon-round'}}">
+ {{it.type}}
diff --git a/packagecard/moments/publish/momentpublish.wxss b/packagecard/moments/publish/momentpublish.wxss
index 8095690..30ff623 100644
--- a/packagecard/moments/publish/momentpublish.wxss
+++ b/packagecard/moments/publish/momentpublish.wxss
@@ -230,7 +230,7 @@ van-action-sheet .noline:active {
.sel-border {
border: 1rpx solid #E6B980;
border-radius: 10rpx;
- padding-bottom: 15rpx;
+ padding: 15rpx;
}
/* 语音弹框 */
diff --git a/pages/index/index.js b/pages/index/index.js
index 432dd0a..47ee330 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -285,8 +285,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 +407,48 @@ 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 => {
+ console.log(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) {
@@ -1179,16 +1231,84 @@ Page({
},
//显示评论
showComment(e) {
- this.setData({
- isShowComment: true
+ //需要跳详情
+ var cId = e.currentTarget.dataset.cid
+ var uId = e.currentTarget.dataset.uid
+ wx.navigateTo({
+ url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId,
})
},
//点赞
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 => {})
}
})
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 361557f..0924d19 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -307,37 +307,40 @@
-
-
+
+
-
+ data-item="{{it}}" data-idx="{{idx}}" data-index="{{index}}" catchtap="doCollect">
+
收藏
+
-
- 10
+ catchtap="showComment" data-uid="{{it.uid}}" data-cid="{{item.cId}}">
+
+ {{it.commentCount>1000 ? '1000+':it.commentCount}}
-
-
- 12
+
+
+
+ {{it.likeCount>1000? '1000+':it.likeCount}}
- -->
+
@@ -438,6 +441,7 @@
+