import UserApi from '../../assets/js/http/userApi' import { appName } from '../../assets/js/project.config' import {previewFile,initFileList} from '../../assets/js/preview' import MeetingApi from '../../assets/js/http/meetingApi' Page({ /** * 页面的初始数据 */ data: { statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'], type:'',//区别是哪个项目的项目详情 work工作组 form: {}, id: '', // 在工作组id,项目id workingGroupId: '', //工作组id showMeeting: false, // 会议信息的显隐 showProjectData:true, // 项目资料的显示隐藏 projectFileList: [], // 项目资料文件 notifyFileList: [], // 通知文件 meetingList: [], // 会议文件 // 合同签订联系人的id signedContactsId:{}, // 当前登录人的id currentId:'', pageTitle:'项目',// 页面标题 默认是 项目 }, goBack(){ wx.navigateBack() }, // 预览 preview(e) { const fileObj = e.currentTarget.dataset.file previewFile(fileObj.id, fileObj.name) }, // 获取更多会议信息数据 goMoreMeeting() { wx.navigateTo({ url: `../meeting/meeting?workingGroupId=${this.data.workingGroupId}`, }) }, // 会议详情 meetingDetail(e) { const meetingInfo = JSON.stringify(e.currentTarget.dataset.meetinginfo) wx.navigateTo({ url: `../meetingDetailSigned/meetingDetailSigned?meetingInfo=${meetingInfo}`, }) }, // 查看物流 lookProgress(e){ let num = e.currentTarget.dataset.progress.postNo wx.navigateTo({ url: `plugin://kdPlugin/index?num=${num}&appName=${appName}`, }) }, // 跳转合同详情 contractDetail(){ const that = this console.log(this.data.form) if(this.data.form.contractId){ wx.navigateTo({ url: `../contractDetail/contractDetail?id=${that.data.form.contractId}`, }) }else{ wx.showToast({ title: '未关联合同', icon: 'none' }) } // if(this.data.form.contractId) { // 关联了合同才能去合同详情 // UserApi.contractDetail({id:this.data.form.contractId}).then(res=>{ // console.log(res) // if(res.success){ // this.setData({ // signedContactsId: res.result.signedContactsId // }) // wx.getStorage({ // key:'userInfo', // success(res){ // that.setData({ // currentId:res.data.id // }) // // 判断当前登录人是否是合同企业签订联系人 // console.log('that.data.currentId === that.data.signedContactsId',that.data.currentId === that.data.signedContactsId); // if(that.data.currentId === that.data.signedContactsId){ // wx.navigateTo({ // url: `../contractDetail/contractDetail?id=${that.data.form.contractId}`, // }) // }else{ // wx.showToast({ // title: '当前登录人不是合同签订企业联系人', // icon: 'none' // }) // } // } // }) // } // }) // // // }else{ // wx.showToast({ // title: '未关联合同', // icon: 'none' // }) // } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(options.type){ this.setData({ type:options.type }) } if(options.type === 'ziliao'){ this.setData({ showProjectData:false, pageTitle:'资料网员详情' }) } this.data.id = options.id this.data.workingGroupId = options.workingGroupId if (options.type == 'work') { // 工作组项目有会议详情 this.setData({ showMeeting: true, pageTitle:'工作组详情' }) MeetingApi.meetingList({ workingGroupProjectId: this.data.id, column: 'createTime', order: 'desc' }).then(res => { if (res.success) { if (res.result.records && res.result.records.length <= 2) { this.setData({ meetingList: res.result.records }) } else if (res.result.records && res.result.records.length > 2) { this.setData({ meetingList: res.result.records.slice(0, 2) }) } } }).catch(err => { wx.showToast({ title: '加载失败', icon: 'none', duration: 2000 }) }) } UserApi.projectDetail({ id: this.data.id }).then(res => { this.setData({ form: res.result }) // 获取项目资料文件list if (this.data.form) { initFileList(this.data.form.files).then(res => { this.setData({ projectFileList: res }) }) // 获取通知文件list initFileList(this.data.form.chargeNoticeId).then(res => { this.setData({ notifyFileList: res }) }) } }).catch(err => { wx.showToast({ title: '加载失败', icon: 'none', duration: 2000 }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })