userInfo.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="content">
  3. <!-- 个人信息 -->
  4. <view class="user-info">
  5. <view class="info-box">
  6. <view class="left justify-center align-center">
  7. <view class="head-box center">
  8. <u-avatar :src="avatar" size="50"></u-avatar>
  9. </view>
  10. <view class="info">
  11. <text class="name">{{nickName}}</text>
  12. <text class="title">{{phonenumber}}</text>
  13. </view>
  14. </view>
  15. <image class="right" :src="imgPath+'/app/images/icon_edit.png'" mode="aspectFill'" @click="editInfo"></image>
  16. </view>
  17. <!-- 公司 -->
  18. <view class="comp-info">
  19. <image class="img" :src="imgPath+'/app/images/icon_comp_white.png'" mode="aspectFill"></image>
  20. <text class="text">{{deptName}}</text>
  21. </view>
  22. </view>
  23. <!-- 详细信息 -->
  24. <view class="info-detail">
  25. <view class="item">
  26. <text class="label">姓名</text>
  27. <text class="text">{{nickName}}</text>
  28. </view>
  29. <view class="item">
  30. <text class="label">性别</text>
  31. <text class="text">{{sex}}</text>
  32. </view>
  33. <view class="item column" @click="callPhone(phonenumber)">
  34. <view class="left">
  35. <text class="label">手机</text>
  36. <text class="text">{{phonenumber}}</text>
  37. </view>
  38. </view>
  39. <view class="item">
  40. <text class="label">邮箱</text>
  41. <text class="text">{{email}}</text>
  42. </view>
  43. <view class="item">
  44. <text class="label">部门</text>
  45. <text class="text">{{deptName}}</text>
  46. </view>
  47. <view class="item">
  48. <text class="label">岗位</text>
  49. <text class="text">{{postNames}}</text>
  50. </view>
  51. <view class="item">
  52. <text class="label">角色</text>
  53. <text class="text">{{roleNames}}</text>
  54. </view>
  55. <view class="item justify-start align-center">
  56. <text class="label">二维码</text>
  57. <!-- <text class="text">{{postNames}}</text> -->
  58. <image :src="qrCodeWeixin" class="w120 h120" mode="aspectFill"></image>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {getCompanyUser} from '@/api/user.js';
  65. export default {
  66. data() {
  67. return {
  68. avatar:this.$store.state.imgpath+"/app/images/detault_head.jpg",
  69. nickName:"",
  70. deptName:"",
  71. postNames:"",
  72. phonenumber:"",
  73. email:"",
  74. sex:"",
  75. qrCodeWeixin:"",
  76. isShow:false,
  77. userId:undefined,
  78. roleNames:''
  79. }
  80. },
  81. onLoad(option) {
  82. // 修改顶部导航背景色
  83. // uni.setNavigationBarColor({
  84. // frontColor: '#ffffff',
  85. // backgroundColor: '#4BC9B1',
  86. // animation: {
  87. // duration: 400,
  88. // timingFunc: 'easeIn'
  89. // }
  90. // })
  91. },
  92. computed: {
  93. imgPath() {
  94. return this.$store.state.imgpath
  95. }
  96. },
  97. onShow() {
  98. this.getCompanyUser();
  99. },
  100. methods: {
  101. bindUser(data){
  102. var that=this;
  103. that.nickName=data.nickName;
  104. that.deptName=data.companyName?data.companyName:'暂无';
  105. that.phonenumber=data.phonenumber?data.phonenumber:'暂无';
  106. if(data.posts){
  107. that.postNames=data.posts.map(item=>item.postName).join(",")
  108. }
  109. if(data.roles){
  110. this.roleNames=data.roles.map(item=>item.roleName).join(",")
  111. }
  112. // this.postNames=data.posts.map(item=>item.postName).join(",")||'暂无'
  113. // this.roleNames=data.roles.map(item=>item.roleName).join(",")||'暂无'
  114. that.email=data.email?data.email:'暂无';
  115. if(data.sex==0){
  116. that.sex="男";
  117. }
  118. else if(data.sex==1){
  119. that.sex="女";
  120. }
  121. else if(data.sex==2){
  122. that.sex="未知";
  123. }
  124. that.qrCodeWeixin=uni.getStorageSync('requestPath')+data.qrCodeWeixin
  125. if(data.avatar){
  126. that.avatar=uni.getStorageSync('requestPath')+data.avatar;
  127. }
  128. },
  129. getCompanyUser(){
  130. var data = {};
  131. var that=this;
  132. getCompanyUser(data).then(
  133. res => {
  134. that.bindUser(res.user);
  135. },
  136. rej => {}
  137. );
  138. },
  139. // 拨打电话
  140. callPhone(tel){
  141. uni.makePhoneCall({
  142. phoneNumber: tel
  143. })
  144. },
  145. // 个人信息编辑
  146. editInfo() {
  147. uni.navigateTo({
  148. url: 'editUser'
  149. })
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. page{
  156. background: #fff;
  157. }
  158. </style>
  159. <style scoped lang="scss">
  160. .content{
  161. // 个人信息
  162. .user-info{
  163. // background: #115296;
  164. background: linear-gradient(to right, #dae9ff, #e1e1fd);
  165. padding: 0 30upx;
  166. .info-box{
  167. display: flex;
  168. align-items: center;
  169. justify-content: space-between;
  170. .left{
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. padding: 20upx 0;
  175. .head-box{
  176. width: 120upx;
  177. height: 120upx;
  178. line-height: 100upx;
  179. font-size: 30upx;
  180. color: #fff;
  181. text-align: center;
  182. margin-right: 20upx;
  183. .img{
  184. border-radius: 50%;
  185. width: 100%;
  186. height: 100%;
  187. }
  188. }
  189. .info{
  190. height: 80upx;
  191. display: flex;
  192. flex-direction: column;
  193. justify-content: space-between;
  194. .name{
  195. font-size: 30upx;
  196. color: #878787;
  197. }
  198. .title{
  199. font-size: 28upx;
  200. color: #878787;
  201. }
  202. }
  203. }
  204. .right{
  205. width: 40upx;
  206. height: 40upx;
  207. }
  208. }
  209. .comp-info{
  210. padding: 20upx 0 40upx;
  211. display: flex;
  212. align-items: center;
  213. .img{
  214. width: 30upx;
  215. height: 30upx;
  216. margin-right: 20upx;
  217. }
  218. .text{
  219. font-size: 30upx;
  220. color: #878787;
  221. }
  222. }
  223. }
  224. // 详细信息
  225. .info-detail{
  226. padding: 0 24upx;
  227. .item{
  228. padding: 20upx 0;
  229. border-bottom: 1px solid #f7f7f7;
  230. .label{
  231. font-size: 30upx;
  232. color: #999;
  233. margin-right: 20upx;
  234. }
  235. .text{
  236. font-size: 30upx;
  237. color: #333;
  238. }
  239. &.column{
  240. display: flex;
  241. align-items: center;
  242. justify-content: flex-start;
  243. align-items: flex-start;
  244. flex-direction: row;
  245. .img{
  246. width: 50upx;
  247. height: 50upx;
  248. margin-right: 20rpx;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. </style>