var e = function(e) { return e && e.__esModule ? e : { default: e }; }(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o, i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), n = new e.default(); var regeneratorRuntime = require('../../../utils/runtime.js'); var api = require('../../../api/api.js'); Page({ /** * 页面的初始数据 */ data: { images: [o.imghost + "/miniapp/images/plus/card_one.jpg", o.imghost + "/miniapp/images/plus/card_two.jpg", o.imghost + "/miniapp/images/plus/card_three.jpg"], currentId: 0, url: o.imghost, j: false, screenWidth: 0, screenheight: 0, canvasHidden: true, shareImgPath: null, plusCard: "", imagePath: "", isshare: 0, }, swiperChange: function(e) { var currentId = e.detail.current; this.setData({ currentId: currentId }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { var that = this; //获取用户设备信息,屏幕宽度 wx.getSystemInfo({ success: res => { that.setData({ screenWidth: res.screenWidth }) } }) this.getPlusCardType(); }, //获取卡类 getPlusCardType: function(e) { var storid = o.stoid; var th = this; getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { th.setData({ plusCard: res.data.data }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ saveImageToPhotosAlbum: function() { var th = this; var unit = th.data.screenWidth / 750 * 1.35; const ctx = wx.createCanvasContext('myCanvas'); //设置画板显示,才能开始绘图 th.setData({ canvasHidden: false }) ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0,554 * unit,899 * unit); ctx.drawImage("../../../images/userinfo/user_head.jpg", 60 * unit, 20 * unit, 60 * unit, 60 * unit); ctx.setFontSize(26 * unit); ctx.setFillStyle("rgb(0,0,0)"); ctx.setTextAlign('left') ctx.fillText("钱巧玲", 136 * unit, 65 * unit, 110 * unit); ctx.setFontSize(22 * unit); ctx.setFillStyle("rgb(255,255,255)"); ctx.fillText("强烈推荐", 400 * unit, 60 * unit); ctx.setStrokeStyle("rgb(255,255,255)"); ctx.setLineDash([5 * unit, 5 * unit], 5 * unit); ctx.beginPath(); ctx.moveTo(0, 120 * unit); ctx.lineTo(554 * unit, 120 * unit); ctx.stroke(); ctx.setStrokeStyle("rgb(218,194,169)"); ctx.beginPath(); ctx.moveTo(0, 420 * unit); ctx.lineTo(554 * unit, 420 * unit); ctx.stroke(); // 卡图片 ctx.drawImage("../../../images/plus/share/one.jpg", 55 * unit, 170 * unit, 444 * unit, 205 * unit); ctx.setFontSize(26 * unit); ctx.setFillStyle("white"); ctx.fillText("PLUSI会员", 80 * unit, 215 * unit); ctx.setFontSize(18 * unit); ctx.setFillStyle("white"); ctx.fillText("开通会员年卡仅199元", 80 * unit, 240 * unit); ctx.setFontSize(18 * unit); ctx.setFillStyle("white"); ctx.fillText("立即开通", 360 * unit, 215 * unit); ctx.drawImage("../../../images/userinfo/user_head.jpg", 80 * unit, 315 * unit, 40 * unit, 40 * unit); ctx.setFontSize(14 * unit); ctx.setFillStyle("white"); ctx.fillText("根据大家购买数据,您成为超级会员预计可省¥2899元", 130 * unit, 345 * unit); ctx.setFontSize(22 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("超级VIP权益", 90 * unit, 475 * unit); ctx.setFontSize(20 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("超级会员专属权益", 90 * unit, 505 * unit); ctx.drawImage("../../../images/plus/share/Ancrown.png", 395 * unit, 435 * unit, 80 * unit, 80 * unit); ctx.setFontSize(22 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("超级VIP标识", 90 * unit, 580 * unit); ctx.setFontSize(20 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("彰显尊贵身份的象征", 90 * unit, 610 * unit); ctx.drawImage("../../../images/plus/share/Identification.png", 395 * unit, 545 * unit, 80 * unit, 80 * unit); ctx.setFontSize(22 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("超级VIP价格", 90 * unit, 695 * unit); ctx.setFontSize(20 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("享受专属会员超低价", 90 * unit, 725 * unit); ctx.drawImage("../../../images/plus/share/money.png", 395 * unit, 660 * unit, 80 * unit, 80 * unit); ctx.drawImage("../../../images/userinfo/user_head.jpg", 100 * unit, 760 * unit, 100 * unit, 100 * unit); ctx.setFontSize(20 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("解锁新权益 精彩享不停", 220 * unit, 800 * unit); ctx.setFontSize(20 * unit); ctx.setFillStyle("rgb(198,165,126)"); ctx.fillText("长按识别二维码,立即开通", 220 * unit, 840 * unit); //绘制图片 ctx.draw(false, wx.canvasToTempFilePath({ x: 0, y: 0, width: 750, height: 1217, destWidth: 1.2 * 750 * 750 / th.data.screenWidth, destHeight: 1.2 * 1217 * 750 / th.data.screenWidth, canvasId: 'myCanvas', success: function(res) { var tempFilePath = res.tempFilePath; th.setData({ imagePath: tempFilePath, maskHidden: false, canvasHidden: true, isshare: 1 }); wx.previewImage({ urls: [tempFilePath], }) } })) }, /** * 生命周期函数--监听页面显示 */ onShow: function() { var goods_list = this.selectComponent("#goods_list"); //组件的id goods_list.get_list(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { var goods_list = this.selectComponent("#goods_list"); //组件的id goods_list.get_list(); this.setData({ j: true }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { }, //开通会员 Opening: function() { this.setData({ j: true }) }, //返回会员页面 OpeningClose: function() { this.setData({ j: false }) } })