(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0fb125d2"],{"1d77":function(t,o,e){},"401c":function(t,o,e){"use strict";e.d(o,"b",(function(){return n})),e.d(o,"c",(function(){return r})),e.d(o,"a",(function(){return l}));var a=e("b775");function n(t){return Object(a["a"])({url:"/admin/photo/getAlbumList",method:"post",data:t})}function r(t){return Object(a["a"])({url:"/admin/photo/list",method:"get",params:t})}function l(t){return Object(a["a"])({url:"/admin/photo",method:"post",data:t})}},"9fd5":function(t,o,e){"use strict";e("1d77")},c932:function(t,o,e){"use strict";e.r(o);var a=function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"add-photo"},[e("van-nav-bar",{attrs:{fixed:"","left-arrow":"","left-text":"返回","right-text":"保存",title:"上传照片"},on:{"click-right":t.handleSave,"click-left":function(o){return t.$router.go(-1)}}}),e("van-cell-group",{attrs:{inset:""}},[e("van-field",{attrs:{label:"图片名称",placeholder:"请输入图片名称"},model:{value:t.photoForm.name,callback:function(o){t.$set(t.photoForm,"name",o)},expression:"photoForm.name"}}),e("van-cell",{attrs:{title:t.uploadPhotoFlag?"网络资源":"本地上传",center:""},scopedSlots:t._u([{key:"right-icon",fn:function(){return[e("van-switch",{attrs:{size:"24"},model:{value:t.uploadPhotoFlag,callback:function(o){t.uploadPhotoFlag=o},expression:"uploadPhotoFlag"}})]},proxy:!0}])}),e("van-row",{staticClass:"d-flex flex-items-center"},[t.photoForm.photoBase64?e("van-image",{attrs:{src:t.photoForm.photoBase64,fit:"scale-down",height:"5rem",width:"5rem"}}):t._e(),t.photoForm.photoBase64?e("van-button",{attrs:{type:"info"},on:{click:function(o){t.photoForm.photoBase64=""}}},[t._v("清除")]):t._e()],1),t.uploadPhotoFlag?e("van-field",{attrs:{label:"图片url",placeholder:"请输入图片url"},model:{value:t.photoForm.photoBase64,callback:function(o){t.$set(t.photoForm,"photoBase64",o)},expression:"photoForm.photoBase64"}}):t._e(),t.uploadPhotoFlag||t.photoForm.photoBase64?t._e():e("van-uploader",{attrs:{"after-read":t.afterRead,"before-read":t.beforeRead,"max-count":1}}),e("van-field",{attrs:{"is-link":"",label:"所属相册",placeholder:"请选择所属相册",readonly:""},on:{click:function(o){t.showAlbumType=!0}},model:{value:t.photoForm.typeName,callback:function(o){t.$set(t.photoForm,"typeName",o)},expression:"photoForm.typeName"}}),e("van-field",{attrs:{autosize:"",label:"备注",maxlength:"200",placeholder:"请输入备注",rows:"2","show-word-limit":"",type:"textarea"},model:{value:t.photoForm.remark,callback:function(o){t.$set(t.photoForm,"remark",o)},expression:"photoForm.remark"}})],1),e("van-popup",{attrs:{position:"bottom",round:""},model:{value:t.showAlbumType,callback:function(o){t.showAlbumType=o},expression:"showAlbumType"}},[e("van-picker",{attrs:{columns:t.typeOptions,"show-toolbar":"","value-key":"dictLabel"},on:{cancel:function(o){t.showAlbumType=!1},confirm:t.onConfirm}})],1)],1)},n=[],r=e("b775");function l(t){return Object(r["a"])({url:"/admin/uploadImage",method:"post",data:t})}var i=e("401c"),s={name:"add",data:function(){return{showAlbumType:!1,photoForm:{name:"",type:this.$route.query.type,photoBase64:void 0,remark:""},uploadPhotoFlag:!1,typeOptions:[]}},mounted:function(){var t=this;this.getDicts("px_album_name").then((function(o){t.typeOptions=o.data}))},methods:{beforeRead:function(t){return!(t.size>2048e3)||(this.$toast("请上传小于2MB的图片"),!1)},handleSave:function(){var t=this;this.photoForm.photoBase64?this.photoForm.type?Object(i["a"])(this.photoForm).then((function(o){t.$toast("保存成功"),t.$router.go(-1)})):this.$toast("请选择所属相册"):this.$toast("请上传图片或输入网络资源")},onConfirm:function(t){this.photoForm.type=t.dictValue,this.photoForm.typeName=t.dictLabel,this.showAlbumType=!1},afterRead:function(t){var o=this,e=new FormData;e.append("image",t.file),l(e).then((function(t){o.photoForm.photoBase64="https://pnkx.tophttp://120.53.247.15/prod-api"+t.imgUrl}))}}},p=s,u=(e("9fd5"),e("2877")),h=Object(u["a"])(p,a,n,!1,null,"72de0e7b",null);o["default"]=h.exports}}]);