// pages/m_consult/consultdetailcase/consultdetailcase.js
const consultservice = require("../../../service/consultservice")
const util = require("../../../utils/util")
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
showloading: false,
case: {},
caseTag: [],
showDialog: false,
groups: [
'actionSlot1',
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var that = this
this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
that.setData({
caseId: data.caseId
})
that.getCase()
})
},
getCase() {
this.setData({
showloading: true
})
var that = this
consultservice.getCase(app.globalData.accessToken.userId, this.data.caseId, {
success(res) {
let caseTag = []
if (res.ecIsPunish) caseTag.push({icon: '/res/icons/cq_punish.png', name: '涉及行政处罚'})
if (res.ecIsIllegal) caseTag.push({icon: '/res/icons/cq_illegal.png', name: '涉及刑事责任'})
if (res.ecIsSupervise) caseTag.push({icon: '/res/icons/cq_supervise.png', name: '涉及环保督察要点'})
if (res.ecIsShotspot) caseTag.push({icon: '/res/icons/cq_shotspot.png', name: '涉及环保管理热点'})
if (res.ecIsMinor) caseTag.push({icon: '/res/icons/cq_minor.png', name: '涉及轻微违法'})
if (res.ecIsDetained) caseTag.push({icon: '/res/icons/cq_detained.png', name: '涉及行政拘留'})
res.ecSummary = res.ecSummary.replaceAll('\\n', '
')
res.ecMeaning = res.ecMeaning.replaceAll('\\n', '
')
res.ecExamined = res.ecExamined.replaceAll('\\n', '
')
res.ecEnlightenment = res.ecEnlightenment.replaceAll('\\n', '
')
res.ecOccurDate = util.formatTime(res.ecOccurDate)
that.setData({
case: res,
caseTag
})
console.log(res);
},
complete(res) {
that.setData({
showloading: false
})
}
})
},
openDialog: function () {
this.setData({
showDialog: true
})
},
closeDialog: function () {
this.setData({
showDialog: false
})
},
btnClick(e) {
console.log(e)
this.closeDialog()
},
previewImage(e) {
const i = e.currentTarget.dataset.index
// const img = this.data.case.ecAppendixUrl[i]
const remark = this.data.case.ecAppendixText[i]
const previewImageUrls = this.data.case.ecAppendixUrl;
this.setData({
previewImageUrls,
remark,
previewCurrent: 0,
showPreview: true
});
},
})