// pages/home/customer-info/index.js import Scene from '../../index/scene' const util = require('../../../utils/util') const qrCode = require('../../../utils/weapp-qrcode') const app = getApp() Scene({ /** * 页面的初始数据 */ data: { name: '裕隆纸业有限公司', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(!util.isEmpty(options.id)){ 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 }) }, previewImage: function(){ wx.canvasToTempFilePath({ canvasId: 'van-qrcode', success: (res) => { wx.previewImage({ urls: [res.tempFilePath] }) } }) }, customerInfo: function(){ } })