You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.6 KiB
110 lines
2.6 KiB
import regeneratorRuntime from '../../../../utils/runtime.js'
|
|
import {
|
|
getWeekRecordDetail
|
|
} from '../../../../api/weeklyIndex'
|
|
Page({
|
|
data: {
|
|
imageUrl: [],
|
|
currentUrl: '',
|
|
infoId: '',
|
|
images: [],
|
|
dataList: [],
|
|
loadVisible: false,
|
|
loadType: 'more',
|
|
nowData: '',
|
|
filesName:''
|
|
},
|
|
async onLoad(options) {
|
|
this.setData({
|
|
infoId: options.infoId,
|
|
loadVisible: true
|
|
})
|
|
await this.getWeekRecordDetail()
|
|
this.setData({
|
|
loadVisible: false
|
|
})
|
|
},
|
|
// 放大预览
|
|
gopreviewImage(e) {
|
|
console.log('e图片', e.currentTarget.dataset.index)
|
|
let imageUrl = []
|
|
this.data.dataList.images.forEach((element, index) => {
|
|
if (e.currentTarget.dataset.index == index) {
|
|
this.setData({
|
|
currentUrl: element.imgUrl
|
|
})
|
|
}
|
|
imageUrl.push(element.imgUrl)
|
|
})
|
|
this.setData({
|
|
imageUrl,
|
|
})
|
|
wx.previewImage({
|
|
current: this.data.currentUrl,
|
|
urls: this.data.imageUrl // 需要预览的图片http链接列表
|
|
})
|
|
},
|
|
// 获得编辑周报详情
|
|
async getWeekRecordDetail() {
|
|
let {
|
|
data
|
|
} = await getWeekRecordDetail(this.data.infoId)
|
|
this.setData({
|
|
dataList: data
|
|
})
|
|
// 标题和选项都不显示的
|
|
// let totalData = []
|
|
// data.totalData.forEach((element) => {
|
|
// element.totalList.forEach((item) => {
|
|
// if (item.total !== '') {
|
|
// totalData.push(
|
|
// element
|
|
// )
|
|
// }
|
|
// })
|
|
// })
|
|
// totalData = Array.from(new Set(totalData))
|
|
// this.setData({
|
|
// [`dataList.totalData`]: totalData
|
|
// })
|
|
// 标题和选项都不显示的
|
|
let totalData = data.totalData
|
|
let totalList = []
|
|
data.totalData.forEach((element, index) => {
|
|
element.totalList.forEach((item) => {
|
|
// 拼接:
|
|
item.totalName = item.totalName + ' : '
|
|
if (item.total !== '') {
|
|
// // 拼接:
|
|
// element.totalDescribe = element.totalDescribe + ':'
|
|
totalData[index].totalList.push(item)
|
|
totalData[index].totalList = Array.from(new Set(totalData[index].totalList))
|
|
} else if (item.total == '') {
|
|
// element.totalDescribe = element.totalDescribe.replace('{0}', '2222')
|
|
totalData[index].totalList = []
|
|
}
|
|
})
|
|
})
|
|
totalData = Array.from(new Set(totalData))
|
|
totalData.forEach((element,index)=>{
|
|
if(element.totalList.length ==0){
|
|
element.totalDescribe = element.totalDescribe.replace('{0}', '未')
|
|
}else {
|
|
element.totalDescribe = element.totalDescribe.replace('{0}', '')
|
|
}
|
|
})
|
|
let filesName = ''
|
|
data.files.forEach((element,index)=>{
|
|
if(index==0){
|
|
filesName+=`${element.fileName}`
|
|
}else {
|
|
filesName+=`、${element.fileName}`
|
|
}
|
|
|
|
})
|
|
this.setData({
|
|
[`dataList.totalData`]: totalData,
|
|
filesName,
|
|
})
|
|
},
|
|
})
|