|
@ -1,14 +1,14 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="pageBgImg"> |
|
|
<view class="pageBgImg"> |
|
|
<topNavbar title="个人二维码"></topNavbar> |
|
|
|
|
|
|
|
|
<topNavbar title="驾校二维码"></topNavbar> |
|
|
<view class="pad"> |
|
|
<view class="pad"> |
|
|
<view class="card"> |
|
|
<view class="card"> |
|
|
<view class="refresh_row" @click="refresh"> |
|
|
|
|
|
|
|
|
<!-- <view class="refresh_row" @click="refresh"> |
|
|
<view class="text">刷新二维码</view> |
|
|
<view class="text">刷新二维码</view> |
|
|
<view class="icon"> |
|
|
<view class="icon"> |
|
|
<image src="@/static/images/index/ic_shuaxin.png" mode=""></image> |
|
|
<image src="@/static/images/index/ic_shuaxin.png" mode=""></image> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
</view> --> |
|
|
<view class="qcode"> |
|
|
<view class="qcode"> |
|
|
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;"></canvas> |
|
|
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;"></canvas> |
|
|
</view> |
|
|
</view> |
|
@ -26,7 +26,6 @@ |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
timer: null |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
@ -35,27 +34,14 @@ |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// onHide() { |
|
|
|
|
|
// console.log('清除了') |
|
|
|
|
|
// clearTimeout(this.timer) |
|
|
|
|
|
// this.timer = null |
|
|
|
|
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
beforeDestroy() { |
|
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
|
this.timer = null |
|
|
|
|
|
// this.refresh = null |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
refresh() { |
|
|
refresh() { |
|
|
let {coachId, name, schoolId, tenantId, schoolName} = this.vuex_userInfo |
|
|
|
|
|
|
|
|
let { schoolId, schoolName} = this.vuex_userInfo |
|
|
// 设置二维码内容 |
|
|
// 设置二维码内容 |
|
|
qr.data = JSON.stringify({ |
|
|
qr.data = JSON.stringify({ |
|
|
coachId, |
|
|
|
|
|
schoolId, |
|
|
schoolId, |
|
|
nickname: encodeURIComponent(name), |
|
|
|
|
|
timer: Date.now(), |
|
|
|
|
|
schoolName: encodeURIComponent(schoolName), |
|
|
schoolName: encodeURIComponent(schoolName), |
|
|
|
|
|
QrType: 1 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 设置二维码大小,必须与canvas设置的宽高一致 |
|
|
// 设置二维码大小,必须与canvas设置的宽高一致 |
|
@ -71,10 +57,6 @@ |
|
|
qr.canvasContext = canvasContext; |
|
|
qr.canvasContext = canvasContext; |
|
|
// 调用绘制方法将二维码图案绘制到canvas上 |
|
|
// 调用绘制方法将二维码图案绘制到canvas上 |
|
|
qr.drawCanvas(); |
|
|
qr.drawCanvas(); |
|
|
this.timer = setTimeout(()=>{ |
|
|
|
|
|
console.log('刷新了') |
|
|
|
|
|
this.refresh() |
|
|
|
|
|
},1000*20) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |