// pages/pfyy/pfyy.js const app = getApp(); var Validator = require("../../utils/validate.tools.js"); const verify = Validator.Validator; Page({ /** * 页面的初始数据 */ data: { disabled: false, id: '', picType: '', evalList: {}, picturesInfo: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; console.log(options) let id = options.id let disabled = options.disabled var userinfo = wx.getStorageSync("user"); wx.request({ url: app.globalData.url + '/api/v1/appointment/find?id=' + id, success: function (res) { console.log(res.data.data.lawAppointment) if (res.data.code == 0) { that.setData({ picturesInfo: { ...res.data.data.lawAppointment, createId: userinfo.id, activitiesTime: app.formatDateday(res.data.data.lawAppointment.activitiesTime) }, disabled }) } else { wx.showModal({ title: '提示', content: "请求失败!" }) } } }) }, inputChange: function (e) { var name = e.currentTarget.dataset.name; this.setData({ picturesInfo: { ...this.data.picturesInfo, [name]: e.detail.value } }) }, submit: function (e) { var picturesInfo = this.data.picturesInfo; if (!picturesInfo.schoolName) { return app.showModal("请填写学校名称!"); } if (!picturesInfo.schoolAddress) { return app.showModal("请填写学校地址!"); } if (!picturesInfo.contactName) { return app.showModal("请填写联系人!"); } if (!picturesInfo.contactPhone) { return app.showModal("请填写联系方式!"); } if (!picturesInfo.activitiesTime) { return app.showModal("请填写活动时间!"); } if (!picturesInfo.content) { return app.showModal("请填写普法内容!"); } if (!picturesInfo.activitiesNum) { return app.showModal("请填写活动人数!"); } if (!picturesInfo.activitiesAddress) { return app.showModal("请填写活动场地!"); } if (!picturesInfo.remake) { return app.showModal("请填写备注!"); } var that = this; wx.request({ url: app.globalData.url + '/api/v1/appointment/save', data: picturesInfo, method: 'POST', header: { "Content-Type": "application/json" }, success: function (res) { if (res.data.code == 0) { wx.showToast({ title: '提交成功', icon: 'success', duration: 2000 }) setTimeout(function () { wx.reLaunch({ url: '../zhwj/zhwj', }) }, 2000) } else { wx.showModal({ title: '提示', content: "提交失败!" }) } } }) }, })