chunk-a18bf584.3a867d51.js 5.2 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a18bf584"],{"06c0":function(t,e,i){},1743:function(t,e,i){"use strict";i.r(e);var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"layout"},[e("div",{staticClass:"header"},[e("van-icon",{staticClass:"vanIcon",attrs:{name:"arrow-left"},on:{click:t.backtrack}}),e("span",[t._v("演习图文记录")])],1),e("div",{staticClass:"textContent",staticStyle:{"background-color":"#eee"}},[e("div",{staticClass:"sample"},[e("van-cell-group",[e("van-cell",{attrs:{title:"演习编号",value:this.$route.query.drillSn}}),e("van-cell",{attrs:{title:"演习名称",value:this.$route.query.drillName}}),e("van-cell",{attrs:{title:"演习类型",value:this.$route.query.drillType}}),e("van-cell",{attrs:{title:"演习地点",value:this.$route.query.drillArea}})],1)],1),e("div",{staticClass:"sample"},[e("span",[t._v("上传演习签到表")]),e("div",{staticClass:"photo"},[e("Photo",{attrs:{type:""},on:{getPhoto:t.getPhoto}})],1)])]),e("div",{staticClass:"foot"},[e("van-button",{attrs:{type:"info"},on:{click:t.doEnd}},[t._v("提 交")])],1)])},a=[],o=(i("14d9"),i("907a"),i("986a"),i("1d02"),i("3c5d"),i("6ce5"),i("2834"),i("4ea1"),i("669d"),i("109c"),i("b2c1"),i("b7ef"),i("fe3c"),i("c437")),n=i("c761"),l={name:"VueCli4VantIndex",data(){return{showPopover:!1,actions:[{text:"选项一"},{text:"选项二"},{text:"选项三"}],person:"请选择",fileList:[],user:{}}},components:{Photo:o["a"]},mounted(){window.suplink.getUserInfo().then(t=>{"200"===t.code&&(this.user=t.data)})},methods:{backtrack(){this.$router.go(-1)},getPhoto(t){this.fileList=t.fileList,this.loading=!0,this.chartUrl="";const e=[];t.fileList.forEach((t,i)=>{const s=new window.File([this.dataURLtoBlob(t.content)],`演习签名表图片${i}.jpg`,{type:"jpg"});console.log("转成file类型"+s);var a=new FormData;a.append("file",s),a.append("moduleName","emergency"),e.push(Object(n["y"])(a))}),Promise.all(e).then(t=>{console.log(t),t.forEach((t,e)=>{this.chartUrl+=e?","+t.data.msg:t.data.msg}),console.log(this.chartUrl)})},onSelect(t){console.log(t),this.person=t.text},doEnd(){void 0!==this.chartUrl?Object(n["v"])({id:this.$route.query.recordId,updated:this.user.username,drillSignUrl:this.chartUrl}).then(({data:t})=>{console.log(t),200===t.code?(this.$emit("cloneSpecific",!1),this.$notify({type:"success",message:"操作成功!"}),this.$router.go(-1)):this.$notify({type:"danger",message:t.msg})}):this.$notify({type:"danger",message:"请上传图片"})},dataURLtoBlob(t){var e=t.split(",");const i=e[0].match(/:(.*?);/)[1],s=window.atob(e[1]);let a=s.length;const o=new Uint8Array(a);while(a--)o[a]=s.charCodeAt(a);return new Blob([o],{type:i})}}},c=l,r=(i("8e3a"),i("2877")),h=Object(r["a"])(c,s,a,!1,null,"894fed3a",null);e["default"]=h.exports},"72db":function(t,e,i){"use strict";i("06c0")},"8e3a":function(t,e,i){"use strict";i("abc8")},abc8:function(t,e,i){},c437:function(t,e,i){"use strict";var s=function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"photo"},[e("van-uploader",{attrs:{multiple:"",accept:"image/*","after-read":t.fileImage,"before-delete":t.deletes,"preview-size":"24vw","preview-full-image":!1},on:{"click-preview":t.preview},model:{value:t.fileList,callback:function(e){t.fileList=e},expression:"fileList"}})],1),e("van-image-preview",{attrs:{images:t.images},model:{value:t.showPic,callback:function(e){t.showPic=e},expression:"showPic"}})],1)},a=[],o=(i("68ef"),i("a71a"),i("9d70"),i("3743"),i("09fe"),i("4d75"),i("e3b3"),i("8270"),i("786d"),i("504b"),i("28a2"));i("14d9"),i("741a"),i("5ff5"),i("907a"),i("986a"),i("1d02"),i("3c5d"),i("6ce5"),i("2834"),i("4ea1"),i("669d"),i("109c"),i("b2c1"),i("b7ef");function n(t,e,i){return i.readAsDataURL(t),new Promise((function(s,a){i.onload=function(i){const a=new Image;a.src=i.target.result,a.onload=function(){const i=e.width,a=e.height,o=document.createElement("canvas"),n=o.getContext("2d");let l=null;o.setAttribute("width",i),o.setAttribute("height",a),n.drawImage(this,0,0,i,a),l=o.toDataURL(t.type,e.quality),s(l)}}}))}var l={props:{list:{type:Array,required:!0},index:{type:Number,required:!1}},name:"VueCli4VantIndex",data(){return{fileList:[],isEditor:!1,showPic:!1,images:[]}},components:{[o["a"].Component.name]:o["a"].Component},watch:{list(t,e){t&&(this.list=t,this.list.forEach(t=>{this.fileList.push({content:t})}),this.$emit("getPhoto",{fileList:this.fileList,index:this.index}))}},mounted(){console.log(this.list),this.fileList=[],this.list.forEach(t=>{this.fileList.push({content:t})})},methods:{preview(t,e){console.log(t,e),this.images=[],this.images.push(t.content),this.showPic=!0},getImages(t){const e=t.size/1024<200;return!!e||new Promise(e=>{compressAccurately(t,{size:2048,width:400}).then(i=>{const s=new File([i],t.name,{type:t.type});e(s)})})},fileImage(){const t={width:600,height:600,quality:.9};this.fileList.forEach(async(e,i)=>{if(e.file){const s=new FileReader;await n(e.file,t,s).then(t=>{this.fileList[i].content=t,i===this.fileList.length-1&&this.$emit("getPhoto",{fileList:this.fileList,index:this.index})})}})},deletes(){return this.$nextTick(async()=>{this.$emit("getPhoto",{fileList:this.fileList,index:this.index})}),!0},close(){this.isEditor=!1}}},c=l,r=(i("72db"),i("2877")),h=Object(r["a"])(c,s,a,!1,null,"1a4af3ba",null);e["a"]=h.exports}}]);