register-for-invite.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="register-for-invite">
  3. <div class="">注册</div>
  4. <form @submit.prevent>
  5. <input v-model="form.phone" label="phone" name="phone" />
  6. <input v-model="form.code" label="code" name="code" maxlength="6" />
  7. <div class="">
  8. <button @click="register()">注册</button>
  9. <button @click="sendSmsCode()">发送验证码</button>
  10. </div>
  11. </form>
  12. </div>
  13. </template>
  14. <script>
  15. import { registerForInvite } from '~/api/user/client.js';
  16. import { sendSmsCode } from '~/api/message/phone.js';
  17. export default {
  18. auth: false,
  19. name: 'RegisterForInvite',
  20. data() {
  21. return {
  22. form: {
  23. phone: '17603013019',
  24. code: '',
  25. invitationUserName: null,
  26. activityId: null,
  27. },
  28. };
  29. },
  30. fetch() {
  31. this.form.invitationUserName = this.$route.query.invitationUserName;
  32. this.form.activityId = this.$route.query.activityId;
  33. },
  34. head: {
  35. title: '注册',
  36. },
  37. methods: {
  38. async register() {
  39. this.$tongji.trackEvent('活动', '注册', '', 0);
  40. await registerForInvite(this, this.form);
  41. },
  42. async sendSmsCode() {
  43. this.$tongji.trackEvent('活动', '发送短信', '', 0);
  44. const res = await sendSmsCode(this, {
  45. type: 'common',
  46. authorizationType: 4,
  47. phone: this.form.phone,
  48. });
  49. this.$message({ content: res.msg });
  50. },
  51. },
  52. };
  53. </script>