setting.uvue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="setting-page">
  3. <view class="setting-list">
  4. <view class="setting-item" @click="goToAccountSecurity">
  5. <text class="item-text">
  6. 账号安全
  7. </text>
  8. <u-icon name="arrow-right" size="18" color="#999" />
  9. </view>
  10. <view class="setting-item" @click="goToFeedback">
  11. <text class="item-text">
  12. 意见反馈
  13. </text>
  14. <u-icon name="arrow-right" size="18" color="#999" />
  15. </view>
  16. <view class="setting-item" @click="goToAbout">
  17. <text class="item-text">
  18. 关于我们
  19. </text>
  20. <u-icon name="arrow-right" size="18" color="#999" />
  21. </view>
  22. </view>
  23. <view class="logout-section">
  24. <button class="logout-btn" @click="doLogout">
  25. 退出登录
  26. </button>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup lang="ts">
  31. const goToAccountSecurity = () => {
  32. uni.navigateTo({
  33. url: '/pages/myEdit/account-security'
  34. })
  35. }
  36. const goToFeedback = () => {
  37. uni.navigateTo({
  38. url: '/pages/myEdit/feedback'
  39. })
  40. }
  41. const goToAbout = () => {
  42. uni.navigateTo({
  43. url: '/pages/myEdit/about'
  44. })
  45. }
  46. const doLogout = () => {
  47. // 清除本地 token 或其他信息
  48. uni.removeStorageSync('token');
  49. uni.showToast({ title: '已退出登录', icon: 'success' });
  50. setTimeout(() => {
  51. uni.reLaunch({
  52. url: '/pages/login/login'
  53. })
  54. }, 500)
  55. }
  56. </script>
  57. <style>
  58. .setting-page {
  59. background: #f7f8fa;
  60. padding-top: 20rpx;
  61. display: flex;
  62. flex-direction: column;
  63. justify-content: space-between;
  64. }
  65. .setting-list {
  66. background: #fff;
  67. border-radius: 20rpx;
  68. margin: 24rpx 24rpx 0 24rpx;
  69. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  70. overflow: hidden;
  71. }
  72. .setting-item {
  73. display: flex;
  74. align-items: center;
  75. justify-content: space-between;
  76. padding: 32rpx 24rpx;
  77. border-bottom: 1rpx solid #f1f1f1;
  78. font-size: 30rpx;
  79. color: #222;
  80. background: #fff;
  81. }
  82. .setting-item:last-child {
  83. border-bottom: none;
  84. }
  85. .item-text {
  86. }
  87. .logout-section {
  88. margin-top: auto;
  89. margin-bottom: 60rpx;
  90. padding: 0 24rpx;
  91. }
  92. .logout-btn {
  93. width: 100%;
  94. color: #000;
  95. border-radius: 40rpx;
  96. font-size: 32rpx;
  97. padding: 26rpx 0;
  98. border: none;
  99. box-shadow: 0 4rpx 10rpx rgba(186, 171, 171, 0.1);
  100. font-weight: bold;
  101. border: 1rpx solid #000;
  102. }
  103. </style>