<template>
  <div>
    <van-nav-bar title="邀请成员" left-text="返回" @click-left="$route_back" left-arrow></van-nav-bar>
    <div style="padding:0.5rem 0.5rem;">
      <div style=" text-align: center; -webkit-border-radius: 0.2rem;-moz-border-radius: 0.2rem;border-radius: 0.2rem; padding:0.5rem 0;">
        <h4>{{ company_info.name }}</h4>
        <div id="example"><qrcode-vue class="qrcode_box" :value="url" :size="150" level="H"></qrcode-vue></div>
        <p style="color:#999; font-size:0.28rem;">用APP扫一扫，快速加入组织</p>
      </div>
    </div>
  </div>
</template>
<script src="html5plus://ready"></script>
<script>
import request from '@/utils/request';
import QrcodeVue from 'qrcode.vue';
import plusShare from '../../../static/js/plusShare.js';
import { getToken, getUserId } from '@/utils/auth';
import Vue from 'vue';
import axios from 'axios';

export default {
  name: 'invite',

  data() {
    return {
      userinfo: this.$store.getters.user_info,
      url: 'http://192.168.1.3:8080/#/join_company?id=',
      company_info: {},
      site_id: '',
      employee_id: ''
    };
  },
  components: {
    QrcodeVue
    // coreDialog
  },
  created() {
    this.companyId = this.$route.query.id;
    let id = this.$route.query.id;
    let dept_id = this.$route.query.dept_id;
    this.url = this.url + id;
    this.site_id = this.userinfo.site_id;
    this.employee_id = this.userinfo.id;
    this.get_company_info(id);
  },
  methods: {
    getUserInfo(event) {},
    get_company_info(id) {
      let self = this;
      request('get', '/addons/ems/index/get_company_info', { id: id })
        .then(res => {
          if (res.data.code == 1) {
            self.company_info = res.data.data;
            self.url = this.url + '&site_id=' + this.site_id + '&employee_idz';
          }
        })
        .catch(e => {});
    }
  }
};
</script>

<style scoped></style>
