lyn7568 3 years ago
parent
commit
32d12de024
1 changed files with 67 additions and 0 deletions
  1. 67 0
      src/components/print-dialog/index.vue

+ 67 - 0
src/components/print-dialog/index.vue

@ -0,0 +1,67 @@
1
<template>
2
  <el-dialog title="打印" :visible.sync="printVisible" width="30%">
3
    <div style="text-align:center" id="print">
4
      <vue-qr :text="token" :size="200"></vue-qr>
5
      <p style="font-size:18px">姓名:{{name}}</p>
6
      <p style="font-size:18px">{{organization}}</p>
7
    </div>
8
    <span slot="footer" class="dialog-footer">
9
      <el-button @click="printVisible = false">取 消</el-button>
10
      <el-button type="primary" v-print="'#print'" @click="handClick">确 定</el-button>
11
    </span>
12
  </el-dialog>
13
</template>
14
<script>
15
import vueQr from "vue-qr";
16
17
export default {
18
  name: "printCode",
19
  data() {
20
    return {
21
      printVisible: false,
22
      name: "",
23
      organization: "",
24
      meetingId: "",
25
      token: ""
26
    };
27
  },
28
  created() {},
29
  components: {
30
    vueQr
31
  },
32
  computed: {},
33
  beforeMount() {},
34
  mounted() {},
35
  methods: {
36
    init(data) {
37
      this.printVisible = true;
38
      this.name = data.truename;
39
      this.organization = data.organization;
40
      this.aid = data.aid;
41
      this.token =
42
        window.SITE_CONFIG['img']+"/qrcode/webmeeting.html?token=" + data.symbol + "&meetingId=" + data.meetingId;
43
    },
44
    handClick() {
45
      this.$http({
46
        url: this.$http.adornUrl(`/admin/sign/printcode/${this.aid}`),
47
        method: "post",
48
        data: {
49
        }
50
      })
51
        .then(({ data }) => {
52
          if (data && data.code === 0) {
53
            this.printVisible = false;
54
            this.$emit("getData");
55
            return;
56
          }
57
        })
58
        .catch(error => {
59
          console.log(error);
60
        });
61
    }
62
  },
63
  watch: {}
64
};
65
</script>
66
<style scoped>
67
</style>