settings.vue 3.2 KB

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