myCenter.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="content">
  3. <view class="banner custom_status_bar">
  4. <div class="custom-nav">个人中心</div>
  5. <div class="user-container">
  6. <view class="avatar">
  7. <image v-if="user.userAvatar" class="photo" :src="user.userAvatar" mode="widthFix" @error="userAvatar=defaultAvatar"></image>
  8. <image v-else class="photo" :src="defaultAvatar" mode="widthFix"></image>
  9. </view>
  10. <view class="bottom">
  11. <view class="name">
  12. <text>{{user.userName}}</text>
  13. </view>
  14. <div class="phone">{{user.userPhone}}</div>
  15. </view>
  16. </div>
  17. </view>
  18. <view class="handle-container">
  19. <view class="list">
  20. <view class="item">
  21. <div class="lf">
  22. <image class="icon" src="/static/center/dollar-circle.png" mode="widthFix"></image>
  23. <text class="name">联系电话</text>
  24. </div>
  25. <view class="rt">
  26. <text class="cont">{{user.userPhone}}</text>
  27. <uni-icons type="right" size="20" color="#B3B3B3"></uni-icons>
  28. </view>
  29. </view>
  30. <view class="item">
  31. <div class="lf">
  32. <image class="icon" src="/static/center/timer.png" mode="widthFix"></image>
  33. <text class="name">部门</text>
  34. </div>
  35. <view class="rt">
  36. <text class="cont">{{user.groupName}}</text>
  37. <uni-icons type="right" size="20" color="#B3B3B3"></uni-icons>
  38. </view>
  39. </view>
  40. <view class="item">
  41. <div class="lf">
  42. <image class="icon" src="/static/center/heart.png" mode="widthFix"></image>
  43. <text class="name">企业通讯录</text>
  44. </div>
  45. <view class="rt">
  46. <text class="cont"></text>
  47. <uni-icons type="right" size="20" color="#B3B3B3"></uni-icons>
  48. </view>
  49. </view>
  50. <view class="item">
  51. <div class="lf">
  52. <image class="icon" src="/static/center/archive-tick.png" mode="widthFix"></image>
  53. <text class="name">修改密码</text>
  54. </div>
  55. <view class="rt">
  56. <text class="cont"></text>
  57. <uni-icons type="right" size="20" color="#B3B3B3"></uni-icons>
  58. </view>
  59. </view>
  60. <view class="item">
  61. <div class="lf">
  62. <image class="icon" src="/static/center/setting.png" mode="widthFix"></image>
  63. <text class="name">版本升级</text>
  64. </div>
  65. <view class="rt">
  66. <text class="cont">1.0.0</text>
  67. <uni-icons type="right" size="20" color="#B3B3B3"></uni-icons>
  68. </view>
  69. </view>
  70. </view>
  71. <div class="logoutBt" @click="logout">退出登录</div>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import {logout} from '@/api/system/user.js'
  77. export default{
  78. data(){
  79. return{
  80. defaultAvatar:"/static/components/avatar.png",
  81. user:{
  82. groupName: "",
  83. ocName: "",
  84. positionName: "",
  85. roleName: "",
  86. userAvatar: "",
  87. userIntro: "",
  88. userName: "",
  89. userPhone: "",
  90. userPhoto: "",
  91. userRealName: ""
  92. }
  93. }
  94. },
  95. onShow() {
  96. this.init();
  97. },
  98. methods:{
  99. init(){
  100. let user=uni.getStorageSync('accountInfo');
  101. if(user){
  102. user=JSON.parse(user)
  103. this.user=user
  104. }
  105. },
  106. logout(){
  107. uni.showModal({
  108. title:'提示!',
  109. content:"是否要退出登录",
  110. success(res) {
  111. if (res.confirm) {
  112. logout().then(()=>{
  113. uni.clearStorageSync()
  114. uni.reLaunch({
  115. url:'/pages/login/index'
  116. })
  117. })
  118. }
  119. }
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .content{
  127. background-color: rgba(243, 244, 247, 1);
  128. min-height: 100vh;
  129. box-sizing: border-box;
  130. .banner{
  131. height: 422rpx;
  132. background-image: url('/static/center/bg.png');
  133. background-repeat: no-repeat;
  134. background-size: 100% 100%;
  135. .custom-nav{
  136. font-size: 40rpx;
  137. color: #fff;
  138. padding-top: 24rpx;
  139. text-indent: 32rpx;
  140. /* #ifdef MP-WEIXIN */
  141. margin-top: 28px;
  142. /* #endif */
  143. }
  144. .user-container{
  145. &{
  146. display: flex;
  147. justify-content: flex-start;
  148. align-items: center;
  149. padding: 46rpx 0 0 32rpx;
  150. }
  151. .avatar{
  152. width: 120rpx;
  153. height: 120rpx;
  154. border-radius: 50%;
  155. display: block;
  156. overflow: hidden;
  157. background: rgba(255,255,255,0.39);
  158. border: 2rpx solid #707070;
  159. .photo{
  160. width: 120rpx;
  161. height: 120rpx;
  162. border-radius: 50%;
  163. }
  164. }
  165. .bottom{
  166. &{
  167. padding-left: 20rpx;
  168. }
  169. .name{
  170. font-size: 36rpx;
  171. font-family: PingFang SC;
  172. font-weight: bold;
  173. line-height: 50rpx;
  174. color: #FFFFFF;
  175. }
  176. .phone{
  177. font-size: 28rpx;
  178. font-family: PingFang SC;
  179. font-weight: 400;
  180. line-height: 40rpx;
  181. color: #FFFFFF;
  182. padding-top: 14rpx;
  183. }
  184. }
  185. }
  186. }
  187. .handle-container{
  188. padding: 30rpx 24rpx;
  189. .logoutBt{
  190. width: 700rpx;
  191. height: 72rpx;
  192. line-height: 72rpx;
  193. text-align: center;
  194. background:#fff;
  195. font-size: 32rpx;
  196. font-family: PingFang SC;
  197. font-weight: 400;
  198. color:rgba(110, 116, 128, 1);
  199. margin-top: 30rpx;
  200. }
  201. .list{
  202. .item{
  203. height: 98rpx;
  204. display: flex;
  205. justify-content: space-between;
  206. align-items: center;
  207. background-color: #fff;
  208. padding: 0 24rpx;
  209. border-bottom: 1px solid rgba(238, 238, 238, 1);
  210. .lf{
  211. display: flex;
  212. align-items: center;
  213. .icon{
  214. width: 48rpx;
  215. height: 48rpx;
  216. }
  217. .name{
  218. padding-left: 20rpx;
  219. font-size: 32rpx;
  220. font-family: PingFang SC;
  221. color: rgba(45, 49, 51, 1);
  222. }
  223. }
  224. .rt{
  225. flex: 1;
  226. display: flex;
  227. align-items: center;
  228. justify-content: flex-end;
  229. .cont{
  230. padding-right: 30rpx;
  231. font-size: 32rpx;
  232. font-family: PingFang SC;
  233. color: rgba(45, 49, 51, 1);
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. </style>