submit-register.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view>
  3. <!-- 头部 -->
  4. <headContent>
  5. <template #left>
  6. <view class="head-revers-back iconfont" @click.stop="reversBackBtn()">&#xe604;</view>
  7. </template>
  8. </headContent>
  9. <view class="page-content">
  10. <text class="login-title">设置密码</text>
  11. <setPswd @submitPswd="submitPswd" />
  12. </view>
  13. <load ref="loadRef" />
  14. </view>
  15. </template>
  16. <script>
  17. import setPswd from "./modules/set-pswd.vue"
  18. import {
  19. reverseBack
  20. } from "@/utils/common.js"
  21. import {
  22. Api_setPassword,
  23. Api_submitRegister
  24. } from "@/api/index.js"
  25. export default {
  26. name: 'submit-register',
  27. components: {
  28. setPswd
  29. },
  30. data() {
  31. return {
  32. type: '',
  33. account: '',
  34. accountCode: '',
  35. invitationCode: ''
  36. };
  37. },
  38. onLoad(opt) {
  39. // type=0&account=13133111133&invitationCode=1&accountCode=123456
  40. this.type = opt?.type;
  41. this.account = opt?.account;
  42. this.accountCode = opt?.accountCode;
  43. this.invitationCode = opt?.invitationCode;
  44. },
  45. mounted() {
  46. },
  47. methods: {
  48. reversBackBtn() {
  49. reverseBack()
  50. },
  51. submitPswd(e) {
  52. uni.showLoading({
  53. title: ''
  54. })
  55. const obj = {
  56. type: this.type == 1 ? 'email' : 'mogile',
  57. user_string: this.account,
  58. invitationCode: this.invitationCode,
  59. password: e.newPassword,
  60. re_password: e.confirmPassword
  61. }
  62. Api_submitRegister(obj).then(res => {
  63. setTimeout(() => {
  64. uni.showToast({
  65. title: '注册成功',
  66. icon: 'none'
  67. })
  68. setTimeout(() => {
  69. uni.redirectTo({
  70. url: '/pages/login/index'
  71. });
  72. }, 300)
  73. }, 200)
  74. }).catch(err => {}).finally(() => {
  75. uni.hideLoading()
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. @import "~./common.scss";
  83. </style>