index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="home">
  3. <div class="header">
  4. <div class="title">
  5. <div class="back">
  6. <!-- <van-icon name="arrow-left" size='20' /> -->
  7. </div>
  8. <div class="text">客户画像</div>
  9. <div class="more"></div>
  10. </div>
  11. <div class="user-info">
  12. <div class="user-icon">
  13. <img src="../../assets/images/people.png" alt="" />
  14. </div>
  15. <div class="user-text">
  16. <div class="name">{{userInfo.nickName}}</div>
  17. <div class="company">{{userInfo.dept ? userInfo.dept.deptName : ''}}</div>
  18. </div>
  19. <div class="more">
  20. <van-icon name="arrow" size="16" />
  21. </div>
  22. </div>
  23. </div>
  24. <ul class="set-list">
  25. <li @click="toChanagePassword">
  26. <div class="icon-box">
  27. <i class="iconfont icon-icon_pz"></i>
  28. </div>
  29. <div class="text">修改密码</div>
  30. <div class="more">
  31. <van-icon name="arrow" size="16" />
  32. </div>
  33. </li>
  34. </ul>
  35. <van-button class="logout" type="primary" @click="logout" block
  36. >退出登录</van-button
  37. >
  38. </div>
  39. </template>
  40. <script setup>
  41. import { ref, getCurrentInstance, onMounted } from 'vue'
  42. import { showSuccessToast, showFailToast,showConfirmDialog } from 'vant'
  43. import { useRoute } from 'vue-router'
  44. import { getUserInfo } from '@/utils/auth'
  45. const onClickLeft = () => history.back()
  46. const proxy = getCurrentInstance().proxy
  47. const userInfo = ref(getUserInfo())
  48. console.log(userInfo)
  49. const toMessageList = () => {
  50. proxy.$router.push('/main/messageList')
  51. }
  52. const toChanagePassword = () => {
  53. proxy.$router.push('/main/changePassword')
  54. }
  55. const logout = () => {
  56. showConfirmDialog({
  57. title: '提示',
  58. message: '您确定退出本次登录么?',
  59. }).then(() => {
  60. proxy.get('logout').then((res) => {
  61. if (res.code == 200) {
  62. showSuccessToast('退出成功')
  63. //清除路由历史记录
  64. proxy.$router.replace('/')
  65. } else {
  66. showFailToast('退出失败')
  67. }
  68. })
  69. })
  70. }
  71. </script>
  72. <style lang="scss">
  73. .home {
  74. background: #fff;
  75. min-height: 100vh;
  76. .van-nav-bar {
  77. background: rgba(0, 0, 0, 0);
  78. }
  79. .logout {
  80. border-radius: 22px;
  81. background: #eaf0ff;
  82. border: 1px solid #eaf0ff;
  83. color: #3370ff;
  84. width: 80% !important;
  85. margin: 0 auto;
  86. position: fixed;
  87. bottom: 100px;
  88. left: 10%;
  89. }
  90. .set-list {
  91. position: relative;
  92. top: -80px;
  93. background: #fff;
  94. min-height: 200px;
  95. border-radius: 10px;
  96. padding-top: 10px;
  97. li {
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: center;
  101. height: 40px;
  102. padding: 0 12px;
  103. .icon-box {
  104. width: 40px;
  105. height: 40px;
  106. text-align: center;
  107. line-height: 40px;
  108. i {
  109. font-size: 20px;
  110. color: #3370ff;
  111. }
  112. }
  113. .text {
  114. flex: 1;
  115. margin: 0 12px;
  116. font-size: 16px;
  117. color: #333;
  118. }
  119. .more {
  120. i {
  121. color: #999;
  122. }
  123. }
  124. }
  125. }
  126. .header {
  127. background: linear-gradient(180deg, #3370ff 0%, #f1f1f1 100%);
  128. height: 250px;
  129. .user-info {
  130. display: flex;
  131. justify-content: space-between;
  132. padding: 0 12px;
  133. height: 60px;
  134. margin-top: 10px;
  135. .user-text {
  136. color: #fff;
  137. .name {
  138. font-size: 20px;
  139. font-weight: bold;
  140. margin: 5px 0;
  141. width: calc(100vw - 140px);
  142. }
  143. }
  144. .user-icon {
  145. width: 60px;
  146. height: 60px;
  147. background-color: #f1f1f1;
  148. border-radius: 50%;
  149. text-align: center;
  150. img {
  151. width: 40px;
  152. margin-top: 10px;
  153. }
  154. overflow: hidden;
  155. }
  156. .more {
  157. line-height: 60px;
  158. i {
  159. color: #fff;
  160. }
  161. }
  162. }
  163. .title {
  164. display: flex;
  165. justify-content: space-between;
  166. height: 46px;
  167. line-height: 46px;
  168. padding: 0 12px;
  169. color: #fff;
  170. font-size: 16px;
  171. font-weight: bold;
  172. .back,
  173. .more {
  174. width: 40px;
  175. height: 100%;
  176. }
  177. }
  178. }
  179. }
  180. </style>