myAccount.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="page">
  3. <view class="infoItem" @click="gotoUpdateName">
  4. <text class="tip">姓名</text>
  5. <text class="info">{{name}}</text>
  6. </view>
  7. <view class="infoItem" @click="gotoUpdateIdNumber">
  8. <text class="tip">身份证号</text>
  9. <text class="info">{{idNumber}}</text>
  10. </view>
  11. <view class="infoItem">
  12. <text class="tip">手机号</text>
  13. <text class="info">{{phone}}</text>
  14. </view>
  15. <view class="infoItem">
  16. <text class="tip">邮箱</text>
  17. <text class="info">{{email}}</text>
  18. </view>
  19. <view>
  20. <u-modal :show="modalShow" :content="modalContent" @confirm="modalShow=false"></u-modal>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. mapMutations,
  27. mapState
  28. } from 'vuex'
  29. export default {
  30. data() {
  31. return {
  32. name: '',
  33. phone: '',
  34. email: '',
  35. idNumber: '',
  36. canNameUpdate: false,
  37. modalShow: false,
  38. modalContent: '请完善姓名及身份证号以正常使用!'
  39. };
  40. },
  41. computed: {
  42. ...mapState('m_user', ['token', 'userInfo'])
  43. },
  44. methods: {
  45. gotoUpdateName() {
  46. if (this.canNameUpdate) {
  47. uni.navigateTo({
  48. url: '/subpkg/updateName/updateName'
  49. })
  50. } else {
  51. uni.$showMsg('您已修改过姓名,无法再次修改')
  52. }
  53. },
  54. gotoUpdateIdNumber() {
  55. uni.navigateTo({
  56. url: '/subpkg/updateIdNumber/updateIdNumber'
  57. })
  58. }
  59. },
  60. onShow() {
  61. this.canNameUpdate = this.userInfo.canNameUpdate;
  62. this.name = (this.userInfo.name ? this.userInfo.name[0] + '**' : '') + (this.userInfo.canNameUpdate ? ' >' :
  63. '');
  64. this.idNumber = (this.userInfo.idNumber ?
  65. this.userInfo.idNumber.slice(0, 6) + '********' + this.userInfo.idNumber.slice(14, 18) :
  66. '立即完善') + ' >';
  67. this.phone = (this.userInfo.phone ? this.userInfo.phone.slice(0, 3) + '****' + this.userInfo.phone.slice(7,
  68. 11) : '') + ' >';
  69. this.email = (this.userInfo.email || '') + '无 >';
  70. },
  71. onLoad(options) {
  72. if (options.needSetIdNumber === 'true') {
  73. this.modalShow = true
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .page {
  80. background-color: #F5F5F5;
  81. }
  82. .infoItem {
  83. height: 100rpx;
  84. display: flex;
  85. justify-content: space-between;
  86. align-items: center;
  87. margin: 0 40rpx;
  88. border-bottom: black 1px solid;
  89. }
  90. </style>