lyqu 4 lat temu
rodzic
commit
ff0287b112

+ 3 - 2
components/works-poster/works-poster.vue

@@ -4,8 +4,9 @@
 			<canvas id='canvas' @click.stop="" :style="{ width: canvasW + 'px', height: canvasH + 'px' }" canvas-id="my-canvas"></canvas>
 			<!-- <view class="text-center text-white">长按保存图片</view> -->
 		</view>
-		<u-popup v-model="imgShow" mode="center" width="640" height="940" border-radius="16">
+		<u-popup v-model="imgShow" mode="center" width="640" height="990" >
 			<image style="width: 640rpx;height: 940rpx;" :src="imgUrl"></image>
+			<view class="text-center text-lg text-white" style="line-height: 50upx;background-color: #666666;">长按图片保存</view>
 		</u-popup>
 	</view>
 
@@ -71,7 +72,7 @@
 				// }
 				
 				//绘制标题图
-				this.drawRoundImg(this.ctx,headerImg.path,((this.canvasW-hW) / 2-uni.upx2px(10)),((this.canvasW-hW) / 2) - uni.upx2px(10),hW + uni.upx2px(20),hW + uni.upx2px(20),uni.upx2px(16))
+				this.drawRoundImg(this.ctx,headerImg.path,((this.canvasW-hW) / 2-uni.upx2px(10)),((this.canvasW-hW) / 2) - uni.upx2px(10),hW + uni.upx2px(20),hW + uni.upx2px(20),uni.upx2px(6))
 
 				//绘制名称
 				this.ctx.setFontSize(24);

+ 0 - 1
pages/activityList/activity/authorBoost.vue

@@ -148,7 +148,6 @@
 	import {authUrl} from '@/common/conf/config.js';
 	import {getUrlParams} from '@/common/utils/utils.js';
 	import worksPoster from "@/components/works-poster/works-poster.vue";
-	import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue'
 	import { pathToBase64, base64ToPath } from '@/common/utils/index.js'
 	export default {
 		components: {worksPoster},

+ 1 - 0
pages/activityList/activity/musicBoost.vue

@@ -146,6 +146,7 @@
 	import {authUrl} from '@/common/conf/config.js';
 	import {getUrlParams} from '@/common/utils/utils.js';
 	import worksPoster from "@/components/works-poster/works-poster.vue";
+	import { pathToBase64, base64ToPath } from '@/common/utils/index.js'
 	export default {
 		components: {worksPoster},
 		data() {

+ 61 - 4
pages/activityList/mine/introduction.vue

@@ -26,6 +26,17 @@
 				<button class="theme-bg-color text-white round cu-btn" style="width: 200upx;height: 70upx;" @click="pyqShare">生成海报</button>
 			</view>
 		</view>
+		<view style="width: 10upx;height: 10upx;" class="qrimg-i" v-if="qrCode">
+			<tki-qrcode 
+			cid="qrcode" 
+			ref="qrcode" 
+			:val="val" 
+			:size="size" 
+			:onval="onval" 
+			:loadMake="loadMake" 
+			:usingComponents="true"
+			 @result="qrR" />
+		</view>
 		<view class="container margin-sm" v-if="!$u.test.isEmpty(boostList)">
 			<block v-for="(item, index) in boostList" :key="index">
 				<view class="flex align-center justify-between padding-lr-sm">
@@ -57,13 +68,36 @@
 		<view style="height: 80rpx;" v-if="status">
 			<u-divider bgColor="#f1f1f1;"  height="80">到底了</u-divider>
 		</view>
+		<works-poster ref="myCard" :works="works"></works-poster>
 	</view>
 </template>
 
 <script>
+	import worksPoster from "@/components/works-poster/works-poster.vue";
+	import { pathToBase64, base64ToPath } from '@/common/utils/index.js'
 	export default {
+		components: {worksPoster},
 		data() {
 			return {
+				val: '', // 要生成的二维码值
+				size: 200, // 二维码大小
+				//unit: 'upx', // 单位
+				//icon: '', // 二维码图标
+				//iconsize: 40, // 二维码图标大小
+				//lv: 3, // 二维码容错级别 , 一般不用设置,默认就行
+				onval: false, // val值变化时自动重新生成二维码
+				loadMake: true, // 组件加载完成后自动生成二维码
+				src: '' ,// 二维码生成后的图片地址或base64
+				qrCode: false,
+				works: {
+					image: 'https://yyzs.nanyue6688.com/obsfile/9bd6e4bb9e464794a23d7073de826662-图层 1.png',
+					title: '',
+					hotValue: '',
+					rank: '',
+					avatar: '',
+					name: '',
+					qrcode: 'https://yyzs.nanyue6688.com/obsfile/c531395a576b4b1aa7377cdbf62cb088-default.png',
+				},
 				productId: '',
 				detail: {},
 				boostList: [],
@@ -94,7 +128,7 @@
 				})
 			},
 			getProductInfo() {
-				this.$u.api.production.detail({id: this.productId}).then(res => {
+				this.$u.api.musicBoost.detail({id: this.productId}).then(res => {
 					this.detail = res;
 					this.getActivity(res.activityId);
 				})
@@ -124,9 +158,32 @@
 				this.type = "发送给朋友";
 			},
 			pyqShare() {
-				this.wxShareShow = true;
-				this.type = "分享到朋友圈"
-			}
+				this.qrCode = true;
+				uni.showLoading({
+				    title: '制作海报中...',
+					mask: true
+				})
+				if (this.detail.urlsType == 1) {
+					this.works.image = this.detail.cover;
+				} else {
+					this.works.image = this.detail.urls;
+				}
+				this.works.title = this.detail.title;
+				this.works.hotValue = +this.detail.hotValue;
+				this.works.rank = this.detail.rank;
+				this.works.name = this.detail.personName;
+				setTimeout(() => {
+					this.ctx.draw(true,()=>{
+						uni.hideLoading()
+						this.$refs.myCard.showCanvas();
+					})
+				},800)
+			},
+			qrR(res) {
+				base64ToPath(res).then(res => {
+					this.works.qrcode = res;
+				});
+			},
 		}
 	}
 </script>