myCenter.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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">{{statistics.myTaskHandlingCount}}</view>
  17. </view>
  18. <view class="card danger" @click="linkTo('danger')">
  19. <view class="name">待处理隐患</view>
  20. <view class="number">{{statistics.myDangerHandlingCount}}</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 {waitHandleStatistics} from '@/api/aqpt/task.js'
  52. import defAvatar from '@/static/avatar.png'
  53. export default {
  54. data() {
  55. return {
  56. defAvatar,
  57. user:{
  58. userAvatar:"",
  59. userName:"",
  60. userIntro:"",
  61. userPhone:""
  62. },
  63. statistics:{
  64. myDangerHandlingCount:0,
  65. myTaskHandlingCount: 0
  66. }
  67. }
  68. },
  69. onLoad() {
  70. this.init()
  71. },
  72. methods: {
  73. init(){
  74. this.initUser()
  75. this.getwaitHandleStatistics()
  76. },
  77. getwaitHandleStatistics(){
  78. waitHandleStatistics().then((res)=>{
  79. this.statistics=res.data
  80. })
  81. },
  82. initUser(){
  83. let userInfo=uni.getStorageSync('accountInfo')
  84. if(userInfo){this.user=userInfo}
  85. },
  86. linkTo(index){
  87. if(index===1){uni.switchTab({url:'/pages/history/history'})}
  88. if(index===2){uni.navigateTo({url:'/pages/myCenter/profile/profile'})}
  89. if(index===3){uni.navigateTo({url:'/pages/service_agreement/service_agreement'})}
  90. if(index==='task'){
  91. uni.navigateTo({url:'/pages/task/task'})
  92. }
  93. if(index==='danger'){
  94. uni.navigateTo({url:'/pages/danger/danger'})
  95. }
  96. },
  97. logoutSubmit(){
  98. uni.clearStorageSync();
  99. logout().then(()=>{
  100. uni.navigateTo({
  101. url:'/pages/login/index'
  102. })
  103. })
  104. },
  105. avatarError(){
  106. this.user.userAvatar=this.defAvatar
  107. }
  108. }
  109. ,onPullDownRefresh() {
  110. this.init()
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .profile{
  116. .banner{
  117. height: 236rpx;
  118. padding-left:30rpx;
  119. display: flex;
  120. align-items: center;
  121. .avatar{
  122. display: block;
  123. width: 112rpx;
  124. height: 112rpx;
  125. border-radius: 50%;
  126. }
  127. .user-info{
  128. padding-left: 30rpx;
  129. .name{
  130. color: #35364F;
  131. font-size: 38rpx;
  132. font-weight: 700;
  133. line-height: 54rpx;
  134. }
  135. .phone{
  136. color: #35364F;
  137. font-size: 28rpx;
  138. line-height: 44rpx;
  139. }
  140. }
  141. }
  142. .statistics{
  143. display: flex;
  144. justify-content: space-between;
  145. padding: 32rpx;
  146. .card{
  147. width: 328rpx;
  148. height: 168rpx;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. flex-direction: column;
  153. background-position: bottom right;
  154. background-repeat: no-repeat;
  155. background-size: 102rpx 102rpx;
  156. border-radius: 16rpx;
  157. &.task{
  158. background-color: #FFFDED;
  159. margin-right: 15rpx;
  160. background-image: url('/static/center/task.png');
  161. }
  162. &.danger{
  163. background-color: #F4F5FE;
  164. margin-left: 15rpx;
  165. background-image: url('/static/center/danger.png');
  166. }
  167. .name{
  168. font-size: 28rpx;
  169. line-height: 48rpx;
  170. color: #35364F;
  171. }
  172. .number{
  173. font-size: 40rpx;
  174. line-height: 48rpx;
  175. color: #35364F;
  176. font-weight: 700;
  177. }
  178. }
  179. }
  180. .hand-list{
  181. margin-top: 24rpx;
  182. padding: 0 24rpx;
  183. .hand-item{
  184. height: 120rpx;
  185. display: flex;
  186. align-items: center;
  187. background-image: url('/static/arrow.png');
  188. background-position:center right 36rpx;
  189. background-repeat: no-repeat;
  190. background-size: 44rpx 44rpx;
  191. .hand-lf{
  192. flex: 1;
  193. display: flex;
  194. align-items: center;
  195. .icon{
  196. display: block;
  197. width: 48rpx;
  198. height: 48rpx;
  199. }
  200. .name{
  201. font-size: 32rpx;
  202. line-height: 48rpx;
  203. padding-left: 8rpx;
  204. color: #35364F;
  205. }
  206. }
  207. }
  208. }
  209. .submit-BT {
  210. width: 600rpx;
  211. height: 72rpx;
  212. line-height: 72rpx;
  213. box-sizing: border-box;
  214. border-radius: 16upx;
  215. margin-top: 50upx;
  216. background-color:#3384FF;
  217. font-size: 32rpx;
  218. }
  219. }
  220. </style>