小程序生成二维码功能完成
This commit is contained in:
@@ -32,6 +32,7 @@ Page({
|
||||
wx.redirectTo({
|
||||
url: '/pages/index/login'
|
||||
})
|
||||
return
|
||||
} else {
|
||||
// 用户已登录
|
||||
this.userGroup = getUserGroupByRole(this.userInfo.role)
|
||||
@@ -47,16 +48,18 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: "/pages/scan/entrance"
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 开发模式下自动跳转到指定页面,节省开发时间
|
||||
console.log("app.globalData", app.globalData)
|
||||
if (app.globalData.debugMode) {
|
||||
wx.switchTab({
|
||||
url: '/pages/residents/report'
|
||||
})
|
||||
// // 开发模式下自动跳转到指定页面,节省开发时间
|
||||
// console.log("app.globalData", app.globalData)
|
||||
// if (app.globalData.debugMode) {
|
||||
// wx.switchTab({
|
||||
// url: '/pages/residents/report'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -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