diff --git a/pages/scratchCard/scratch.js b/pages/scratchCard/scratch.js index 00480d6..2858167 100644 --- a/pages/scratchCard/scratch.js +++ b/pages/scratchCard/scratch.js @@ -21,6 +21,7 @@ class Scratch { this.direction = opts.direction;//号码行数 this.transverse = opts.transverse;//每行个数 this.init() + // console.log(this.scale); } init () { @@ -35,8 +36,10 @@ class Scratch { let sx, sy, swidth, sheight, x, y, width, height; // 底图是像素1080的宽 - sx = (this.screenWidth-this.width)/2*1080/this.screenWidth; - sy = (this.screenWidth/1.5)*1080/this.screenWidth;//开始剪切的 y 坐标位置 + // sx = (this.screenWidth-this.width)/2*1080/this.screenWidth; + sx = 65; + // sy = (this.screenWidth/1.5)*1080/this.screenWidth;//开始剪切的 y 坐标位置 + sy = 720;//开始剪切的 y 坐标位置 swidth = this.width*1080/this.screenWidth;//被剪切图像的宽度 sheight = this.height*1080/this.screenWidth;//被剪切图像的高度 x = 0;//在画布上放置图像的 x 坐标位置(从画布的左上顶点开始绘制) @@ -48,6 +51,14 @@ class Scratch { if(this.codeType==='digit_number_icon'){//888 // sy = 820;// 上下刮板一体 sy = 1207;// 上下刮板分体 + if(this.canvasId=='guaguaLeft'){ + sx = 65; + sy = 927; + } + if(this.canvasId=='guaguaRight'){ + sx = 512; + sy = 927; + } } if(this.codeType==='digit_icon'&&this.direction==2){//666 sy = 528; @@ -59,7 +70,7 @@ class Scratch { console.log(sx, sy, swidth, sheight, x, y, width, height); // 数字计算的稍微会偏0.00几像素 this.ctx.drawImage(this.bgImg, sx, sy, swidth, sheight, x, y, width, height); - // this.ctx.drawImage(this.bgImg, 64.8, 720, 950.4, 864, 0, 0, 330, 300); + // this.ctx.drawImage(this.bgImg, Math.floor(sx), Math.floor(sy), Math.floor(swidth), Math.floor(sheight), x, y, Math.floor(width), Math.floor(height)); this.ctx.setFillStyle(this.maskColor) this.ctx.fillRect(0, 0, this.width, this.height) this.ctx.draw() @@ -112,6 +123,8 @@ class Scratch { } if (len && this.r * this.r * len > this.scale * this.totalArea) { this.show = true; + // console.log(this.r * this.r * len); + // console.log(this.scale * this.totalArea); // console.log('刮奖面积达标'); } this.clearArcFun(x, y, this.r, this.ctx) diff --git a/pages/scratchCard/scratchCard.vue b/pages/scratchCard/scratchCard.vue index f1b65c2..13bedaf 100644 --- a/pages/scratchCard/scratchCard.vue +++ b/pages/scratchCard/scratchCard.vue @@ -1,5 +1,5 @@