|
@@ -1,6 +1,8 @@
|
|
|
// pages/index/index.js
|
|
|
import { homePage } from '../../api/index'
|
|
|
import { userEntityRecharge } from '../../api/charge'
|
|
|
+import { createQRcode } from "../../api/document";
|
|
|
+
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -15,7 +17,10 @@ Page({
|
|
|
scanTimer: null,
|
|
|
scanOverShow: false,
|
|
|
scanResMsg: '',
|
|
|
- scanSuccess: true
|
|
|
+ scanSuccess: true,
|
|
|
+ baseStr: 'data:image/jpg;base64,',
|
|
|
+ QRCodeBase64: '',
|
|
|
+ qrcodeDialog: false
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -94,6 +99,10 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
handleScanCode () {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/exchange/exchange?form=index',
|
|
|
+ })
|
|
|
+ return
|
|
|
var that = this
|
|
|
wx.scanCode({
|
|
|
onlyFromCamera: true,
|
|
@@ -175,5 +184,32 @@ Page({
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/appointment/appointment?form=index',
|
|
|
})
|
|
|
+ },
|
|
|
+ handleShowQRCode (e) {
|
|
|
+ var that = this
|
|
|
+ var id = e.currentTarget.dataset.id
|
|
|
+ wx.showLoading({
|
|
|
+ title: '生成中...'
|
|
|
+ })
|
|
|
+ createQRcode({ documentId: id }).then(res => {
|
|
|
+ wx.hideLoading()
|
|
|
+ that.setData({
|
|
|
+ QRCodeBase64: that.data.baseStr + res.data,
|
|
|
+ qrcodeDialog: true
|
|
|
+ })
|
|
|
+ }).catch(e => {
|
|
|
+ wx.hideLoading()
|
|
|
+ wx.showModal({
|
|
|
+ content: e,
|
|
|
+ confirmColor: '#333',
|
|
|
+ showCancel: false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCloseQRCode (e) {
|
|
|
+ this.setData({
|
|
|
+ qrcodeDialog: false,
|
|
|
+ QRCodeBase64: ''
|
|
|
+ })
|
|
|
}
|
|
|
})
|