register-for-invite.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. await registerForInvite(this,this.form);
  39. },
  40. async sendSmsCode() {
  41. const res = await sendSmsCode(this,{
  42. type: 'common',
  43. authorizationType: 4,
  44. phone: this.form.phone,
  45. });
  46. this.$message({ content: res.msg });
  47. },
  48. },
  49. };
  50. </script>