// Componet/Componet.js const app = getApp(); Component({ /** * 组件的属性列表 */ properties: { // 是否显示用户授权 item: { type: Object } }, /** * 组件的初始数据 */ data: { uploadUrl: app.globalData.url + '/api/v1/attachment/wechatMaterials?', fileIcon: app.globalData.imgUrl + '/images/icon_file.png', }, ready: function() { }, /** * 组件的方法列表 */ methods: { // 直播调解跳转 linkLive(e) { var roomid = e.currentTarget.dataset['roomid']; console.log(roomid); wx.navigateTo({ url: '../linkLive/linkLive?roomId=' + roomid }) }, // 附件处理 onChange(e) { console.log('onChange', e); const { file } = e.detail; if (file.status === 'uploading') { wx.showLoading() } else if (file.status === 'done') { } }, onSuccess(e) { console.log('onSuccess', e) }, onFail(e) { console.log('onFail', e) }, onComplete(e) { let that = this; console.log('onComplete', e); var id = e.currentTarget.dataset['id']; console.log('id', id); let { supplyAttachmentList } = that.data.item; if (e.detail.statusCode == 200) { let data = JSON.parse(e.detail.data); that.data.item.supplyAttachmentList = supplyAttachmentList.concat(data.data); console.log(that.data.item); that.setData({ item: that.data.item }); wx.hideLoading(); } else { wx.hideLoading({ title: '上传失败, 请重试...', icon: 'none' }); } }, onProgress(e) { console.log('onProgress', e) }, onPreview(e) { console.log('onPreview', e) const { file, fileList } = e.detail wx.previewImage({ current: file.url, urls: fileList.map((n) => n.url), }) }, onRemove(e) { const { file, fileList } = e.detail; let that = this; var id = e.currentTarget.dataset['id']; console.log(id); let { supplyAttachmentList } = that.data.item; wx.showModal({ content: '确定删除?', success: (res) => { if (res.confirm) { wx.showLoading(); wx.request({ url: app.globalData.url + '/api/v1/attachment/deleteByOwnerAtt', method: 'GET', data: { attId: file.id, owenId: id }, success: function (res) { console.log('res', res); that.data.item.supplyAttachmentList = supplyAttachmentList.filter((n) => n.uid !== file.uid) that.setData({ item: that.data.item }) wx.hideLoading(); } }) } }, }) }, // 案件补录跳转 onCaseSupply(e) { var id = e.currentTarget.dataset['id']; console.log('id', id); wx.navigateTo({ url: '../applyMediation/applyMediation?caseId=' + id }) }, openFile(e) { app.openFileByType(e); }, // 签到调解 signIn(e) { var meetingtype = e.currentTarget.dataset['meetingtype']; var caseid = e.currentTarget.dataset['caseid']; console.log(meetingtype, caseid); var that = this; wx.showLoading(); wx.request({ url: app.globalData.url + '/api/meetingPerson/wechatSignIn/' + wx.getStorageSync('#wxEmpowerInfo#').openId + '/' + caseid + '/' + meetingtype, method: 'GET', header: { "Content-Type": "application/json" }, success: function (res) { console.log(res.data.data) if (res.data.code == 0) { wx.hideLoading(); wx.showToast({ title: '签到成功', icon: 'success', success() { that.triggerEvent('onLoadRender', {}); } }) } else { wx.hideLoading(); wx.showToast({ title: '网络请求失败,请稍后再试!', icon: 'none' }) } } }) } } })