user-info.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="user-info-page">
  3. <!-- 头像区域 -->
  4. <view class="avatar-section">
  5. <view class="avatar-wrap">
  6. <text>头像:</text>
  7. <u-avatar :size="50"
  8. src="https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png"></u-avatar>
  9. <u-button type="success" style="width:200rpx" size="small" @click="handleEditAvatar">去修改</u-button>
  10. </view>
  11. </view>
  12. <!-- 基本信息区域 -->
  13. <view class="info-section">
  14. <view class="section-title">基本信息</view>
  15. <view class="info-card">
  16. <u-cell-group :border="false">
  17. <u-cell title="姓名" :value="userInfo.name || '无'" />
  18. <u-cell title="性别" :value="userInfo.gender || '无'" />
  19. <u-cell title="生日" :value="userInfo.birthday || '无'" />
  20. <u-cell title="学历" :value="userInfo.education || '无'" />
  21. <u-cell title="毕业学校" :value="userInfo.school || '无'" :border="false" />
  22. </u-cell-group>
  23. </view>
  24. </view>
  25. <!-- 账号信息区域 -->
  26. <view class="info-section">
  27. <view class="section-title">用户账号</view>
  28. <view class="info-card">
  29. <u-cell-group :border="false">
  30. <u-cell title="账号" :value="userInfo.account" />
  31. <u-cell title="创建日期" :value="userInfo.createTime" />
  32. <u-cell title="最近登录" :value="userInfo.lastLogin || '--'" :border="false" />
  33. </u-cell-group>
  34. </view>
  35. </view>
  36. <!-- 员工资料区域 -->
  37. <view class="info-section">
  38. <view class="section-title">员工资料</view>
  39. <view class="info-card">
  40. <u-cell-group :border="false">
  41. <u-cell title="公司" :value="userInfo.company || '无'" />
  42. <u-cell title="员工编号" :value="userInfo.employeeId || '无'" />
  43. <u-cell title="职位" :value="userInfo.position || '无'" :border="false" />
  44. </u-cell-group>
  45. </view>
  46. </view>
  47. <!-- 联系方式区域 -->
  48. <view class="info-section">
  49. <view class="section-title">联系方式</view>
  50. <view class="info-card">
  51. <u-cell-group :border="false">
  52. <u-cell title="电话" :value="userInfo.phone" />
  53. <u-cell title="邮箱" :value="userInfo.email || '无'" />
  54. <u-cell title="住址" :value="userInfo.address || '无'" :border="false" />
  55. </u-cell-group>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script setup>
  61. import {
  62. ref
  63. } from 'vue'
  64. const userInfo = ref({
  65. avatar: '/static/images/avatar.jpg',
  66. name: '无',
  67. gender: '无',
  68. birthday: '无',
  69. education: '无',
  70. school: '无',
  71. username: '用户账号',
  72. account: 'fxt',
  73. createTime: '2024-06-12 12:00:00',
  74. lastLogin: '',
  75. company: '无',
  76. employeeId: '无',
  77. position: '无',
  78. phone: '18888888888',
  79. email: '无',
  80. address: '无'
  81. })
  82. const handleEditAvatar = () => {
  83. uni.chooseImage({
  84. count: 1,
  85. success: (res) => {
  86. // 处理头像上传逻辑
  87. console.log('选择的图片:', res.tempFilePaths[0])
  88. }
  89. })
  90. }
  91. </script>
  92. <style>
  93. page {
  94. background: #F5F6FA;
  95. }
  96. </style>
  97. <style lang="scss" scoped>
  98. .user-info-page {
  99. padding: 20rpx;
  100. box-sizing: border-box;
  101. .avatar-section {
  102. background: #FFFFFF;
  103. border-radius: 16rpx;
  104. padding: 40rpx;
  105. margin-bottom: 20rpx;
  106. .avatar-wrap {
  107. display: flex;
  108. align-items: center;
  109. gap: 30rpx;
  110. }
  111. }
  112. .info-section {
  113. margin-bottom: 20rpx;
  114. .section-title {
  115. font-size: 28rpx;
  116. color: #666;
  117. padding: 20rpx 10rpx;
  118. font-weight: 500;
  119. }
  120. .info-card {
  121. background: #FFFFFF;
  122. border-radius: 16rpx;
  123. overflow: hidden;
  124. }
  125. }
  126. }
  127. </style>