123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- Component({
-
- properties: {
- },
-
- data: {
- shareFlag: true,
- imgUrls: ''
- },
-
- methods: {
- poster: function () {
- const that = this;
- const ctx = wx.createCanvasContext('myCanvas');
- ctx.rect(0, 0, 370, 507)
- ctx.setFillStyle('#fff')
- ctx.fill()
- ctx.save()
- ctx.beginPath()
- ctx.setFillStyle('#fff')
- ctx.fill()
- ctx.arc(185, 48, 37, 0, 2 * Math.PI, false)
- ctx.clip();
- ctx.drawImage('../../../static/groupImg/Bitmap1.png', 148, 8, 100, 100);
- ctx.restore();
- ctx.setFontSize(20)
- ctx.setFillStyle('#000')
- ctx.fillText('喔喔', 166, 115)
- ctx.setFillStyle('#FF4400')
- ctx.fillText('郎朗读书声是世上最美的声音', 50, 138)
- ctx.drawImage('../../../static/groupImg/Bitmap1.png', 9, 156, 352, 145);
- ctx.setFontSize(18)
- ctx.setFillStyle('#000')
- ctx.fillText('一年级语文上学期', 12, 329)
- ctx.drawImage('../../../static/groupImg/Combined Shape.png', 11, 348, 196, 65);
- ctx.drawImage('../../../static/groupImg/Rectangle 41.png', 134, 358, 59, 20);
- ctx.setFontSize(14)
- ctx.setFillStyle('#fff')
- ctx.fillText('五人团', 149, 373)
- ctx.setFontSize(16)
- ctx.setFillStyle('#A95A00')
- ctx.fillText('原价', 24, 373)
- ctx.setStrokeStyle('red')
- ctx.moveTo(64, 368)
- ctx.lineTo(114, 368)
- ctx.stroke()
- ctx.fillText('¥99元', 64, 373)
- ctx.setFontSize(18)
- ctx.fillText('团购价仅需', 20, 403)
- ctx.fillText('元', 144, 403)
- ctx.setFontSize(20)
- ctx.setFillStyle('red')
- ctx.fillText('¥1', 109, 403)
- ctx.drawImage('../../../static/groupImg/Group 5 Copy 7.png', 3, 419, 370, 192);
- ctx.setFontSize(20)
- ctx.setFillStyle('red')
- ctx.fillText('名额有限,售完截止', 9, 467)
- ctx.setFontSize(18)
- ctx.setFillStyle('#000')
- ctx.fillText('长按识别二维码参加团购', 9, 493)
- ctx.drawImage('../../../static/groupImg/code.png', 217, 374, 135, 135);
- ctx.draw(true, function (res) {
- wx.canvasToTempFilePath({
- x: 0,
- y: 0,
- width: 370,
- height: 507,
- destWidth: 370,
- destHeight: 507,
- canvasId: 'myCanvas',
- success:(res) => {
- console.log(res.tempFilePath)
-
-
-
-
-
-
- that.setData({
- imgUrls: res.tempFilePath
- })
- }
- })
- })
- },
- share: function () {
- this.setData({
- shareFlag: !this.data.shareFlag
- })
- },
- PreservationImg: function () {
- wx.saveImageToPhotosAlbum({
- filePath: this.data.imgUrls,
- success(res) {
- console.log('保存成功')
- }
- })
- }
- }
- })
|