setting.uvue 2.2 KB

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