UserInfo.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. console.log(this.$options);
  58. },
  59. methods: {
  60. //获取用户信息
  61. async getUserInfo() {
  62. let res = await this.$api.requested(this.param)
  63. this.userInfo = res.data
  64. console.log(this.userInfo);
  65. },
  66. //上传头像成功
  67. onSuccess(id) {
  68. //如果图片存在进行删除
  69. let isUp = true
  70. if(this.userInfo.attinfos.length > 0) {
  71. isUp = false
  72. removeFile.removeFileList(this.userInfo.attinfos).then( res => {
  73. this.bindFile(id)
  74. })
  75. }
  76. if(isUp) this.bindFile(id)
  77. },
  78. //文件绑定
  79. async bindFile(id) {
  80. let res = await this.$api.requested({
  81. "classname": "system.attachment.Attachment",
  82. "method": "createFileLink",
  83. "content": {
  84. "ownertable": "sys_users",
  85. "ownerid": JSON.parse(window.sessionStorage.getItem('active_account')).userid,
  86. "usetype": "defaultheadportrait",
  87. "attachmentids": [
  88. id
  89. ]
  90. }
  91. })
  92. this.tool.showMessage(res,() => {
  93. this.getUserInfo()
  94. })
  95. },
  96. phoneChange(phone) {
  97. this.$refs.userInfo.ruleForm.phonenumber = phone
  98. },
  99. },
  100. };
  101. </script>
  102. <style scoped>
  103. *{
  104. box-sizing: border-box;
  105. }
  106. .user-info-panl {
  107. width: 100%;
  108. min-height: 100%;
  109. background: #ffffff;
  110. padding: 50px 60px 0 60px;
  111. }
  112. .user-info-panl .top {
  113. }
  114. .user-info-panl .top .avatar {
  115. display: flex;
  116. align-items: center;
  117. margin-bottom: 40px;
  118. }
  119. .user-info-panl .top .avatar img {
  120. margin-right: 20px;
  121. }
  122. .user-info-panl .top .avatar img {
  123. width: 96px;
  124. height: 96px;
  125. border-radius: 50%;
  126. margin-bottom: 16px;
  127. }
  128. .user-info-panl .top .avatar .el-button {
  129. width: 120px;
  130. height: 36px;
  131. }
  132. .user-info-panl .info1 .vx img {
  133. vertical-align: middle;
  134. }
  135. .user-info-panl .info1 .info-item {
  136. display: flex;
  137. justify-content: space-between;
  138. align-items: center;
  139. padding-bottom: 30px;
  140. border-bottom: 1px solid #DDDDDD;
  141. margin-bottom: 30px;
  142. }
  143. .user-info-panl .info1 .info-item .left {
  144. }
  145. .user-info-panl .info1 .info-item .left p:first-child {
  146. margin-bottom: 20px;
  147. }
  148. .user-info-panl .info1 .info-item .right {
  149. }
  150. .user-info-panl .logout {
  151. display: flex;
  152. flex-direction: column;
  153. align-items: center;
  154. margin: 40px 0 90px 0;
  155. }
  156. </style>