myCenter.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="container">
  3. <!-- 顶部个人信息区域 -->
  4. <view class="header">
  5. <img class="header_img" src="../../static/images/center-bg.png" />
  6. <img
  7. mode="aspectFill"
  8. class="user_photo"
  9. :src="userInfo.headImage || '../../static/images/header.png'"
  10. @click="previewImage(userInfo.headImage || '../../static/images/header.png')"
  11. />
  12. <view class="user_name">{{ userInfo.name }}</view>
  13. <view class="user_grade">{{ userInfo.departmentName }}</view>
  14. </view>
  15. <!-- 列表区域 -->
  16. <view class="body">
  17. <!-- 每一个盒子区域 -->
  18. <view class="body_box" v-for="item in list" :key="item.id" @click="goPage(item.page)">
  19. <img class="box_img" :src="item.url" />
  20. <text class="box_title">{{ item.title }}</text>
  21. <img class="box_icon" src="../../static/images/right.png" />
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script setup>
  27. import { ref } from 'vue'
  28. import { onLoad } from '@dcloudio/uni-app'
  29. import { previewImage } from '@/utils/previewImage.js'
  30. // 用户信息
  31. const userInfo = ref({})
  32. onLoad(() => {
  33. userInfo.value = uni.getStorageSync('userInfo')
  34. })
  35. // 列表信息
  36. const list = ref([
  37. {
  38. id: 1,
  39. title: '我的信息',
  40. url: '../../static/images/message.png',
  41. page: '/pages/myMsg/myMsg'
  42. },
  43. {
  44. id: 2,
  45. title: '消息提醒',
  46. url: '../../static/images/warn.png',
  47. page: '/pages/msgWarn/msgWarn'
  48. }
  49. ])
  50. // 跳转页面函数
  51. const goPage = (url) => {
  52. uni.navigateTo({
  53. url
  54. })
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .container {
  59. padding: 0 20rpx;
  60. min-height: 100vh;
  61. background-color: #f1f6fe;
  62. // 顶部个人信息区域样式
  63. .header {
  64. position: relative;
  65. width: 710rpx;
  66. height: 260rpx;
  67. text-align: end;
  68. overflow: hidden;
  69. .header_img {
  70. margin-top: -24rpx;
  71. margin-right: -45rpx;
  72. width: 589rpx;
  73. height: 320rpx;
  74. }
  75. .user_photo {
  76. position: absolute;
  77. top: 80rpx;
  78. left: 20rpx;
  79. width: 120rpx;
  80. height: 120rpx;
  81. border-radius: 50%;
  82. }
  83. .user_name {
  84. position: absolute;
  85. top: 90rpx;
  86. left: 167rpx;
  87. font-size: 40rpx;
  88. font-weight: bold;
  89. }
  90. .user_grade {
  91. position: absolute;
  92. top: 160rpx;
  93. left: 167rpx;
  94. font-size: 24rpx;
  95. color: #666666;
  96. }
  97. }
  98. // 列表区域样式
  99. .body {
  100. padding: 0 30rpx;
  101. background-color: #fff;
  102. .body_box {
  103. display: flex;
  104. align-items: center;
  105. height: 110rpx;
  106. .box_img {
  107. width: 50rpx;
  108. height: 50rpx;
  109. border-radius: 50%;
  110. }
  111. .box_title {
  112. flex: 1;
  113. margin-left: 18rpx;
  114. font-size: 32rpx;
  115. }
  116. .box_icon {
  117. width: 31rpx;
  118. height: 31rpx;
  119. }
  120. }
  121. }
  122. }
  123. </style>