UserInfo.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="user-info-panl">
  3. <div class="top">
  4. <div class="avatar">
  5. <img :src="getAvatar || require('@/assets/normal_avatar.png')" alt="">
  6. <up-load target="avatar" @onSuccess="onSuccess" classType="1"></up-load>
  7. </div>
  8. </div>
  9. <base-info :userInfo="userInfo" ref="userInfo">
  10. <phone-edit slot="phoneEdit" :userInfo="userInfo" @phoneChange="phoneChange"></phone-edit>
  11. <pass-edit slot="passEdit" :userInfo="userInfo"></pass-edit>
  12. </base-info>
  13. <wx-bind :userInfo="userInfo">
  14. </wx-bind>
  15. </div>
  16. </template>
  17. <script>
  18. import upLoad from '@/SManagement/archives_upload/components/upload'
  19. import baseInfo from '@/SManagement/user/user-info/components/baseInfo'
  20. import phoneEdit from '@/SManagement/user/user-info/components/PhoneEdit'
  21. import passEdit from '@/SManagement/user/user-info/components/PassEdit'
  22. import logOut from '@/SManagement/user/user-info/components/LogOut'
  23. import wxBind from '@/SManagement/user/user-info/components/wxBind'
  24. import wxPanl from '@/SManagement/user/user-info/components/wxPanl'
  25. import removeFile from '@/utils/removeFile'
  26. export default {
  27. name: 'UserInfo',
  28. data() {
  29. return {
  30. param: {
  31. "classname": "common.usercenter.usercenter",
  32. "method": "queryUserMsg",
  33. "content": {
  34. }
  35. },
  36. userInfo:''
  37. };
  38. },
  39. components: {
  40. upLoad,
  41. baseInfo,
  42. phoneEdit,
  43. passEdit,
  44. wxBind,
  45. wxPanl,
  46. logOut
  47. },
  48. computed:{
  49. getAvatar() {
  50. if(this.userInfo && this.userInfo.attinfos.length > 0) return this.userInfo.attinfos[0].url
  51. },
  52. },
  53. watch:{
  54. },
  55. created() {
  56. this.getUserInfo()
  57. },
  58. methods: {
  59. //获取用户信息
  60. async getUserInfo() {
  61. let res = await this.$api.requested(this.param)
  62. this.userInfo = res.data
  63. console.log(this.userInfo);
  64. },
  65. //上传头像成功
  66. onSuccess(id) {
  67. //如果图片存在进行删除
  68. let isUp = true
  69. if(this.userInfo.attinfos.length > 0) {
  70. isUp = false
  71. removeFile.removeFileList(this.userInfo.attinfos).then( res => {
  72. this.bindFile(id)
  73. })
  74. }
  75. if(isUp) this.bindFile(id)
  76. },
  77. //文件绑定
  78. async bindFile(id) {
  79. let res = await this.$api.requested({
  80. "classname": "system.attachment.Attachment",
  81. "method": "createFileLink",
  82. "content": {
  83. "ownertable": "sys_users",
  84. "ownerid": JSON.parse(window.sessionStorage.getItem('active_account')).userid,
  85. "usetype": "defaultheadportrait",
  86. "attachmentids": [
  87. id
  88. ]
  89. }
  90. })
  91. this.tool.showMessage(res,() => {
  92. this.getUserInfo()
  93. })
  94. },
  95. phoneChange(phone) {
  96. this.$refs.userInfo.ruleForm.phonenumber = phone
  97. },
  98. },
  99. };
  100. </script>
  101. <style scoped>
  102. *{
  103. box-sizing: border-box;
  104. }
  105. .user-info-panl {
  106. width: 100%;
  107. min-height: 100%;
  108. background: #ffffff;
  109. padding: 50px 60px 0 60px;
  110. }
  111. .user-info-panl .top {
  112. }
  113. .user-info-panl .top .avatar {
  114. display: flex;
  115. align-items: center;
  116. margin-bottom: 40px;
  117. }
  118. .user-info-panl .top .avatar img {
  119. margin-right: 20px;
  120. }
  121. .user-info-panl .top .avatar img {
  122. width: 96px;
  123. height: 96px;
  124. border-radius: 50%;
  125. margin-bottom: 16px;
  126. }
  127. .user-info-panl .top .avatar .el-button {
  128. width: 120px;
  129. height: 36px;
  130. }
  131. .user-info-panl .info1 .vx img {
  132. vertical-align: middle;
  133. }
  134. .user-info-panl .info1 .info-item {
  135. display: flex;
  136. justify-content: space-between;
  137. align-items: center;
  138. padding-bottom: 30px;
  139. border-bottom: 1px solid #DDDDDD;
  140. margin-bottom: 30px;
  141. }
  142. .user-info-panl .info1 .info-item .left {
  143. }
  144. .user-info-panl .info1 .info-item .left p:first-child {
  145. margin-bottom: 20px;
  146. }
  147. .user-info-panl .info1 .info-item .right {
  148. }
  149. .user-info-panl .logout {
  150. display: flex;
  151. flex-direction: column;
  152. align-items: center;
  153. margin: 40px 0 90px 0;
  154. }
  155. </style>