myCenter.vue 5.4 KB

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