小程序生成二维码功能完成
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
// pages/residents/code.js
|
||||
import SparkMD5 from '../../utils/spark-md5.min'
|
||||
import SparkMD5 from '../../utils/lib/spark-md5.min'
|
||||
import utils from '../../utils/util'
|
||||
import drawQrcode from '../../utils/qrcode/index'
|
||||
// import drawQrcode from '../../utils/qrcode/index'
|
||||
import drawQrcode from '../../utils/lib/weapp.qrcode.esm.js'
|
||||
import scanQRCode from '../../utils/scanQRCode'
|
||||
|
||||
const app = getApp();
|
||||
@@ -132,7 +133,7 @@ Page({
|
||||
t: t
|
||||
}));
|
||||
console.log("chksum", chksum)
|
||||
that.drawCode(`https://epp.cxyxiaomo.com/access/validCode?id=${that.data.userInfo.id}&t=${t}&chksum=${chksum}`, result.data.qrcodeColor)
|
||||
that.drawCode(`${app.globalData.baseUrl}/access/validCode?id=${that.data.userInfo.id}&t=${t}&chksum=${chksum}`, result.data.qrcodeColor)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: result.msg,
|
||||
@@ -186,15 +187,26 @@ Page({
|
||||
}
|
||||
console.log("canvas:", canvas, "res:", res)
|
||||
// 调用方法drawQrcode生成二维码
|
||||
await drawQrcode(wx, {
|
||||
canvas: canvas,
|
||||
canvasId: 'myQrcode',
|
||||
width: 150,
|
||||
padding: 0,
|
||||
background: '#ffffff',
|
||||
foreground: foreground,
|
||||
text: text,
|
||||
})
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#myQrcode')
|
||||
.fields({
|
||||
node: true,
|
||||
size: true
|
||||
})
|
||||
.exec((res) => {
|
||||
var canvas = res[0].node
|
||||
|
||||
// 调用方法drawQrcode生成二维码
|
||||
drawQrcode({
|
||||
canvas: canvas,
|
||||
canvasId: 'myQrcode',
|
||||
width: 150,
|
||||
padding: 0,
|
||||
background: '#ffffff',
|
||||
foreground: foreground,
|
||||
text: text,
|
||||
})
|
||||
})
|
||||
console.log("end drawQrcode")
|
||||
|
||||
this.updateTime();
|
||||
|
Reference in New Issue
Block a user