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.
 
 
 
 
 
 

48 lines
963 B

  1. <template>
  2. <view class="page">
  3. <view class="btn" @click="tapScan">
  4. 扫码
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import scanCodeFun from '@/common/js/scanCodeFun.js';
  10. export default {
  11. data() {
  12. return {}
  13. },
  14. methods: {
  15. init() {
  16. let _this = this;
  17. scanCodeFun.scanCodeFun().then(res => {
  18. console.log(res); //"scanType": "CODABAR"是一维码,QR_CODE是二维码,
  19. if (!res) return;
  20. if (res.scanType=="QR_CODE" && res.result != "" && res.result != null && res.result != undefined) {
  21. this.NAV_TO('./from', {
  22. AIId: res.result
  23. }, true);
  24. }else{
  25. this.TOAST("无法识别到二维码!");
  26. return;
  27. }
  28. })
  29. },
  30. tapScan() {
  31. this.init();
  32. }
  33. },
  34. mounted() {
  35. let _this = this;
  36. setTimeout(function() {
  37. _this.init();
  38. }, 100);
  39. }
  40. };
  41. </script>
  42. <style lang="less" scoped>
  43. @import '~@/common/css/sidepage.less';
  44. @import '~@/common/css/customlist.less';
  45. </style>