// pages/home/customer-info/index.js import Scene from '../../index/scene' const qrCode = require('../../../utils/weapp-qrcode.js'); const app = getApp() Scene({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.showQrCode('?mark=ztb_saas&QrCodeRecordId=597399780326510592' + Math.ceil(Math.random() * 100) ) }, rpx2px: function(rpx) { return rpx / 750 * app.globalData.windowWidth }, showQrCode: function(text){ new qrCode('van-qrcode', { text: text, width: this.rpx2px(600), height: this.rpx2px(600), colorDark: "#333333", colorLight: "#FFFFFF", correctLevel: qrCode.CorrectLevel.H }) this.setData({ show: true }) }, previewImage: function(){ wx.canvasToTempFilePath({ canvasId: 'van-qrcode', success: (res) => { wx.previewImage({ urls: [res.tempFilePath] }) } }) } })