myCenter.vue 2.3 KB

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