UserCenter.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <HeaderNav headerText="个人中心"></HeaderNav>
  3. <div class="user-center">
  4. <div class="user-info">
  5. <div class="info-left">
  6. <img src="../../assets/img/index/user/default-head.png" alt="" />
  7. <div class="left-message">
  8. <div class="name pf500 fs18 fc061237">用户昵称</div>
  9. </div>
  10. </div>
  11. <div class="info-right pf400 fs12 fcFFFFFF" @click="updateInfoFlag = true">
  12. 编辑
  13. </div>
  14. </div>
  15. <div class="notifi-index">
  16. <div class="notifi-classifi">
  17. <div class="pf600 fs18 fc121212" @click="messageChange('userInfo')">个人资料</div>
  18. <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('safetySet')">
  19. 安全设置
  20. </div>
  21. <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('hobbySet')">
  22. 偏好设置
  23. </div>
  24. </div>
  25. <component :is="currentComponent" />
  26. </div>
  27. </div>
  28. <UpdateInfo v-show="updateInfoFlag" @updateInfoClose="updateInfoClose"></UpdateInfo>
  29. </template>
  30. <script setup>
  31. import HeaderNav from "./components/HeaderNav.vue";
  32. import HobbySet from "./user/HobbySet.vue";
  33. import SafetySet from "./user/SafetySet.vue";
  34. import UserInfo from "./user/UserInfo.vue";
  35. import UpdateInfo from "./dialog/UpdateInfo.vue";
  36. import { ref, computed } from "vue";
  37. const updateInfoFlag = ref(false);
  38. const updateInfoClose = () => {
  39. updateInfoFlag.value = false;
  40. };
  41. const current = ref("userInfo");
  42. const componentsMap = {
  43. hobbySet: HobbySet,
  44. safetySet: SafetySet,
  45. userInfo: UserInfo,
  46. };
  47. const currentComponent = computed(() => componentsMap[current.value]);
  48. const messageChange = (key) => {
  49. current.value = key;
  50. };
  51. </script>
  52. <style lang="less" scoped>
  53. .user-center {
  54. display: flex;
  55. flex-direction: column;
  56. justify-content: flex-start;
  57. align-items: center;
  58. width: 100%;
  59. .user-info {
  60. display: flex;
  61. flex-direction: row;
  62. justify-content: space-between;
  63. align-items: center;
  64. margin-top: 48px;
  65. width: 345px;
  66. height: 56px;
  67. .info-left {
  68. display: flex;
  69. flex-direction: row;
  70. justify-content: flex-start;
  71. height: 56px;
  72. img {
  73. width: 56px;
  74. height: 56px;
  75. }
  76. .left-message {
  77. display: flex;
  78. flex-direction: column;
  79. justify-content: center;
  80. margin-left: 16px;
  81. height: 56px;
  82. }
  83. }
  84. .info-right {
  85. width: 60px;
  86. height: 24px;
  87. line-height: 24px;
  88. text-align: center;
  89. background: #df384c;
  90. border-radius: 5px;
  91. }
  92. }
  93. .notifi-classifi {
  94. display: flex;
  95. flex-direction: row;
  96. justify-content: flex-start;
  97. align-items: flex-end;
  98. margin-top: 15px;
  99. width: 349px;
  100. height: 24px;
  101. .sys-notifi {
  102. margin-left: 43px;
  103. }
  104. }
  105. }
  106. </style>