var $url="/common/material/layerImage",$urlUpload=$apiUrl+"/common/material/layerImage/actions/upload?siteId="+utils.getQueryInt("siteId"),data=utils.init({uploadList:[],dialogImageUrl:"",dialogVisible:!1,form:{siteId:utils.getQueryInt("siteId"),isThumb:!1,thumbWidth:500,thumbHeight:500,isLinkToOriginal:!0,filePaths:[]}}),methods={btnSubmitClick:function(){var i=this;if(0===this.form.filePaths.length)return utils.error("请选择需要插入的图片文件！"),!1;utils.loading(this,!0),$api.post($url,this.form).then(function(i){var t=i.data;if(t&&t.length>0)for(var e=0;e<t.length;e++){var r=t[e];r.thumbUrl?parent.$vue.insertHtml('<a href="'+r.url+'" target="_blank"><img src="'+r.thumbUrl+'" border="0" /></a><br/>'):parent.$vue.insertHtml('<img src="'+r.url+'" border="0" /><br/>')}utils.closeLayer()}).catch(function(i){utils.error(i)}).then(function(){utils.loading(i,!1)})},btnCancelClick:function(){utils.closeLayer()},uploadBefore:i=>/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.webp)$/i.exec(i.name)?!!(i.size/1024/1024<10)||(utils.error("上传图片大小不能超过 10MB!"),!1):(utils.error("文件只能是图片格式，请选择有效的文件上传!"),!1),uploadProgress:function(){utils.loading(this,!0)},uploadSuccess:function(i){this.form.filePaths.push(i.path),utils.loading(this,!1)},uploadError:function(i){utils.loading(this,!1);var t=JSON.parse(i.message);utils.error(t.message)},uploadRemove(i){i.response&&this.form.filePaths.splice(this.form.filePaths.indexOf(i.response.path),1)},uploadPictureCardPreview(i){this.dialogImageUrl=i.url,this.dialogVisible=!0}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.pageLoad=!0}});