my.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="settings-page">
  3. <!-- 顶部用户信息 -->
  4. <view class="user-header">
  5. <view class="user-info">
  6. <u-avatar :size="50"
  7. src="https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png"></u-avatar>
  8. <view class="greeting">
  9. <text class="time">下午好!</text>
  10. <text class="name">涨涨涨</text>
  11. </view>
  12. </view>
  13. </view>
  14. <!-- 设置列表 -->
  15. <view class="settings-list">
  16. <u-cell-group :border="false">
  17. <u-cell v-for="(item, index) in settingsList" :key="index" :title="item.title" :isLink="true"
  18. @click="handleClick(item)" :border="index==settingsList.length-1?false:true">
  19. <template #icon>
  20. <view class="cell-icon">
  21. <u-icon :name="item.icon||'setting'" size="20" color="#333"></u-icon>
  22. </view>
  23. </template>
  24. </u-cell>
  25. </u-cell-group>
  26. </view>
  27. </view>
  28. </template>
  29. <script setup>
  30. import {
  31. ref
  32. } from 'vue'
  33. const settingsList = ref([{
  34. title: '用户信息',
  35. path: '/pages/my/page/user-info',
  36. },
  37. {
  38. title: '默认仓库',
  39. path: '/pages/my/page/warehouse',
  40. },
  41. {
  42. title: '学校设置',
  43. path: '/pages/my/page/school'
  44. },
  45. {
  46. title: '审核未完成',
  47. path: '/pages/my/page/audit-unfinished',
  48. },
  49. {
  50. title: '版本设置',
  51. path: '/pages/my/page/version',
  52. icon: 'tags'
  53. },
  54. {
  55. title: '音频设置',
  56. path: '/pages/my/page/volume',
  57. },
  58. {
  59. title: '图书显示设置',
  60. path: '/pages/my/page/book-display',
  61. },
  62. {
  63. title: '修改密码',
  64. icon: 'lock',
  65. path: '/pages/my/page/password'
  66. },
  67. {
  68. title: '退出账号',
  69. path: '/pages/my/page/logout',
  70. }
  71. ])
  72. const handleClick = (item) => {
  73. if (item.type === 'logout') {
  74. uni.showModal({
  75. title: '提示',
  76. content: '确定要退出登录吗?',
  77. success: (res) => {
  78. if (res.confirm) {
  79. // 执行退出登录逻辑
  80. uni.clearStorageSync()
  81. uni.reLaunch({
  82. url: '/pages/login/index'
  83. })
  84. }
  85. }
  86. })
  87. return
  88. }
  89. uni.navigateTo({
  90. url: item.path
  91. })
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .settings-page {
  96. .user-header {
  97. background: #4CD964;
  98. padding: 40rpx 32rpx;
  99. .user-info {
  100. display: flex;
  101. align-items: center;
  102. .greeting {
  103. display: flex;
  104. flex-direction: column;
  105. margin-left: 20rpx;
  106. .time {
  107. font-size: 32rpx;
  108. color: #FFFFFF;
  109. margin-bottom: 8rpx;
  110. }
  111. .name {
  112. font-size: 36rpx;
  113. color: #FFFFFF;
  114. font-weight: 500;
  115. }
  116. }
  117. }
  118. }
  119. :deep(.u-cell) {
  120. .u-cell__body {
  121. padding: 15px;
  122. }
  123. }
  124. .settings-list {
  125. padding: 20rpx;
  126. :deep(.u-cell-group) {
  127. border-radius: 16rpx;
  128. overflow: hidden;
  129. background: #FFFFFF;
  130. }
  131. }
  132. }
  133. </style>