You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
4.8 KiB

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/user/editNeeds/index"],{"4c6a":function(e,t,r){"use strict";var i=r("f534"),a=r.n(i);a.a},"8be9":function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(r("d3dd"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=r("514b"),u=getApp(),n={data:function(){return{form:{resourceType:0,title:"",detailedDescription:"",resourceImgs:[],capital:"",resourceStartTime:"",resourceEndTime:""},id:"",active:1,resourcesList:[],resourcesIdx:null}},components:{},props:{},onLoad:function(e){e.id&&(this.setData({id:e.id}),this.getDetail(e.id)),e.type&&(this.setData({}),this.form.resourceType=Number(e.type)),this.initValidate(),this.getResourcesCagetory()},methods:{tabClick:function(e){var t=e.currentTarget.dataset.i;2==t&&(this.setData({}),this.form.capital="价格可议"),this.setData({active:e.currentTarget.dataset.i})},capitalChange:function(e){this.setData({}),this.form.capital=e.detail.value},startTimeChange:function(e){console.log(e.detail.value);var t=e.detail.value.split("-"),r=Number(t[0])+1;this.setData({}),this.form.resourceEndTime=r+"-"+t[1]+"-"+t[2],this.form.resourceStartTime=e.detail.value},endTimeChange:function(e){this.setData({}),this.form.resourceEndTime=e.detail.value},bindPickerChange:function(e){this.setData({}),this.form.resourceType=this.typeArr[e.detail.value]},getResourcesCagetory:function(){var e=this;u.http("GET","ResourcesCagetory/listResourcesCagetory").then((function(t){t.data.success&&e.setData({resourcesList:t.data.data})}))},resourcesChange:function(e){var t=Number(e.detail.value);this.resourcesIdx=t,this.form.resourceCagetoryId=this.resourcesList[t].id},getDetail:function(e){var t=this;u.http("GET","Resources/resourceInfo",{id:e}).then((function(e){if(e.data.success){var r=e.data.data;t.setData({}),t.form.resourceEndTime=r.resourceEndTime,t.form.resourceStartTime=r.resourceStartTime,t.form.capital=r.capital,t.form.resourceImgs=r.resourceImgs,t.form.detailedDescription=r.detailedDescription,t.form.title=r.title,t.form.resourceType=r.resourceType,isNaN(Number(r.capital))&&t.setData({active:2})}}))},initValidate:function(){var e={title:{required:!0},resourceCagetoryId:{required:!0},detailedDescription:{required:!0},resourceStartTime:{required:!0},resourceEndTime:{required:!0}},t=s({title:{required:"请填写标题"},resourceCagetoryId:{required:"请选择需求类型"},detailedDescription:{required:"请填写内容"},resourceEndTime:{required:"请设置展示开始时间"}},"resourceEndTime",{required:"请设置展示结束时间"});this.WxValidate=new i.default(e,t)},upImgs:function(){var e=this;o.chooseImages2((function(t){var r=e.form.resourceImgs;r.push(t),e.setData({}),e.form.resourceImgs=r}))},submit:function(t){var r=this,i=t.detail.target.dataset.type,a=t.detail.value;""!=this.id&&(a.id=this.id),a.resourceType=r.form.resourceType,a.resourceCagetoryId=r.form.resourceCagetoryId,a.resourceImgs=r.form.resourceImgs,a.capital=r.form.capital,0==i?(a.isDraft=!0,e.showModal({title:"提示!",content:"是否保存到草稿箱?",success:function(e){if(e.confirm){if(!r.WxValidate.checkForm(a)){var t=r.WxValidate.errorList[0];return r.showModal(t),!1}r.submitHttp(a)}else console.log("已取消")}})):e.showModal({title:"提示!",content:"是否确认提交?",success:function(e){if(e.confirm){if(a.isDraft=!1,!r.WxValidate.checkForm(a)){var t=r.WxValidate.errorList[0];return r.showModal(t),!1}r.submitHttp(a)}else console.log("已取消")}})},submitHttp:function(t){u.http("post","Resources/create",t).then((function(t){t.data.success?(e.showToast({title:"提交成功",duration:2e3}),setTimeout((function(){e.navigateBack({delta:1})}),2e3)):e.showToast({title:"请求失败",duration:2e3,icon:"none"})}))},showModal:function(t){e.showModal({content:t.msg,showCancel:!1})}}};t.default=n}).call(this,r("543d")["default"])},cfe2:function(e,t,r){"use strict";var i;r.d(t,"b"