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 lines
9.9 KiB
1 lines
9.9 KiB
{"version":3,"sources":["webpack:///C:/Users/18634/Desktop/项目/fude_mini/components/gg-camera/outputer.vue?a553","webpack:///C:/Users/18634/Desktop/项目/fude_mini/components/gg-camera/outputer.vue?0d12","webpack:///C:/Users/18634/Desktop/项目/fude_mini/components/gg-camera/outputer.vue?9459","webpack:///C:/Users/18634/Desktop/项目/fude_mini/components/gg-camera/outputer.vue?5663","uni-app:///components/gg-camera/outputer.vue"],"names":["name","data","canvasWidth","canvasHeight","converterInfo","created","mounted","beforeDestroy","methods","converterResult","console","getPhotoFilePath","photoInfo","resolve","reject","width","height","setTimeout","uni","canvasId","x","y","success","ctx","quality","filePath","fail","output","waterMark","photoFilePath","wxml","style","position","top","right","bottom","left","flexDirection","justifyContent","background","fileType","tempFilePath"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAqH;AACrH;AAC4D;AACL;;;AAGvD;AACqK;AACrK,gBAAgB,+KAAU;AAC1B,EAAE,8EAAM;AACR,EAAE,mFAAM;AACR,EAAE,4FAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,uFAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACtBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACRA;AAAA;AAAA;AAAA;AAAkmB,CAAgB,4nBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;ACWtnB;;;;;;;;;;;eAEA;EACAA;EACAC;IACA;MACAC;MACAC;MACAC;IACA;EACA;EACAC,6BAEA;EACAC,6BAEA;EACAC,yCAEA;EACAC;IACAC;MACA;MACAC;MACA;MACA;QACA;UACAN;QACA;UACAA;QACA;MACA;IACA;IACAO;MAAA;MAAA;QAAA;UAAA;YAAA;cAAA;gBAAA,IACAC;kBAAA;kBAAA;gBAAA;gBAAA,iCACAA;cAAA;gBAEAF;gBAAA,iCACA;kBACA;oBAAAG;oBAAAC;oBAAAC;oBAAAC;kBAAA;kBACA;kBAAAC;oBACA;oBACAC;sBACAC;sBACAlB;sBACAmB;sBAAAC;sBACAN;sBAAAC;sBACAM;wBACAC;0BACAN;4BACAC;8BACAC;8BACAK;8BACAF;gCACAJ;kCACAO;gCACA;gCACA;8BACA;8BACAC;gCACA;8BACA;4BACA;0BACA;wBACA;sBACA;sBACAA;wBACA;sBACA;oBACA;kBACA;gBACA;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA;IACA;IACAC;MAAA;MAAA;QAAA;QAAA;UAAA;YAAA;cAAA;gBACAC;gBAEA1B;gBACAC;gBAEA;gBACA;gBAAA;gBAAA,OAEA;cAAA;gBAAA0B;gBAAA;gBAAA,OAEAD;cAAA;gBAAA;gBAAAE;gBAAAC;gBACAD,6EACAD,sCACAC,wBACA;gBACAC;kBACAC;kBACAC;kBACAC;kBACAC;kBACAC;kBACArB;kBACAC;gBACA;gBACAe;kBACAhB;kBACAC;kBACAqB;kBACAC;kBACAC;gBACA;gBAAA;gBAAA,OACA;kBACA;kBACA;oBAAAT;oBAAAC;kBAAA;gBACA;cAAA;gBAAA;gBAAA,OACA;kBACA;kBACA;oBACAS;kBACA;gBACA;cAAA;gBAAA;gBALAC;gBAAA,kCAMAA;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA;IACA;EACA;AACA;AAAA,2B","file":"components/gg-camera/outputer.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./outputer.vue?vue&type=template&id=0c05f5b4&\"\nvar renderjs\nimport script from \"./outputer.vue?vue&type=script&lang=js&\"\nexport * from \"./outputer.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\runtime\\\\componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"components/gg-camera/outputer.vue\"\nexport default component.exports","export * from \"-!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\templateLoader.js??vue-loader-options!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--17-0!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\template.js!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-uni-app-loader\\\\page-meta.js!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./outputer.vue?vue&type=template&id=0c05f5b4&\"","var components\nvar render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./outputer.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!D:\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./outputer.vue?vue&type=script&lang=js&\"","<template>\n <view>\n <wxml-to-canvas v-if=\"canvasWidth && canvasHeight\" class=\"outputCanvas\" :width=\"canvasWidth\" :height=\"canvasHeight\"></wxml-to-canvas>\n <canvas v-if=\"converterInfo\" \n canvas-id=\"converter\" \n binderror=\"converterResult\"\n :style=\"'width: '+(converterInfo.width)+'px; height: '+(converterInfo.height)+'px;'\"></canvas>\n </view>\n</template>\n\n<script>\n import waterMarkProvider from './watermark/index.js';\r\n\n export default {\n name:'outputer',\n \tdata() {\n \t\treturn {\n canvasWidth:0,\n canvasHeight:0,\n converterInfo:false,\n }\n \t},\n created(){\n \n },\n mounted() {\n \n },\n beforeDestroy() {\n \n },\n \tmethods: {\n converterResult(err,filePath){\n const converterInfo=this.converterInfo;\n console.log(666,err,filePath,converterInfo.width,converterInfo.height)\n this.converterInfo=false;\n if(converterInfo){\n if(err){\n converterInfo.reject(err)\n }else{\n converterInfo.resolve(filePath)\n }\n }\n },\n async getPhotoFilePath(photoInfo){\n if(!photoInfo.filePath.byteLength){\n return photoInfo.filePath;\n }\n console.log(photoInfo.filePath)\n return new Promise((resolve,reject)=>{\n this.converterInfo={resolve,reject,width:photoInfo.width,height:photoInfo.height};\n /* this.$nextTick */setTimeout(()=>{\n let ctx = uni.createCanvasContext('converter',this);\n uni.canvasPutImageData({\n canvasId:'converter',\n data:photoInfo.filePath,\n x:0,y:0,\n width:photoInfo.width,height:photoInfo.height,\n success:(res)=>{\n ctx.draw(false,(res)=>{\n setTimeout(()=>{\n uni.canvasToTempFilePath({\n \tcanvasId: 'converter',\n quality:1,\n \tsuccess: (res) => {\n uni.saveImageToPhotosAlbum({\n filePath:res.tempFilePath\n })\n this.converterResult(null,res.tempFilePath)\n \t},\n fail:(err)=>{\n this.converterResult(err)\n }\n },this);\n },3000)\n })\n },\n fail:(err)=>{\n this.converterResult(err)\n }\n },this)\n },1000)\n });\n },\n async output(orientation,config,photoInfo){\n const waterMark = waterMarkProvider.getProvider(config.type);\n \n const canvasWidth=this.systemInfo.windowWidth;\n const canvasHeight=this.systemInfo.windowHeight;\n \n this.canvasWidth=canvasWidth;\n this.canvasHeight=canvasHeight;\n \n const photoFilePath=await this.getPhotoFilePath(photoInfo);\n \n let { wxml, style } = await waterMark.render(config.form,canvasWidth,canvasHeight);\n wxml=`<view class=\"canvas\">\n <image class=\"photo\" src=\"${photoFilePath}\"/>\n ${wxml}\n </view>`\n style.photo={\n position:'absolute',\n top:0,\n right:0,\n bottom:0,\n left:0,\n width: canvasWidth,\n height: canvasHeight,\n }\n style.canvas={\n width: canvasWidth,\n height: canvasHeight,\n flexDirection: 'column',\n justifyContent:'flex-end',\n background: 'rgba(255,255,255,0)',\n }\n await this.$tools.whileTaskDone(()=>{\n const outputCanvas = this.selectComponent('.outputCanvas')\n return outputCanvas.renderToCanvas({ wxml, style });\n },20,50)\n const {tempFilePath}=await this.$tools.whileTaskDone(()=>{\n const outputCanvas = this.selectComponent('.outputCanvas')\n return outputCanvas.canvasToTempFilePath({\n fileType:'png',\n });\n },20,50)\n return tempFilePath;\n }\n }\n }\n</script>\n\n<style>\n</style>"],"sourceRoot":""} |