myDetail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="detail-content">
  3. <view class="detail-box">
  4. <view class="detail-item">
  5. <view class="detail-label">头像</view>
  6. <image class="detail-avatar" :src="user.portrait" mode="aspectFill"></image>
  7. </view>
  8. <view class="detail-item">
  9. <view class="detail-label">姓名</view>
  10. <view class="detail-value">{{user.userName}}</view>
  11. </view>
  12. <view class="detail-item">
  13. <view class="detail-label">所属组织</view>
  14. <view class="detail-value">{{user.organizedName}}</view>
  15. </view>
  16. <view class="detail-item">
  17. <view class="detail-label">手机号</view>
  18. <view class="detail-value">{{user.phone}}</view>
  19. </view>
  20. <view class="detail-item">
  21. <view class="detail-label">性别</view>
  22. <view class="detail-value">{{user.sex === 'W'?'女':'男'}}</view>
  23. </view>
  24. </view>
  25. <view class="logout" @click="logout">退出登录</view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. user: {}
  33. }
  34. },
  35. onShow() {
  36. this.user = this.$store.getters.user;
  37. this.user.organizedName = this.$store.getters.organization.name;
  38. console.log(this.user);
  39. },
  40. methods: {
  41. logout() {
  42. uni.showModal({
  43. title: '有极提示',
  44. content: '是否退出登录',
  45. success: res => {
  46. if (res.confirm) {
  47. uni.removeStorageSync('token');
  48. uni.removeStorageSync('chatToken');
  49. uni.switchTab({
  50. url: '/pages/highseas/highseas'
  51. })
  52. this.$toast('退出成功');
  53. }
  54. }
  55. });
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. .detail-content {
  62. padding: 30rpx;
  63. .detail-avatar {
  64. width: 80rpx;
  65. height: 80rpx;
  66. border-radius: 50%;
  67. }
  68. .detail-box {
  69. background: #fff;
  70. border-radius: 16rpx;
  71. padding: 30rpx;
  72. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  73. }
  74. .detail-label {
  75. color: $uni-secondary-color;
  76. font-weight: 300;
  77. margin-bottom: 10rpx;
  78. }
  79. .detail-value {
  80. font-size: 32rpx;
  81. color: $uni-base-color;
  82. }
  83. .detail-item {
  84. margin-bottom: 20rpx;
  85. }
  86. .logout {
  87. margin-top: 40rpx;
  88. background: $uni-error;
  89. color: #fff;
  90. height: 68rpx;
  91. line-height: 68rpx;
  92. border-radius: 68rpx;
  93. text-align: center;
  94. }
  95. }
  96. </style>