myDetail.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. uni.removeTabBarBadge({
  55. index: 1
  56. })
  57. this.$toast('退出成功');
  58. setTimeout(() => {
  59. this.$navigateBack();
  60. }, 400)
  61. }
  62. }
  63. });
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss">
  69. .detail-content {
  70. padding: 30rpx;
  71. .detail-avatar {
  72. width: 80rpx;
  73. height: 80rpx;
  74. border-radius: 50%;
  75. }
  76. .detail-box {
  77. background: #fff;
  78. border-radius: 16rpx;
  79. padding: 30rpx;
  80. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  81. }
  82. .detail-label {
  83. color: $uni-secondary-color;
  84. font-weight: 300;
  85. margin-bottom: 10rpx;
  86. }
  87. .detail-value {
  88. font-size: 32rpx;
  89. color: $uni-base-color;
  90. }
  91. .detail-item {
  92. margin-bottom: 20rpx;
  93. }
  94. .logout {
  95. margin-top: 40rpx;
  96. background: $uni-error;
  97. color: #fff;
  98. height: 68rpx;
  99. line-height: 68rpx;
  100. border-radius: 68rpx;
  101. text-align: center;
  102. }
  103. }
  104. </style>