|
|
@@ -8,13 +8,13 @@
|
|
|
<view class="" :style="{'height': height*1/2/2 + 'px'}">
|
|
|
</view>
|
|
|
<!-- <canvas :style="{ width: '600rpx', height: '1066rpx',}" canvas-id="myCanvas" id="myCanvas" class="hb"></canvas> -->
|
|
|
-
|
|
|
- <!-- #ifdef H5 -->
|
|
|
<canvas :style="{ width: '600rpx', height: '1066rpx',}" canvas-id="myCanvas" id="myCanvas" class="qrimg"></canvas>
|
|
|
- <image :style="{'display': block, width: '600rpx', height: '1066rpx',margin: auto}" :src="shareQrcodeUrl" mode="" id="saveImg" class="hb"></image>
|
|
|
+ <image :style="{'display': 'block', width: '600rpx', height: '1066rpx',margin: 'auto'}" :src="shareQrcodeUrl" mode="" id="saveImg" class="hb"></image>
|
|
|
+ <!-- #ifdef H5 -->
|
|
|
+
|
|
|
<!-- #endif -->
|
|
|
- <!-- #ifdef MP -->
|
|
|
- <canvas :style="{ width: '600rpx', height: '1066rpx',}" canvas-id="myCanvas" id="myCanvas" class="hb"></canvas>
|
|
|
+ <!--#ifndef H5 -->
|
|
|
+ <!-- <canvas :style="{ width: '600rpx', height: '1066rpx',}" canvas-id="myCanvas" id="myCanvas" class="hb"></canvas> -->
|
|
|
<!-- #endif -->
|
|
|
<view class="scrop">
|
|
|
|
|
|
@@ -49,6 +49,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ spreadBanner
|
|
|
+ } from '@/api/user.js';
|
|
|
import {
|
|
|
mapState,
|
|
|
mapMutations
|
|
|
@@ -121,10 +124,17 @@
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
- this.val = this.baseURL + '/index/#/pages/index/index?spread=' + this.userInfo.uid
|
|
|
+ this.val = this.baseURL + '/index/#/pages/index/index?spread=' + this.userInfo.phone
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ spreadBanner() {
|
|
|
+ spreadBanner({
|
|
|
+ type: 2
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ })
|
|
|
+ },
|
|
|
uniCopy(content) {
|
|
|
/**
|
|
|
* 小程序端 和 app端的复制逻辑
|
|
|
@@ -175,21 +185,28 @@
|
|
|
qrR(res) {
|
|
|
this.erweimasrc = res
|
|
|
console.log(res, 'erweima');
|
|
|
- this.createPoster()
|
|
|
+ //
|
|
|
+ spreadBanner({
|
|
|
+ type: 2
|
|
|
+ }).then(res => {
|
|
|
+
|
|
|
+ this.createPoster(res.data[0].pic)
|
|
|
+ console.log(res.data[0].pic,'res.data[0].pic')
|
|
|
+ })
|
|
|
},
|
|
|
- async createPoster() {
|
|
|
+ async createPoster(goodimg) {
|
|
|
let that = this
|
|
|
// 获取设备信息,主要获取宽度,赋值给canvasW 也就是宽度:100%
|
|
|
this.SystemInfo = await this.getSystemInfo();
|
|
|
// 获取商品主图,二维码信息,APP端会返回图片的本地路径(H5端只能返回原路径)
|
|
|
- this.goodsImg = await this.getImageInfo('/static/img/sharebase.jpg');
|
|
|
+ this.goodsImg = await this.getImageInfo(goodimg);
|
|
|
this.ewmImg = await this.getImageInfo(this.erweimasrc);
|
|
|
// this.canvasW = this.SystemInfo.windowWidth; // 画布宽度
|
|
|
this.ratio = this.SystemInfo.windowWidth / 750;
|
|
|
this.canvasW = 600 * this.ratio;
|
|
|
this.canvasH = 1066 * this.ratio;
|
|
|
// #ifdef APP-PLUS
|
|
|
- this.ewmW = 350 * this.ratio;
|
|
|
+ this.ewmW = 250 * this.ratio;
|
|
|
// #endif
|
|
|
// #ifdef H5
|
|
|
this.ewmW = 250 * this.ratio;
|
|
|
@@ -217,12 +234,12 @@
|
|
|
ctx.drawImage(this.goodsImg.path, 0, 0, this.canvasW, this
|
|
|
.canvasH) // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度)
|
|
|
// #ifdef APP-PLUS
|
|
|
- ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2),this.canvasH - 85*this.ratio - this.ewmW,
|
|
|
+ ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2),this.canvasH - 130*this.ratio - this.ewmW,
|
|
|
this.ewmW, this.ewmW) // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度,二维码的宽,高)
|
|
|
|
|
|
// #endif
|
|
|
// #ifdef H5
|
|
|
- ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2),this.canvasH - 170*this.ratio - this.ewmW,
|
|
|
+ ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2),this.canvasH - 280*this.ratio - this.ewmW,
|
|
|
this.ewmW, this.ewmW) // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度,二维码的宽,高)
|
|
|
// #endif
|
|
|
|
|
|
@@ -232,7 +249,7 @@
|
|
|
ctx.setFillStyle('#fff'); // setFillStyle() 设置字体颜色
|
|
|
ctx.textAlign = "center";
|
|
|
// 邀请码
|
|
|
- ctx.fillText('邀请码:' + this.userInfo.uid,this.canvasW/2,this.canvasH -10)
|
|
|
+ ctx.fillText('邀请码:' + this.userInfo.uid,this.canvasW/2,this.canvasH -50*this.ratio)
|
|
|
ctx.draw(false, (ret) => { // draw方法 把以上内容画到 canvas 中。
|
|
|
console.log(ret)
|
|
|
uni.showToast({
|
|
|
@@ -382,12 +399,14 @@
|
|
|
}
|
|
|
.bottom-btn {
|
|
|
// background-color: #fff;
|
|
|
- display: block;
|
|
|
+ // display: block;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
width: 550rpx;
|
|
|
height: 80rpx;
|
|
|
background-color: $base-color;
|
|
|
color: #fff;
|
|
|
- line-height: 80rpx;
|
|
|
margin: 30rpx auto;
|
|
|
text-align: center;
|
|
|
border-radius: 40rpx;
|