freeTrialBtn.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <span class="free-btn" @click.stop.prevent="btnClick">免费试用</span>
  3. </template>
  4. <script>
  5. export default {
  6. name: "freeTrialBtn",
  7. props: {
  8. myType: {
  9. type: String,
  10. default: 'kaoshi'
  11. },
  12. select: {
  13. type: Boolean,
  14. default: false,
  15. }
  16. },
  17. data() {
  18. return {
  19. visible: false,
  20. }
  21. },
  22. methods: {
  23. isPC() {
  24. const browserWidth = document.documentElement.clientWidth;
  25. if (browserWidth <= 768) {
  26. return false;
  27. } else {
  28. return true;
  29. }
  30. },
  31. btnClick() {
  32. if (this.select) {
  33. this.$emit('need-select')
  34. return false;
  35. }
  36. // 执行业务
  37. this.FreeTrial();
  38. // 执行通知
  39. if (this.isPC()) {
  40. this.$emit('active-pc', this.myType)
  41. } else {
  42. this.$emit('active-h5', this.myType)
  43. }
  44. },
  45. FreeTrial() {
  46. if (!this.isPC()) {
  47. // H5
  48. if (this.myType === 'kaoshi') {
  49. window.open('https://qg.qtavip.com/mdist/#/webRegister?flug=1')
  50. } else {
  51. window.open('https://qg.qtavip.com/#/webRegister?flug=2')
  52. }
  53. } else {
  54. if (this.myType === 'kaoshi') {
  55. window.open('https://qg.qtavip.com/a/register?flug=1')
  56. } else {
  57. window.open('https://qg.qtavip.com/a/register?flug=2')
  58. }
  59. }
  60. },
  61. }
  62. }
  63. </script>
  64. <style lang="scss">
  65. .free-btn {
  66. width: 154px;
  67. height: 48px;
  68. line-height: 48px;
  69. background: #00b96b;
  70. border-radius: 24px;
  71. color: #fff;
  72. cursor: pointer;
  73. display: inline-block;
  74. text-align: center;
  75. @media (max-width: 768px) {
  76. width: 44%;height:35px;line-height:35px;max-width: 120px;margin: 0 3%;display: inline-block;
  77. padding: 0;text-align: center;font-size: 14px;
  78. }
  79. }
  80. .free-btn.shouye {
  81. height: 55px;
  82. width: 180px;
  83. line-height: 55px;
  84. color: #00b96b;
  85. background: #fff;
  86. }
  87. </style>