栏目内容列表、删除、修改、提交接口对接
This commit is contained in:
parent
cc9495386c
commit
afa042ae16
@ -752,7 +752,7 @@ radio.white[checked] .wx-radio-input {
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 1024;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cu-btn.round[class*="line"]::after {
|
.cu-btn.round[class*="line"]::after {
|
||||||
|
@ -136,7 +136,7 @@ Page({
|
|||||||
case '1': //跳转小程序内部
|
case '1': //跳转小程序内部
|
||||||
case '3': //链接
|
case '3': //链接
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType
|
url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType+'&title='+item.configColumnName
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case '2': //其他小程序
|
case '2': //其他小程序
|
||||||
|
@ -17,6 +17,10 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
uploadCount: 0,
|
uploadCount: 0,
|
||||||
uploadVideoCount: 0,
|
uploadVideoCount: 0,
|
||||||
|
currentIndex: 0,
|
||||||
|
columnId: '', //栏目Id
|
||||||
|
uId: '', //内容UID
|
||||||
|
fieldList: [], //栏目字段
|
||||||
textList: [], //文本添加内容
|
textList: [], //文本添加内容
|
||||||
textareaList: [], //文本域添加内容
|
textareaList: [], //文本域添加内容
|
||||||
audioList: [], //音频添加内容
|
audioList: [], //音频添加内容
|
||||||
@ -40,44 +44,120 @@ Page({
|
|||||||
speedStep: 5, //快进快退秒数
|
speedStep: 5, //快进快退秒数
|
||||||
setInter: '', //定时器
|
setInter: '', //定时器
|
||||||
currentItem: undefined,
|
currentItem: undefined,
|
||||||
items: [{
|
isAuthAudio: false,
|
||||||
title: '标题', //标题
|
title:'栏目内容修改'
|
||||||
count: 3, //数量
|
|
||||||
type: 'TEXT', //类型
|
|
||||||
}, {
|
|
||||||
title: '标题', //标题
|
|
||||||
count: 9, //数量
|
|
||||||
type: 'TEXTAREA', //类型
|
|
||||||
}, {
|
|
||||||
title: '标题', //标题
|
|
||||||
count: 2, //数量
|
|
||||||
type: 'AUDIO', //类型
|
|
||||||
}, {
|
|
||||||
title: '标题', //标题
|
|
||||||
count: 3, //数量
|
|
||||||
type: 'VIDEO', //类型
|
|
||||||
}, {
|
|
||||||
title: '标题', //标题
|
|
||||||
count: 9, //数量
|
|
||||||
type: 'PHOTO', //类型
|
|
||||||
}, {
|
|
||||||
title: '标题', //标题
|
|
||||||
count: 9, //数量
|
|
||||||
type: 'LINK', //类型
|
|
||||||
}, {
|
|
||||||
title: '标题', //标题
|
|
||||||
count: 2, //数量
|
|
||||||
type: 'LOCATION', //类型
|
|
||||||
}],
|
|
||||||
isAuthAudio: false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
this.setData({
|
||||||
|
columnId: options.id,
|
||||||
|
uId: options.uid,
|
||||||
|
title:options.title+'修改'
|
||||||
|
})
|
||||||
this.checkPermission()
|
this.checkPermission()
|
||||||
|
this.getMomentContent()
|
||||||
|
},
|
||||||
|
getMomentContent() {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
})
|
||||||
|
var _self = this
|
||||||
|
app.http.get(app.urls.getMomentsContent.format({
|
||||||
|
configColumnId: _self.data.columnId,
|
||||||
|
uid: _self.data.uId
|
||||||
|
}), {
|
||||||
|
header: {
|
||||||
|
token: app.globalData.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
//构建数据
|
||||||
|
_self.buildDetail(res.data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//构建展示数据
|
||||||
|
buildDetail(data) {
|
||||||
|
var _self = this
|
||||||
|
data.list.forEach(it => {
|
||||||
|
switch (it.dataType) {
|
||||||
|
case '2': //图片
|
||||||
|
var items = it.value.split(',')
|
||||||
|
var tempList = []
|
||||||
|
items.forEach(item => {
|
||||||
|
var tempItem = {
|
||||||
|
id: item,
|
||||||
|
path: app.urls.baseImgUrl + item,
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
})
|
||||||
|
it.valueList = tempList
|
||||||
|
break
|
||||||
|
case '4': //视频
|
||||||
|
var items = it.value.split(',')
|
||||||
|
var tempList = []
|
||||||
|
items.forEach(item => {
|
||||||
|
var tempItem = {
|
||||||
|
id: item,
|
||||||
|
path: app.urls.baseImgUrl + item,
|
||||||
|
imgPath: '../../../images/ic_temp.png'
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
})
|
||||||
|
it.valueList = tempList
|
||||||
|
break
|
||||||
|
case '3': //音频
|
||||||
|
var items = it.value.split(',')
|
||||||
|
var tempList = []
|
||||||
|
items.forEach(item => {
|
||||||
|
var tempItem = {
|
||||||
|
id: item, //id
|
||||||
|
path: app.urls.baseImgUrl + item, //地址
|
||||||
|
isPlay: false, //是否播放中
|
||||||
|
duration: 100, //时长
|
||||||
|
curDuation: 0,
|
||||||
|
curDurationStr: '00:00',
|
||||||
|
totalDurationStr: '00:00'
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
})
|
||||||
|
it.valueList = tempList
|
||||||
|
break
|
||||||
|
case '6': //定位
|
||||||
|
var items = it.value.split('-')
|
||||||
|
var tempList = []
|
||||||
|
items.forEach(item => {
|
||||||
|
var latlng = item.split(',')
|
||||||
|
var tempItem = {
|
||||||
|
name: '',
|
||||||
|
address: '',
|
||||||
|
latitude: latlng[0],
|
||||||
|
longitude: latlng[1],
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
})
|
||||||
|
it.valueList = tempList
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
_self.setData({
|
||||||
|
fieldList: data.list
|
||||||
|
})
|
||||||
|
},
|
||||||
|
inputText(e) {
|
||||||
|
var index = e.currentTarget.dataset.index
|
||||||
|
var _self = this
|
||||||
|
_self.data.fieldList[index].value = e.detail.value
|
||||||
|
_self.setData({
|
||||||
|
fieldList: _self.data.fieldList
|
||||||
|
})
|
||||||
},
|
},
|
||||||
//申请录音权限
|
//申请录音权限
|
||||||
checkPermission() {
|
checkPermission() {
|
||||||
@ -122,10 +202,11 @@ Page({
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (chooseLocation.getLocation() != null) {
|
if (chooseLocation.getLocation() != null) {
|
||||||
if (this.data.locationList.length < this.data.currentItem.count) {
|
var item = this.data.fieldList[this.data.curMapIndex]
|
||||||
this.data.locationList.push(chooseLocation.getLocation())
|
if (item.valueList.length < item.maxCount) {
|
||||||
|
this.data.fieldList[this.data.curMapIndex].valueList.push(chooseLocation.getLocation())
|
||||||
this.setData({
|
this.setData({
|
||||||
locationList: this.data.locationList
|
fieldList: this.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,17 +231,17 @@ Page({
|
|||||||
//选择视频来源
|
//选择视频来源
|
||||||
chooseVideo(e) {
|
chooseVideo(e) {
|
||||||
var _self = this
|
var _self = this
|
||||||
var countNum = _self.data.currentItem.count - _self.data.videoList.length
|
var item = e.currentTarget.dataset.item
|
||||||
console.log(countNum)
|
var countNum = item.maxCount - item.valueList.length
|
||||||
var type = e.currentTarget.dataset.type
|
var index = e.currentTarget.dataset.index
|
||||||
wx.chooseMedia({
|
wx.chooseMedia({
|
||||||
count: Number.parseInt(countNum),
|
count: Number.parseInt(countNum),
|
||||||
mediaType: ['video'],
|
mediaType: ['video'],
|
||||||
sourceType: [type],
|
sourceType: ['camera', 'album'],
|
||||||
maxDuration: 60,
|
maxDuration: 60,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.tempFiles.length > 0) {
|
if (res.tempFiles.length > 0) {
|
||||||
_self.doUploadVideo(1, res.tempFiles, _self.data.uploadVideoCount)
|
_self.doUploadVideo(index, res.tempFiles, _self.data.uploadVideoCount)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
@ -173,8 +254,7 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
//上传视频
|
//上传视频
|
||||||
doUploadVideo(type, paths, curIndex) {
|
doUploadVideo(index, paths, curIndex) {
|
||||||
console.log(paths)
|
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '上传中...',
|
title: '上传中...',
|
||||||
})
|
})
|
||||||
@ -198,14 +278,14 @@ Page({
|
|||||||
path: pathStr,
|
path: pathStr,
|
||||||
imgPath: paths[_self.data.uploadVideoCount].thumbTempFilePath
|
imgPath: paths[_self.data.uploadVideoCount].thumbTempFilePath
|
||||||
}
|
}
|
||||||
_self.data.videoList.push(item)
|
_self.data.fieldList[index].valueList.push(item)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
videoList: _self.data.videoList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
_self.setData({
|
_self.setData({
|
||||||
uploadVideoCount: ++_self.data.uploadVideoCount
|
uploadVideoCount: ++_self.data.uploadVideoCount
|
||||||
})
|
})
|
||||||
_self.doUploadVideo(1, paths, _self.data.uploadVideoCount)
|
_self.doUploadVideo(index, paths, _self.data.uploadVideoCount)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
wx.hideLoading({})
|
wx.hideLoading({})
|
||||||
@ -236,6 +316,8 @@ Page({
|
|||||||
//删除视频
|
//删除视频
|
||||||
delVideo(e) {
|
delVideo(e) {
|
||||||
let _self = this
|
let _self = this
|
||||||
|
var index = e.currentTarget.dataset.index
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确定要删除该视频吗?',
|
content: '确定要删除该视频吗?',
|
||||||
@ -243,9 +325,9 @@ Page({
|
|||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
_self.data.videoList.splice(e.currentTarget.dataset.index, 1)
|
_self.data.fieldList[index].valueList.splice(idx, 1)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
videoList: _self.data.videoList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,13 +492,15 @@ Page({
|
|||||||
//选择图片
|
//选择图片
|
||||||
choosePhoto(e) {
|
choosePhoto(e) {
|
||||||
var _self = this
|
var _self = this
|
||||||
var countNum = _self.data.currentItem.count - _self.data.photoList.length
|
var item = e.currentTarget.dataset.item
|
||||||
var type = e.currentTarget.dataset.type
|
var index = e.currentTarget.dataset.index
|
||||||
|
var countNum = item.maxCount - item.valueList.length
|
||||||
|
|
||||||
wx.chooseImage({
|
wx.chooseImage({
|
||||||
count: Number.parseInt(countNum),
|
count: Number.parseInt(countNum),
|
||||||
sourceType: [type],
|
sourceType: ['album', 'camera'],
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
_self.doUploadImg(1, res.tempFilePaths, _self.data.uploadCount)
|
_self.doUploadImg(index, res.tempFilePaths, _self.data.uploadCount)
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
|
|
||||||
@ -432,9 +516,9 @@ Page({
|
|||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.data.photoList.splice(e.currentTarget.dataset.index, 1)
|
this.data.fieldList[e.currentTarget.dataset.itemindex].valueList.splice(e.currentTarget.dataset.index, 1)
|
||||||
this.setData({
|
this.setData({
|
||||||
photoList: this.data.photoList
|
fieldList: this.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +532,7 @@ Page({
|
|||||||
current: e.currentTarget.dataset.url
|
current: e.currentTarget.dataset.url
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
doUploadImg(type, paths, curIndex) {
|
doUploadImg(index, paths, curIndex) {
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '上传中...',
|
title: '上传中...',
|
||||||
})
|
})
|
||||||
@ -471,21 +555,21 @@ Page({
|
|||||||
id: id,
|
id: id,
|
||||||
path: pathStr
|
path: pathStr
|
||||||
}
|
}
|
||||||
_self.data.photoList.push(item)
|
_self.data.fieldList[index].valueList.push(item)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
photoList: _self.data.photoList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
_self.setData({
|
_self.setData({
|
||||||
uploadCount: ++_self.data.uploadCount
|
uploadCount: ++_self.data.uploadCount
|
||||||
})
|
})
|
||||||
_self.doUploadImg(1, paths, _self.data.uploadCount)
|
_self.doUploadImg(index, paths, _self.data.uploadCount)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
wx.hideLoading({})
|
wx.hideLoading({})
|
||||||
_self.setData({
|
_self.setData({
|
||||||
uploadCount: ++_self.data.uploadCount
|
uploadCount: ++_self.data.uploadCount
|
||||||
})
|
})
|
||||||
_self.doUploadImg(1, paths, _self.data.uploadCount)
|
_self.doUploadImg(index, paths, _self.data.uploadCount)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading({})
|
wx.hideLoading({})
|
||||||
@ -495,13 +579,10 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//地图选点
|
//地图选点
|
||||||
chooseLocation() {
|
chooseLocation(e) {
|
||||||
this.data.items.forEach(it => {
|
var index = e.currentTarget.dataset.index
|
||||||
if (it.type == 'LOCATION') {
|
this.setData({
|
||||||
this.setData({
|
curMapIndex: index
|
||||||
currentItem: it
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}`
|
url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}`
|
||||||
@ -652,7 +733,7 @@ Page({
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
wx.hideLoading({})
|
wx.hideLoading({})
|
||||||
if (_self.data.audioList.length < _self.data.currentItem.count) {
|
if (_self.data.fieldList[_self.data.currentIndex].valueList.length < _self.data.currentItem.maxCount) {
|
||||||
wx.hideLoading({})
|
wx.hideLoading({})
|
||||||
//插入到集合中
|
//插入到集合中
|
||||||
var id = JSON.parse(res).data
|
var id = JSON.parse(res).data
|
||||||
@ -673,12 +754,11 @@ Page({
|
|||||||
curDurationStr: '00:00',
|
curDurationStr: '00:00',
|
||||||
totalDurationStr: totalStr
|
totalDurationStr: totalStr
|
||||||
}
|
}
|
||||||
_self.data.audioList.push(item)
|
_self.data.fieldList[_self.data.currentIndex].valueList.push(item)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
console.log(_self.data.audioList)
|
if (_self.data.fieldList[_self.data.currentIndex].valueList.length == _self.data.currentItem.maxCount) {
|
||||||
if (_self.data.audioList.length == _self.data.currentItem.count) {
|
|
||||||
_self.setData({
|
_self.setData({
|
||||||
isShowAudio: false
|
isShowAudio: false
|
||||||
})
|
})
|
||||||
@ -691,9 +771,10 @@ Page({
|
|||||||
|
|
||||||
//进行播放
|
//进行播放
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
var _self = this
|
var _self = this
|
||||||
_self.data.audioList.forEach(it => {
|
_self.data.fieldList[index].valueList.forEach(it => {
|
||||||
if (it.isPlay) {
|
if (it.isPlay) {
|
||||||
innerAudioContext.stop()
|
innerAudioContext.stop()
|
||||||
}
|
}
|
||||||
@ -706,15 +787,15 @@ Page({
|
|||||||
//找到该文件
|
//找到该文件
|
||||||
innerAudioContext = wx.createInnerAudioContext()
|
innerAudioContext = wx.createInnerAudioContext()
|
||||||
// 播放音频文件
|
// 播放音频文件
|
||||||
innerAudioContext.src = _self.data.audioList[index].path
|
innerAudioContext.src = _self.data.fieldList[index].valueList[idx].path
|
||||||
innerAudioContext.autoplay = true
|
innerAudioContext.autoplay = true
|
||||||
}
|
}
|
||||||
//先需要停止其他录音文件的播放
|
//先需要停止其他录音文件的播放
|
||||||
|
|
||||||
innerAudioContext.onPlay(() => {
|
innerAudioContext.onPlay(() => {
|
||||||
_self.data.audioList[index].isPlay = true
|
_self.data.fieldList[index].valueList[idx].isPlay = true
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -727,27 +808,27 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
innerAudioContext.onStop((res) => {
|
innerAudioContext.onStop((res) => {
|
||||||
_self.data.audioList[index].isPlay = false
|
_self.data.fieldList[index].valueList[idx].isPlay = false
|
||||||
_self.data.audioList[index].curDuration = 0
|
_self.data.fieldList[index].valueList[idx].curDuration = 0
|
||||||
_self.data.audioList[index].curDurationStr = '00:00'
|
_self.data.fieldList[index].valueList[idx].curDurationStr = '00:00'
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList,
|
fieldList: _self.data.fieldList,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
innerAudioContext.onEnded((res) => {
|
innerAudioContext.onEnded((res) => {
|
||||||
_self.data.audioList[index].isPlay = false
|
_self.data.fieldList[index].valueList[idx].isPlay = false
|
||||||
_self.data.audioList[index].curDuration = 0
|
_self.data.fieldList[index].valueList[idx].curDuration = 0
|
||||||
_self.data.audioList[index].curDurationStr = '00:00'
|
_self.data.fieldList[index].valueList[idx].curDurationStr = '00:00'
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList,
|
fieldList: _self.data.fieldList,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
innerAudioContext.onError((res) => {
|
innerAudioContext.onError((res) => {
|
||||||
_self.data.audioList[index].isPlay = false
|
_self.data.fieldList[index].valueList[idx].isPlay = false
|
||||||
_self.data.audioList[index].curDuration = 0
|
_self.data.fieldList[index].valueList[idx].curDuration = 0
|
||||||
_self.data.audioList[index].curDurationStr = '00:00'
|
_self.data.fieldList[index].valueList[idx].curDurationStr = '00:00'
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList,
|
fieldList: _self.data.fieldList,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
innerAudioContext.onSeeking(() => {
|
innerAudioContext.onSeeking(() => {
|
||||||
@ -761,8 +842,8 @@ Page({
|
|||||||
})
|
})
|
||||||
innerAudioContext.onTimeUpdate(() => {
|
innerAudioContext.onTimeUpdate(() => {
|
||||||
if (innerAudioContext.duration != Infinity) {
|
if (innerAudioContext.duration != Infinity) {
|
||||||
_self.data.audioList[index].curDuration = parseInt(innerAudioContext.currentTime)
|
_self.data.fieldList[index].valueList[idx].curDuration = parseInt(innerAudioContext.currentTime)
|
||||||
_self.data.audioList[index].duration = parseInt(innerAudioContext.duration)
|
_self.data.fieldList[index].valueList[idx].duration = parseInt(innerAudioContext.duration)
|
||||||
console.log(innerAudioContext.duration)
|
console.log(innerAudioContext.duration)
|
||||||
var curM = parseInt(innerAudioContext.currentTime / 60) //分钟
|
var curM = parseInt(innerAudioContext.currentTime / 60) //分钟
|
||||||
var curS = parseInt(innerAudioContext.currentTime % 60) //秒
|
var curS = parseInt(innerAudioContext.currentTime % 60) //秒
|
||||||
@ -772,10 +853,10 @@ Page({
|
|||||||
var curSStr = curS > 9 ? curS : '0' + curS
|
var curSStr = curS > 9 ? curS : '0' + curS
|
||||||
var totalMStr = tM > 9 ? tM : '0' + tM
|
var totalMStr = tM > 9 ? tM : '0' + tM
|
||||||
var totalSStr = +tS > 9 ? tS : '0' + tS
|
var totalSStr = +tS > 9 ? tS : '0' + tS
|
||||||
_self.data.audioList[index].curDurationStr = curMStr + ':' + curSStr
|
_self.data.fieldList[index].valueList[idx].curDurationStr = curMStr + ':' + curSStr
|
||||||
_self.data.audioList[index].totalDurationStr = totalMStr + ':' + totalSStr
|
_self.data.fieldList[index].valueList[idx].totalDurationStr = totalMStr + ':' + totalSStr
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -784,31 +865,32 @@ Page({
|
|||||||
rewind(e) {
|
rewind(e) {
|
||||||
var _self = this
|
var _self = this
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
if (item.isPlay) {
|
if (item.isPlay) {
|
||||||
_self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration - _self.data.speedStep
|
_self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration - _self.data.speedStep
|
||||||
innerAudioContext.seek(_self.data.audioList[index].curDuration)
|
innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
//快进5秒
|
//快进5秒
|
||||||
speed(e) {
|
speed(e) {
|
||||||
var _self = this
|
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
|
var _self = this
|
||||||
if (item.isPlay) {
|
if (item.isPlay) {
|
||||||
_self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration + _self.data.speedStep
|
_self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration + _self.data.speedStep
|
||||||
innerAudioContext.seek(_self.data.audioList[index].curDuration)
|
innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
slider4change(e) {
|
slider4change(e) {
|
||||||
var index = e.currentTarget.dataset.index
|
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
if (item.isPlay) {
|
if (item.isPlay) {
|
||||||
innerAudioContext.seek(e.detail.value)
|
innerAudioContext.seek(e.detail.value)
|
||||||
@ -816,19 +898,105 @@ Page({
|
|||||||
},
|
},
|
||||||
//显示弹框
|
//显示弹框
|
||||||
showDialog(e) {
|
showDialog(e) {
|
||||||
var type = e.currentTarget.dataset.type
|
|
||||||
var keyType = e.currentTarget.dataset.keytype
|
|
||||||
console.log(e)
|
console.log(e)
|
||||||
this.data.items.forEach(it => {
|
|
||||||
if (it.type == type) {
|
|
||||||
this.setData({
|
|
||||||
currentItem: it
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.setData({
|
this.setData({
|
||||||
[keyType]: true
|
isShowAudio: true,
|
||||||
|
currentItem: e.currentTarget.dataset.item,
|
||||||
|
currentIndex: e.currentTarget.dataset.index
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
//提交保存
|
||||||
|
doPublish() {
|
||||||
|
var _self = this
|
||||||
|
if (_self.checkParams()) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '保存中...',
|
||||||
|
})
|
||||||
|
var params = _self.buildParams()
|
||||||
|
app.http.post(app.urls.doSaveMoments.format({
|
||||||
|
configColumnId: _self.data.columnId
|
||||||
|
}), {
|
||||||
|
data: params,
|
||||||
|
header: {
|
||||||
|
token: app.globalData.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
let pages = getCurrentPages();
|
||||||
|
let beforePage = pages[pages.length - 2];
|
||||||
|
beforePage.setData({
|
||||||
|
isRefresh: true
|
||||||
|
})
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//校验参数
|
||||||
|
checkParams() {
|
||||||
|
var _self = this
|
||||||
|
var isLegal = true
|
||||||
|
for (var i = 0; i < _self.data.fieldList.length; i++) {
|
||||||
|
var field = _self.data.fieldList[i]
|
||||||
|
if (field.must) {
|
||||||
|
if (field.dataType == '1' || field.dataType == '7') {
|
||||||
|
if (field.value.length <= 0) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请输入' + field.comment,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
isLegal = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (field.valueList.length <= 0) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请上传' + field.comment,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
isLegal = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isLegal
|
||||||
|
},
|
||||||
|
//构建提交参数
|
||||||
|
buildParams() {
|
||||||
|
var _self = this
|
||||||
|
var params = {
|
||||||
|
uid: _self.data.uId
|
||||||
|
}
|
||||||
|
for (var i = 0; i < _self.data.fieldList.length; i++) {
|
||||||
|
var field = _self.data.fieldList[i]
|
||||||
|
if (field.dataType == '1' || field.dataType == '7') {
|
||||||
|
if (field.value.length > 0) {
|
||||||
|
params[field.name] = field.value
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (field.valueList.length > 0) {
|
||||||
|
var ids = ""
|
||||||
|
if (field.dataType == '6') {
|
||||||
|
field.valueList.forEach(it => {
|
||||||
|
ids += it.latitude + ',' + it.longitude + '-'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
field.valueList.forEach(it => {
|
||||||
|
ids += it.id + ','
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ids = ids.substr(0, ids.length - 1)
|
||||||
|
params[field.name] = ids
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,240 +1,203 @@
|
|||||||
<cu-custom isBack="{{true}}">
|
<cu-custom isBack="{{true}}">
|
||||||
<view slot="content">内容修改</view>
|
<view slot="content">{{title}}</view>
|
||||||
</cu-custom>
|
</cu-custom>
|
||||||
<!-- 内容 -->
|
<view wx:if="{{fieldList.length>0}}" class="flex flex-direction radius align-center">
|
||||||
<view wx:for="{{items}}" wx:key="index">
|
<view class="flex flex-direction self-center" style="width:95%;margin-bottom:100rpx;">
|
||||||
<!-- 文本 -->
|
<!-- 内容 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章 -->
|
||||||
<view class="flex flex-direction" wx:if="{{item.type=='TEXT'}}">
|
<view wx:for="{{fieldList}}" wx:key="index">
|
||||||
<view class="hint-title">
|
<!-- 文本 -->
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
<view wx:if="{{item.dataType == '1'}}" class="margin-top-xs">
|
||||||
<text>文本内容</text>
|
<view class="cu-form-group">
|
||||||
</view>
|
<view class="title margin-left-sm">{{item.comment}}</view>
|
||||||
<view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
|
<input placeholder="请输入内容" maxlength="{{item.maxLength}}" data-key="{{item.name}}"
|
||||||
<view wx:if="{{textList.length>0}}" class="flex flex-direction" style="width:100%;">
|
data-value="{{item.value}}" value="{{item.value}}" bindinput="inputText"
|
||||||
<!--输入的文本内容 -->
|
data-index="{{index}}"></input>
|
||||||
<view class="flex flex-nowrap align-center margin-top-xs" wx:for="{{textList}}" wx:key="index"
|
</view>
|
||||||
wx:for-item="txt" style="width:100%;">
|
</view>
|
||||||
<text class="flex-sub" style="word-break:break-all" decode="true" space="nbsp">{{txt}}</text>
|
<!-- 文本域 -->
|
||||||
<view class="cu-tag bg-gray margin-left-xs" catchtap="delText" data-index="{{index}}">
|
<view wx:if="{{item.dataType == '7'}}" class=" margin-top-xs">
|
||||||
<text class="cuIcon-close"></text>
|
<view class="cu-bar bg-white margin-top-xs">
|
||||||
|
<view class="action">
|
||||||
|
<text>{{item.comment}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bg-white">
|
||||||
|
<view class="cu-form-group">
|
||||||
|
<textarea class="border-line padding-left-xs padding-right-xs margin-left-xs margin-right-xs"
|
||||||
|
maxlength="{{item.maxLength}}" data-key="{{item.name}}" data-value="{{item.value}}"
|
||||||
|
bindinput="inputText" value="{{item.value}}" data-index="{{index}}"
|
||||||
|
placeholder="请输入内容"></textarea>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
<!-- 图片 -->
|
||||||
<image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;"></image>
|
<view wx:elif="{{item.dataType == '2'}}" class=" margin-top-xs">
|
||||||
<text class="text-gray">
|
<view class="cu-bar bg-white margin-top-xs">
|
||||||
用一段话,向名片访客介绍自己吧
|
<view class="action">
|
||||||
</text>
|
<text>{{item.comment}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="action">
|
||||||
<view wx:if="{{textList.length < item.count}}" class="cu-btn bg-blue radius margin-top-sm"
|
{{item.valueList.length}}/{{item.maxCount}}
|
||||||
style="width:60%;" bindtap="showDialog" data-type="TEXT" data-keyType="isShowText">点击添加</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 文本域 -->
|
|
||||||
<view class="flex flex-direction" wx:elif="{{item.type=='TEXTAREA'}}">
|
|
||||||
<view class="hint-title">
|
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
|
||||||
<text>文本域内容</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
|
|
||||||
<view wx:if="{{textareaList.length>0}}" class="flex flex-direction" style="width:100%;">
|
|
||||||
<!--输入的文本内容 -->
|
|
||||||
<view class="flex flex-nowrap align-center margin-top-xs" wx:for="{{textareaList}}" wx:key="index"
|
|
||||||
wx:for-item="txt" style="width:100%;">
|
|
||||||
<text class="flex-sub" style="word-break:break-all" decode="true" space="nbsp">{{txt}}</text>
|
|
||||||
<view class="cu-tag bg-gray margin-left-xs" catchtap="delDesc" data-index="{{index}}">
|
|
||||||
<text class="cuIcon-close"></text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="cu-form-group">
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
<view class="grid col-4 grid-square flex-sub">
|
||||||
<image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;"></image>
|
<view class="bg-img" wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx"
|
||||||
<text class="text-gray">
|
bindtap="viewImg" wx:for-item="photo" data-url="{{photo.path}}">
|
||||||
用一段话,向名片访客介绍自己吧
|
<image src='{{photo.path}}' mode='aspectFill'></image>
|
||||||
</text>
|
<view class="cu-tag bg-red" catchtap="delImg" data-index="{{idx}}"
|
||||||
</view>
|
data-itemIndex="{{index}}">
|
||||||
<view wx:if="{{textareaList.length < item.count}}" class="cu-btn bg-blue radius margin-top-sm"
|
<text class="cuIcon-close"></text>
|
||||||
style="width:60%;" bindtap="showDialog" data-type="TEXTAREA" data-keyType="isShowDesc">点击添加</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="solids" bindtap="choosePhoto" data-item="{{item}}" data-index="{{index}}"
|
||||||
<!-- 图片 -->
|
wx:if="{{item.valueList.length<item.maxCount}}">
|
||||||
<view class="flex flex-direction" wx:elif="{{item.type=='PHOTO'}}">
|
<text class="cuIcon-cameraadd"></text>
|
||||||
<view class="hint-title">
|
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
|
||||||
<text>图片内容</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-direction bg-white margin-sm radius padding-sm">
|
|
||||||
<view class="flex flex-direction self-end" style="width:100%;text-align:right;"
|
|
||||||
wx:if="{{photoList.length>0}}">
|
|
||||||
{{'数量'+'('+photoList.length+'/'+ currentItem.count+')'}}
|
|
||||||
</view>
|
|
||||||
<view wx:if="{{photoList.length>0}}" class="cu-form-group">
|
|
||||||
<view class="grid col-4 grid-square flex-sub">
|
|
||||||
<view class="bg-img" wx:for="{{photoList}}" wx:key="index" wx:for-item="photo" bindtap="viewImg"
|
|
||||||
data-url="{{photo.path}}">
|
|
||||||
<image src='{{photo.path}}' mode='scaleToFill'></image>
|
|
||||||
<view class="cu-tag bg-red" catchtap="delImg" data-index="{{index}}">
|
|
||||||
<text class="cuIcon-close"></text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
<!-- 音频 -->
|
||||||
<image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
|
<view wx:elif="{{item.dataType == '3'}}" class=" margin-top-xs">
|
||||||
</image>
|
<view class="cu-bar bg-white margin-top-xs">
|
||||||
<text class="text-gray">
|
<view class="action">
|
||||||
用一段话,向名片访客介绍自己吧
|
<text>{{item.comment}}</text>
|
||||||
</text>
|
</view>
|
||||||
</view>
|
<view class="action">
|
||||||
<view wx:if="{{photoList.length < item.count}}" class="cu-btn bg-blue radius margin-top-sm selfcenter"
|
{{item.valueList.length}}/{{item.maxCount}}
|
||||||
style="width:60%;" bindtap="showDialog" data-type="PHOTO" data-keyType="isShowPhoto">点击添加</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="flex flex-direction align-center bg-white radius padding-sm">
|
||||||
</view>
|
<view wx:if="{{item.valueList.length > 0}}" style="width:100%;">
|
||||||
<!-- 音频 -->
|
<view class="flex align-center shadow-box margin-top-xs" style="width:100%;"
|
||||||
<view class="flex flex-direction" wx:elif="{{item.type=='AUDIO'}}">
|
wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx" wx:for-item="audio">
|
||||||
<view class="hint-title">
|
<image src="/images/ic_user_default.png" mode="scaleToFill"
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
style="width:80rpx;height:80rpx;">
|
||||||
<text>语音介绍</text>
|
</image>
|
||||||
</view>
|
<view class="play-box">
|
||||||
<view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
|
<view class="flex justify-between align-center" style="width:80%;">
|
||||||
<view wx:if="{{audioList.length > 0}}" style="width:100%;">
|
<text>{{audio.curDurationStr}}</text>
|
||||||
<view class="flex align-center shadow-box margin-top-xs" style="width:100%;" wx:for="{{audioList}}"
|
<slider class="flex-sub" bindchange="slider4change" min="{{0}}"
|
||||||
wx:key="index" wx:for-item="audio">
|
max="{{audio.duration}}" value="{{audio.curDuration}}" backgroundColor="#cacaca"
|
||||||
<image src="/images/ic_user_default.png" mode="scaleToFill" style="width:80rpx;height:80rpx;">
|
activeColor="#1296db" data-index="{{index}}" data-idx="{{idx}}"
|
||||||
</image>
|
data-item="{{audio}}" block-size="14" block-color="#1296db" />
|
||||||
<view class="play-box">
|
<text>{{audio.totalDurationStr}}</text>
|
||||||
<view class="flex justify-between align-center" style="width:80%;">
|
</view>
|
||||||
<text>{{audio.curDurationStr}}</text>
|
<view class="flex justify-between" style="width:80%;">
|
||||||
<slider class="flex-sub" bindchange="slider4change" min="{{0}}" max="{{audio.duration}}"
|
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" data-index="{{index}}"
|
||||||
value="{{audio.curDuration}}" backgroundColor="#cacaca" activeColor="#1296db" data-index="{{index}}" data-item="{{audio}}"
|
data-idx="{{idx}}" data-item="{{audio}}" bindtap="rewind"></image>
|
||||||
block-size="14" block-color="#1296db" />
|
<image
|
||||||
<text>{{audio.totalDurationStr}}</text>
|
src="{{audio.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
|
||||||
</view>
|
mode="scaleToFill" bindtap="play" data-index="{{index}}" data-idx="{{idx}}"
|
||||||
<view class="flex justify-between" style="width:80%;">
|
data-item="{{audio}}">
|
||||||
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" data-index="{{index}}" data-item="{{audio}}" bindtap="rewind"></image>
|
</image>
|
||||||
<image
|
<image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed"
|
||||||
src="{{audio.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
|
data-index="{{index}}" data-idx="{{idx}}" data-item="{{audio}}"></image>
|
||||||
mode="scaleToFill" bindtap="play" data-index="{{index}}" data-item="{{audio}}"></image>
|
</view>
|
||||||
<image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed" data-index="{{index}}" data-item="{{audio}}"></image>
|
</view>
|
||||||
|
<view class="cu-tag bg-gray margin-left-xs" style="border-radius:50%;" catchtap="delAudio"
|
||||||
|
data-index="{{index}}" data-idx="{{idx}}">
|
||||||
|
<text class="cuIcon-close"></text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-tag bg-gray margin-left-xs" style="border-radius:50%;" catchtap="delAudio"
|
|
||||||
data-index="{{index}}">
|
<view class="flex align-center flex-direction" wx:else>
|
||||||
<text class="cuIcon-close"></text>
|
<image src="/images/ic_empty_voice.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
|
||||||
|
</image>
|
||||||
|
<text class="text-gray">
|
||||||
|
语音,可以给名片访客留下更深的印象
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{item.valueList.length<item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
|
||||||
|
style="width:60%;" data-index="{{index}}" data-item="{{item}}" bindtap="showDialog">点击添加
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 视频 -->
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
<view wx:elif="{{item.dataType == '4'}}" class=" margin-top-xs">
|
||||||
<image src="/images/ic_empty_voice.png" mode="scaleToFill" style="width:200rpx;height:200rpx;"></image>
|
<view class="cu-bar bg-white margin-top-xs">
|
||||||
<text class="text-gray">
|
<view class="action">
|
||||||
语音,可以给名片访客留下更深的印象
|
{{item.comment}}
|
||||||
</text>
|
</view>
|
||||||
</view>
|
<view class="action">
|
||||||
<view wx:if="{{audioList.length<item.count}}" class="cu-btn bg-blue radius margin-top-sm" style="width:60%;"
|
{{item.valueList.length}}/{{item.maxCount}}
|
||||||
data-type="AUDIO" data-keyType="isShowAudio" bindtap="showDialog">点击添加</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="cu-form-group">
|
||||||
<!-- 视频 -->
|
<view class="grid col-4 grid-square flex-sub">
|
||||||
<view class="flex flex-direction" wx:elif="{{item.type=='VIDEO'}}">
|
<view class="bg-img" wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx"
|
||||||
<view class="hint-title">
|
wx:for-item="video" bindtap="viewVideo" data-url="{{video.path}}">
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
<image src='{{video.imgPath}}' mode='aspectFill'></image>
|
||||||
<text>视频内容</text>
|
<view class="cu-tag bg-red" catchtap="delVideo" data-index="{{index}}" data-idx="{{idx}}">
|
||||||
</view>
|
<text class="cuIcon-close"></text>
|
||||||
<view class="flex flex-direction bg-white margin-sm radius padding-sm">
|
</view>
|
||||||
<view class="flex flex-direction self-end" style="width:100%;text-align:right;"
|
</view>
|
||||||
wx:if="{{videoList.length>0}}">
|
<view class="solids" bindtap="chooseVideo" wx:if="{{item.valueList.length<item.maxCount}}"
|
||||||
{{'数量'+'('+videoList.length+'/'+ currentItem.count+')'}}
|
data-item="{{item}}" data-index="{{index}}">
|
||||||
</view>
|
<text class="cuIcon-cameraadd"></text>
|
||||||
<view wx:if="{{videoList.length>0}}" class="cu-form-group">
|
|
||||||
<view class="grid col-1 grid-square flex-sub">
|
|
||||||
<view class="bg-img" wx:for="{{videoList}}" wx:key="index" wx:for-item="video" bindtap="viewVideo"
|
|
||||||
style="height:280rpx;padding-bottom:0rpx;" data-url="{{video.path}}">
|
|
||||||
<image src='{{video.imgPath}}' mode='scaleToFill'></image>
|
|
||||||
<view class="cu-tag bg-red" catchtap="delVideo" data-index="{{index}}">
|
|
||||||
<text class="cuIcon-close"></text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
<!-- 链接 -->
|
||||||
<image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
|
<view wx:if="{{item.dataType == '5'}}" class=" margin-top-xs">
|
||||||
</image>
|
<view class="cu-form-group">
|
||||||
<text class="text-gray">
|
<view class="title margin-left-sm">{{item.comment}}</view>
|
||||||
用一段话,向名片访客介绍自己吧
|
<input placeholder="请输入内容" maxlength="{{item.maxLength}}" data-key="{{item.name}}"
|
||||||
</text>
|
data-value="{{item.value}}" bindinput="inputText" data-index="{{index}}"></input>
|
||||||
</view>
|
|
||||||
<view wx:if="{{videoList.length < item.count}}" class="cu-btn bg-blue radius margin-top-sm selfcenter"
|
|
||||||
style="width:60%;" bindtap="showDialog" data-type="VIDEO" data-keyType="isShowVideo">点击添加</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
<!-- 连接 -->
|
|
||||||
<view class="flex flex-direction" wx:elif="{{item.type=='LINK'}}">
|
|
||||||
<view class="hint-title">
|
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
|
||||||
<text>链接</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
|
|
||||||
<view wx:if="{{linkList.length>0}}" class="flex flex-direction" style="width:100%;">
|
|
||||||
<!--输入的文本内容 -->
|
|
||||||
<view class="flex flex-nowrap align-center margin-top-xs" wx:for="{{linkList}}" wx:key="index"
|
|
||||||
wx:for-item="txt" style="width:100%;">
|
|
||||||
<text class="flex-sub" style="word-break:break-all" decode="true" space="nbsp">{{txt}}</text>
|
|
||||||
<view class="cu-tag bg-gray margin-left-xs" catchtap="delLink" data-index="{{index}}">
|
|
||||||
<text class="cuIcon-close"></text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
<!-- 定位 -->
|
||||||
<image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;"></image>
|
<view wx:elif="{{item.dataType=='6'}}" class=" margin-top-xs">
|
||||||
<text class="text-gray">
|
<view class="cu-bar bg-white">
|
||||||
用一段话,向名片访客介绍自己吧
|
<view class="action">
|
||||||
</text>
|
<text>{{item.comment}}</text>
|
||||||
</view>
|
|
||||||
|
|
||||||
<view wx:if="{{linkList.length < item.count}}" class="cu-btn bg-blue radius margin-top-sm"
|
|
||||||
style="width:60%;" bindtap="showDialog" data-type="LINK" data-keyType="isShowLink">点击添加</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 定位 -->
|
|
||||||
<view class="flex flex-direction" wx:elif="{{item.type=='LOCATION'}}">
|
|
||||||
<view class="hint-title">
|
|
||||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
|
||||||
<text>定位</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
|
|
||||||
<view wx:if="{{locationList.length>0}}">
|
|
||||||
<view wx:for="{{locationList}}" wx:key="index" wx:for-item="m" style="width:100%;"
|
|
||||||
class="margin-top-xs">
|
|
||||||
<view class="flex justify-between">
|
|
||||||
<view>
|
|
||||||
{{m.name}}-{{m.address}}
|
|
||||||
</view>
|
|
||||||
<view class="cu-tag bg-gray margin-left-xs" catchtap="delMap" data-index="{{index}}">
|
|
||||||
<text class="cuIcon-close"></text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view style="border-radius:10rpx;overflow:hidden;margin-top:10rpx;">
|
<view class="action">
|
||||||
<map style="width:100%;height:300rpx;" longitude="{{m.longitude}}" latitude="{{m.latitude}}"
|
|
||||||
scale="12" markers="{{[{latitude:m.latitude,longitude:m.longitude}]}}"></map>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="flex flex-direction align-center bg-white radius padding-sm">
|
||||||
|
<view wx:if="{{item.valueList.length>0}}">
|
||||||
|
<view wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx" wx:for-item="m"
|
||||||
|
style="width:100%;" class="margin-top-xs">
|
||||||
|
<view class="flex justify-between">
|
||||||
|
<view>
|
||||||
|
{{m.name}}-{{m.address}}
|
||||||
|
</view>
|
||||||
|
<view class="cu-tag bg-gray margin-left-xs" catchtap="delMap" data-index="{{index}}"
|
||||||
|
data-idx="{{idx}}">
|
||||||
|
<text class="cuIcon-close"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="border-radius:10rpx;overflow:hidden;margin-top:10rpx;">
|
||||||
|
<map style="width:100%;height:300rpx;" longitude="{{m.longitude}}"
|
||||||
|
latitude="{{m.latitude}}" scale="12"
|
||||||
|
markers="{{[{latitude:m.latitude,longitude:m.longitude}]}}"></map>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex align-center bg-white flex-direction" wx:else>
|
||||||
|
<image src="/images/ic_empty_map.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
|
||||||
|
</image>
|
||||||
|
<text class="text-gray">
|
||||||
|
在地图上选取一个地点
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{item.valueList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
|
||||||
|
data-index="{{index}}" style="width:60%;" bindtap="chooseLocation">点击添加</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex align-center flex-direction" wx:else>
|
|
||||||
<image src="/images/ic_empty_map.png" mode="scaleToFill" style="width:200rpx;height:200rpx;"></image>
|
|
||||||
<text class="text-gray">
|
|
||||||
在地图上选取一个地点
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view wx:if="{{locationList.length < item.count}}" class="cu-btn bg-blue radius margin-top-sm"
|
|
||||||
style="width:60%;" bindtap="chooseLocation">点击添加</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view wx:else style="margin-top:200rpx;width:100%;">
|
||||||
|
<van-empty description="暂无数据" image="../../../images/ic_empty_data.png" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="padding-xs foot bg-white" wx:if="{{fieldList.length > 0}}">
|
||||||
|
<button class="cu-btn bg-blue" style="width:100%" bindtap="doPublish">保存</button>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 语音弹框 -->
|
<!-- 语音弹框 -->
|
||||||
<van-action-sheet show="{{ isShowAudio }}" title="语音介绍添加" bind:close="onHide" data-type="1"
|
<van-action-sheet show="{{ isShowAudio }}" title="语音介绍添加" bind:close="onHide" data-type="1"
|
||||||
|
@ -13,104 +13,40 @@ Page({
|
|||||||
waitFlag: false,
|
waitFlag: false,
|
||||||
configMode: '2', //1单条数据 2多条数据
|
configMode: '2', //1单条数据 2多条数据
|
||||||
dataList: [],
|
dataList: [],
|
||||||
trendsList: [{
|
|
||||||
auto: false,
|
|
||||||
seeMore: false,
|
|
||||||
text: '小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟',
|
|
||||||
}, {
|
|
||||||
auto: false,
|
|
||||||
seeMore: false,
|
|
||||||
text: '小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟',
|
|
||||||
}],
|
|
||||||
photoList: [{
|
|
||||||
path: 'https://t7.baidu.com/it/u=2604797219,1573897854&fm=193&f=GIF'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'https://t7.baidu.com/it/u=2942499027,2479446682&fm=193&f=GIF'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'https://t7.baidu.com/it/u=3165657288,4248157545&fm=193&f=GIF'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'https://t7.baidu.com/it/u=3240224891,3518615655&fm=193&f=GIF'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'https://t7.baidu.com/it/u=3240224891,3518615655&fm=193&f=GIF'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
videoList: [{
|
|
||||||
imgPath: '../../../images/ic_temp.png',
|
|
||||||
path: 'https://media.w3.org/2010/05/sintel/trailer.mp4'
|
|
||||||
}],
|
|
||||||
locationList: [{
|
|
||||||
name: '满都海公园',
|
|
||||||
address: '乌兰察布西街南',
|
|
||||||
latitude: 40.816084,
|
|
||||||
longitude: 111.688774
|
|
||||||
}],
|
|
||||||
audioList: [{
|
|
||||||
id: '', //id
|
|
||||||
path: 'http://em.sycdn.kuwo.cn/0e15005756dcda91a39bec26dd824614/60d99781/resource/n3/30/66/2205407643.mp3', //地址
|
|
||||||
isPlay: false, //是否播放中
|
|
||||||
duration: 100, //时长
|
|
||||||
curDuation: 0,
|
|
||||||
curDurationStr: '00:00',
|
|
||||||
totalDurationStr: '00:56'
|
|
||||||
}, {
|
|
||||||
id: '', //id
|
|
||||||
path: 'http://em.sycdn.kuwo.cn/0e15005756dcda91a39bec26dd824614/60d99781/resource/n3/30/66/2205407643.mp3', //地址
|
|
||||||
isPlay: false, //是否播放中
|
|
||||||
duration: 100, //时长
|
|
||||||
curDuation: 0,
|
|
||||||
curDurationStr: '00:00',
|
|
||||||
totalDurationStr: '00:56'
|
|
||||||
}],
|
|
||||||
linkList: [{
|
|
||||||
url: 'https://www.baidu.com'
|
|
||||||
}, {
|
|
||||||
url: 'https://www.baidu.com'
|
|
||||||
}, {
|
|
||||||
url: 'https://www.baidu.com'
|
|
||||||
}],
|
|
||||||
count: 2,
|
count: 2,
|
||||||
isLoadMore: false
|
isLoadMore: false,
|
||||||
|
imgUrl: app.urls.baseImgUrl,
|
||||||
|
isRefresh: false,
|
||||||
|
title: '栏目内容'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
const query = wx.createSelectorQuery()
|
|
||||||
let _self = this
|
let _self = this
|
||||||
console.log(options.type)
|
|
||||||
_self.setData({
|
_self.setData({
|
||||||
columnId: options.id,
|
columnId: options.id,
|
||||||
configMode: options.mode,
|
configMode: options.mode,
|
||||||
type: options.type
|
type: options.type,
|
||||||
|
title: options.title
|
||||||
})
|
})
|
||||||
query.selectAll('.textFour_box').boundingClientRect(res => {
|
|
||||||
var lineHeight = 26
|
|
||||||
for (var i = 0; i < res.length; i++) {
|
|
||||||
if (res[i].height / lineHeight > 3) {
|
|
||||||
_self.data.trendsList[i].auto = true
|
|
||||||
_self.data.trendsList[i].seeMore = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_self.setData({
|
|
||||||
trendsList: _self.data.trendsList
|
|
||||||
})
|
|
||||||
}).exec()
|
|
||||||
query.select('#it').boundingClientRect(res => {
|
|
||||||
if (res.height > app.globalData.windowHeight) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}).exec()
|
|
||||||
_self.getList()
|
_self.getList()
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
if (this.data.isRefresh) {
|
||||||
|
wx.startPullDownRefresh({})
|
||||||
|
this.setData({
|
||||||
|
isRefresh: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
//获取栏目数据
|
//获取栏目数据
|
||||||
getList() {
|
getList() {
|
||||||
var _self = this
|
var _self = this
|
||||||
wx.showLoading({})
|
wx.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
})
|
||||||
app.http.get(app.urls.getMomentsList.format({
|
app.http.get(app.urls.getMomentsList.format({
|
||||||
configColumnId: _self.data.columnId
|
configColumnId: _self.data.columnId
|
||||||
}), {
|
}), {
|
||||||
@ -120,12 +56,67 @@ Page({
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
wx.hideLoading({})
|
wx.hideLoading({})
|
||||||
|
// 构建数据
|
||||||
|
// 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章
|
||||||
|
res.data.forEach(it => {
|
||||||
|
it.list.forEach(item => {
|
||||||
|
switch (item.dataType) {
|
||||||
|
case '2':
|
||||||
|
case '4':
|
||||||
|
var items = item.value.split(',')
|
||||||
|
var tempList = []
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var urls = _self.data.imgUrl + items[i]
|
||||||
|
var tempItem = {
|
||||||
|
path: urls,
|
||||||
|
imgPath: '../../../images/ic_temp.png'
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
}
|
||||||
|
item.valueList = tempList
|
||||||
|
break
|
||||||
|
case '6': //定位
|
||||||
|
var items = item.value.split('-')
|
||||||
|
var tempList = []
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
//截取经纬度
|
||||||
|
var latlng = items[i].split(',')
|
||||||
|
var tempItem = {
|
||||||
|
latitude: latlng[0], //纬度
|
||||||
|
longitude: latlng[1], //经度
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
}
|
||||||
|
item.valueList = tempList
|
||||||
|
break
|
||||||
|
case '3': //音频
|
||||||
|
var items = item.value.split(',')
|
||||||
|
var tempList = []
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var urls = _self.data.imgUrl + items[i]
|
||||||
|
var tempItem = {
|
||||||
|
path: urls, //地址
|
||||||
|
isPlay: false, //是否播放中
|
||||||
|
duration: 100, //时长
|
||||||
|
curDuation: 0,
|
||||||
|
curDurationStr: '00:00',
|
||||||
|
totalDurationStr: '00:00'
|
||||||
|
}
|
||||||
|
tempList.push(tempItem)
|
||||||
|
}
|
||||||
|
item.valueList = tempList
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
_self.setData({
|
_self.setData({
|
||||||
dataList: res.data
|
dataList: res.data
|
||||||
})
|
})
|
||||||
|
wx.stopPullDownRefresh({})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
wx.stopPullDownRefresh({})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//展开更多
|
//展开更多
|
||||||
@ -172,39 +163,47 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
wx.stopPullDownRefresh({})
|
this.getList()
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
console.log('触底了')
|
console.log('触底了')
|
||||||
},
|
},
|
||||||
play(e) {
|
play(e) {
|
||||||
|
|
||||||
//进行播放
|
//进行播放
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
|
var ix = e.currentTarget.dataset.i
|
||||||
var _self = this
|
var _self = this
|
||||||
_self.data.audioList.forEach(it => {
|
_self.data.dataList.forEach(it => {
|
||||||
if (it.isPlay) {
|
it.list.forEach(item => {
|
||||||
innerAudioContext.stop()
|
if (item.valueList) {
|
||||||
}
|
item.valueList.forEach(ii => {
|
||||||
it.isPlay = false
|
if (ii.isPlay) {
|
||||||
it.curDuation = 0
|
innerAudioContext.stop()
|
||||||
it.curDuationStr = '00:00'
|
}
|
||||||
|
ii.isPlay = false
|
||||||
|
ii.curDuation = 0
|
||||||
|
ii.curDuationStr = '00:00'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
if (!item.isPlay) {
|
if (!item.isPlay) {
|
||||||
// innerAudioContext.stop()
|
// innerAudioContext.stop()
|
||||||
//找到该文件
|
//找到该文件
|
||||||
innerAudioContext = wx.createInnerAudioContext()
|
innerAudioContext = wx.createInnerAudioContext()
|
||||||
|
|
||||||
// 播放音频文件
|
// 播放音频文件
|
||||||
innerAudioContext.src = _self.data.audioList[index].path
|
innerAudioContext.src = _self.data.dataList[index].list[idx].valueList[ix].path
|
||||||
innerAudioContext.autoplay = true
|
innerAudioContext.autoplay = true
|
||||||
}
|
}
|
||||||
//先需要停止其他录音文件的播放
|
//先需要停止其他录音文件的播放
|
||||||
|
|
||||||
innerAudioContext.onPlay(() => {
|
innerAudioContext.onPlay(() => {
|
||||||
_self.data.audioList[index].isPlay = true
|
_self.data.dataList[index].list[idx].valueList[ix].isPlay = true
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
dataList: _self.data.dataList
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,27 +216,27 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
innerAudioContext.onStop((res) => {
|
innerAudioContext.onStop((res) => {
|
||||||
_self.data.audioList[index].isPlay = false
|
_self.data.dataList[index].list[idx].valueList[ix].isPlay = false
|
||||||
_self.data.audioList[index].curDuration = 0
|
_self.data.dataList[index].list[idx].valueList[ix].curDuration = 0
|
||||||
_self.data.audioList[index].curDurationStr = '00:00'
|
_self.data.dataList[index].list[idx].valueList[ix].curDurationStr = '00:00'
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList,
|
dataList: _self.data.dataList,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
innerAudioContext.onEnded((res) => {
|
innerAudioContext.onEnded((res) => {
|
||||||
_self.data.audioList[index].isPlay = false
|
_self.data.dataList[index].list[idx].valueList[ix].isPlay = false
|
||||||
_self.data.audioList[index].curDuration = 0
|
_self.data.dataList[index].list[idx].valueList[ix].curDuration = 0
|
||||||
_self.data.audioList[index].curDurationStr = '00:00'
|
_self.data.dataList[index].list[idx].valueList[ix].curDurationStr = '00:00'
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList,
|
dataList: _self.data.dataList,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
innerAudioContext.onError((res) => {
|
innerAudioContext.onError((res) => {
|
||||||
_self.data.audioList[index].isPlay = false
|
_self.data.dataList[index].list[idx].valueList[ix].isPlay = false
|
||||||
_self.data.audioList[index].curDuration = 0
|
_self.data.dataList[index].list[idx].valueList[ix].curDuration = 0
|
||||||
_self.data.audioList[index].curDurationStr = '00:00'
|
_self.data.dataList[index].list[idx].valueList[ix].curDurationStr = '00:00'
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList,
|
dataList: _self.data.dataList,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
innerAudioContext.onSeeking(() => {
|
innerAudioContext.onSeeking(() => {
|
||||||
@ -251,9 +250,8 @@ Page({
|
|||||||
})
|
})
|
||||||
innerAudioContext.onTimeUpdate(() => {
|
innerAudioContext.onTimeUpdate(() => {
|
||||||
if (innerAudioContext.duration != Infinity) {
|
if (innerAudioContext.duration != Infinity) {
|
||||||
_self.data.audioList[index].curDuration = parseInt(innerAudioContext.currentTime)
|
_self.data.dataList[index].list[idx].valueList[ix].curDuration = parseInt(innerAudioContext.currentTime)
|
||||||
_self.data.audioList[index].duration = parseInt(innerAudioContext.duration)
|
_self.data.dataList[index].list[idx].valueList[ix].duration = parseInt(innerAudioContext.duration)
|
||||||
console.log(innerAudioContext.duration)
|
|
||||||
var curM = parseInt(innerAudioContext.currentTime / 60) //分钟
|
var curM = parseInt(innerAudioContext.currentTime / 60) //分钟
|
||||||
var curS = parseInt(innerAudioContext.currentTime % 60) //秒
|
var curS = parseInt(innerAudioContext.currentTime % 60) //秒
|
||||||
var tM = parseInt(innerAudioContext.duration / 60) //分钟
|
var tM = parseInt(innerAudioContext.duration / 60) //分钟
|
||||||
@ -262,10 +260,10 @@ Page({
|
|||||||
var curSStr = curS > 9 ? curS : '0' + curS
|
var curSStr = curS > 9 ? curS : '0' + curS
|
||||||
var totalMStr = tM > 9 ? tM : '0' + tM
|
var totalMStr = tM > 9 ? tM : '0' + tM
|
||||||
var totalSStr = +tS > 9 ? tS : '0' + tS
|
var totalSStr = +tS > 9 ? tS : '0' + tS
|
||||||
_self.data.audioList[index].curDurationStr = curMStr + ':' + curSStr
|
_self.data.dataList[index].list[idx].valueList[ix].curDurationStr = curMStr + ':' + curSStr
|
||||||
_self.data.audioList[index].totalDurationStr = totalMStr + ':' + totalSStr
|
_self.data.dataList[index].list[idx].valueList[ix].totalDurationStr = totalMStr + ':' + totalSStr
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
dataList: _self.data.dataList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -275,11 +273,13 @@ Page({
|
|||||||
var _self = this
|
var _self = this
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
|
var ix = e.currentTarget.dataset.i
|
||||||
if (item.isPlay) {
|
if (item.isPlay) {
|
||||||
_self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration - _self.data.speedStep
|
_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.audioList[index].curDuration)
|
innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
dataList: _self.data.dataList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,11 +289,13 @@ Page({
|
|||||||
var _self = this
|
var _self = this
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
var item = e.currentTarget.dataset.item
|
var item = e.currentTarget.dataset.item
|
||||||
|
var idx = e.currentTarget.dataset.idx
|
||||||
|
var ix = e.currentTarget.dataset.i
|
||||||
if (item.isPlay) {
|
if (item.isPlay) {
|
||||||
_self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration + _self.data.speedStep
|
_self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix] + _self.data.speedStep
|
||||||
innerAudioContext.seek(_self.data.audioList[index].curDuration)
|
innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration)
|
||||||
_self.setData({
|
_self.setData({
|
||||||
audioList: _self.data.audioList
|
dataList: _self.data.dataList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -306,11 +308,59 @@ Page({
|
|||||||
},
|
},
|
||||||
//删除
|
//删除
|
||||||
delItem(e) {
|
delItem(e) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除该条数据吗?',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '确定',
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.doDelMoment(e.currentTarget.dataset.index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doDelMoment(index) {
|
||||||
|
var _self = this
|
||||||
|
wx.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
})
|
||||||
|
var item = _self.data.dataList[index]
|
||||||
|
app.http.delete(app.urls.doDelMoment.format({
|
||||||
|
configColumnId: _self.data.columnId,
|
||||||
|
uid: item.uid
|
||||||
|
}), {
|
||||||
|
header: {
|
||||||
|
token: app.globalData.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
wx.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
this.data.dataList.splice(index, 1)
|
||||||
|
this.setData({
|
||||||
|
dataList: this.data.dataList
|
||||||
|
})
|
||||||
|
wx.startPullDownRefresh({})
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
wx.hideLoading({})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
doPublish() {
|
doPublish() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../publish/momentpublishline?id=' + this.data.columnId,
|
url: '../publish/momentpublishline?id=' + this.data.columnId + '&title=' + this.data.title
|
||||||
|
})
|
||||||
|
},
|
||||||
|
editMoment(e) {
|
||||||
|
var _self = this
|
||||||
|
var item = _self.data.dataList[e.currentTarget.dataset.index]
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../edit/momentedit?id=' + _self.data.columnId + '&uid=' + item.uid + '&title=' + _self.data.title
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,109 +1,125 @@
|
|||||||
<cu-custom isBack="{{true}}">
|
<cu-custom isBack="{{true}}">
|
||||||
<view slot="content">内容列表</view>
|
<view slot="content">{{title}}</view>
|
||||||
</cu-custom>
|
</cu-custom>
|
||||||
<view id="it" class="flex flex-direction bg-white margin-sm radius padding-sm">
|
<view wx:if="{{dataList.length>0}}">
|
||||||
<view class="flex justify-between padding-xs align-center">
|
<view id="it" class="flex flex-direction bg-white margin-sm radius padding-sm" wx:for="{{dataList}}" wx:key="index"
|
||||||
<view class="text-black text-df text-bold ">
|
data-index="{{index}}" bindtap="editMoment">
|
||||||
发表时间:2021年12月12日 12:12:12
|
<view class="flex justify-between padding-xs align-center">
|
||||||
</view>
|
<view class="text-black text-df text-bold ">
|
||||||
<image src="../../../images/ic_squareness_del.png" mode="scaleToFill" style="width:48rpx;height:48rpx;"
|
发表时间:{{item.gmtCreate}}
|
||||||
catchtap="delItem"></image>
|
|
||||||
</view>
|
|
||||||
<!-- 文本 -->
|
|
||||||
<view wx:for="{{trendsList}}" wx:key='index'>
|
|
||||||
<view class="box">
|
|
||||||
<view class="textFour_box {{item.seeMore?'three':''}}">{{item.text}}</view>
|
|
||||||
<view class="text_toggle_box" style="display:flex;align-items:center;" wx:if='{{item.seeMore}}'
|
|
||||||
data-index='{{index}}' catchtap='toggleHandler'>
|
|
||||||
<text class="text_toggle_text">查看更多</text>
|
|
||||||
<image class="toggle-icon" src="/images/ic_arrow_down.png"></image>
|
|
||||||
</view>
|
|
||||||
<view class="text_toggle_box" style="display:flex;align-items:center;"
|
|
||||||
wx:if='{{!item.seeMore && item.auto}}' data-index='{{index}}' catchtap='toggleContent'>
|
|
||||||
<text class="text_toggle_text">收起</text>
|
|
||||||
<image class="toggle-icon" src="/images/ic_arrow_up.png"></image>
|
|
||||||
</view>
|
</view>
|
||||||
|
<image src="../../../images/ic_squareness_del.png" mode="scaleToFill" style="width:48rpx;height:48rpx;"
|
||||||
|
data-index="{{index}}" catchtap="delItem"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view wx:for="{{item.list}}" wx:for-index="idx" wx:key="idx" wx:for-item="child">
|
||||||
<!-- 图片 -->
|
<!-- 文本 -->
|
||||||
<view wx:if="{{photoList.length>0}}" class="cu-form-group margin-top-xs">
|
<view wx:if="{{child.dataType=='1'}}">
|
||||||
<view class="grid col-4 grid-square flex-sub">
|
<view class="cu-bar bg-white">
|
||||||
<view class="bg-img" wx:for="{{photoList}}" wx:key="index" wx:for-item="photo" catchtap="viewImg"
|
<view class="action">
|
||||||
data-url="{{photo.path}}">
|
<text>{{child.comment}}</text>
|
||||||
<image src='{{photo.path}}' mode='scaleToFill'></image>
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bg-white">
|
||||||
|
<view class="cu-form-group">
|
||||||
|
<view id="content" class="padding-left-xs padding-right-xs margin-left-xs margin-right-xs"
|
||||||
|
style="line-height:40rpx;">
|
||||||
|
{{child.value}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<!-- 图片 -->
|
||||||
</view>
|
<view wx:if="{{child.dataType=='2'}}" class="cu-form-group margin-top-xs">
|
||||||
<!-- 视频 -->
|
<view class="grid col-4 grid-square flex-sub">
|
||||||
<view wx:if="{{videoList.length>0}}" class="cu-form-group">
|
<view class="bg-img" wx:for="{{child.valueList}}" wx:key="index" wx:for-item="photo"
|
||||||
<view class="grid col-{{count>3 ? count : 1}} grid-square flex-sub">
|
catchtap="viewImg" data-url="{{photo.path}}">
|
||||||
<view class="bg-img" wx:for="{{videoList}}" wx:key="index" wx:for-item="video" catchtap="viewVideo"
|
<image src='{{photo.path}}' mode='scaleToFill'></image>
|
||||||
style="{{count > 3 ? '' :'height:280rpx;width:100%;padding-bottom:0px;'}}" data-url="{{video.path}}">
|
</view>
|
||||||
<image style="width:100%;height:100%;" src='{{video.imgPath}}' mode='scaleToFill'></image>
|
</view>
|
||||||
<view class="{{count > 3 ? 'play-box-arrow-pos':'play-box-arrow-flex'}}">
|
</view>
|
||||||
<image src="/images/ic_video_play.png" mode="scaleToFill"
|
<!-- 视频 -->
|
||||||
style="{{count > 3 ? 'width:32px;height:32px':'height:64px;width:64px;'}}"></image>
|
<view wx:if="{{child.dataType=='4'}}" class="cu-form-group margin-top-sm" style="border:1rpx solid #eee;">
|
||||||
|
<view class="grid col-{{count>3 ? count : 1}} grid-square flex-sub">
|
||||||
|
<view class="bg-img" wx:for="{{child.valueList}}" wx:key="index" wx:for-item="video"
|
||||||
|
catchtap="viewVideo" style="{{count > 3 ? '' :'height:280rpx;width:100%;padding-bottom:0px;'}}"
|
||||||
|
data-url="{{video.path}}">
|
||||||
|
<image style="width:100%;height:100%;" src='{{video.imgPath}}' mode='scaleToFill'></image>
|
||||||
|
<view class="{{count > 3 ? 'play-box-arrow-pos':'play-box-arrow-flex'}}">
|
||||||
|
<image src="/images/ic_video_play.png" mode="scaleToFill"
|
||||||
|
style="{{count > 3 ? 'width:32px;height:32px':'height:64px;width:64px;'}}"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 音频 -->
|
||||||
|
<view wx:if="{{child.dataType=='3'}}" style="width:100%;">
|
||||||
|
<view class="flex align-center shadow-box margin-top-xs" style="width:100%;"
|
||||||
|
wx:for="{{child.valueList}}" wx:for-index="i" wx:key="i" wx:for-item="audio">
|
||||||
|
<image src="/images/ic_user_default.png" mode="scaleToFill" style="width:80rpx;height:80rpx;">
|
||||||
|
</image>
|
||||||
|
<view class="play-box">
|
||||||
|
<view class="flex justify-between align-center" style="width:80%;">
|
||||||
|
<text>{{audio.curDurationStr}}</text>
|
||||||
|
<slider class="flex-sub" bindchange="slider4change" min="{{0}}" max="{{audio.duration}}"
|
||||||
|
value="{{audio.curDuration}}" backgroundColor="#cacaca" activeColor="#1296db"
|
||||||
|
data-index="{{index}}" data-idx="{{idx}}" data-i="{{i}}" data-item="{{audio}}"
|
||||||
|
block-size="14" block-color="#1296db" />
|
||||||
|
<text>{{audio.totalDurationStr}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex justify-between" style="width:80%;">
|
||||||
|
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" data-index="{{index}}"
|
||||||
|
data-idx="{{idx}}" data-i="{{i}}" data-item="{{audio}}" bindtap="rewind"></image>
|
||||||
|
<image src="{{audio.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
|
||||||
|
mode="scaleToFill" bindtap="play" data-index="{{index}}" data-i="{{i}}"
|
||||||
|
data-idx="{{idx}}" data-item="{{audio}}"></image>
|
||||||
|
<image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed"
|
||||||
|
data-index="{{index}}" data-idx="{{idx}}" data-i="{{i}}" data-item="{{audio}}"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 地图定位 -->
|
||||||
|
<view wx:if="{{child.dataType=='6'}}">
|
||||||
|
<view wx:for="{{child.valueList}}" wx:key="index" wx:for-item="m" style="width:100%;"
|
||||||
|
class="margin-top-xs">
|
||||||
|
<view class="flex justify-between">
|
||||||
|
<view>
|
||||||
|
</view>
|
||||||
|
<view></view>
|
||||||
|
</view>
|
||||||
|
<view style="border-radius:10rpx;overflow:hidden;margin-top:10rpx;">
|
||||||
|
<map style="width:100%;height:300rpx;" longitude="{{m.longitude}}" latitude="{{m.latitude}}"
|
||||||
|
scale="12" enable-scroll="{{false}}" enable-zoom="{{false}}" enable-rotate="{{false}}"
|
||||||
|
enable-traffic="{{false}}"
|
||||||
|
markers="{{[{latitude:m.latitude,longitude:m.longitude}]}}"></map>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 文本域 -->
|
||||||
|
<view wx:if="{{child.dataType == '7'}}" class=" margin-top-xs">
|
||||||
|
<view class="cu-bar bg-white">
|
||||||
|
<view class="action">
|
||||||
|
<text>{{child.comment}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bg-white">
|
||||||
|
<view class="cu-form-group">
|
||||||
|
<view id="content" class="padding-left-xs padding-right-xs margin-left-xs margin-right-xs"
|
||||||
|
style="line-height:40rpx;">
|
||||||
|
{{child.value}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 音频 -->
|
</view>
|
||||||
<view wx:if="{{audioList.length > 0}}" style="width:100%;">
|
<view wx:else style="margin-top:200rpx;width:100%;">
|
||||||
<view class="flex align-center shadow-box margin-top-xs" style="width:100%;" wx:for="{{audioList}}"
|
<van-empty description="暂无数据" image="../../../images/ic_empty_data.png" />
|
||||||
wx:key="index" wx:for-item="audio">
|
|
||||||
<image src="/images/ic_user_default.png" mode="scaleToFill" style="width:80rpx;height:80rpx;">
|
|
||||||
</image>
|
|
||||||
<view class="play-box">
|
|
||||||
<view class="flex justify-between align-center" style="width:80%;">
|
|
||||||
<text>{{audio.curDurationStr}}</text>
|
|
||||||
<slider class="flex-sub" bindchange="slider4change" min="{{0}}" max="{{audio.duration}}"
|
|
||||||
value="{{audio.curDuration}}" backgroundColor="#cacaca" activeColor="#1296db"
|
|
||||||
data-index="{{index}}" data-item="{{audio}}" block-size="14" block-color="#1296db" />
|
|
||||||
<text>{{audio.totalDurationStr}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex justify-between" style="width:80%;">
|
|
||||||
<image src="/images/ic_audio_rewind.png" mode="scaleToFill" data-index="{{index}}"
|
|
||||||
data-item="{{audio}}" bindtap="rewind"></image>
|
|
||||||
<image src="{{audio.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
|
|
||||||
mode="scaleToFill" bindtap="play" data-index="{{index}}" data-item="{{audio}}"></image>
|
|
||||||
<image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed" data-index="{{index}}"
|
|
||||||
data-item="{{audio}}"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 连接 -->
|
|
||||||
<view wx:if="{{linkList.length > 0}}" style="width:100%;">
|
|
||||||
<view class="flex align-center margin-top-xs" style="width:100%;" wx:for="{{linkList}}" wx:key="index"
|
|
||||||
wx:for-item="link">
|
|
||||||
<view class="flex-sub">
|
|
||||||
{{link.url}}
|
|
||||||
</view>
|
|
||||||
<view class="cu-btn bg-blue radius">
|
|
||||||
打开
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 地图定位 -->
|
|
||||||
<view wx:for="{{locationList}}" wx:key="index" wx:for-item="m" style="width:100%;" class="margin-top-xs">
|
|
||||||
<view class="flex justify-between">
|
|
||||||
<view>
|
|
||||||
{{m.name}}-{{m.address}}
|
|
||||||
</view>
|
|
||||||
<view></view>
|
|
||||||
</view>
|
|
||||||
<view style="border-radius:10rpx;overflow:hidden;margin-top:10rpx;">
|
|
||||||
<map style="width:100%;height:300rpx;" longitude="{{m.longitude}}" latitude="{{m.latitude}}" scale="12"
|
|
||||||
enable-scroll="{{false}}" enable-zoom="{{false}}" enable-rotate="{{false}}" enable-traffic="{{false}}"
|
|
||||||
markers="{{[{latitude:m.latitude,longitude:m.longitude}]}}"></map>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="padding-xs foot bg-white" wx:if="{{configMode == '2' || dataList.length <= 0}}">
|
<view class="padding-xs foot bg-white" wx:if="{{configMode == '2' || dataList.length <= 0}}">
|
||||||
<button class="cu-btn bg-blue" style="width:100%" bindtap="doPublish">发布</button>
|
<button class="cu-btn bg-blue" style="width:100%" bindtap="doPublish">去发布</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
|
@ -43,7 +43,8 @@ Page({
|
|||||||
speedStep: 5, //快进快退秒数
|
speedStep: 5, //快进快退秒数
|
||||||
setInter: '', //定时器
|
setInter: '', //定时器
|
||||||
currentItem: undefined,
|
currentItem: undefined,
|
||||||
isAuthAudio: false
|
isAuthAudio: false,
|
||||||
|
title: '栏目内容发布'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +52,8 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
this.setData({
|
this.setData({
|
||||||
columnId: options.id
|
columnId: options.id,
|
||||||
|
title: options.title + '发布'
|
||||||
})
|
})
|
||||||
this.checkPermission()
|
this.checkPermission()
|
||||||
this.getFieldList()
|
this.getFieldList()
|
||||||
@ -142,10 +144,11 @@ Page({
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (chooseLocation.getLocation() != null) {
|
if (chooseLocation.getLocation() != null) {
|
||||||
if (this.data.locationList.length < this.data.currentItem.count) {
|
var item = this.data.fieldList[this.data.curMapIndex]
|
||||||
this.data.locationList.push(chooseLocation.getLocation())
|
if (item.valueList.length < item.maxCount) {
|
||||||
|
this.data.fieldList[this.data.curMapIndex].valueList.push(chooseLocation.getLocation())
|
||||||
this.setData({
|
this.setData({
|
||||||
locationList: this.data.locationList
|
fieldList: this.data.fieldList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -518,7 +521,7 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//地图选点
|
//地图选点
|
||||||
chooseLocation() {
|
chooseLocation(e) {
|
||||||
var index = e.currentTarget.dataset.index
|
var index = e.currentTarget.dataset.index
|
||||||
this.setData({
|
this.setData({
|
||||||
curMapIndex: index
|
curMapIndex: index
|
||||||
@ -697,7 +700,7 @@ Page({
|
|||||||
_self.setData({
|
_self.setData({
|
||||||
fieldList: _self.data.fieldList
|
fieldList: _self.data.fieldList
|
||||||
})
|
})
|
||||||
if (_self.data.fieldList[_self.data.currentIndex].valueList == _self.data.currentItem.maxCount) {
|
if (_self.data.fieldList[_self.data.currentIndex].valueList.length == _self.data.currentItem.maxCount) {
|
||||||
_self.setData({
|
_self.setData({
|
||||||
isShowAudio: false
|
isShowAudio: false
|
||||||
})
|
})
|
||||||
@ -843,5 +846,97 @@ Page({
|
|||||||
currentItem: e.currentTarget.dataset.item,
|
currentItem: e.currentTarget.dataset.item,
|
||||||
currentIndex: e.currentTarget.dataset.index
|
currentIndex: e.currentTarget.dataset.index
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
//提交保存
|
||||||
|
doPublish() {
|
||||||
|
var _self = this
|
||||||
|
if (_self.checkParams()) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '保存中...',
|
||||||
|
})
|
||||||
|
var params = _self.buildParams()
|
||||||
|
app.http.post(app.urls.doSaveMoments.format({
|
||||||
|
configColumnId: _self.data.columnId
|
||||||
|
}), {
|
||||||
|
data: params,
|
||||||
|
header: {
|
||||||
|
token: app.globalData.token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
let pages = getCurrentPages();
|
||||||
|
let beforePage = pages[pages.length - 2];
|
||||||
|
beforePage.setData({
|
||||||
|
isRefresh: true
|
||||||
|
})
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
wx.hideLoading({})
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//校验参数
|
||||||
|
checkParams() {
|
||||||
|
var _self = this
|
||||||
|
var isLegal = true
|
||||||
|
for (var i = 0; i < _self.data.fieldList.length; i++) {
|
||||||
|
var field = _self.data.fieldList[i]
|
||||||
|
if (field.must) {
|
||||||
|
if (field.dataType == '1' || field.dataType == '7') {
|
||||||
|
if (field.value.length <= 0) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请输入' + field.comment,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
isLegal = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (field.valueList.length <= 0) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请上传' + field.comment,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
isLegal = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isLegal
|
||||||
|
},
|
||||||
|
//构建提交参数
|
||||||
|
buildParams() {
|
||||||
|
var params = {}
|
||||||
|
var _self = this
|
||||||
|
for (var i = 0; i < _self.data.fieldList.length; i++) {
|
||||||
|
var field = _self.data.fieldList[i]
|
||||||
|
if (field.dataType == '1' || field.dataType == '7') {
|
||||||
|
if (field.value.length > 0) {
|
||||||
|
params[field.name] = field.value
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (field.valueList.length > 0) {
|
||||||
|
var ids = ""
|
||||||
|
if (field.dataType == '6') {
|
||||||
|
field.valueList.forEach(it => {
|
||||||
|
ids += it.latitude + ',' + it.longitude + '-'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
field.valueList.forEach(it => {
|
||||||
|
ids += it.id + ','
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ids = ids.substr(0, ids.length - 1)
|
||||||
|
params[field.name] = ids
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,8 +1,8 @@
|
|||||||
<cu-custom isBack="{{true}}">
|
<cu-custom isBack="{{true}}">
|
||||||
<view slot="content">内容发布</view>
|
<view slot="content">{{title}}</view>
|
||||||
</cu-custom>
|
</cu-custom>
|
||||||
<view wx:if="{{fieldList.length>0}}" class="flex flex-direction radius align-center">
|
<view wx:if="{{fieldList.length>0}}" class="flex flex-direction radius align-center">
|
||||||
<view class="flex flex-direction self-center" style="width:95%;">
|
<view class="flex flex-direction self-center" style="width:95%;margin-bottom:100rpx;">
|
||||||
<!-- 内容 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章 -->
|
<!-- 内容 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章 -->
|
||||||
<view wx:for="{{fieldList}}" wx:key="index">
|
<view wx:for="{{fieldList}}" wx:key="index">
|
||||||
<!-- 文本 -->
|
<!-- 文本 -->
|
||||||
@ -182,7 +182,7 @@
|
|||||||
在地图上选取一个地点
|
在地图上选取一个地点
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{locationList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
|
<view wx:if="{{item.valueList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
|
||||||
data-index="{{index}}" style="width:60%;" bindtap="chooseLocation">点击添加</view>
|
data-index="{{index}}" style="width:60%;" bindtap="chooseLocation">点击添加</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -52,6 +52,8 @@ var apis = {
|
|||||||
getMomentsList: `app/configcolumndata/listrelease/{configColumnId}`, //获取栏目数据列表
|
getMomentsList: `app/configcolumndata/listrelease/{configColumnId}`, //获取栏目数据列表
|
||||||
doSaveMoments: `app/configcolumndata/saverelease/{configColumnId}`, //保存栏目数据
|
doSaveMoments: `app/configcolumndata/saverelease/{configColumnId}`, //保存栏目数据
|
||||||
getMomentsField: `app/configcolumndata/listfieldrelease/{configColumnId}`, //获取栏目字段列表
|
getMomentsField: `app/configcolumndata/listfieldrelease/{configColumnId}`, //获取栏目字段列表
|
||||||
|
doDelMoment: `app/configcolumndata/deleterelease/{configColumnId}/{uid}`, //删除栏目数据
|
||||||
|
getMomentsContent: `app/configcolumndata/getrelease/{configColumnId}/{uid}`, //获取栏目数据
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
Reference in New Issue
Block a user