myAccount.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view>
  3. <view class="top">
  4. <!-- #ifdef MP-WEIXIN -->
  5. <NavigateBar title="我的账户" control="back" bgcolor="#a09cc4"></NavigateBar>
  6. <!-- #endif -->
  7. <!-- #ifdef MP-ALIPAY -->
  8. <NavigateBar title="我的账户" bgcolor="#a09cc4"></NavigateBar>
  9. <!-- #endif -->
  10. </view>
  11. <view class="infoItem">
  12. <u-text text="姓名"></u-text>
  13. <u-text :text="name" align="right"></u-text>
  14. </view>
  15. <view class="infoItem">
  16. <u-text text="身份证号"></u-text>
  17. <u-text :text="idNumber" align="right"></u-text>
  18. </view>
  19. <view class="infoItem">
  20. <u-text text="手机号"></u-text>
  21. <u-text :text="phone" align="right"></u-text>
  22. </view>
  23. <view>
  24. <u-modal :show="modalShow" :content="modalContent" @confirm="modalConfirm"></u-modal>
  25. </view>
  26. <view class="btn">
  27. <u-button text="修改信息" color="#a09cc4" @click="gotoUpdateNameAndIdNumber"></u-button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. stringHasText
  34. } from '../../utils/commonUtils.js'
  35. import {
  36. mapMutations,
  37. mapState
  38. } from 'vuex'
  39. import NavigateBar from "../../components/navigateBar/navigate-bar.vue";
  40. export default {
  41. components: {
  42. NavigateBar
  43. },
  44. data() {
  45. return {
  46. name: '',
  47. phone: '',
  48. idNumber: '',
  49. canNameUpdate: false,
  50. modalShow: false,
  51. modalContent: '请完善姓名及身份证号以正常使用!'
  52. };
  53. },
  54. computed: {
  55. ...mapState('m_user', ['token', 'userInfo'])
  56. },
  57. methods: {
  58. modalConfirm(){
  59. this.modalShow=false
  60. this.gotoUpdateNameAndIdNumber()
  61. },
  62. gotoUpdateNameAndIdNumber() {
  63. uni.navigateTo({
  64. url: '/subpkg/updateNameAndIdNumber/updateNameAndIdNumber'
  65. })
  66. }
  67. },
  68. onShow() {
  69. if (!stringHasText(this.userInfo.name) || !stringHasText(this.userInfo.idNumber)) {
  70. this.modalShow = true
  71. } else {
  72. this.name = this.userInfo.name ? this.userInfo.name[0] + '**' : '';
  73. this.idNumber = this.userInfo.idNumber.slice(0, 6) + '********' + this.userInfo.idNumber.slice(14, 18);
  74. this.phone = this.userInfo.phone;
  75. }
  76. },
  77. // #ifdef MP-WEIXIN
  78. onShareAppMessage(info) {
  79. return {
  80. title: '源享住',
  81. path: 'pages/login/login',
  82. imageUrl: "/static/logo.png"
  83. }
  84. }
  85. // #endif
  86. }
  87. </script>
  88. <style lang="scss">
  89. .infoItem {
  90. height: 100rpx;
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. margin: 0 40rpx;
  95. border-bottom: black 1px solid;
  96. }
  97. .btn {
  98. margin: 40rpx auto;
  99. width: 80vw;
  100. color: #FFFFFF;
  101. }
  102. </style>