|
|
@@ -23,12 +23,14 @@
|
|
|
<el-button type="primary" size="small" @click="sweepBtn">扫一扫</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <sweepPage ref="sweepPageRef" @success="sweepSuccess" @error="sweepError"/>
|
|
|
+ <!-- <sweepPage ref="sweepPageRef" @success="sweepSuccess" @error="sweepError"/> -->
|
|
|
+ <sweepPage_html5_qrcode ref="sweepPage_html5_qrcodeRef" @success="sweepSuccess" @error="sweepError"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import sweepPage from '@/components/sweepPage.vue';
|
|
|
+// import sweepPage from '@/components/sweepPage.vue';
|
|
|
+import sweepPage_html5_qrcode from '@/components/sweepPage_html5_qrcode.vue';
|
|
|
export default {
|
|
|
props: {
|
|
|
tindex: {
|
|
|
@@ -47,7 +49,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
components:{
|
|
|
- sweepPage
|
|
|
+ // sweepPage
|
|
|
+ sweepPage_html5_qrcode
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -74,29 +77,30 @@ export default {
|
|
|
return JSON.parse(JSON.stringify(s))
|
|
|
},
|
|
|
sweepBtn(){
|
|
|
- this.$refs.sweepPageRef.open();
|
|
|
+ this.$refs.sweepPage_html5_qrcodeRef.open();
|
|
|
},
|
|
|
sweepSuccess(result){
|
|
|
this.checkJson.answer2 = result;
|
|
|
- this.$refs.sweepPageRef.close();
|
|
|
+ this.$refs.sweepPage_html5_qrcodeRef.close();
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
sweepError(error){
|
|
|
- if (error.name === 'NotAllowedError') {
|
|
|
- this.$toast.fail('您需要授予相机访问权限')
|
|
|
- } else if (error.name === 'NotFoundError') {
|
|
|
- this.$toast.fail('这个设备上没有摄像头')
|
|
|
- } else if (error.name === 'NotSupportedError') {
|
|
|
- this.$toast.fail('所需的安全上下文(HTTPS、本地主机)')
|
|
|
- } else if (error.name === 'NotReadableError') {
|
|
|
- this.$toast.fail('相机被占用')
|
|
|
- } else if (error.name === 'OverconstrainedError') {
|
|
|
- this.$toast.fail('安装摄像头不合适')
|
|
|
- } else if (error.name === 'StreamApiNotSupportedError') {
|
|
|
- this.$toast.fail('此浏览器不支持流API')
|
|
|
- }else{
|
|
|
- this.$toast.fail(error.name)
|
|
|
- }
|
|
|
+ this.$toast.fail(error)
|
|
|
+ // if (error.name === 'NotAllowedError') {
|
|
|
+ // this.$toast.fail('您需要授予相机访问权限')
|
|
|
+ // } else if (error.name === 'NotFoundError') {
|
|
|
+ // this.$toast.fail('这个设备上没有摄像头')
|
|
|
+ // } else if (error.name === 'NotSupportedError') {
|
|
|
+ // this.$toast.fail('所需的安全上下文(HTTPS、本地主机)')
|
|
|
+ // } else if (error.name === 'NotReadableError') {
|
|
|
+ // this.$toast.fail('相机被占用')
|
|
|
+ // } else if (error.name === 'OverconstrainedError') {
|
|
|
+ // this.$toast.fail('安装摄像头不合适')
|
|
|
+ // } else if (error.name === 'StreamApiNotSupportedError') {
|
|
|
+ // this.$toast.fail('此浏览器不支持流API')
|
|
|
+ // }else{
|
|
|
+ // this.$toast.fail(error.name)
|
|
|
+ // }
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|