<template>
<div>
     <Info @spstatus="spstatus" ></Info>
     
		<div class="mui-content" style="padding-top:24px">
			 
			 
			 
            <div class="mui-content-padded vongi-meform-pho" v-show="qrCodeImg" >
					<div class="vongi-center">
                        <p class="margin10">核验码</p>
						<img :src="qrCodeImg" id="qrcode" width="80%">
						
 					</div>
			</div>
		</div>
</div>
</template>


<script>
	import Info from '@/views-xsy/Approval/Info.vue'
	   import QRCode from 'qrcodejs2'
  import {
    convertCanvasToImage,
    currentTimeStamp,
    parseUnixTime,isWeiXin
  } from '$project/utils'
  
	export default {
		name: '',
		components: {
			Info
		},
		data() {
			return {
			 status:0,
			qrCodeImg:"",
			}
		},
		created() {
			//this.id = this.$route.query.id;
		},
		methods: {
			//生成二维码
			qrcode() {
				
			var url=window.location.href.split("#")[0]+"#/xsy/scan/info?id="+this.$route.query.id
			 
			  let qrcode = new QRCode('qrcode', {
			    width: 200,
			    height: 200,
			    text: url,
			    correctLevel: QRCode.CorrectLevel.M,
			    // render: 'canvas' // 设置渲染方式（有两种方式 table和canvas，默认是canvas）
			  // colorLight: '#FFFFFF' ,
			  // colorDark: '#33BB00'
			  })
			  var canvas = document.getElementsByTagName('canvas')[0];
			  this.qrCodeImg = convertCanvasToImage(canvas);
			},
			spstatus(status){
				this.status=status;
				if(status=="1"){
					 this.qrcode();
				}
			},
			asynCallBack() {

			},
			 
		},
		mounted() {
			
			
		},
		destroyed() {},
		

	}
</script>

<style src="$project/assets/css/iconfont.css"></style>
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/xsy.css"></style>
<style>
</style>
