<template>
	<view>
		<mumu-getQrcode @success='qrcodeSucess' @error="qrcodeError"></mumu-getQrcode>
	</view>
</template>

<script>
	import mumuGetQrcode from '../../components/mumu-getQrcode/mumu-getQrcode.vue'
	// 嫌路径长的话可以单独复制出来
	export default {
		components: {
			mumuGetQrcode
		},
		onLoad() {
		},
		methods: {
			qrcodeSucess(data) {
				uni.showToast({
					icon: "none",
					title: '扫码成功',
					duration: 3000
				})
				setTimeout(function(){
					uni.navigateTo({
						url:'/pages/index/cancel?code='+data
					})
				},500)
				
			},
			qrcodeError(err) {
				console.log(err)
				// alert(err)
				uni.showModal({
					title: '摄像头授权失败',
					content: '摄像头授权失败，请检测当前浏览器是否有摄像头权限。',
					success: () => {
						// uni.navigateBack({})
					}
				})
			}
		}
	}
</script>

<style></style>