Files
wdsxh/unpackage/dist/build/mp-weixin/pages/component/activity/poster.js
2026-04-29 15:33:58 +08:00

11 lines
10 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/component/activity/poster"],{"0d27":function(t,e,r){"use strict";(function(t,o){var n=r("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n(r("7eb4")),s=n(r("ee10")),i=n(r("7ca3")),c=r("8f59"),p=r("23b3");function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}var l={name:"activityPoster",data:function(){return{titleBarHeight:0,posterInfo:{},posterWidth:0,posterHeight:0,posterReady:!1,posterAvatar:"",codeData:"",posterCode:"",posterPath:""}},computed:function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){(0,i.default)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},(0,c.mapState)({themeColor:function(t){return t.app.themeColor}})),mounted:function(){var e=t.getSystemInfoSync().statusBarHeight,r=t.getMenuButtonBoundingClientRect();this.titleBarHeight=e+2*(r.top-e)+r.height},methods:{getPoster:function(e){var r=this;t.showLoading({title:"加载中",mask:!0}),this.posterWidth=t.getSystemInfoSync().windowWidth,this.posterHeight=parseInt(this.posterWidth*(456/311)),this.$util.request("activity.attendance",{activity_id:e}).then((function(e){1==e.code?(r.posterInfo=e.data,r.codeData={wechatId:e.data.wechat_id},r.codeData=JSON.stringify(r.codeData),r.createQrcode()):t.showToast({title:e.msg,icon:"none"})})).catch((function(t){console.error("获取参会凭证 ",t)}))},base64ToPath:function(t){var e=t.split(","),r=e[0].match(/:(.*?);/)[1],o=atob(e[1]),n=o.length,a=new Uint8Array(n);while(n--)a[n]=o.charCodeAt(n);var s=new Blob([a],{type:r}),i=URL.createObjectURL(s);return i},createQrcode:function(){var e=this;this.$refs.qrcode&&this.$refs.qrcode.toTempFilePath?this.$refs.qrcode.toTempFilePath({success:function(r){var n=r.tempFilePath.replace(/^data:image\/\w+;base64,/,""),a="".concat(o.env.USER_DATA_PATH,"/qrcode.jpg");t.getFileSystemManager().writeFile({filePath:a,data:n,encoding:"base64",success:function(){e.posterCode=a,e.showNucleus()}})},fail:function(){setTimeout((function(){e.createQrcode()}),200)}}):setTimeout((function(){e.createQrcode()}),200)},showNucleus:function(){var t=this;return(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.loadingResources().then((function(e){e&&(t.posterReady=!0,t.createImage())}));case 1:case"end":return e.stop()}}),e)})))()},loadingResources:function(){var t=this;return(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,p.loadImage)(t.posterCode);case 2:return t.posterCode=e.sent,e.next=5,(0,p.loadImage)(t.posterInfo.member_avatar);case 5:return t.posterAvatar=e.sent,e.abrupt("return",!0);case 7:case"end":return e.stop()}}),e)})))()},createImage:function(){var e=this;return(0,s.default)(a.default.mark((function r(){var o,n,s,i,c,h,l,d,f,u,I,g,m,W;return a.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(e.posterReady){r.next=4;break}return t.hideLoading(),t.showToast({title:"参会凭证图片资源加载失败",icon:"none"}),r.abrupt("return");case 4:return o=t.createCanvasContext("myCanvas",e),0,0,n=e.posterWidth,s=e.posterHeight,i=parseInt(e.posterWidth*(20/311)),o.beginPath(),o.moveTo(0+i,0),o.lineTo(0+n-i,0),o.arc(0+n-i,0+i,i,-Math.PI/2,0),o.lineTo(0+n,0+s-i),o.arc(0+n-i,0+s-i,i,0,Math.PI/2),o.lineTo(0+i,0+s),o.arc(0+i,0+s-i,i,Math.PI/2,Math.PI),o.lineTo(0,0+i),o.arc(0+i,0+i,i,Math.PI,-Math.PI/2),o.closePath(),o.setFillStyle("#ffffff"),o.fill(),o.setStrokeStyle("#ffffff"),o.stroke(),2,2,c=parseInt(e.posterWidth-4),h=parseInt(e.posterHeight-4),l=parseInt(e.posterWidth*(20/311)),o.beginPath(),o.moveTo(2+l,2),o.lineTo(2+c-l,2),o.arc(2+c-l,2+l,l,-Math.PI/2,0),o.lineTo(2+c,2+h-l),o.arc(2+c-l,2+h-l,l,0,Math.PI/2),o.lineTo(2+l,2+h),o.arc(2+l,2+h-l,l,Math.PI/2,Math.PI),o.lineTo(2,2+l),o.arc(2+l,2+l,l,Math.PI,-Math.PI/2),o.closePath(),o.setFillStyle(e.$util.hexToRgb(e.themeColor,.1)),o.fill(),o.setStrokeStyle("rgba(255, 255, 255, 0)"),o.stroke(),d=parseInt(e.posterWidth*(16/311)),f=parseInt(e.posterWidth*(64/311)),u=parseInt(e.posterWidth-e.posterWidth*(32/311)),I=parseInt(e.posterWidth*(228/311)),g=parseInt(e.posterWidth*(10/311)),o.beginPath(),o.moveTo(d+g,f),o.lineTo(d+u-g,f),o.arc(d+u-g,f+g,g,-Math.PI/2,0),o.lineTo(d+u,f+I-g),o.arc(d+u-g,f+I-g,g,0,Math.PI/2),o.lineTo(d+g,f+I),o.arc(d+g,f+I-g,g,Math.PI/2,Math.PI),o.lineTo(d,f+g),o.arc(d+g,f+g,g,Math.PI,-Math.PI/2),o.closePath(),m=o.createLinearGradient(0,0,0,parseInt(e.posterWidth*(321/311))),m.addColorStop(0,"#ffffff"),m.addColorStop(1,"rgba(255, 255, 255, 0.4)"),o.setFillStyle(m),o.fill(),o.setStrokeStyle("rgba(255, 255, 255, 0)"),o.stroke(),r.next=71,(0,p.createPoster)(o,[{type:"text",text:"活动参会凭证",config:{x:parseInt(e.posterWidth/2),y:parseInt(e.posterWidth*(36/311)),color:e.themeColor,font:"bold ".concat(parseInt(e.posterWidth*(24/311)),"px sans-serif"),textAlign:"center",lineHeight:parseInt(e.posterWidth*(28/311))}},{type:"image",url:e.posterAvatar,config:{x:parseInt(e.posterWidth*(32/311)),y:parseInt(e.posterWidth*(80/311)),w:parseInt(e.posterWidth*(68/311)),h:parseInt(e.posterWidth*(68/311)),r:parseInt(e.posterWidth*(6/248))}},{type:"text",text:e.posterInfo.member_name,config:{x:parseInt(e.posterWidth*(108/311)),y:parseInt(e.posterWidth*(92/311)),color:"#5A5B6E",font:"bold ".concat(parseInt(e.posterWidth*(18/311)),"px sans-serif"),textAlign:"left",maxWidth:parseInt(e.posterWidth*(177/311))}},{type:"text",text:e.posterInfo.mobile,config:{x:parseInt(e.posterWidth*(108/311)),y:parseInt(e.posterWidth*(118/311)),color:"#5A5B6E",fontSize:parseInt(e.posterWidth*(12/311)).toString(),textAlign:"left",maxWidth:parseInt(e.posterWidth*(177/311))}},{type:"text",text:e.posterInfo.member_level_name,config:{x:parseInt(e.posterWidth*(108/311)),y:parseInt(e.posterWidth*(142/311)),color:"#5A5B6E",fontSize:parseInt(e.posterWidth*(12/311)).toString(),textAlign:"left",maxWidth:parseInt(e.posterWidth*(177/311))}},{type:"text",text:"活动",config:{x:parseInt(e.posterWidth*(32/311)),y:parseInt(e.posterWidth*(172/311)),color:"#5A5B6E",font:"bold ".concat(parseInt(e.posterWidth*(14/311)),"px sans-serif"),textAlign:"left",maxWidth:parseInt(e.posterWidth*(247/311))}},{type:"text",text:e.posterInfo.activity_name,config:{x:parseInt(e.posterWidth*(32/311)),y:parseInt(e.posterWidth*(196/311)),color:e.themeColor,fontSize:parseInt(e.posterWidth*(14/311)).toString(),textAlign:"left",maxWidth:parseInt(e.posterWidth*(247/311)),wrap:!0,lineNumber:2,lineHeight:parseInt(e.posterWidth*(18/311)),isVerticalCenter:!1}},{type:"text",text:"地址",config:{x:parseInt(e.posterWidth*(32/311)),y:parseInt(e.posterWidth*(235/311)),color:"#5A5B6E",font:"bold ".concat(parseInt(e.posterWidth*(14/311)),"px sans-serif"),textAlign:"left",maxWidth:parseInt(e.posterWidth*(247/311))}},{type:"text",text:e.posterInfo.address,config:{x:parseInt(e.posterWidth*(32/311)),y:parseInt(e.posterWidth*(259/311)),color:e.themeColor,fontSize:parseInt(e.posterWidth*(14/311)).toString(),textAlign:"left",maxWidth:parseInt(e.posterWidth*(247/311)),wrap:!0,lineNumber:2,lineHeight:parseInt(e.posterWidth*(18/311)),isVerticalCenter:!1}},{type:"image",url:e.posterCode,config:{x:parseInt(e.posterWidth*(106/311)),y:parseInt(e.posterWidth*(308/311)),w:parseInt(e.posterWidth*(100/311)),h:parseInt(e.posterWidth*(100/311))}},{type:"text",text:"参会时,请出示二维码进行核销",config:{x:parseInt(e.posterWidth/2),y:parseInt(e.posterWidth*(428/311)),color:"#5A5B6E",fontSize:parseInt(e.posterWidth*(14/311)).toString(),textAlign:"center",lineHeight:parseInt(e.posterWidth*(24/311))}}]);case 71:return r.next=73,(0,p.canvasToTempFilePath)("myCanvas",e);case 73:W=r.sent,e.posterPath=W,e.$refs.popupModal.open(),t.hideLoading();case 77:case"end":return r.stop()}}),r)})))()},saveImage:function(){var e=this;t.authorize({scope:"scope.writePhotosAlbum",success:function(){t.getImageInfo({src:e.posterPath,success:function(e){t.saveImageToPhotosAlbum({filePath:e.path,success:function(){t.showToast({title:"保存成功",icon:"success"})},fail:function(t){console.error(t)}})},fail:function(t){console.error(t)}})},fail:function(){t.showModal({title:"图片保存失败",content:"请确认是否已开启授权",confirmText:"开启授权",confirmColor:e.themeColor,success:function(e){e.confirm&&t.openSetting({success:function(e){e.authSetting["scope.writePhotosAlbum"]?t.showToast({title:"授权成功,请重新保存",icon:"none"}):t.showToast({title:"请确定已打开保存权限",icon:"none"})}})}})}})},onClose:function(){this.$refs.popupModal.close()},onChange:function(t){this.$emit("onChange",t.show)}}};e.default=l}).call(this,r("df3c")["default"],r("3223")["default"])},"3f7e":function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return a})),r.d(e,"a",(function(){return o}));var o={uqrcode:function(){return Promise.all([r.e("common/vendor"),r.e("uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode")]).then(r.bind(null,"bee2"))},uniPopup:function(){return r.e("uni_modules/uni-popup/components/uni-popup/uni-popup").then(r.bind(null,"f295"))}},n=function(){var t=this.$createElement;this._self._c},a=[]},9550:function(t,e,r){},c5f1:function(t,e,r){"use strict";var o=r("9550"),n=r.n(o);n.a},eb63:function(t,e,r){"use strict";r.r(e);var o=r("3f7e"),n=r("f6b8");for(var a in n)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(a);r("c5f1");var s=r("828b"),i=Object(s["a"])(n["default"],o["b"],o["c"],!1,null,"62b614c8",null,!1,o["a"],void 0);e["default"]=i.exports},f6b8:function(t,e,r){"use strict";r.r(e);var o=r("0d27"),n=r.n(o);for(var a in o)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return o[t]}))}(a);e["default"]=n.a}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
'pages/component/activity/poster-create-component',
{
'pages/component/activity/poster-create-component':(function(module, exports, __webpack_require__){
__webpack_require__('df3c')['createComponent'](__webpack_require__("eb63"))
})
},
[['pages/component/activity/poster-create-component']]
]);