You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

<template>
<mumu-get-qrcode @success='qrcodeSucess' @error="qrcodeError"></mumu-get-qrcode>
</template>
<script>
import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue'
export default {
components: {
mumuGetQrcode
},
methods: {
//扫码成功
qrcodeSucess(data) {
setTimeout(function() {
let type = data.substr(data.lastIndexOf("?")).substr(1, 7);
let query = data.substr(data.lastIndexOf("=")).substr(1)
if (type == 'uniscid') { //企业详情(企业统一社会代码)
uni.showToast({
title: '扫码成功',
})
uni.redirectTo({
url: `/sub-public/enterprise-new-info/enterprise-new-info?uniscid=${query}`
})
} else if (type == 'certifi') { //食品详情
uni.showToast({
title: '扫码成功',
})
uni.redirectTo({
url: `/sub-public/food-query/food-query?certificationld=${query}`,
})
} else {
uni.showToast({
title: '未查到相关数据',
icon: 'none'
})
}
}, 1000)
},
//扫码是失败
qrcodeError(err) {
console.log(err)
uni.showModal({
title: '摄像头授权失败',
content: '摄像头授权失败,请检测当前浏览器是否有摄像头权限。',
success: () => {
uni.navigateBack({})
}
})
}
}
}
</script>
<style>
</style>