index.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="details_container">
  3. <custom-nav-bar title="个人资料" />
  4. <view class="info_list">
  5. <user-info-row-item class="info_item" lable="头像" arrow>
  6. <my-avatar
  7. :src="sourceInfo.faceURL"
  8. :desc="sourceInfo.nickname"
  9. size="26"
  10. />
  11. </user-info-row-item>
  12. <user-info-row-item class="info_item" lable="昵称" arrow>
  13. <text class="right_content">{{ sourceInfo.nickname }}</text>
  14. </user-info-row-item>
  15. <user-info-row-item class="info_item" lable="性别" arrow>
  16. <text class="right_content">{{ getGender }}</text>
  17. </user-info-row-item>
  18. <user-info-row-item class="info_item" lable="生日" arrow>
  19. <text class="right_content">{{ getBirthStr }}</text>
  20. </user-info-row-item>
  21. </view>
  22. <view class="info_list">
  23. <user-info-row-item class="info_item" lable="手机号码" arrow>
  24. <text class="right_content">{{ sourceInfo.phoneNumber || "-" }}</text>
  25. </user-info-row-item>
  26. <user-info-row-item class="info_item" lable="邮箱" arrow>
  27. <text class="right_content">{{ sourceInfo.email || "-" }}</text>
  28. </user-info-row-item>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import dayjs from "dayjs";
  34. import CustomNavBar from "../../../components/CustomNavBar/index.vue";
  35. import MyAvatar from "../../../components/MyAvatar/index.vue";
  36. import UserInfoRowItem from "../userCard/components/UserInfoRowItem.vue";
  37. export default {
  38. components: {
  39. CustomNavBar,
  40. MyAvatar,
  41. UserInfoRowItem,
  42. },
  43. data() {
  44. return {
  45. sourceInfo: {},
  46. };
  47. },
  48. computed: {
  49. getGender() {
  50. if (this.sourceInfo.gender === 1) {
  51. return "男";
  52. }
  53. if (this.sourceInfo.gender === 2) {
  54. return "女";
  55. }
  56. return "保密";
  57. },
  58. getBirthStr() {
  59. const birth = this.sourceInfo.birth ?? 0;
  60. return dayjs(birth).format("YYYY-MM-DD");
  61. },
  62. },
  63. onLoad(options) {
  64. const { sourceInfo } = options;
  65. this.sourceInfo = JSON.parse(sourceInfo);
  66. },
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. .details_container {
  71. @include colBox(false);
  72. height: 100vh;
  73. background-color: #f6f6f6;
  74. .info_list {
  75. border-radius: 6px;
  76. overflow: hidden;
  77. margin: 24rpx;
  78. .info_item {
  79. background-color: #fff;
  80. // border-bottom: 1px solid rgba(153, 153, 153, 0.3);
  81. .right_content {
  82. color: #999;
  83. }
  84. }
  85. }
  86. }
  87. </style>