freeTrialBtn.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <span class="btn" v-bind="$attrs" @click="btnClick">免费试用</span>
  3. </template>
  4. <script>
  5. export default {
  6. name: "freeTrialBtn",
  7. props: {
  8. myType: {
  9. type: String,
  10. default: 'kaoshi'
  11. }
  12. },
  13. methods: {
  14. isPC() {
  15. const browserWidth = document.documentElement.clientWidth;
  16. if (browserWidth <= 768) {
  17. return false;
  18. } else {
  19. return true;
  20. }
  21. },
  22. btnClick() {
  23. // 执行业务
  24. this.FreeTrial();
  25. // 执行通知
  26. if (this.isPC()) {
  27. this.$emit('active-pc', this.myType)
  28. } else {
  29. this.$emit('active-h5', this.myType)
  30. }
  31. },
  32. FreeTrial() {
  33. if (!this.isPC()) {
  34. // H5
  35. if (this.myType === 'kaoshi') {
  36. window.open('https://cdnks.mtavip.com/mdist/#/webRegister?flug=1')
  37. } else {
  38. window.open('https://cdnks.mtavip.com/mdist/#/webRegister?flug=2')
  39. }
  40. } else {
  41. if (this.myType === 'kaoshi') {
  42. window.open('https://cdnks.mtavip.com/a/register?flug=1')
  43. } else {
  44. window.open('https://cdnks.mtavip.com/a/register?flug=2')
  45. }
  46. }
  47. },
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .btn {
  53. width: 154px;
  54. height: 47px;
  55. background: #00b96b;
  56. border-radius: 24px;
  57. padding: 10px 30px;
  58. color: #fff;
  59. cursor: pointer;
  60. @media (max-width: 768px) {
  61. width: 44%;max-width: 100px;margin: 0 3%;
  62. }
  63. }
  64. </style>