main
fanfan 7 months ago
parent 04f36895a9
commit be30ba5f4e
  1. 35
      pages/invite/index.vue

@ -80,7 +80,8 @@
</view>
</view>
</view>
<canvas id="myCanvas" class="myCanvas" canvas-id="myCanvas" :style="{'width': 702/devicePixelRatio+'px',' height': 1248/devicePixelRatio+'px'}" ></canvas>
<canvas id="myCanvas" class="myCanvas" canvas-id="myCanvas"
:style="{'width': 702/devicePixelRatio+'px',' height': 1248/devicePixelRatio+'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
</view>
</template>
@ -130,21 +131,27 @@
uni.downloadFile({
url: 'https://www.royaum.com.cn/static/3@2x.png',
success(res) {
ctx.drawImage(res.tempFilePath, 0, 0, 702/that.devicePixelRatio, 1248/that.devicePixelRatio);
ctx.drawImage(res.tempFilePath, 0, 0, 702 / that.devicePixelRatio, 1248 / that
.devicePixelRatio);
uni.downloadFile({
url: that.qrcode,
success: (res2) => {
ctx.save(); //
ctx.beginPath(); //
ctx.arc(162/that.devicePixelRatio / 2 + 285/that.devicePixelRatio, 162/that.devicePixelRatio / 2 + 870/that.devicePixelRatio, 162/that.devicePixelRatio / 2, 0, Math.PI * 2, false);
ctx.arc(162 / that.devicePixelRatio / 2 + 285 / that.devicePixelRatio,
162 / that.devicePixelRatio / 2 + 870 / that.devicePixelRatio,
162 / that.devicePixelRatio / 2, 0, Math.PI * 2, false);
ctx.clip();
ctx.drawImage(res2.tempFilePath, 285/that.devicePixelRatio, 870/that.devicePixelRatio, 162/that.devicePixelRatio, 162/that.devicePixelRatio);
ctx.drawImage(res2.tempFilePath, 285 / that.devicePixelRatio, 870 /
that.devicePixelRatio, 162 / that.devicePixelRatio, 162 / that
.devicePixelRatio);
//
ctx.restore();
//
ctx.setFontSize(45 / that.devicePixelRatio);
ctx.setFillStyle('#cf100d');
ctx.fillText(that.userInfo.user_id, 200/that.devicePixelRatio, 1213/that.devicePixelRatio);
ctx.fillText(that.userInfo.user_id, 200 / that.devicePixelRatio, 1213 /
that.devicePixelRatio);
ctx.draw()
uni.canvasToTempFilePath({
width: 702 / that.devicePixelRatio,
@ -161,8 +168,12 @@
that.$success('保存成功')
},
fail(err) {
if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
that.$toast('请允许访问相册后重试 (右上角菜单 - 设置 - 相册)', 3000)
if (err.errMsg ===
'saveImageToPhotosAlbum:fail auth deny'
) {
that.$toast(
'请允许访问相册后重试 (右上角菜单 - 设置 - 相册)',
3000)
}
}
})
@ -339,13 +350,13 @@
background-size: 100% auto;
position: relative;
overflow: hidden;
min-height: 100vh;
.myCanvas {
position: absolute;
left: 0;
top: -1200rpx;
z-index: -1;
opacity: 0;
}
&-popup {
width: 100%;
height: 100%;
@ -364,10 +375,12 @@
top: 50%;
margin-top: -635rpx;
z-index: 2;
.bg {
width: 620rpx;
height: 1102rpx;
}
.code {
width: 150rpx;
height: 150rpx;
@ -405,12 +418,14 @@
display: flex;
align-items: center;
justify-content: space-between;
.cancle {
flex: 1;
background-color: #FFFFFF;
margin-right: 30rpx;
border-radius: 10rpx;
}
.sure {
border-radius: 10rpx;
flex: 1;

Loading…
Cancel
Save