userdetail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. <view class="example-body " style="display: flex;justify-content: center; margin-top: 80rpx;">
  10. <uni-file-picker readonly :value="fileLists" :imageStyles="imageStyles" file-mediatype="image">
  11. </uni-file-picker>
  12. </view>
  13. <!-- list列表 -->
  14. <uni-card>
  15. <view class="cu-list menu">
  16. <!-- <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
  17. <view class="content">
  18. <text class="text-grey">头像</text>
  19. </view>
  20. <view class="action">
  21. <view class="cu-avatar round sm" :style="{backgroundImage: 'url(' + personalMsg.avatar + ')'}"></view>
  22. </view>
  23. </view> -->
  24. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
  25. <view class="content">
  26. <text class="text-grey">姓名:</text>
  27. </view>
  28. <view class="action">
  29. <text class="text-grey">{{user.username}}</text>
  30. </view>
  31. </view>
  32. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
  33. <view class="content">
  34. <text class="text-grey">单位名称:</text>
  35. </view>
  36. <view class="action">
  37. <text class="text-grey">{{user.companyname}}</text>
  38. </view>
  39. </view>
  40. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
  41. <view class="content">
  42. <text class="text-grey">手机号:</text>
  43. </view>
  44. <view class="action">
  45. <text class="text-grey">{{user.number}}</text>
  46. </view>
  47. </view>
  48. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
  49. <view class="content">
  50. <text class="text-grey">邮箱:</text>
  51. </view>
  52. <view class="action">
  53. <text class="text-grey">{{user.remark}}</text>
  54. </view>
  55. </view>
  56. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
  57. <view class="content">
  58. <text class="text-grey">备注:</text>
  59. </view>
  60. <view class="action">
  61. <text class="text-grey">{{user.remark}}</text>
  62. </view>
  63. </view>
  64. <!-- <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
  65. <view class="content">
  66. <text class="text-grey">性别</text>
  67. </view>
  68. <view class="action">
  69. <text class="text-grey">{{personalMsg.sex}}</text>
  70. </view>
  71. </view> -->
  72. <!-- <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.4s'}]">
  73. <view class="content">
  74. <text class="text-grey">生日</text>
  75. </view>
  76. <view class="action">
  77. <text class="text-grey">{{personalMsg.birthday}}</text>
  78. </view>
  79. </view> -->
  80. </view>
  81. <!-- <view class="cu-list menu">
  82. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
  83. <view class="content">
  84. <text class="text-grey">对外信息展示</text>
  85. </view>
  86. <view class="action">
  87. <text class="text-grey">{{getSubStringText(personalMsg.realname+'@'+personalMsg.orgCode,11)}}</text>
  88. </view>
  89. </view>
  90. </view> -->
  91. <!-- <view class="cu-list menu">
  92. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.9s'}]">
  93. <view class="content">
  94. <text class="text-grey">手机</text>
  95. </view>
  96. <view class="action">
  97. <text class="text-grey">{{personalMsg.phone}}</text>
  98. </view>
  99. </view>
  100. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1s'}]">
  101. <view class="content">
  102. <text class="text-grey">邮箱</text>
  103. </view>
  104. <view class="action">
  105. <text class="text-grey">{{personalMsg.email}}</text>
  106. </view>
  107. </view>
  108. </view> -->
  109. </uni-card>
  110. </scroll-view>
  111. </view>
  112. </template>
  113. <script>
  114. import { ACCESS_TOKEN,USER_NAME,USER_INFO } from "@/common/util/constants"
  115. import api from '@/api/api.js'
  116. export default {
  117. data() {
  118. return {
  119. imageStyles: {
  120. width: 84,
  121. height: 84,
  122. border: {
  123. radius: '50%'
  124. }
  125. },
  126. listStyles: {
  127. // 是否显示边框
  128. border: true,
  129. // 是否显示分隔线
  130. dividline: true,
  131. // 线条样式
  132. borderStyle: {
  133. width: 1,
  134. color: 'blue',
  135. style: 'dashed',
  136. radius: 2
  137. }
  138. },
  139. fileLists: [{
  140. //url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg',
  141. url:'/static/touxiang.jpg',
  142. extname: 'png',
  143. name: 'shuijiao.png'
  144. }],
  145. user:{
  146. companyname:'',
  147. number:'',
  148. username:'',
  149. },
  150. personalMsg:{
  151. avatar:'',
  152. realname:'',
  153. username:'',
  154. sex:1,
  155. birthday:new Date(),
  156. orgCode:'',
  157. workNo:'',
  158. status:1,
  159. phone:'',
  160. telephone:'',
  161. email:'',
  162. post:'',
  163. departIds:'',
  164. identity:'',
  165. },
  166. userUrl:'/sys/user/queryById',
  167. positionUrl:'/sys/position/list',
  168. departUrl:'/sys/user/userDepartList'
  169. };
  170. },
  171. onLoad() {
  172. this.user=uni.getStorageSync(USER_INFO);
  173. //this.loadinfo()
  174. },
  175. methods: {
  176. getSubStringText(text,len){
  177. if(!text || text.length==0){
  178. return ''
  179. }
  180. if(text.length<len){
  181. return text;
  182. }
  183. return text.substr(0,len)+"..."
  184. },
  185. rightClick(){
  186. this.$Router.push({name:'useredit', params:this.personalMsg})
  187. /* uni.navigateTo({
  188. url: '/pages/user/useredit?item='+item
  189. }); */
  190. },
  191. loadinfo(){
  192. this.$http.get(this.userUrl,{params:{id:this.$store.getters.userid}}).then(res=> {
  193. console.log("用户",res)
  194. if (res.data.success) {
  195. let result = res.data.result
  196. if(result.avatar&&result.avatar.length >0)
  197. this.personalMsg.avatar = api.getFileAccessHttpUrl(result.avatar)
  198. this.personalMsg.realname = result.realname
  199. this.personalMsg.username= result.username
  200. this.personalMsg.post = result.post
  201. this.personalMsg.sex = result.sex===1?'男':'女'
  202. this.personalMsg.birthday = result.birthday== null?'无':result.birthday
  203. this.personalMsg.departIds= result.departIds
  204. this.personalMsg.workNo= result.workNo
  205. this.personalMsg.phone= result.phone
  206. this.personalMsg.telephone= result.telephone== null?'无':result.telephone
  207. this.personalMsg.email= result.email
  208. this.personalMsg.post= result.post
  209. this.personalMsg.identity= result.identity=== 1?'普通成员':'上级'
  210. this.personalMsg.status= result.status === 1?'正常':'冻结'
  211. this.personalMsg.orgCode= result.orgCode
  212. }
  213. }).catch(e=>{
  214. console.log("请求错误",e)
  215. })
  216. this.$http.get(this.departUrl,{params:{userId:this.$store.getters.userid}}).then(res=> {
  217. if (res.success) {
  218. for (let item of res.result){
  219. this.personalMsg.orgCode = item.title
  220. this.personalMsg.departIds = item.title
  221. }
  222. }
  223. }).catch(e=>{
  224. console.log("请求错误",e)
  225. })
  226. this.$http.get(this.positionUrl).then(res=> {
  227. if (res.success) {
  228. let postArr = res.result.records
  229. for (let item of postArr ){
  230. if (this.personalMsg.post == item.code){
  231. this.personalMsg.post = item.name
  232. }
  233. }
  234. }
  235. }).catch(e=>{
  236. console.log("请求错误",e)
  237. })
  238. },
  239. }
  240. }
  241. </script>
  242. <style>
  243. .page {
  244. height: 100Vh;
  245. width: 100vw;
  246. }
  247. .page.show {
  248. overflow: hidden;
  249. }
  250. .switch-sex::after {
  251. content: "\e716";
  252. }
  253. .switch-sex::before {
  254. content: "\e7a9";
  255. }
  256. .switch-music::after {
  257. content: "\e66a";
  258. }
  259. .switch-music::before {
  260. content: "\e6db";
  261. }
  262. .example-body {
  263. padding: 10px;
  264. padding-top: 0;
  265. }
  266. .custom-image-box {
  267. /* #ifndef APP-NVUE */
  268. display: flex;
  269. /* #endif */
  270. flex-direction: row;
  271. justify-content: space-between;
  272. align-items: center;
  273. }
  274. .text {
  275. font-size: 14px;
  276. color: #333;
  277. }
  278. </style>