userdetail.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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.6s'}]">
  56. <view class="content">
  57. <text class="text-grey">所在部门</text>
  58. </view>
  59. <view class="action">
  60. <text class="text-grey">{{personalMsg.orgCode}}</text>
  61. </view>
  62. </view>
  63. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.7s'}]">
  64. <view class="content">
  65. <text class="text-grey">工号</text>
  66. </view>
  67. <view class="action">
  68. <text class="text-grey">{{personalMsg.workNo}}</text>
  69. </view>
  70. </view>
  71. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.8s'}]">
  72. <view class="content">
  73. <text class="text-grey">状态</text>
  74. </view>
  75. <view class="action">
  76. <text class="text-grey">{{personalMsg.status}}</text>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="cu-list menu">
  81. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.9s'}]">
  82. <view class="content">
  83. <text class="text-grey">手机</text>
  84. </view>
  85. <view class="action">
  86. <text class="text-grey">{{personalMsg.phone}}</text>
  87. </view>
  88. </view>
  89. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1s'}]">
  90. <view class="content">
  91. <text class="text-grey">邮箱</text>
  92. </view>
  93. <view class="action">
  94. <text class="text-grey">{{personalMsg.email}}</text>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="cu-list menu">
  99. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.1s'}]">
  100. <view class="content">
  101. <text class="text-grey">职务</text>
  102. </view>
  103. <view class="action">
  104. <text class="text-grey">{{personalMsg.post}}</text>
  105. </view>
  106. </view>
  107. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.2s'}]">
  108. <view class="content">
  109. <text class="text-grey">身份</text>
  110. </view>
  111. <view class="action">
  112. <text class="text-grey">{{personalMsg.identity}}</text>
  113. </view>
  114. </view>
  115. <view class="cu-item animation-slide-bottom" v-if="personalMsg.identity =='上级'" >
  116. <view class="content">
  117. <text class="text-grey">负责部门</text>
  118. </view>
  119. <view class="action">
  120. <text class="text-grey">{{personalMsg.departIds}}</text>
  121. </view>
  122. </view>
  123. </view>
  124. </scroll-view>
  125. </view>
  126. </template>
  127. <script>
  128. import api from '@/api/api.js'
  129. export default {
  130. data() {
  131. return {
  132. personalMsg:{
  133. avatar:'',
  134. realname:'',
  135. username:'',
  136. sex:1,
  137. birthday:new Date(),
  138. orgCode:'',
  139. workNo:'',
  140. status:1,
  141. phone:'',
  142. telephone:'',
  143. email:'',
  144. post:'',
  145. departIds:'',
  146. identity:'',
  147. },
  148. userUrl:'/sys/user/queryById',
  149. positionUrl:'/sys/position/list',
  150. departUrl:'/sys/user/userDepartList'
  151. };
  152. },
  153. onLoad() {
  154. this.loadinfo()
  155. },
  156. methods: {
  157. getSubStringText(text,len){
  158. if(!text || text.length==0){
  159. return ''
  160. }
  161. if(text.length<len){
  162. return text;
  163. }
  164. return text.substr(0,len)+"..."
  165. },
  166. rightClick(){
  167. this.$Router.push({name:'useredit', params:this.personalMsg})
  168. /* uni.navigateTo({
  169. url: '/pages/user/useredit?item='+item
  170. }); */
  171. },
  172. loadinfo(){
  173. this.$http.get(this.userUrl,{params:{id:this.$store.getters.userid}}).then(res=> {
  174. console.log("用户",res)
  175. if (res.data.success) {
  176. let result = res.data.result
  177. if(result.avatar&&result.avatar.length >0)
  178. this.personalMsg.avatar = api.getFileAccessHttpUrl(result.avatar)
  179. this.personalMsg.realname = result.realname
  180. this.personalMsg.username= result.username
  181. this.personalMsg.post = result.post
  182. this.personalMsg.sex = result.sex===1?'男':'女'
  183. this.personalMsg.birthday = result.birthday== null?'无':result.birthday
  184. this.personalMsg.departIds= result.departIds
  185. this.personalMsg.workNo= result.workNo
  186. this.personalMsg.phone= result.phone
  187. this.personalMsg.telephone= result.telephone== null?'无':result.telephone
  188. this.personalMsg.email= result.email
  189. this.personalMsg.post= result.post
  190. this.personalMsg.identity= result.identity=== 1?'普通成员':'上级'
  191. this.personalMsg.status= result.status === 1?'正常':'冻结'
  192. this.personalMsg.orgCode= result.orgCode
  193. }
  194. }).catch(e=>{
  195. console.log("请求错误",e)
  196. })
  197. this.$http.get(this.departUrl,{params:{userId:this.$store.getters.userid}}).then(res=> {
  198. if (res.success) {
  199. for (let item of res.result){
  200. this.personalMsg.orgCode = item.title
  201. this.personalMsg.departIds = item.title
  202. }
  203. }
  204. }).catch(e=>{
  205. console.log("请求错误",e)
  206. })
  207. this.$http.get(this.positionUrl).then(res=> {
  208. if (res.success) {
  209. let postArr = res.result.records
  210. for (let item of postArr ){
  211. if (this.personalMsg.post == item.code){
  212. this.personalMsg.post = item.name
  213. }
  214. }
  215. }
  216. }).catch(e=>{
  217. console.log("请求错误",e)
  218. })
  219. },
  220. }
  221. }
  222. </script>
  223. <style>
  224. .page {
  225. height: 100Vh;
  226. width: 100vw;
  227. }
  228. .page.show {
  229. overflow: hidden;
  230. }
  231. .switch-sex::after {
  232. content: "\e716";
  233. }
  234. .switch-sex::before {
  235. content: "\e7a9";
  236. }
  237. .switch-music::after {
  238. content: "\e66a";
  239. }
  240. .switch-music::before {
  241. content: "\e6db";
  242. }
  243. </style>