myCenter.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="profile">
  3. <view class="banner">
  4. <image :src="user.userAvatar" class="avatar" @error="avatarError"></image>
  5. <view class="user-info">
  6. <view class="name">
  7. <text>{{user.userName}}</text>
  8. <text v-if="user.positionName">({{user.positionName}})</text>
  9. </view>
  10. <view>{{user.userPhone}}</view>
  11. </view>
  12. </view>
  13. <view class="statistics">
  14. <view class="card task" @click="linkTo('task')">
  15. <view class="name">代办任务</view>
  16. <view class="number">10</view>
  17. </view>
  18. <view class="card danger" @click="linkTo('danger')">
  19. <view class="name">代处理隐患</view>
  20. <view class="number">8</view>
  21. </view>
  22. </view>
  23. <div class="hand-list">
  24. <view class="hand-item">
  25. <view class="hand-lf" @click="linkTo(1)">
  26. <image class="icon" src="/static/center/location.png"></image>
  27. <view class="name">操作记录</view>
  28. </view>
  29. <view class="hand-rt"></view>
  30. </view>
  31. <view class="hand-item">
  32. <view class="hand-lf" @click="linkTo(2)">
  33. <image class="icon" src="/static/center/user-group.png"></image>
  34. <view class="name">个人信息</view>
  35. </view>
  36. <view class="hand-rt"></view>
  37. </view>
  38. <view class="hand-item" @click="linkTo(3)">
  39. <view class="hand-lf">
  40. <image class="icon" src="/static/center/unlock.png"></image>
  41. <view class="name">关于</view>
  42. </view>
  43. <view class="hand-rt"></view>
  44. </view>
  45. </div>
  46. <button type="primary" @click="logoutSubmit" class="submit-BT">退出登录</button>
  47. </view>
  48. </template>
  49. <script>
  50. import {logout} from '@/api/system/user.js'
  51. import defAvatar from '@/static/avatar.png'
  52. export default {
  53. data() {
  54. return {
  55. defAvatar,
  56. user:{
  57. userAvatar:"",
  58. userName:"",
  59. userIntro:"",
  60. userPhone:""
  61. },
  62. phone:""
  63. }
  64. },
  65. onLoad() {
  66. this.init()
  67. },
  68. methods: {
  69. init(){
  70. this.initUser()
  71. },
  72. initUser(){
  73. let userInfo=uni.getStorageSync('accountInfo')
  74. if(userInfo){this.user=userInfo}
  75. },
  76. linkTo(index){
  77. if(index===1){uni.switchTab({url:'/pages/history/history'})}
  78. if(index===2){uni.navigateTo({url:'/pages/myCenter/profile/profile'})}
  79. if(index===3){uni.navigateTo({url:'/pages/service_agreement/service_agreement'})}
  80. if(index==='task'){
  81. uni.navigateTo({url:'/pages/task/task'})
  82. }
  83. if(index==='danger'){
  84. uni.navigateTo({url:'/pages/danger/danger'})
  85. }
  86. },
  87. logoutSubmit(){
  88. uni.clearStorageSync();
  89. logout().then(()=>{
  90. uni.navigateTo({
  91. url:'/pages/login/index'
  92. })
  93. })
  94. },
  95. avatarError(){
  96. this.user.userAvatar=this.defAvatar
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .profile{
  103. .banner{
  104. height: 236rpx;
  105. padding-left:30rpx;
  106. display: flex;
  107. align-items: center;
  108. .avatar{
  109. display: block;
  110. width: 112rpx;
  111. height: 112rpx;
  112. border-radius: 50%;
  113. }
  114. .user-info{
  115. padding-left: 30rpx;
  116. .name{
  117. color: #35364F;
  118. font-size: 38rpx;
  119. font-weight: 700;
  120. line-height: 54rpx;
  121. }
  122. .phone{
  123. color: #35364F;
  124. font-size: 28rpx;
  125. line-height: 44rpx;
  126. }
  127. }
  128. }
  129. .statistics{
  130. display: flex;
  131. justify-content: space-between;
  132. padding: 32rpx;
  133. .card{
  134. width: 328rpx;
  135. height: 168rpx;
  136. display: flex;
  137. justify-content: center;
  138. align-items: center;
  139. flex-direction: column;
  140. background-position: bottom right;
  141. background-repeat: no-repeat;
  142. background-size: 102rpx 102rpx;
  143. border-radius: 16rpx;
  144. &.task{
  145. background-color: #FFFDED;
  146. margin-right: 15rpx;
  147. background-image: url('/static/center/task.png');
  148. }
  149. &.danger{
  150. background-color: #F4F5FE;
  151. margin-left: 15rpx;
  152. background-image: url('/static/center/danger.png');
  153. }
  154. .name{
  155. font-size: 28rpx;
  156. line-height: 48rpx;
  157. color: #35364F;
  158. }
  159. .number{
  160. font-size: 40rpx;
  161. line-height: 48rpx;
  162. color: #35364F;
  163. font-weight: 700;
  164. }
  165. }
  166. }
  167. .hand-list{
  168. margin-top: 24rpx;
  169. padding: 0 24rpx;
  170. .hand-item{
  171. height: 120rpx;
  172. display: flex;
  173. align-items: center;
  174. background-image: url('/static/arrow.png');
  175. background-position:center right 36rpx;
  176. background-repeat: no-repeat;
  177. background-size: 44rpx 44rpx;
  178. .hand-lf{
  179. flex: 1;
  180. display: flex;
  181. align-items: center;
  182. .icon{
  183. display: block;
  184. width: 48rpx;
  185. height: 48rpx;
  186. }
  187. .name{
  188. font-size: 32rpx;
  189. line-height: 48rpx;
  190. padding-left: 8rpx;
  191. color: #35364F;
  192. }
  193. }
  194. }
  195. }
  196. .submit-BT {
  197. width: 600rpx;
  198. height: 72rpx;
  199. line-height: 72rpx;
  200. box-sizing: border-box;
  201. border-radius: 16upx;
  202. margin-top: 50upx;
  203. background-color:#3384FF;
  204. font-size: 32rpx;
  205. }
  206. }
  207. </style>