webpackJsonp([42],{B4mb:function(e,t,l){(e.exports=l("bKW+")(!1)).push([e.i,"\n.avatar-uploader .el-upload[data-v-221b34c2] {\r\n    border: 1px dashed #d9d9d9;\r\n    border-radius: 6px;\r\n    cursor: pointer;\r\n    position: relative;\r\n    overflow: hidden;\n}\n.avatar-uploader .el-upload[data-v-221b34c2]:hover {\r\n    border-color: #409EFF;\n}\r\n \r\n",""])},jyho:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=l("gyMJ"),a={name:"indexLinkAdd",data:function(){return{form:{links:{}},imgUploadUrl:"",thumbUrl:"",fields:[],rules:{name:[{required:!0,message:"请输入名称",trigger:"blur"}],links:{url:[{required:!0,message:"请输入网址",trigger:"blur"}]}}}},created:function(){this.cid=this.$route.query.cid,this.fetchData(),this.getImgUpload()},activated:function(){var e=this.$route.query.cid;e!=this.cid&&(this.cid=e,this.getImgUpload())},methods:{fetchData:function(){var e=this,t={cid:this.cid};s.a.getInfo(t).then(function(t){e.images=[],e.form.cid=e.cid,e.fields=t.data.column_fields})},getImgUpload:function(){this.imgUploadUrl=CIM.domain+"/files/api/upload/module/index/file/file/field/thumb/cid/"+this.cid},handleThumbSuccess:function(e){1==e.success_count?(this.thumbUrl=e.success[0].url,this.form.thumb=e.success[0].path):e.fail&&e.fail[0].msg&&this.$message('文件"'+e.fail[0].name+'"'+e.fail[0].msg)},onSubmit:function(){var e=this;if(this.fields.length>0)for(var t in this.form.fields={},this.fields)this.form.fields[this.fields[t].key]=this.fields[t].values;this.$refs.form.validate(function(t){if(!t)return!1;s.a.editInfo(e.form).then(function(t){e.$message.success(t.msg),eventBus.$emit("updateLinkSuccess"),e.form={links:{},status:1},e.fields=[],e.thumbUrl="",e.fetchData()})})}}},i={render:function(){var e=this,t=e.$createElement,l=e._self._c||t;return l("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-position":"top","label-width":"180px"}},[l("el-row",{attrs:{gutter:20}},[l("el-col",{attrs:{span:10}},[l("div",{staticClass:"grid-content"},[l("el-form-item",{attrs:{label:"网站名称",prop:"name"}},[l("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"网站logo"}},[l("el-upload",{staticClass:"avatar-uploader",attrs:{action:e.imgUploadUrl,"show-file-list":!1,"on-success":e.handleThumbSuccess}},[e.thumbUrl?l("img",{staticClass:"avatar",attrs:{src:e.thumbUrl}}):l("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),l("el-form-item",{attrs:{label:"网址",prop:"links.url"}},[l("el-input",{model:{value:e.form.links.url,callback:function(t){e.$set(e.form.links,"url",t)},expression:"form.links.url"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"到期时间"}},[l("el-date-picker",{staticStyle:{width:"160px"},attrs:{size:"small",type:"date",placeholder:"到期时间"},model:{value:e.form.links.end_time,callback:function(t){e.$set(e.form.links,"end_time",t)},expression:"form.links.end_time"}})],1),e._v(" "),l("el-form-item",[l("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("保存")])],1)],1)]),e._v(" "),l("el-col",{attrs:{span:8}},[e.fields&&e.fields.length>0?l("div",[l("h4",[e._v("扩展字段")]),e._v(" "),l("hr",{staticClass:"mb-sm",staticStyle:{"border-top":"none"},attrs:{color:"#E5E9EC"}}),e._v(" "),e._l(e.fields,function(t){return l("el-form-item",{key:t.id,attrs:{label:t.name}},[0==t.type?l("el-input",{model:{value:t.values,callback:function(l){e.$set(t,"values",l)},expression:"item.values"}},[t.unit?l("template",{slot:"append"},[e._v(e._s(t.unit))]):e._e()],2):1==t.type?l("el-select",{attrs:{placeholder:"请选择"},model:{value:t.values,callback:function(l){e.$set(t,"values",l)},expression:"item.values"}},e._l(t.options,function(e,t){return l("el-option",{key:t,attrs:{label:e.value,value:e.key}})})):2==t.type?l("el-checkbox-group",{model:{value:t.values,callback:function(l){e.$set(t,"values",l)},expression:"item.values"}},e._l(t.options,function(t,s){return l("el-checkbox",{key:s,attrs:{label:t.key,checked:"1"==t.default}},[e._v(e._s(t.value))])})):3==t.type?l("el-radio-group",{model:{value:t.values,callback:function(l){e.$set(t,"values",l)},expression:"item.values"}},e._l(t.options,function(t,s){return l("el-radio",{key:s,attrs:{label:t.key}},[e._v(e._s(t.value))])})):4==t.type?l("el-input",{attrs:{type:"textarea"},model:{value:t.values,callback:function(l){e.$set(t,"values",l)},expression:"item.values"}}):e._e()],1)})],2):e._e()])],1)],1)},staticRenderFns:[]};var r=l("XAIM")(a,i,!1,function(e){l("vdi2")},"data-v-221b34c2",null);t.default=r.exports},vdi2:function(e,t,l){var s=l("B4mb");"string"==typeof s&&(s=[[e.i,s,""]]),s.locals&&(e.exports=s.locals);l("6imX")("11552d39",s,!0)}});