settings.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view>
  3. <view class="user_box">
  4. <view class="box_left">
  5. <image class="user_image" :src="userInfo.userpic"></image>
  6. </view>
  7. <view class="box_center">
  8. <view class="user_name">{{ userInfo.username }}</view>
  9. <view class="user_info">{{ userInfo.phone }}</view>
  10. </view>
  11. <view class="box_right"> </view>
  12. </view>
  13. <view class="setting_list">
  14. </view>
  15. <view class="setting_list">
  16. <view class="setting_item" @click="outLogin()">
  17. <text class="setting_title">退出登录</text>
  18. <view class="setting_icon">&gt; </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. userInfo: {
  28. username: "",
  29. userpic: "",
  30. phone: "",
  31. status: 0,
  32. company_status: 0,
  33. },
  34. };
  35. },
  36. onLoad() {
  37. let userInfo = uni.getStorageSync("userInfo");
  38. this.userInfo = userInfo;
  39. if (!this.userInfo.userpic) this.userInfo.userpic = "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png";
  40. },
  41. onShow() {},
  42. methods: {
  43. outLogin() {
  44. uni.showModal({
  45. title: "确认退出登录?",
  46. success(re) {
  47. if (re.confirm) {
  48. // 清空登录标识
  49. uni.setStorageSync("userLogin", null);
  50. // 清空用户信息
  51. uni.setStorageSync("userInfo", null);
  52. // 跳转到登录页
  53. uni.redirectTo({
  54. url: "/pages/login/index",
  55. });
  56. }
  57. },
  58. });
  59. },
  60. },
  61. };
  62. </script>
  63. <style lang="less">
  64. .user_box {
  65. width: 680rpx;
  66. height: 180rpx;
  67. overflow: hidden;
  68. background: #ffffff;
  69. padding: 10rpx 35rpx;
  70. .box_left {
  71. float: left;
  72. display: block;
  73. width: 140rpx;
  74. height: 140rpx;
  75. .user_image {
  76. display: block;
  77. width: 120rpx;
  78. height: 120rpx;
  79. border-radius: 50%;
  80. margin: 10rpx auto;
  81. }
  82. }
  83. .box_center {
  84. float: left;
  85. width: 300rpx;
  86. height: 140rpx;
  87. margin-left: 35rpx;
  88. .user_name {
  89. font-size: 30rpx;
  90. line-height: 80rpx;
  91. }
  92. .user_info {
  93. color: #999999;
  94. font-size: 24rpx;
  95. line-height: 60rpx;
  96. }
  97. }
  98. .box_right {
  99. float: right;
  100. width: 140rpx;
  101. height: 140rpx;
  102. font-size: 20rpx;
  103. .setting_page {
  104. width: 140rpx;
  105. height: 140rpx;
  106. display: block;
  107. overflow: hidden;
  108. .setting_icon {
  109. width: 60rpx;
  110. height: 60rpx;
  111. display: block;
  112. margin: 40rpx auto;
  113. }
  114. }
  115. }
  116. }
  117. .setting_list {
  118. overflow: hidden;
  119. margin: 10rpx auto;
  120. padding: 0rpx 0rpx;
  121. .setting_item {
  122. height: 80rpx;
  123. display: block;
  124. font-size: 26rpx;
  125. line-height: 80rpx;
  126. margin: 10rpx auto;
  127. padding: 0rpx 35rpx;
  128. background: #ffffff;
  129. .setting_title {
  130. }
  131. .setting_icon {
  132. float: right;
  133. color: #999999;
  134. }
  135. }
  136. }
  137. </style>