auth-identity.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="auth-identity">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <view class="app-item item">
  6. <text>邀请人</text>
  7. <text>{{ userinfo.recom_nickname }}</text>
  8. </view>
  9. <view class="app-item item">
  10. <text>联系方式</text>
  11. <text>{{ userinfo.recom_mobile }}</text>
  12. </view>
  13. <view class="app-item item item-space">
  14. <text>微信昵称</text>
  15. <input v-model="wx_nickname" placeholder="请填写微信昵称" />
  16. </view>
  17. <view class="app-item item">
  18. <text>真实姓名</text>
  19. <input v-model="real_name" maxlength="32" placeholder="请填写真实姓名" />
  20. </view>
  21. <view class="app-item item">
  22. <text>身份证号</text>
  23. <input type="number" @input="inputChange" v-model="id_card_num" maxlength="18" placeholder="请填写身份证号" />
  24. </view>
  25. <button class="big-btn bg" @tap="submit">提交</button>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import { _API_SubAuthInfo } from '@/apis/user.js'
  31. export default {
  32. data() {
  33. return {
  34. title: '身份认证',
  35. wx_nickname: '',
  36. real_name: '',
  37. id_card_num: ''
  38. }
  39. },
  40. computed: {
  41. userinfo() {
  42. return this.$store.state.userinfo
  43. }
  44. },
  45. methods: {
  46. inputChange() {
  47. this.id_card_num = this.id_card_num.trim()
  48. },
  49. submit() { // 点击提交
  50. if (!this.wx_nickname.length) {
  51. uni.toast('微信昵称不能为空')
  52. return
  53. }
  54. if (!this.real_name.match(/^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/)) {
  55. uni.toast('真实姓名不符合要求')
  56. return
  57. }
  58. if (!this.id_card_num.match(/^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/)) {
  59. uni.toast('身份号码不合法')
  60. return
  61. }
  62. uni.showLoading({ mask: true }) // 显示 loading
  63. _API_SubAuthInfo({ // 提交信息
  64. wechatname: this.wx_nickname,
  65. realname: this.real_name,
  66. cre_num: this.id_card_num
  67. }).then(res => {
  68. if (res.code === 200) { // 提交成功
  69. this.$store.commit('userinfo/UPDATA_USERINFO', { cert_status: 1 })
  70. uni.redirectTo({ url:'../auth-progress/auth-progress' }) // redirect 到 审核进度页面
  71. } else if (res.code === 300) {
  72. uni.showToast({ duration: 3333, title: res.message })
  73. }
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .auth-identity {
  81. @include page();
  82. .content {
  83. }
  84. }
  85. </style>