userdetail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view>
  3. <scroll-view scroll-y class="page">
  4. <cu-custom bgColor="bg-gradual-pink" :isBack="true">
  5. <block slot="backText">返回</block>
  6. <block slot="content">用户详情</block>
  7. <view slot="right" @tap="rightClick">编辑</view>
  8. </cu-custom>
  9. <!-- list列表 -->
  10. <view class="cu-list menu">
  11. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
  12. <view class="content">
  13. <text class="text-grey">头像</text>
  14. </view>
  15. <view class="action">
  16. <view class="cu-avatar round sm" :style="{backgroundImage: 'url(' + personalMsg.avatar + ')'}"></view>
  17. </view>
  18. </view>
  19. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
  20. <view class="content">
  21. <text class="text-grey">姓名</text>
  22. </view>
  23. <view class="action">
  24. <text class="text-grey">{{personalMsg.realname}}</text>
  25. </view>
  26. </view>
  27. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
  28. <view class="content">
  29. <text class="text-grey">性别</text>
  30. </view>
  31. <view class="action">
  32. <text class="text-grey">{{personalMsg.sex}}</text>
  33. </view>
  34. </view>
  35. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.4s'}]">
  36. <view class="content">
  37. <text class="text-grey">生日</text>
  38. </view>
  39. <view class="action">
  40. <text class="text-grey">{{personalMsg.birthday}}</text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="cu-list menu">
  45. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
  46. <view class="content">
  47. <text class="text-grey">对外信息展示</text>
  48. </view>
  49. <view class="action">
  50. <text class="text-grey">{{getSubStringText(personalMsg.realname+'@'+personalMsg.orgCode,11)}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="cu-list menu">
  55. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.9s'}]">
  56. <view class="content">
  57. <text class="text-grey">手机</text>
  58. </view>
  59. <view class="action">
  60. <text class="text-grey">{{personalMsg.phone}}</text>
  61. </view>
  62. </view>
  63. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1s'}]">
  64. <view class="content">
  65. <text class="text-grey">邮箱</text>
  66. </view>
  67. <view class="action">
  68. <text class="text-grey">{{personalMsg.email}}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </scroll-view>
  73. </view>
  74. </template>
  75. <script>
  76. import api from '@/api/api.js'
  77. export default {
  78. data() {
  79. return {
  80. personalMsg:{
  81. avatar:'',
  82. realname:'',
  83. username:'',
  84. sex:1,
  85. birthday:new Date(),
  86. orgCode:'',
  87. workNo:'',
  88. status:1,
  89. phone:'',
  90. telephone:'',
  91. email:'',
  92. post:'',
  93. departIds:'',
  94. identity:'',
  95. },
  96. userUrl:'/sys/user/queryById',
  97. positionUrl:'/sys/position/list',
  98. departUrl:'/sys/user/userDepartList'
  99. };
  100. },
  101. onLoad() {
  102. this.loadinfo()
  103. },
  104. methods: {
  105. getSubStringText(text,len){
  106. if(!text || text.length==0){
  107. return ''
  108. }
  109. if(text.length<len){
  110. return text;
  111. }
  112. return text.substr(0,len)+"..."
  113. },
  114. rightClick(){
  115. this.$Router.push({name:'useredit', params:this.personalMsg})
  116. /* uni.navigateTo({
  117. url: '/pages/user/useredit?item='+item
  118. }); */
  119. },
  120. loadinfo(){
  121. this.$http.get(this.userUrl,{params:{id:this.$store.getters.userid}}).then(res=> {
  122. console.log("用户",res)
  123. if (res.data.success) {
  124. let result = res.data.result
  125. if(result.avatar&&result.avatar.length >0)
  126. this.personalMsg.avatar = api.getFileAccessHttpUrl(result.avatar)
  127. this.personalMsg.realname = result.realname
  128. this.personalMsg.username= result.username
  129. this.personalMsg.post = result.post
  130. this.personalMsg.sex = result.sex===1?'男':'女'
  131. this.personalMsg.birthday = result.birthday== null?'无':result.birthday
  132. this.personalMsg.departIds= result.departIds
  133. this.personalMsg.workNo= result.workNo
  134. this.personalMsg.phone= result.phone
  135. this.personalMsg.telephone= result.telephone== null?'无':result.telephone
  136. this.personalMsg.email= result.email
  137. this.personalMsg.post= result.post
  138. this.personalMsg.identity= result.identity=== 1?'普通成员':'上级'
  139. this.personalMsg.status= result.status === 1?'正常':'冻结'
  140. this.personalMsg.orgCode= result.orgCode
  141. }
  142. }).catch(e=>{
  143. console.log("请求错误",e)
  144. })
  145. this.$http.get(this.departUrl,{params:{userId:this.$store.getters.userid}}).then(res=> {
  146. if (res.success) {
  147. for (let item of res.result){
  148. this.personalMsg.orgCode = item.title
  149. this.personalMsg.departIds = item.title
  150. }
  151. }
  152. }).catch(e=>{
  153. console.log("请求错误",e)
  154. })
  155. this.$http.get(this.positionUrl).then(res=> {
  156. if (res.success) {
  157. let postArr = res.result.records
  158. for (let item of postArr ){
  159. if (this.personalMsg.post == item.code){
  160. this.personalMsg.post = item.name
  161. }
  162. }
  163. }
  164. }).catch(e=>{
  165. console.log("请求错误",e)
  166. })
  167. },
  168. }
  169. }
  170. </script>
  171. <style>
  172. .page {
  173. height: 100Vh;
  174. width: 100vw;
  175. }
  176. .page.show {
  177. overflow: hidden;
  178. }
  179. .switch-sex::after {
  180. content: "\e716";
  181. }
  182. .switch-sex::before {
  183. content: "\e7a9";
  184. }
  185. .switch-music::after {
  186. content: "\e66a";
  187. }
  188. .switch-music::before {
  189. content: "\e6db";
  190. }
  191. </style>