<template>
  <div id="book">
    <!-- <div class="top-bg"></div> -->
    <div class="online-active">
       <div class="qrcode" id="qrCodeUrl"></div>
    </div>
  </div>
</template>

<script>
import QRCode from "qrcodejs2";
export default {
  name: 'OnlineBookSelection',
  components: {
    QRCode
  },
  data() {
    return {
      QRCode: '',
      activeId: ''
    }
  },
  created() {
    this.activeId = this.$route.query.activeId
    console.log(this.$route.query.activeId)
  },
  mounted(){
    this.creatQrCode()
  },
  methods: {
    creatQrCode() {
      const that = this;
      console.log(window.location.href);
      if(this.isLocal){
        that.QRCode = 'http://192.168.99.50:8089/BookList?activeId?activeId='+ this.activeId
      }else{
        that.QRCode = window.location.origin +'/web/#/BookList?activeId?activeId='+ this.activeId
      }
      console.log(that.QRCode)
      that.$nextTick(function () {
        let q = new QRCode("qrCodeUrl", {
          text: that.QRCode,
          width: 180,
          height: 180,
          colorDark: "#000000",
          colorLight: "#ffffff",
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import "~@/assets/styles/index.scss";
</style>
