1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- Component({
- properties: {},
- data: {
- state: true,
- img: ''
- },
- methods: {
- open() {
- this.setData({
- state: true
- })
- },
- closeMediaBox() {
- this.setData({
- state: false
- })
- },
- savePoster() {
- const query = wx.createSelectorQuery().in(this);
- query
- .select('#cavansId')
- .fields({
- node: true,
- size: true
- }).exec(async (res) => {
- const canvas = res[0].node;
- const ctx = canvas.getContext('2d');
- const dpr = wx.getSystemInfoSync().pixelRatio;
- canvas.width = res[0].width * dpr;
- canvas.height = res[0].height * dpr;
- let pic = canvas.createImage();
- pic.src = 'https://reader-wx.ai160.com/images/reader/pay/shareBg.jpg'
- pic.onload = () => {
- ctx.drawImage(pic, 0, 0, 646, 959);
- let pl = canvas.createImage();
- pl.src = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQEs8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyZzR0ZTE2T2M5N1UxYURaYU5CY1QAAgSHoQplAwQgHAAA'
- pl.onload = () => {
- ctx.drawImage(pl, 25, 747, 173, 173)
- }
- }
- })
- }
- }
- })
|