|
@@ -26,6 +26,7 @@
|
|
|
<!-- <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" /> -->
|
|
<!-- <sweepPage_html5_qrcode ref="sweepPage_html5_qrcodeRef" @success="sweepSuccess" @error="sweepError" /> -->
|
|
|
<qrScanner ref="qrScannerRef" @success="sweepSuccess" />
|
|
<qrScanner ref="qrScannerRef" @success="sweepSuccess" />
|
|
|
|
|
+ <weChatQrcode ref="weChatQrcodeRef" @success="sweepSuccess" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -33,6 +34,7 @@
|
|
|
// import sweepPage from '@/components/sweepPage.vue'
|
|
// import sweepPage from '@/components/sweepPage.vue'
|
|
|
// import sweepPage_html5_qrcode from '@/components/sweepPage_html5_qrcode.vue'
|
|
// import sweepPage_html5_qrcode from '@/components/sweepPage_html5_qrcode.vue'
|
|
|
import qrScanner from '@/components/qrScanner.vue'
|
|
import qrScanner from '@/components/qrScanner.vue'
|
|
|
|
|
+import weChatQrcode from '@/components/weChatQrcode.vue'
|
|
|
export default {
|
|
export default {
|
|
|
props: {
|
|
props: {
|
|
|
tindex: {
|
|
tindex: {
|
|
@@ -53,7 +55,8 @@ export default {
|
|
|
components: {
|
|
components: {
|
|
|
// sweepPage,
|
|
// sweepPage,
|
|
|
// sweepPage_html5_qrcode
|
|
// sweepPage_html5_qrcode
|
|
|
- qrScanner
|
|
|
|
|
|
|
+ qrScanner,
|
|
|
|
|
+ weChatQrcode
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -80,14 +83,21 @@ export default {
|
|
|
return JSON.parse(JSON.stringify(s))
|
|
return JSON.parse(JSON.stringify(s))
|
|
|
},
|
|
},
|
|
|
sweepBtn() {
|
|
sweepBtn() {
|
|
|
- // this.$refs.sweepPageRef.open()
|
|
|
|
|
- this.$refs.qrScannerRef.open()
|
|
|
|
|
|
|
+ if (this.isWechatBrowser) {
|
|
|
|
|
+ this.$refs.weChatQrcodeRef.open()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$refs.qrScannerRef.open()
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
sweepSuccess(result) {
|
|
sweepSuccess(result) {
|
|
|
const _valueAndTime = this.extractValueAndTime(result)
|
|
const _valueAndTime = this.extractValueAndTime(result)
|
|
|
|
|
|
|
|
if (!_valueAndTime) {
|
|
if (!_valueAndTime) {
|
|
|
- this.$refs.qrScannerRef.close()
|
|
|
|
|
|
|
+ if (this.isWechatBrowser) {
|
|
|
|
|
+ this.$refs.weChatQrcodeRef.close()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$refs.qrScannerRef.close()
|
|
|
|
|
+ }
|
|
|
return this.$toast.fail('扫码的格式不正确')
|
|
return this.$toast.fail('扫码的格式不正确')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -108,7 +118,11 @@ export default {
|
|
|
}
|
|
}
|
|
|
console.log(_valueAndTime)
|
|
console.log(_valueAndTime)
|
|
|
// this.checkJson.answer2 = result;
|
|
// this.checkJson.answer2 = result;
|
|
|
- this.$refs.qrScannerRef.close()
|
|
|
|
|
|
|
+ if (this.isWechatBrowser) {
|
|
|
|
|
+ this.$refs.weChatQrcodeRef.close()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$refs.qrScannerRef.close()
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
sweepError(error) {
|
|
sweepError(error) {
|
|
|
// this.$message.error(error)
|
|
// this.$message.error(error)
|
|
@@ -167,6 +181,11 @@ export default {
|
|
|
console.error('错误:', error.message)
|
|
console.error('错误:', error.message)
|
|
|
return null
|
|
return null
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ // 检查是否在微信浏览器中
|
|
|
|
|
+ isWechatBrowser() {
|
|
|
|
|
+ const ua = navigator.userAgent.toLowerCase()
|
|
|
|
|
+ return ua.indexOf('micromessenger') !== -1
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|