submit-register.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. code: this.accountCode,
  59. password: e.newPassword,
  60. re_password: e.confirmPassword
  61. }
  62. if (this.invitationCode) {
  63. obj.extension_code = this.invitationCode
  64. }
  65. Api_submitRegister(obj).then(res => {
  66. uni.showToast({
  67. title: '注册成功',
  68. icon: 'none'
  69. })
  70. setTimeout(() => {
  71. reverseBack('pages/login/index')
  72. // setTimeout(() => {
  73. // uni.redirectTo({
  74. // url: ''
  75. // });
  76. // }, 300)
  77. }, 200)
  78. }).catch(err => {}).finally(() => {
  79. uni.hideLoading()
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. @import "~./common.scss";
  87. </style>