Browse Source

Haibao二期

twodate
Enzo 5 years ago
parent
commit
23eed81642
  1. 72
      pages/bill/bill.vue
  2. BIN
      static/images/poster-1.jpg

72
pages/bill/bill.vue

@ -89,80 +89,31 @@
createNewImg() {
var that = this;
var context = wx.createCanvasContext('mycanvas');
context.setFillStyle("#ffe200")
context.fillRect(0, 0, 375, 667)
var path = "../../static/images/empty.png";
context.drawImage(path, 0, 0, 375, 183);
that.info.avatar = "../../static/images/system/payfail.png"
var path1 = that.info.avatar;
console.log(path1, "path1")
//
var path2 = "../../static/images/system/payfail.png";
var path3 = "../../static/images/system/paysuccess.png";
var path4 = "../../static/images/system/paysuccess.png";
var path5 = "../../static/images/system/refresh.png";
context.drawImage(path2, 126, 186, 120, 120);
//
// context.save(); // context
var path = "../../static/images/poster-1.jpg";
context.drawImage(path, 0, 0, 375, 667);
var name = that.info.nickname;
//
context.setFontSize(24);
context.setFillStyle('#333333');
context.setFillStyle('#fff');
context.setTextAlign('center');
context.fillText(name, 185, 340);
context.fillText(name, 34, 620);
context.stroke();
//
context.setFontSize(14);
context.setFillStyle('#333333');
context.setTextAlign('center');
context.fillText("邀请你一起去吃面", 185, 370);
context.stroke();
//
context.drawImage(path3, 48, 390, 280, 84);
//code
context.setFontSize(40);
context.setFillStyle('#ffe200');
context.setTextAlign('center');
context.fillText(that.code, 185, 435);
context.stroke();
//
context.drawImage(path4, 25, 520, 184, 82);
context.setFontSize(12);
context.setFillStyle('#333');
context.setTextAlign('left');
context.fillText("进入小程序输入朋友的邀请", 35, 540);
context.stroke();
context.setFontSize(12);
context.setFillStyle('#333');
context.setTextAlign('left');
context.fillText("码,朋友和你各自获得通用", 35, 560);
context.stroke();
context.setFontSize(12);
context.setFillStyle('#333');
context.setTextAlign('left');
context.fillText("优惠券1张哦~", 35, 580);
context.stroke();
//
context.drawImage(path5, 248, 578, 90, 25);
//
context.arc(186, 246, 50, 0, 2 * Math.PI) //
context.strokeStyle = "#ffe200";
context.clip(); //
context.drawImage(path1, 136, 196, 100, 100); //
//
context.draw();
//
setTimeout(function() {
wx.canvasToTempFilePath({
canvasId: 'mycanvas',
success: function(res) {
var tempFilePath = res.tempFilePath;
that.imagePath = tempFilePath
var tempFilePath1 = res.tempFilePath;
that.imagePath = tempFilePath1
that.canvasHidden = true
console.log('海报生成成功')
console.log(res)
console.log(that.imagePath)
console.log('图片链接',that.imagePath)
},
fail: function(res) {
console.log(res);
@ -200,12 +151,9 @@
icon: 'loading',
duration: 1000
});
setTimeout(function() {
wx.hideToast()
that.createNewImg();
that.maskHidden = true
}, 1000)
}
},
onLoad(options) {

BIN
static/images/poster-1.jpg

After

Width: 549  |  Height: 984  |  Size: 185 KiB

Loading…
Cancel
Save