myCenter.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="content">
  3. <view class="banner">
  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="zhcx-table">
  19. <uni-list>
  20. <uni-list-item title="个人资料"></uni-list-item>
  21. <!-- to="/pages/myCenter/personalData/personalData" showArrow -->
  22. <uni-list-item title="部门":rightText="user.groupName"></uni-list-item>
  23. <uni-list-item title="岗位":rightText="user.positionName"></uni-list-item>
  24. <uni-list-item title="介绍":note="user.userIntro" :ellipsis="3"></uni-list-item>
  25. </uni-list>
  26. </view>
  27. <div class="logoutBt" @click="logout">退出登录</div>
  28. </view>
  29. </template>
  30. <script>
  31. import {logout} from '@/api/system/user.js'
  32. export default{
  33. data(){
  34. return{
  35. defaultAvatar:"/static/components/avatar.png",
  36. user:{
  37. groupName: "",
  38. ocName: "",
  39. positionName: "",
  40. roleName: "",
  41. userAvatar: "",
  42. userIntro: "",
  43. userName: "",
  44. userPhone: "",
  45. userPhoto: "",
  46. userRealName: ""
  47. }
  48. }
  49. },
  50. onShow() {
  51. this.init();
  52. },
  53. methods:{
  54. init(){
  55. let user=uni.getStorageSync('accountInfo');
  56. if(user){
  57. user=JSON.parse(user)
  58. this.user=user
  59. }
  60. },
  61. logout(){
  62. uni.showModal({
  63. title:'提示!',
  64. content:"是否要退出登录",
  65. success(res) {
  66. if (res.confirm) {
  67. logout().then(()=>{
  68. uni.clearStorageSync()
  69. uni.reLaunch({
  70. url:'/pages/login/index'
  71. })
  72. })
  73. }
  74. }
  75. })
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .content{
  82. position: relative;
  83. .banner{
  84. height: 580upx;
  85. background-image: url('/static/center/bg.png');
  86. background-repeat: no-repeat;
  87. background-size: 100% 100%;
  88. position: relative;
  89. &::after{
  90. position: absolute;
  91. content: "";
  92. display: block;
  93. width: 440rpx;
  94. height: 632rpx;
  95. right: 0;
  96. top: 20px;
  97. background-image:url('/static/center/bgmask.png');
  98. background-repeat: no-repeat;
  99. background-size: 100% 100%;
  100. z-index: 1;
  101. }
  102. .custom-nav{
  103. position: fixed;
  104. text-align: center;
  105. top: 24px;
  106. left: var(--window-left);
  107. right: var(--window-right);
  108. height: 88rpx;
  109. line-height: 88rpx;
  110. z-index: 998;
  111. color: #333333;
  112. background-color: transparent;
  113. font-size: 32rpx;
  114. font-weight: 400;
  115. box-sizing: border-box;
  116. font-family: PingFang SC;
  117. }
  118. .user-container{
  119. &{
  120. display: flex;
  121. justify-content: flex-start;
  122. align-items: center;
  123. position: absolute;
  124. bottom: 190rpx;
  125. left: 40rpx;
  126. }
  127. .avatar{
  128. width: 120rpx;
  129. height: 120rpx;
  130. border-radius: 50%;
  131. display: block;
  132. overflow: hidden;
  133. background: rgba(255,255,255,0.39);
  134. border: 2rpx solid #707070;
  135. .photo{
  136. width: 120rpx;
  137. height: 120rpx;
  138. border-radius: 50%;
  139. }
  140. }
  141. .bottom{
  142. &{
  143. padding-left: 20rpx;
  144. }
  145. .name{
  146. font-size: 36rpx;
  147. font-family: PingFang SC;
  148. font-weight: bold;
  149. line-height: 50rpx;
  150. color: #FFFFFF;
  151. }
  152. .phone{
  153. font-size: 28rpx;
  154. font-family: PingFang SC;
  155. font-weight: 400;
  156. line-height: 40rpx;
  157. color: #FFFFFF;
  158. padding-top: 14rpx;
  159. }
  160. }
  161. }
  162. }
  163. .zhcx-table{
  164. width: 710rpx;
  165. position: absolute;
  166. left: 20rpx;
  167. top: 440rpx;
  168. background-color: #fff;
  169. z-index: 99;
  170. border-radius: 12px;
  171. overflow: hidden;
  172. }
  173. .logoutBt{
  174. width: 424rpx;
  175. height: 72rpx;
  176. line-height: 72rpx;
  177. text-align: center;
  178. position: fixed;
  179. bottom: 130rpx;
  180. left: 50%;
  181. transform: translateX(-50%);
  182. background:#3D90F4;
  183. border-radius: 42rpx;
  184. font-size: 32rpx;
  185. font-family: PingFang SC;
  186. font-weight: 400;
  187. color: #FFFFFF;
  188. z-index: 999;
  189. }
  190. .faceRecord-box{
  191. position: fixed;
  192. top: 0;
  193. bottom: 0;
  194. left: 0;
  195. right: 0;
  196. z-index: 9999;
  197. background-color: #fff;
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. flex-direction: column;
  202. .camera,.facePhoto{
  203. width: 450rpx;
  204. height: 450rpx;
  205. border-radius: 50%;
  206. border:2rpx solid #eaeaea;
  207. }
  208. .takePhotoBt{
  209. display: inline-block;
  210. margin: 40rpx 0;
  211. }
  212. .camera-submit{
  213. width: 424rpx;
  214. height: 72rpx;
  215. line-height: 72rpx;
  216. text-align: center;
  217. background:#3D90F4;
  218. border-radius: 42rpx;
  219. font-size: 32rpx;
  220. font-family: PingFang SC;
  221. font-weight: 400;
  222. color: #FFFFFF;
  223. margin: 40rpx auto;
  224. &.cancel{
  225. color: #fff;
  226. background-color: #ED834A;
  227. border-color: #ED834A;
  228. margin: 0 auto 50rpx;
  229. }
  230. }
  231. }
  232. }
  233. </style>