userdetail.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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.username}}</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.workNo}}</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.realname}}</text>
  41. </view>
  42. </view>
  43. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
  44. <view class="content">
  45. <text class="text-grey">性别</text>
  46. </view>
  47. <view class="action">
  48. <text class="text-grey">{{personalMsg.sex}}</text>
  49. </view>
  50. </view>
  51. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.6s'}]">
  52. <view class="content">
  53. <text class="text-grey">英文名</text>
  54. </view>
  55. <view class="action">
  56. <text class="text-grey">{{personalMsg.egName}}</text>
  57. </view>
  58. </view>
  59. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.7s'}]">
  60. <view class="content">
  61. <text class="text-grey">职位</text>
  62. </view>
  63. <view class="action">
  64. <text class="text-grey">{{personalMsg.post}}</text>
  65. </view>
  66. </view>
  67. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.8s'}]">
  68. <view class="content">
  69. <text class="text-grey">部门</text>
  70. </view>
  71. <view class="action">
  72. <text class="text-grey">{{personalMsg.orgCodeTxt}}</text>
  73. </view>
  74. </view>
  75. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.9s'}]">
  76. <view class="content">
  77. <text class="text-grey">邮箱</text>
  78. </view>
  79. <view class="action">
  80. <text class="text-grey">{{personalMsg.email}}</text>
  81. </view>
  82. </view>
  83. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1s'}]">
  84. <view class="content">
  85. <text class="text-grey">手机号码</text>
  86. </view>
  87. <view class="action">
  88. <text class="text-grey">{{personalMsg.phone}}</text>
  89. </view>
  90. </view>
  91. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.1s'}]">
  92. <view class="content">
  93. <text class="text-grey">出生日期</text>
  94. </view>
  95. <view class="action">
  96. <text class="text-grey">{{personalMsg.birthday}}</text>
  97. </view>
  98. </view>
  99. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.2s'}]">
  100. <view class="content">
  101. <text class="text-grey">入职日期</text>
  102. </view>
  103. <view class="action">
  104. <text class="text-grey">{{personalMsg.entryDate}}</text>
  105. </view>
  106. </view>
  107. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.3s'}]">
  108. <view class="content">
  109. <text class="text-grey">紧急联系人</text>
  110. </view>
  111. <view class="action">
  112. <text class="text-grey">{{personalMsg.urgentName}}</text>
  113. </view>
  114. </view>
  115. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.4s'}]">
  116. <view class="content">
  117. <text class="text-grey">联系人电话</text>
  118. </view>
  119. <view class="action">
  120. <text class="text-grey">{{personalMsg.urgentPhone}}</text>
  121. </view>
  122. </view>
  123. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.5s'}]">
  124. <view class="content">
  125. <text class="text-grey">当前可用年假</text>
  126. </view>
  127. <view class="action">
  128. <text class="text-grey">{{personalMsg.availableDay/24}}天</text>
  129. </view>
  130. </view>
  131. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.6s'}]">
  132. <view class="content">
  133. <text class="text-grey">当前剩余调休</text>
  134. </view>
  135. <view class="action">
  136. <text class="text-grey">{{personalMsg.leaveDate}}小时</text>
  137. </view>
  138. </view>
  139. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.7s'}]">
  140. <view class="content">
  141. <text class="text-grey">考勤记录</text>
  142. </view>
  143. <view class="action">
  144. <span style="float: right;" v-if='personalMsg.sum=="2"' @click="sign()">本月无异常</span>
  145. <span style="float: right;color: red;" v-if='personalMsg.sum=="1"' @click="sign()">
  146. 本月有异常
  147. </span>
  148. </view>
  149. </view>
  150. </view>
  151. </scroll-view>
  152. </view>
  153. </template>
  154. <script>
  155. import api from '@/api/api.js'
  156. export default {
  157. data() {
  158. return {
  159. personalMsg:{
  160. avatar:'',
  161. realname:'',
  162. username:'',
  163. post:'',
  164. depart:'',
  165. phone:'',
  166. workNo:'',
  167. birthday:'',
  168. email:'',
  169. sex:'',
  170. egName:'',
  171. birthDate:'',
  172. entryDate:'',
  173. urgentName:'',
  174. urgentPhone:'',
  175. availableDay:'',
  176. orgCodeTxt:'',
  177. leaveDate:'',
  178. sum:''
  179. },
  180. userUrl:'/sys/user/queryById',
  181. positionUrl:'/sys/position/list',
  182. departUrl:'/sys/user/userDepartList'
  183. };
  184. },
  185. onLoad() {
  186. this.loadinfo()
  187. /* this.tt() */
  188. },
  189. methods: {
  190. /* tt(){
  191. var str="今天上海市有暴雨请带好防护装备";
  192. var url= "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=6&text="+str;
  193. new Audio(url).play();
  194. }, */
  195. sign(){
  196. this.$Router.push({name:'usersign'})
  197. },
  198. getSubStringText(text,len){
  199. if(!text || text.length==0){
  200. return ''
  201. }
  202. if(text.length<len){
  203. return text;
  204. }
  205. return text.substr(0,len)+"..."
  206. },
  207. rightClick(){
  208. this.$Router.push({name:'useredit', params:this.personalMsg})
  209. /* uni.navigateTo({
  210. url: '/pages/user/useredit?item='+item
  211. }); */
  212. },
  213. loadinfo(){
  214. this.$http.get(this.userUrl,{params:{id:this.$store.getters.userid}}).then(res=> {
  215. console.log("用户",res)
  216. if (res.statusCode==200) {
  217. let result = res.data.data
  218. let avatar=(result.avatar && result.avatar.length > 0)? api.getFileAccessHttpUrl(result.avatar):'/static/avatar_boy.png'
  219. this.personalMsg.avatar = avatar
  220. this.personalMsg.realname = result.realname
  221. this.personalMsg.username = result.username
  222. this.personalMsg.post = result.post
  223. this.personalMsg.depart = result.departIds
  224. this.personalMsg.phone=result.phone
  225. this.personalMsg.workNo=result.workNo
  226. this.personalMsg.birthday=result.birthday
  227. this.personalMsg.email=result.email
  228. if(result.sex==1){
  229. this.personalMsg.sex='男';
  230. }else{
  231. this.personalMsg.sex='女';
  232. }
  233. this.personalMsg.egName=result.egName
  234. this.personalMsg.birthDate=result.birthDate
  235. this.personalMsg.entryDate=result.entryDate
  236. this.personalMsg.urgentName=result.urgentName
  237. this.personalMsg.urgentPhone=result.urgentPhone
  238. if(res.data.sign!="" &&res.data.sign!=undefined){
  239. this.personalMsg.availableDay=res.data.sign.availableDay
  240. this.personalMsg.leaveDate=res.data.sign.leaveDate
  241. }
  242. this.personalMsg.orgCodeTxt=result.orgCodeTxt
  243. this.personalMsg.sum=res.data.sum
  244. }
  245. }).catch(e=>{
  246. console.log("请求错误",e)
  247. })
  248. /* this.$http.get(this.departUrl,{params:{userId:this.$store.getters.userid}}).then(res=> {
  249. if (res.success) {
  250. for (let item of res.result){
  251. this.personalMsg.orgCode = item.title
  252. this.personalMsg.departIds = item.title
  253. }
  254. }
  255. }).catch(e=>{
  256. console.log("请求错误",e)
  257. })
  258. this.$http.get(this.positionUrl).then(res=> {
  259. if (res.success) {
  260. let postArr = res.result.records
  261. for (let item of postArr ){
  262. if (this.personalMsg.post == item.code){
  263. this.personalMsg.post = item.name
  264. }
  265. }
  266. }
  267. }).catch(e=>{
  268. console.log("请求错误",e)
  269. }) */
  270. },
  271. }
  272. }
  273. </script>
  274. <style>
  275. .page {
  276. height: 100Vh;
  277. width: 100vw;
  278. }
  279. .page.show {
  280. overflow: hidden;
  281. }
  282. .switch-sex::after {
  283. content: "\e716";
  284. }
  285. .switch-sex::before {
  286. content: "\e7a9";
  287. }
  288. .switch-music::after {
  289. content: "\e66a";
  290. }
  291. .switch-music::before {
  292. content: "\e6db";
  293. }
  294. </style>