Recruiting.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <!--闪电增员界面-->
  3. <el-dialog title="闪电增员" width="500px" :visible.sync="backupVisible" :close-on-click-modal="true" :modal=false>
  4. <div class="flex f-c a-c">
  5. <img src="../../../static/face_sao.png" alt="" style="width: 200px;">
  6. <div style="padding:5px;margin: 20px 0;">
  7. <div id="qrcode" ref="qrcode"></div>
  8. </div>
  9. <span style="width: 200px;color: red;">新成员只需要扫描您的二维码,即可马上注册加入啦!</span>
  10. </div>
  11. </el-dialog>
  12. </template>
  13. <script>
  14. import QRCode from "qrcodejs2";
  15. import Cookies from "js-cookie"
  16. export default {
  17. name: "qrCode",
  18. data() {
  19. return {
  20. qrcode: null,
  21. backupVisible: false,
  22. }
  23. },
  24. created() {
  25. },
  26. methods: {
  27. // 设置可见性
  28. setBackupVisible: function (backupVisible) {
  29. var userId = Cookies.get("user");
  30. this.$api.user.recruitinQqueryType().then((res) => {
  31. if(res.code==200){
  32. let url=''
  33. if(res.data=='2'){
  34. url = this.global.h5BaseUrl + "/#/pages/register/orderissuer?id=" + userId;
  35. }
  36. else{
  37. url = this.global.h5BaseUrl + "/#/pages/register/register?id=" + userId;
  38. }
  39. this.backupVisible = backupVisible
  40. this.$nextTick(() => {
  41. this.creatQrCode(url);
  42. });
  43. }
  44. else{
  45. this.$message.error(res.msg)
  46. }
  47. })
  48. },
  49. creatQrCode(text) {
  50. if (this.qrcode) {
  51. this.qrcode.clear();
  52. this.qrcode.makeCode(text);
  53. } else {
  54. this.qrcode = new QRCode("qrcode", {
  55. text: text,
  56. width: 180,
  57. height: 180,
  58. colorDark: "#000000",
  59. colorLight: "#ffffff",
  60. correctLevel: QRCode.CorrectLevel.H,
  61. });
  62. }
  63. },
  64. }
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. #qrCode {
  69. display: inline-block;
  70. margin: 0 auto;
  71. position: relative;
  72. top: 15%;
  73. img {
  74. width: 200px;
  75. height: 200px;
  76. background-color: #fff;
  77. padding: 6px;
  78. }
  79. }
  80. </style>