// pages/course/index.js const $$ = require('../../utils/util'); // 获取案件历程 function getCourseApi(url, submitData) { return $$.request({ url, submitData, type: 'get', service: 'mediate' }); } Page({ /** * 页面的初始数据 */ data: { imgUrl: $$.url.img, pageType: '', //1为调解历程页面、2为司法历程页面 contentData: {}, }, // async _getCourseData(options, modelData) { let url, params; if (options.pageType === '1') { url = 'paCaseInfo/getCourse'; params = { caseId: options.id }; } else if (options.pageType === '2') { url = 'paJudicInfo/getCourse'; params = { judicId: options.id }; } $$.showLoading(); const res = await getCourseApi(url, params); $$.hideLoading(); if (res.type) { res.data.applyTime = $$.timeFormat(res.data.applyTime); this.setData({ pageType: options.pageType, contentData: res.data, }); } }, // 查看附件 onCheck(e) { let idx = e.currentTarget.dataset.fileidx; let fileItem = this.data.contentData.fileInfoList[idx]; let type = fileItem.cat; let url = $$.baseUrl + $$.url.fileShowUrl + fileItem.id; $$.openFiles(type, url, [url]); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { wx.setNavigationBarTitle({ title: options.pageType === '1' ? '调解历程' : '司法确认历程', }); let adjustModel = [ { title: '调解案号:', value: 'caseNo' }, { title: '申请渠道:', value: 'sourceName' }, { title: '申请时间:', value: 'applyTime' }, { title: '申请人:', value: 'plaintiffs' }, { title: '被申请人:', value: 'defendants' }, ]; let judicialModel = [ { title: '司法确认案号:', value: 'judicNo' }, { title: '申请时间:', value: 'applyTime' }, { title: '调解组织:', value: 'applyUnitName' }, { title: '申请人:', value: 'plaintiffs' }, { title: '被申请人:', value: 'defendants' }, ]; let con = options.pageType === '1' ? adjustModel : judicialModel; this._getCourseData(options, con); }, });