培训扫码

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: {
userInfo: null,
//serverUrl: 'https://safeyun.ctcshe.com/',
serverUrl: 'http://127.0.0.1:8000/',
serverUrl: 'https://safeyun.ctcshe.com/',
//serverUrl: 'http://127.0.0.1:8000/',
//serverUrl: 'http://192.168.0.102:8000/',
//serverUrl:'http://10.7.100.250:8000/',
isaqy: 0,

View File

@ -60,4 +60,5 @@
</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 weui-cells_after-title">
<block wx:for="{{steps}}" wx:key="unique">
<view class="weui-cell">
<view class="weui-media-box__title">{{item.step}}-</view>
<view class="weui-media-box__desc" style="color:red">{{item.result}}-</view>
<view class="weui-article__p " style="marigin:5px">
<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:green">{{item.hazard}}</view>
</view>
</block>

View File

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

View File

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