index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="content">
  3. <view class="user-info">
  4. <view class="user-data">
  5. <view class="user-name">{{userData.nickName}}</view>
  6. <view class="user-phone">{{userData.phone}}</view>
  7. </view>
  8. <view class="user-img">
  9. <u-avatar :src="userData.headImage" size="160"></u-avatar>
  10. </view>
  11. </view>
  12. <view class="user-handle" v-for="(item, index) in handleList" :key="index" @click="goToHandle(item)">
  13. <view class="handle-icon">
  14. <u-image :src="item.icon" mode="aspectFit" width="28px" height="28px"></u-image>
  15. </view>
  16. <view class="handle-label">{{item.label}}</view>
  17. <view class="handle-arrow">
  18. <u-icon name="arrow-right" color="#cccccc" size="32"></u-icon>
  19. </view>
  20. </view>
  21. <u-top-tips ref="uTips"></u-top-tips>
  22. </view>
  23. </template>
  24. <script>
  25. const NET = require('@/utils/request')
  26. const API = require('@/config/api')
  27. export default {
  28. data() {
  29. return {
  30. userData: {
  31. headImage: '',
  32. userId: '',
  33. nickName: '',
  34. userName: '',
  35. phone: '',
  36. },
  37. handleList: [{
  38. label: '我的评价',
  39. path: 'evaluateList',
  40. icon: API.getServerImg + 'pingjia.png'
  41. },
  42. {
  43. label: '补课记录',
  44. path: 'extraLessonsList',
  45. icon: API.getServerImg + 'dingdanguanli.png'
  46. },
  47. {
  48. label: '请假记录',
  49. path: 'leaveLessonsList',
  50. icon: API.getServerImg + 'qingjia.png'
  51. },
  52. {
  53. label: '续费率/签到率排行',
  54. path: 'ratioRank',
  55. icon: API.getServerImg + 'paihang.png'
  56. },
  57. {
  58. label: '续费提醒',
  59. path: 'renewList',
  60. icon: API.getServerImg + 'xufeitixing.png'
  61. },
  62. {
  63. label: '签到提醒',
  64. path: 'signList',
  65. icon: API.getServerImg + 'xiaoxi.png'
  66. },
  67. {
  68. label: '退出登录',
  69. path: 'logout',
  70. icon: API.getServerImg + 'xiaoxi.png'
  71. },
  72. ]
  73. }
  74. },
  75. onLoad() {
  76. if (!uni.getStorageSync('token')) {
  77. uni.navigateTo({
  78. url: '/pages/login/index'
  79. });
  80. }
  81. if (uni.getStorageSync('userData')) {
  82. this.userData = uni.getStorageSync('userData')
  83. }
  84. },
  85. methods: {
  86. // 跳转我的各列表界面
  87. goToHandle(site) {
  88. if(site.path == 'logout'){
  89. uni.removeStorageSync('token')
  90. uni.navigateTo({
  91. url: '/pages/login/index'
  92. });
  93. }else{
  94. uni.navigateTo({
  95. url: '/pagesMain/' + site.path
  96. });
  97. }
  98. },
  99. }
  100. }
  101. </script>
  102. <style lang='scss'>
  103. @import "@/static/css/themes.scss";
  104. .content {
  105. width: 100%;
  106. height: 100vh;
  107. float: left;
  108. .user-info {
  109. width: 100%;
  110. height: 110px;
  111. margin-bottom: 20px;
  112. float: left;
  113. background-color: $mainColor;
  114. .user-data {
  115. width: calc(100% - 110px);
  116. height: 110px;
  117. padding: 15px 0 15px 15px;
  118. float: left;
  119. .user-name {
  120. width: 100%;
  121. float: left;
  122. font-size: 24px;
  123. color: #FFFFFF;
  124. line-height: 30px;
  125. margin: 10px 0;
  126. white-space: nowrap;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. }
  130. .user-phone {
  131. width: 100%;
  132. color: #FFFFFF;
  133. line-height: 20px;
  134. float: left;
  135. white-space: nowrap;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. }
  139. }
  140. .user-img {
  141. width: 110px;
  142. height: 110px;
  143. padding: 15px;
  144. float: left;
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. }
  149. }
  150. .user-handle {
  151. width: 100vw;
  152. height: 40px;
  153. float: left;
  154. padding: 0 15px;
  155. margin-bottom: 10px;
  156. display: flex;
  157. align-items: center;
  158. .handle-icon {
  159. width: 40px;
  160. height: 40px;
  161. text-align: center;
  162. line-height: 40px;
  163. display: flex;
  164. align-items: center;
  165. }
  166. .handle-label {
  167. height: 40px;
  168. flex: 1;
  169. margin-left: 10px;
  170. line-height: 40px;
  171. font-size: 15px;
  172. }
  173. .handle-arrow {
  174. line-height: 40px;
  175. }
  176. }
  177. }
  178. </style>