This commit is contained in:
zhangmanman
2021-08-09 15:57:37 +08:00
parent c661dd0e16
commit 540d76bdb8
158 changed files with 4914 additions and 788 deletions

View File

@@ -8,10 +8,11 @@
* 页面的初始数据
*/
data: {
qrcode : '', //二维码
userInfo: '', //我的信息
isImgLay: false, //是否显示图片弹出层
parentId: '' //是否分享进入
qrcode : '', //二维码
userInfo : '', //我的信息
isImgLay : false,//是否显示图片弹出层
parentId : '', //是否分享进入
shareState : false //显示分享朋友圈弹出层
},
/**
@@ -30,7 +31,7 @@
qrcode : res.data.qrcode,
userInfo : res.data.user
})
})
}).catch(err=>{})
},
/**
@@ -43,7 +44,7 @@
let avatarImg = new Promise(success=>{
wx.getImageInfo({
src : this.data.userInfo.avatar,
src : '',
success : res => {
success(res.path)
}
@@ -60,38 +61,44 @@
})
})
Promise.all([codeImg, avatarImg]).then(res => {
Promise.all([codeImg]).then(res => {
// 绘制海报
const ctx = wx.createCanvasContext('qrcodeCard')
ctx.save()
// 绘制背景
ctx.setFillStyle('#f7662d')
ctx.setFillStyle('#e2e2e2')
ctx.fillRect(0, 0, 375, 603)
// 绘制背景
ctx.drawImage('/static/img/user-codeImg-down.png', 0, 0, 375, 650)
// 绘制二维码
ctx.drawImage(res[0], 114, 390, 150, 150)
ctx.drawImage(res[0], 114, 470, 150, 150)
// 文字
ctx.setFontSize(16)
ctx.setFillStyle("#2f3245")
ctx.setTextAlign('center')
ctx.fillText(this.data.userInfo.nickname, 194, 350 , 270)
// ctx.setFontSize(16)
// ctx.setFillStyle("#2f3245")
// ctx.setTextAlign('center')
// ctx.fillText(this.data.userInfo.nickname, 194, 350 , 270)
// 文字
ctx.setFontSize(14)
ctx.setFillStyle("#af7700")
ctx.setFontSize(40)
ctx.setFillStyle("#222222")
ctx.setTextAlign('center')
ctx.fillText(this.data.userInfo.nickname + " -- " + "邀请您进入本时生活", 188, 570 , 270)
ctx.fillText("扫码享福利", 188, 400 , 270)
// 文字
ctx.setFontSize(18)
ctx.setFillStyle("#222222")
ctx.setTextAlign('center')
ctx.fillText("扫描二维码加入本时生活", 188, 440 , 270)
ctx.save();
ctx.beginPath(); //开始绘制
ctx.arc(70 / 2 + 156, 70 / 2 + 250, 70 / 2, 0, Math.PI * 2, false);
ctx.clip();
ctx.drawImage(res[1], 156, 250, 70, 70);
// ctx.drawImage(res[1], 156, 250, 70, 70);
// 保存图片
ctx.draw(true, () => {
@@ -122,9 +129,7 @@
}
})
},
complete: e => {
console.log(e)
}
complete: e => {}
})
}
})
@@ -157,6 +162,15 @@
})
},
/**
* 分享朋友圈弹出层状态
*/
shareShow() {
this.setData({
shareState: !this.data.shareState
})
},
/**
* 分享
*/
@@ -164,7 +178,18 @@
return {
title : this.data.userInfo.nickname + "邀请您进入本时生活",
imageUrl: "",
query : "/pages/code/code?parent_id=" + this.data.userInfo.user_id + "&type=share"
path : "/pages/index/index?parent_id=" + this.data.userInfo.user_id + "&type=share"
}
},
/**
* 用户点击右上角分享朋友圈
*/
onShareTimeline () {
return {
title : this.data.userInfo.nickname + "邀请您进入本时生活",
path : "/pages/index/index?parent_id=" + this.data.userInfo.user_id + "&type=share",
imageUrl: ''
}
}
})