personal_message.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="container">
  3. <!-- 用户头像 -->
  4. <image :src="headImg" class="avatar"></image>
  5. <!-- 用户名及职位 -->
  6. <text class="username">{{ userInfo.name }}</text>
  7. <view class="position" v-for="(item,index) in userInfo.department" :key="index">
  8. {{ item.departmentName }}--{{item.position}}
  9. </view>
  10. <!-- 联系方式 -->
  11. <view class="contact-info">
  12. <view class="info-item">
  13. <view>
  14. <uni-icons type="phone" size="20"></uni-icons>
  15. <text>手机</text>
  16. </view>
  17. <text class="lastText">{{ userInfo.phone || '暂无' }}</text>
  18. </view>
  19. <view class="info-item">
  20. <view>
  21. <uni-icons type="email" size="20"></uni-icons>
  22. <text>邮箱</text>
  23. </view>
  24. <text class="lastText">{{ userInfo.email || '暂无' }}</text>
  25. </view>
  26. </view>
  27. <!-- 个人信息 -->
  28. <view class="personal-info">
  29. <view class="info-item">
  30. <view>
  31. <uni-icons type="person" size="20"></uni-icons>
  32. <text>性别</text>
  33. </view>
  34. <text class="lastText">{{ userInfo.gender || '暂无' }}</text>
  35. </view>
  36. <view class="info-item">
  37. <view>
  38. <uni-icons type="star" size="20"></uni-icons>
  39. <text>生日</text>
  40. </view>
  41. <text class="lastText">{{ userInfo.birthday || '暂无' }}</text>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script setup>
  47. import { ref } from 'vue';
  48. import headImg from "@/static/images/mine/headImg.jpg";
  49. import {
  50. onLoad
  51. } from '@dcloudio/uni-app'
  52. // 监听页面加载
  53. onLoad((options) => {
  54. // 获取传入的标题参数
  55. const name = options.name;
  56. const id = options.id;
  57. console.log('id', id);
  58. if (name) {
  59. // 设置导航栏标题
  60. uni.setNavigationBarTitle({
  61. title: name + "的信息"
  62. });
  63. userInfo.value.name = name
  64. }
  65. })
  66. // 定义个人信息数据
  67. const userInfo = ref({
  68. name: "张三",
  69. department: [{
  70. departmentName: "研发部",
  71. position: '软件开发工程师'
  72. },
  73. {
  74. departmentName: "业务部",
  75. position: '销售经理'
  76. },
  77. ],
  78. phone: "13579543684",
  79. email: "",
  80. gender: "男",
  81. birthday: "2000-01-10"
  82. });
  83. </script>
  84. <style lang="scss" scoped>
  85. .container {
  86. padding: 20px;
  87. background-color: #f8f8f8;
  88. height: 100vh;
  89. box-sizing: border-box;
  90. }
  91. .avatar {
  92. width: 80px;
  93. height: 80px;
  94. border-radius: 50%;
  95. margin-bottom: 15px;
  96. display: block;
  97. margin-left: auto;
  98. margin-right: auto;
  99. }
  100. .username {
  101. font-size: 18px;
  102. }
  103. .position {
  104. font-size: 14px;
  105. color: #666;
  106. margin: 10px auto;
  107. }
  108. .contact-info,
  109. .personal-info {
  110. background-color: #fff;
  111. border-radius: 8px;
  112. overflow: hidden;
  113. margin-bottom: 15px;
  114. }
  115. .info-item {
  116. padding: 12px 16px;
  117. border-top: 1px solid #eee;
  118. font-size: 16px;
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. }
  123. .lastText {
  124. color: #999;
  125. }
  126. </style>