systemSettings.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="my-container">
  3. <!-- 用户信息卡片 -->
  4. <view class="user-card">
  5. <view class="avatar">
  6. <image :src="userInfo.avatar || '/static/default-avatar.png'" mode="aspectFill"></image>
  7. </view>
  8. <view class="user-info">
  9. <view class="info-item">
  10. <text class="label">姓名:</text>
  11. <text class="value">{{ userInfo.name || '未设置' }}</text>
  12. </view>
  13. <view class="info-item">
  14. <text class="label">手机号:</text>
  15. <text class="value">{{ userInfo.phone || '未设置' }}</text>
  16. </view>
  17. <view class="info-item">
  18. <text class="label">所属企业:</text>
  19. <text class="value">{{ userInfo.company || '未设置' }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 退出按钮 -->
  24. <view class="logout-section">
  25. <button class="logout-btn" @click="handleLogout">退出账号</button>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. userInfo: uni.getStorageSync('userInfo') || {}
  34. }
  35. },
  36. methods: {
  37. handleLogout() {
  38. uni.showModal({
  39. title: '提示',
  40. content: '确定要退出账号吗?',
  41. success: (res) => {
  42. if (res.confirm) {
  43. // 清除token和用户信息
  44. uni.removeStorageSync('token');
  45. uni.removeStorageSync('userInfo');
  46. // 跳转到登录页
  47. uni.reLaunch({
  48. url: '/pages/login/login'
  49. });
  50. }
  51. }
  52. });
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .my-container {
  59. min-height: 100vh;
  60. background: linear-gradient(#cfddfc 0%, #e6eeff 10%, #fff 100%);
  61. padding: 30rpx;
  62. }
  63. .user-card {
  64. background-color: #fff;
  65. border-radius: 16rpx;
  66. padding: 40rpx;
  67. margin-bottom: 30rpx;
  68. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
  69. .avatar {
  70. text-align: center;
  71. margin-bottom: 30rpx;
  72. image {
  73. width: 150rpx;
  74. height: 150rpx;
  75. border-radius: 75rpx;
  76. border: 4rpx solid #e6eeff;
  77. }
  78. }
  79. .user-info {
  80. .info-item {
  81. display: flex;
  82. padding: 20rpx 0;
  83. border-bottom: 1rpx solid #eee;
  84. &:last-child {
  85. border-bottom: none;
  86. }
  87. .label {
  88. width: 160rpx;
  89. color: #666;
  90. font-size: 28rpx;
  91. }
  92. .value {
  93. flex: 1;
  94. color: #333;
  95. font-size: 28rpx;
  96. }
  97. }
  98. }
  99. }
  100. .logout-section {
  101. margin-top: 60rpx;
  102. padding: 0 40rpx;
  103. .logout-btn {
  104. width: 100%;
  105. height: 88rpx;
  106. line-height: 88rpx;
  107. background-color: #f44336;
  108. color: #fff;
  109. font-size: 32rpx;
  110. border-radius: 44rpx;
  111. &:active {
  112. opacity: 0.8;
  113. }
  114. }
  115. }
  116. </style>