<template>
	<view class="content">
		<view class="title" v-if="imgURL==''">
			暂未获得证书
		</view>
		<view class="" v-else>
			<view class="title">
				您的考试结果已经生成,请扫二维码查看
			</view>
			<view class="codeBox">
				<image :src="imgURL" mode=""></image>
			</view>
		</view>
		
	</view>
</template>

<script>
	import request from'../../utils/request.js'
	export default{
		data(){
			return{
				id:'',
				token:'',
				imgURL:''
			}
		},
		onLoad(options) {
			this.id=options.id
			this.token=uni.getStorageSync('Authorization')
		},
		onShow() {
			this.getCode()
		},
		methods:{
			getCode(){
				request.post('/api/index/certificateCode',{
					id:this.id,
					// url:'/pages/index/result-login?id='+this.id+'&token='+this.token
					// url:'/pages/index/index?id='+this.id+'&token='+this.token
					url:'/pages/index/result-login'
				}).then(res=>{
					if(res.code==1){
						this.imgURL=res.data.code
					}
					
				}).catch(err=>{
					
				})
			}
		}
	}
</script>

<style>
	.content{
		min-height: 100vh;
		background-color: #F2F3F5;
		width: 100%;
		padding-top: 240rpx;
		box-sizing: border-box;
	}
	.title{
		font-size: 34rpx;
		color: #323233;
		font-weight: 500;
		width: 100%;
		text-align: center;
	}
	.codeBox{
		margin-top: 80rpx;
		display: flex;
		justify-content: center;
	}
	.codeBox image{
		width:424rpx;
		height: 424rpx;
	}
</style>