| | |
| | | evalList: {}, |
| | | disabled: true, |
| | | showInfo: false, |
| | | id:'' |
| | | id: '' |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | onLoad: function(options) { |
| | | const id = options.id || 'new'; |
| | | let that = this; |
| | | var userinfo = wx.getStorageSync("user"); |
| | |
| | | data: { |
| | | id, |
| | | }, |
| | | success: function (res) { |
| | | success: function(res) { |
| | | console.log('res', res); |
| | | var dataSet = res.data; |
| | | var evalList1000 = dataSet.attachments || []; |
| | | var evalList1000 = dataSet.attachmentList || []; |
| | | var evalList = { |
| | | evalList1000, |
| | | }; |
| | | for (var i in evalList) { |
| | | evalList[i] = evalList[i].map(({ |
| | | imgPath: pic, |
| | | attachmentId: id |
| | | id |
| | | }) => ({ |
| | | pic, |
| | | pic: app.globalData.url + '/api/v1/attachment/image/' + id, |
| | | id |
| | | })) |
| | | } |
| | | console.log(evalList) |
| | | const data = res.data || {} |
| | | if (options.id) { |
| | | that.setData({ |
| | |
| | | |
| | | onSubmit() { |
| | | console.log(this.data.thisData) |
| | | if(!this.data.thisData.tipoffObject){ |
| | | if (!this.data.thisData.tipoffObject) { |
| | | return app.showModal("请填写举报对象!"); |
| | | } |
| | | if(!this.data.thisData.tipoffAddress){ |
| | | if (!this.data.thisData.tipoffAddress) { |
| | | return app.showModal("请填写发生地!"); |
| | | } |
| | | if(!this.data.thisData.tipoffContent){ |
| | | if (!this.data.thisData.tipoffContent) { |
| | | return app.showModal("请填写具体事项!"); |
| | | } |
| | | if(!this.data.evalList){ |
| | | if (!this.data.evalList) { |
| | | return app.showModal("请上传证明材料!"); |
| | | } |
| | | if(!this.data.thisData.tipoffType){ |
| | | if (!this.data.thisData.tipoffType) { |
| | | return app.showModal("请选择方式!"); |
| | | } |
| | | if(this.data.thisData.tipoffType=='2'){ |
| | | if(!this.data.thisData.createrName){ |
| | | if (this.data.thisData.tipoffType == '2') { |
| | | if (!this.data.thisData.createrName) { |
| | | return app.showModal("请填写姓名!"); |
| | | } |
| | | if(!this.data.thisData.createrMobile){ |
| | | if (!this.data.thisData.createrMobile) { |
| | | return app.showModal("请填写手机号码!"); |
| | | } |
| | | if(!this.data.thisData.createrAddress){ |
| | | return app.showModal("请填写联系方式!"); |
| | | if (/^[1]([3-9])[0-9]{9}$/.test(this.data.thisData.createrMobile)==false){ |
| | | return app.showModal("手机号码有误!"); |
| | | } |
| | | if (!this.data.thisData.createrAddress) { |
| | | return app.showModal("请填写联系地址!"); |
| | | } |
| | | } |
| | | wx.request({ |
| | |
| | | header: { |
| | | "Content-Type": "application/json" |
| | | }, |
| | | success: function (res) { |
| | | success: function(res) { |
| | | if (res.data.code == 0) { |
| | | wx.showToast({ |
| | | title: '提交成功!', |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }) |
| | | wx.navigateTo({ |
| | | url: '../zhwj/zhwj', |
| | | duration: 2000, |
| | | success: function() { |
| | | setTimeout(function() { |
| | | //要延时执行的代码 |
| | | wx.navigateBack({ |
| | | delta: 2 |
| | | }) |
| | | }, 1000) //延迟时间 |
| | | }, |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | checkMobile: function() { |
| | | var sMobile = document.mobileform.mobile.value |
| | | if (!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(sMobile))) { |
| | | alert("不是完整的11位手机号或者正确的手机号前七位"); |
| | | document.mobileform.mobile.focus(); |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | // 选择地理位置 |
| | | chooseLocation: function (e) { |
| | | chooseLocation: function(e) { |
| | | const that = this; |
| | | wx.chooseLocation({ |
| | | success: function (res) { |
| | | success: function(res) { |
| | | console.log('res', res); |
| | | that.setData({ |
| | | thisData: { |
| | |
| | | }, |
| | | |
| | | //添加图片 |
| | | joinPicture: function (e) { |
| | | joinPicture: function(e) { |
| | | console.log(e) |
| | | var that = this; |
| | | console.log(that) |
| | |
| | | }, |
| | | |
| | | // 删除图片 |
| | | clearImg: function (e) { |
| | | clearImg: function(e) { |
| | | var that = this; |
| | | app.clearImg(e, that); |
| | | }, |
| | | |
| | | //预览图片 |
| | | previewImage: function (e) { |
| | | previewImage: function(e) { |
| | | app.previewImage(e); |
| | | }, |
| | | |
| | |
| | | this.setData({ |
| | | [key]: e.detail.value, |
| | | [`display${key}`]: e.detail.label, |
| | | showInfo:true, |
| | | showInfo: true, |
| | | thisData: { |
| | | ...this.data.thisData, |
| | | [key]: e.detail.value, |
| | | } |
| | | }); |
| | | }else{ |
| | | } else { |
| | | this.setData({ |
| | | [key]: e.detail.value, |
| | | [`display${key}`]: e.detail.label, |