register-for-invite.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. name: 'RegisterForInvite',
  19. data() {
  20. return {
  21. form: {
  22. phone: '17603013019',
  23. code: '',
  24. invitationUserName: null,
  25. activityId: null,
  26. },
  27. };
  28. },
  29. fetch() {
  30. this.form.invitationUserName = this.$route.query.invitationUserName;
  31. this.form.activityId = this.$route.query.activityId;
  32. },
  33. head: {
  34. title: '注册',
  35. },
  36. methods: {
  37. async register() {
  38. this.$tongji.trackEvent('活动', '注册', '', 0);
  39. await registerForInvite(this, this.form);
  40. },
  41. async sendSmsCode() {
  42. this.$tongji.trackEvent('活动', '发送短信', '', 0);
  43. const res = await sendSmsCode(this, {
  44. type: 'common',
  45. authorizationType: 4,
  46. phone: this.form.phone,
  47. });
  48. this.$message({ content: res.msg });
  49. },
  50. },
  51. };
  52. </script>