<template>
	<view>
		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="扫码" @clickLeft="back" />
		<mumu-get-qrcode @success='qrcodeSucess' @error="qrcodeError"></mumu-get-qrcode>
	</view>
</template>

<script>
	import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue'

	export default {
		components: {
			mumuGetQrcode
		},
		data() {
			return {

			}
		},
		onLoad(){

		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			qrcodeSucess(data) {

				uni.showToast({
					title: '扫码成功'
				})
				const eventChannel = this.getOpenerEventChannel();
				eventChannel.emit('getScancode', data);
				setTimeout(()=>{
					uni.navigateBack({
						delta: 1
					});
				},2000)

			},
			qrcodeError(err) {
				console.log(err)
				uni.showModal({
					title: '摄像头授权失败',
					content: '摄像头授权失败，请检测当前浏览器是否有摄像头权限。',

				})
			}
		}
	}
</script>

<style>

</style>
