myDetail.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 && this.$store.getters.organization.name;
  38. },
  39. methods: {
  40. logout() {
  41. uni.showModal({
  42. title: '有极提示',
  43. content: '是否退出登录',
  44. success: res => {
  45. if (res.confirm) {
  46. this.$chat.disConnect();
  47. uni.removeStorageSync('token');
  48. uni.removeStorageSync('chatToken');
  49. uni.removeStorageSync('vuex_state');
  50. this.$store.dispatch('app/changeOrganization', {});
  51. this.$store.dispatch('app/changeProject', {});
  52. this.$store.dispatch('app/changeUser', {});
  53. this.$store.dispatch('app/changeIdentity', {});
  54. this.$toast('退出成功');
  55. setTimeout(() => {
  56. this.$navigateBack();
  57. }, 400)
  58. }
  59. }
  60. });
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss">
  66. .detail-content {
  67. padding: 30rpx;
  68. .detail-avatar {
  69. width: 80rpx;
  70. height: 80rpx;
  71. border-radius: 50%;
  72. }
  73. .detail-box {
  74. background: #fff;
  75. border-radius: 16rpx;
  76. padding: 30rpx;
  77. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  78. }
  79. .detail-label {
  80. color: $uni-secondary-color;
  81. font-weight: 300;
  82. margin-bottom: 10rpx;
  83. }
  84. .detail-value {
  85. font-size: 32rpx;
  86. color: $uni-base-color;
  87. }
  88. .detail-item {
  89. margin-bottom: 20rpx;
  90. }
  91. .logout {
  92. margin-top: 40rpx;
  93. background: $uni-error;
  94. color: #fff;
  95. height: 68rpx;
  96. line-height: 68rpx;
  97. border-radius: 68rpx;
  98. text-align: center;
  99. }
  100. }
  101. </style>