my.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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="32rpx" 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. icon: "account"
  37. },
  38. {
  39. title: '默认仓库',
  40. path: '/pages/my/page/warehouse',
  41. icon: 'home'
  42. },
  43. {
  44. title: '学校设置',
  45. path: '/pages/my/page/school'
  46. },
  47. {
  48. title: '审核未完成',
  49. path: '/pages/my/page/audit-unfinished',
  50. icon: "order"
  51. },
  52. {
  53. title: '版本设置',
  54. path: '/pages/my/page/version',
  55. icon: 'tags'
  56. },
  57. {
  58. title: '音频设置',
  59. path: '/pages/my/page/volume',
  60. icon: 'volume'
  61. },
  62. {
  63. title: '图书显示设置',
  64. path: '/pages/my/page/book-display',
  65. icon: 'bookmark'
  66. },
  67. {
  68. title: '修改密码',
  69. icon: 'lock',
  70. path: '/pages/my/page/password'
  71. },
  72. {
  73. title: '退出账号',
  74. path: '/pages/my/page/logout',
  75. type: 'logout'
  76. }
  77. ])
  78. const handleClick = (item) => {
  79. if (item.type === 'logout') {
  80. uni.showModal({
  81. title: '提示',
  82. content: '确定要退出登录吗?',
  83. success: (res) => {
  84. if (res.confirm) {
  85. // 执行退出登录逻辑
  86. uni.clearStorageSync()
  87. uni.reLaunch({
  88. url: '/pages/login/index'
  89. })
  90. }
  91. }
  92. })
  93. return
  94. }
  95. uni.navigateTo({
  96. url: item.path
  97. })
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .settings-page {
  102. .user-header {
  103. background: #4CD964;
  104. padding: 40rpx 32rpx;
  105. .user-info {
  106. display: flex;
  107. align-items: center;
  108. .greeting {
  109. display: flex;
  110. flex-direction: column;
  111. margin-left: 20rpx;
  112. .time {
  113. font-size: 32rpx;
  114. color: #FFFFFF;
  115. margin-bottom: 8rpx;
  116. }
  117. .name {
  118. font-size: 36rpx;
  119. color: #FFFFFF;
  120. font-weight: 500;
  121. }
  122. }
  123. }
  124. }
  125. :deep(.u-cell) {
  126. .u-cell__body {
  127. padding: 15px;
  128. }
  129. }
  130. .settings-list {
  131. padding: 20rpx;
  132. :deep(.u-cell-group) {
  133. border-radius: 16rpx;
  134. overflow: hidden;
  135. background: #FFFFFF;
  136. }
  137. }
  138. }
  139. </style>