|
@@ -10,6 +10,7 @@
|
|
|
</view>
|
|
|
</view> -->
|
|
|
<view class="downloadBtn" @click="toSaveImage">保存图片</view>
|
|
|
+ <!-- <img :src="mpWxQr2" alt="" ref="image" class="wcl"> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -17,7 +18,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- mpWxQr: "http://dmsphoto.66km.com.cn/marketing/F520E658D4A649B88DF210EA41432A01.png",
|
|
|
+ mpWxQr: "http://dmsphoto.66km.com.cn/thFiles/2D929DEF-6178-42E3-AC8F-1EA2078CD9C4.png",
|
|
|
canvasW: 0,
|
|
|
canvasH: 0,
|
|
|
invest_areas: [{id: 1, name: "儿童教育"}, {id: 1, name: "少儿编程"}, {id: 1, name: "生物智能"}, {id: 1, name: "万物相连"}, {id: 1, name: "大数据"}],
|
|
@@ -29,6 +30,11 @@
|
|
|
time: "2022.01.21~2022.01.2",
|
|
|
finished: false,
|
|
|
sellingPoint:'',
|
|
|
+ userInfo:'',
|
|
|
+ ext:'',
|
|
|
+ mpWxQr2:'',
|
|
|
+ mpWxQr3:'',
|
|
|
+ mpWxQr4:'',
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -46,19 +52,67 @@
|
|
|
onLoad(opt) {
|
|
|
//this.canvasW = uni.getSystemInfoSync().windowWidth
|
|
|
//this.canvasH = this.calculateCanvasHeight()
|
|
|
+
|
|
|
this.avatar=opt.img;
|
|
|
this.nickname=opt.name;
|
|
|
- if(opt.sellingPoint){
|
|
|
+ if(opt.sellingPoint&&opt.sellingPoint!='undefined'){
|
|
|
+
|
|
|
this.sellingPoint=opt.sellingPoint;
|
|
|
}
|
|
|
+ console.log('this.sellingPoint==='+this.sellingPoint)
|
|
|
|
|
|
- console.log(this.sellingPoint)
|
|
|
if(this.nickname.length>18){
|
|
|
this.nickname=this.nickname.substring(0,18)+'...'
|
|
|
}
|
|
|
+ this.userInfo=this.$store.state.userInfo;
|
|
|
+ this.ext=this.$common.getExtStoreId();
|
|
|
this.canvasW =uni.upx2px(600)
|
|
|
this.canvasH = uni.upx2px(827)
|
|
|
- this.toDrawCanvas()
|
|
|
+ var that=this;
|
|
|
+ var type=opt.type
|
|
|
+ if(type==2){
|
|
|
+ var bizType=2;
|
|
|
+ var path='pages/activity/jkDetail'
|
|
|
+ }else{
|
|
|
+ var bizType=1;
|
|
|
+ var path='pages/shop/goodsDetail'
|
|
|
+ }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ })
|
|
|
+ this.$request.httpBinary('openMall/shareQrCode', {
|
|
|
+ bizType:bizType,
|
|
|
+ path:path,//?id+this.id+'&shareId='+this.userInfo.openId,
|
|
|
+ goodsId:opt.id,
|
|
|
+ openId:this.userInfo.openId,
|
|
|
+ unionId:this.ext.unionId
|
|
|
+ },'GET').then(res => {
|
|
|
+ //console.log(res)
|
|
|
+ this.mpWxQr3=res;
|
|
|
+ uni.hideLoading();
|
|
|
+ //this.mpWxQr2= 'data:image/png;base64,'+uni.arrayBufferToBase64(res)
|
|
|
+ // this.mpWxQr4= uni.arrayBufferToBase64(res)
|
|
|
+ this.toDrawCanvas()
|
|
|
+ })
|
|
|
+ // this.$request.httpBinary('openMall/shareQrCode', {
|
|
|
+ // bizType:1,
|
|
|
+ // path:'pages/shop/goodsDetail',//?id+this.id+'&shareId='+this.userInfo.openId,
|
|
|
+ // goodsId:opt.id,
|
|
|
+ // openId:this.userInfo.openId,
|
|
|
+ // unionId:this.ext.unionId
|
|
|
+ // },'GET').then(res => {
|
|
|
+ // //console.log(res)
|
|
|
+ // this.mpWxQr2= 'data:image/png;base64,'+uni.arrayBufferToBase64(res)
|
|
|
+ // // let theNode=uni.createSelectorQuery().select(".wcl")
|
|
|
+ // // theNode.boundingClientRect((data)=>{
|
|
|
+ // // console.log(data)
|
|
|
+ // // // that.mpWxQr=data
|
|
|
+ // // }).exec()
|
|
|
+ // // this.mpWxQr = uni.createSelectorQuery().select('wcl')
|
|
|
+ // this.toDrawCanvas()
|
|
|
+ // })
|
|
|
+ //return false;
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
toSaveImage() {
|
|
@@ -128,18 +182,38 @@
|
|
|
//this.drawHelloInfo(ctx, padding, padding + cardHeight + padding, cw)
|
|
|
// draw qr code
|
|
|
if (this.mpWxQr) {
|
|
|
-
|
|
|
+ var fsm = uni.getFileSystemManager();
|
|
|
+ //var filePath='../../static/timg/CS.png'
|
|
|
+ var times = new Date().getTime();
|
|
|
+ var codeimg = wx.env.USER_DATA_PATH + '/' + times + '.png';
|
|
|
+ fsm.writeFile({
|
|
|
+ filePath: codeimg, // 要写入的文件路径 (本地路径)
|
|
|
+ data: this.mpWxQr3, // 要写入的文本或二进制数据
|
|
|
+ encoding:"base64", // 指定写入文件的字符编码
|
|
|
+ success(e) {
|
|
|
+ console.log(e)
|
|
|
+ console.log(codeimg)
|
|
|
+ var wxsx=uni.upx2px(68)
|
|
|
+ var wxsy=uni.upx2px(649)
|
|
|
+ var wxwidth=uni.upx2px(148)
|
|
|
+ ctx.drawImage(codeimg, wxsx, wxsy, wxwidth,wxwidth)
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ });
|
|
|
const hello = await this.downloadImage(this.mpWxQr)
|
|
|
//const padding = uni.upx2px(34)
|
|
|
//const av = uni.upx2px(180)
|
|
|
//const totalH = this.calculateCanvasHeight()
|
|
|
//console.log("totalH=="+totalH)
|
|
|
- console.log(hello.tempFilePath)
|
|
|
- var wxsx=uni.upx2px(68)
|
|
|
- var wxsy=uni.upx2px(649)
|
|
|
- var wxwidth=uni.upx2px(148)
|
|
|
+ //console.log(hello.tempFilePath)
|
|
|
+ // var wxsx=uni.upx2px(68)
|
|
|
+ // var wxsy=uni.upx2px(649)
|
|
|
+ // var wxwidth=uni.upx2px(148)
|
|
|
+ // ctx.drawImage(codeimg, wxsx, wxsy, wxwidth,wxwidth)
|
|
|
if (hello.tempFilePath) {
|
|
|
- ctx.drawImage(hello.tempFilePath, wxsx, wxsy, wxwidth,wxwidth)
|
|
|
+ //ctx.drawImage(hello.tempFilePath, wxsx, wxsy, wxwidth,wxwidth)
|
|
|
}
|
|
|
}
|
|
|
ctx.draw()
|