培训扫码

This commit is contained in:
caoqianming 2019-08-08 22:00:35 +08:00
parent 3c998f761f
commit 0176171970
5 changed files with 31 additions and 27 deletions

4
app.js
View File

@ -74,8 +74,8 @@ App({
}, },
globalData: { globalData: {
userInfo: null, userInfo: null,
//serverUrl: 'https://safeyun.ctcshe.com/', serverUrl: 'https://safeyun.ctcshe.com/',
serverUrl: 'http://127.0.0.1:8000/', //serverUrl: 'http://127.0.0.1:8000/',
//serverUrl: 'http://192.168.0.102:8000/', //serverUrl: 'http://192.168.0.102:8000/',
//serverUrl:'http://10.7.100.250:8000/', //serverUrl:'http://10.7.100.250:8000/',
isaqy: 0, isaqy: 0,

View File

@ -60,4 +60,5 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<ad unit-id="adunit-cd6a8fdc3f72f822"></ad>

View File

@ -16,9 +16,8 @@
<view class="weui-cells__title">检查项目</view> <view class="weui-cells__title">检查项目</view>
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title">
<block wx:for="{{steps}}" wx:key="unique"> <block wx:for="{{steps}}" wx:key="unique">
<view class="weui-cell"> <view class="weui-article__p " style="marigin:5px">
<view class="weui-media-box__title">{{item.step}}-</view> <view class="weui-media-box__desc" style="color:black">{{item.step}}-<span style="color:red">{{item.result}}</span></view>
<view class="weui-media-box__desc" style="color:red">{{item.result}}-</view>
<view class="weui-media-box__desc" style="color:green">{{item.hazard}}</view> <view class="weui-media-box__desc" style="color:green">{{item.hazard}}</view>
</view> </view>
</block> </block>

View File

@ -1,6 +1,6 @@
// pages/bind/binduser.js // pages/bind/binduser.js
var util = require('../../utils/util.js') var util = require('../../utils/util.js')
import drawQrcode from '../../utils/weapp.qrcode.esm.js' //import drawQrcode from '../../utils/weapp.qrcode.esm.js'
Page({ Page({
/** /**
@ -20,23 +20,23 @@ Page({
pxid: pxid pxid: pxid
}) })
this.getPx(pxid) this.getPx(pxid)
let text = 'https://safeyun.ctcshe.com/miniprogram/checktrain?trainid=' + pxid //let text = 'https://safeyun.ctcshe.com/miniprogram/checktrain?trainid=' + pxid
console.log(text) //console.log(text)
drawQrcode({ // drawQrcode({
width: 200, // width: 200,
height: 200, // height: 200,
canvasId: 'qdQrcode', // canvasId: 'qdQrcode',
// ctx: wx.createCanvasContext('myQrcode'), // // ctx: wx.createCanvasContext('myQrcode'),
text: text, // text: text,
// v1.0.0+版本支持在二维码上绘制图片 // // v1.0.0+版本支持在二维码上绘制图片
// image: { // // image: {
// imageResource: '../../images/icon.png', // // imageResource: '../../images/icon.png',
// dx: 70, // // dx: 70,
// dy: 70, // // dy: 70,
// dWidth: 60, // // dWidth: 60,
// dHeight: 60 // // dHeight: 60
// } // // }
}) // })
}, },
getPx: function (id) { getPx: function (id) {
wx.showLoading({ wx.showLoading({
@ -53,6 +53,10 @@ Page({
wx.hideLoading(); wx.hideLoading();
if (res.statusCode === 200) { if (res.statusCode === 200) {
var pxdata = res.data var pxdata = res.data
if(pxdata.checkqr!=''||pxdata.qrcode!=null){
pxdata.checkqr = getApp().globalData.serverUrl+pxdata.checkqr
console.log(pxdata.checkqr)
}
if (pxdata.starttime != '') { pxdata.starttime = util.formatTime(new Date(pxdata.starttime)) } if (pxdata.starttime != '') { pxdata.starttime = util.formatTime(new Date(pxdata.starttime)) }
this.setData(pxdata) this.setData(pxdata)

View File

@ -3,9 +3,9 @@
<view class="page__title">签到二维码</view> <view class="page__title">签到二维码</view>
<view class="page__desc">请在培训开始前展示给参加人员扫码</view> <view class="page__desc">请在培训开始前展示给参加人员扫码</view>
</view> </view>
<view class="qrcode"> <view style="text-align:center">
<canvas canvas-id="qdQrcode" style="width:200px;height:200px"></canvas> <image src="{{checkqr}}" style="width:200px;height:200px;"></image>
</view> </view>
<view class="page__bd" style="margin:5px"> <view class="page__bd" style="margin:5px">
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">