settings.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. this.$http.request("api/custom/get_info").then((re) => {
  46. if (re.code == "success") {
  47. this.userInfo = re.data;
  48. if (!this.userInfo.userpic) this.userInfo.userpic = "../../static/icon/doctor.png";
  49. }
  50. });
  51. },
  52. onShow() {},
  53. methods: {
  54. outLogin() {
  55. uni.showModal({
  56. title: "确认退出登录?",
  57. success(re) {
  58. if (re.confirm) {
  59. // 清空登录标识
  60. uni.setStorageSync("userLogin", null);
  61. // 清空用户信息
  62. uni.setStorageSync("userInfo", null);
  63. // 跳转到登录页
  64. uni.redirectTo({
  65. url: "/pages/login/index",
  66. });
  67. }
  68. },
  69. });
  70. },
  71. },
  72. };
  73. </script>
  74. <style lang="less">
  75. .user_box {
  76. width: 680rpx;
  77. height: 180rpx;
  78. overflow: hidden;
  79. background: #ffffff;
  80. padding: 10rpx 35rpx;
  81. .box_left {
  82. float: left;
  83. display: block;
  84. width: 140rpx;
  85. height: 140rpx;
  86. .user_image {
  87. display: block;
  88. width: 120rpx;
  89. height: 120rpx;
  90. border-radius: 50%;
  91. margin: 10rpx auto;
  92. }
  93. }
  94. .box_center {
  95. float: left;
  96. width: 300rpx;
  97. height: 140rpx;
  98. margin-left: 35rpx;
  99. .user_name {
  100. font-size: 30rpx;
  101. line-height: 80rpx;
  102. }
  103. .user_info {
  104. color: #999999;
  105. font-size: 24rpx;
  106. line-height: 60rpx;
  107. }
  108. }
  109. .box_right {
  110. float: right;
  111. width: 140rpx;
  112. height: 140rpx;
  113. font-size: 20rpx;
  114. .setting_page {
  115. width: 140rpx;
  116. height: 140rpx;
  117. display: block;
  118. overflow: hidden;
  119. .setting_icon {
  120. width: 60rpx;
  121. height: 60rpx;
  122. display: block;
  123. margin: 40rpx auto;
  124. }
  125. }
  126. }
  127. }
  128. .setting_list {
  129. overflow: hidden;
  130. margin: 10rpx auto;
  131. padding: 0rpx 0rpx;
  132. .setting_item {
  133. height: 80rpx;
  134. display: block;
  135. font-size: 26rpx;
  136. line-height: 80rpx;
  137. margin: 10rpx auto;
  138. padding: 0rpx 35rpx;
  139. background: #ffffff;
  140. .setting_title {
  141. }
  142. .setting_icon {
  143. float: right;
  144. color: #999999;
  145. }
  146. }
  147. }
  148. </style>