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 line
51 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-views-goods-goodsDetails"],{"02a5":function(t,e,i){"use strict";var a=i("c6bb"),o=i.n(a);o.a},"071e":function(t,e,i){"use strict";var a=i("e632"),o=i.n(a);o.a},1269:function(t,e,i){"use strict";var a=i("4ea4");i("cb29"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=a(i("8e5a")),n=getApp(),s={data:function(){return{windowWidth:"",windowHeight:"",colors:"",ctx:"",imgUrl:"",userInfo:{name:"反转",logo:"/static/images/face.jpg",goodsImg:"/static/images/goods/one.jpg",price:"3599.00",goodsName:"魅族17 8GB+128GB 十七度灰 骁龙865 旗舰5G手机 30W快充 6400W后置主摄 90Hz屏幕 支持NFC 智能拍照游戏手机"}}},components:{loading:o.default},props:{posterData:{type:Object}},created:function(){this.getSystem(),this.setData({colors:n.globalData.newColor}),this.setPoster()},onReachBottom:function(){},onShareAppMessage:function(){},methods:{getSystem:function(){var t=this;uni.getSystemInfo({success:function(e){console.log(e),t.setData({windowHeight:e.windowHeight,windowWidth:e.windowWidth})}})},setPoster:function(){uni.showLoading({title:"海报生成中..."});var t=uni.createCanvasContext("mycanvas",this);t.fillStyle="#FFFFFF",t.fillRect(0,0,this.windowWidth-60,520);var e=function(t,e,i,a,o,n,s){t.setFillStyle(i),t.setTextAlign("left"),t.font=s?"normal bold 20px Arial,sans-serif":"normal 20px Arial,sans-serif",t.setFontSize(e),t.fillText(n,a,o),t.restore()};e(t,14,"#333",85,35,this.userInfo.name,"bold"),e(t,12,"#999",85,58,"为您挑选了一个好礼物"),t.save(),t.beginPath();var i=60,a=60,o=15,n=15,s=8;this.setRadius(t,i,a,o,n,s),this.setGoodsImg(t);var l=" "+this.posterData.money;this.setGoodsPrice(t,20,this.colors,15,410,l),this.setGoodsName(t)},setEwm:function(t){var e=this;console.log("生成二维码");var i=100,a=100,o=this.windowWidth-170;t.drawImage("/static/images/ewm.png",o,410,i,a),setTimeout((function(){t.save(),t.draw(!1,(function(){setTimeout((function(){uni.canvasToTempFilePath({canvasId:"mycanvas",success:function(t){console.log(t),e.imgUrl=t.tempFilePath}},e)}),200)})),uni.hideLoading()}),1e3)},setRadius:function(t,e,i,a,o,n){t.arc(a+n,o+n,n,Math.PI,3*Math.PI/2),t.lineTo(e-n+a,o),t.arc(e-n+a,n+o,n,3*Math.PI/2,2*Math.PI),t.lineTo(e+a,i+o-n),t.arc(e-n+a,i-n+o,n,0,1*Math.PI/2),t.lineTo(n+a,i+o),t.arc(n+a,i-n+o,n,1*Math.PI/2,Math.PI),t.strokeStyle="#fff",t.fill(),t.clip(),t.drawImage(this.userInfo.logo,a,o,e,i),t.closePath(),t.restore()},setCircular:function(t,e,i,a,o){t.arc(e/2+a,i/2+o,e/2,0,2*Math.PI,!1),t.strokeStyle="#fff",t.fill(),t.clip(),t.drawImage(this.userInfo.logo,a,o,e,i),t.closePath(),t.restore()},setGoodsImg:function(t){var e=this.windowWidth-90;t.drawImage(this.posterData.img,15,95,e,e),t.save()},setGoodsPrice:function(t,e,i,a,o,n,s){t.setFillStyle(i),t.setTextAlign("left"),t.font=s?"normal bold 20px Arial,sans-serif":"normal 20px Arial,sans-serif",t.setFontSize(e),t.fillText(n,a,o),t.restore()},setGoodsName:function(t){for(var e={x:20,y:440,width:210,height:20,line:2,color:"#202020",size:14,align:"left",baseline:"top",text:this.posterData.title,bold:!0},i=Math.ceil(e.width/e.size),a=Math.ceil(e.text.length/i),o=0;o<a;o++){var n={x:e.x,y:e.y+o*e.height,color:e.color,size:e.size,align:e.align,baseline:e.baseline,text:e.text.substring(o*i,(o+1)*i),bold:e.bold};o<e.line&&(o==e.line-1&&(n.text=n.text.substring(0,n.text.length-3)+"......"),this.drawText(t,n))}this.setEwm(t)},drawText:function(t,e){console.log("渲染文字",e),t.save(),t.setFillStyle(e.color),t.setFontSize(e.size),t.setTextAlign(e.align),t.setTextBaseline(e.baseline),e.bold&&(console.log("字体加粗"),t.fillText(e.text,e.x,e.y-.1),t.fillText(e.text,e.x-.1,e.y)),t.fillText(e.text,e.x,e.y),e.bold&&(t.fillText(e.text,e.x,e.y+.1),t.fillText(e.text,e.x+.1,e.y)),t.restore()},saveImg:function(){uni.showLoading({title:"保存中..."})}}};e.default=s},"13ab":function(t,e,i){"use strict";i.r(e);var a=i("9b40"),o=i.n(a);for(var n in a)"default"!==n&&function(t){i.d(e,t,(function(){return a[t]}))}(n);e["default"]=o.a},"220d":function(t,e