userInfo.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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="../../static/images/icon_edit.png" mode="aspectFill" @click="editInfo"></image>
  16. </view>
  17. <!-- 公司 -->
  18. <view class="comp-info">
  19. <image class="img" src="../../static/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>
  52. </view>
  53. </template>
  54. <script>
  55. import {getCompanyUser} from '@/api/user.js';
  56. export default {
  57. data() {
  58. return {
  59. avatar:"/static/images/detault_head.jpg",
  60. nickName:"",
  61. deptName:"",
  62. postNames:"",
  63. phonenumber:"",
  64. email:"",
  65. sex:"",
  66. isShow:false,
  67. userId:undefined,
  68. }
  69. },
  70. onLoad(option) {
  71. // 修改顶部导航背景色
  72. // uni.setNavigationBarColor({
  73. // frontColor: '#ffffff',
  74. // backgroundColor: '#4BC9B1',
  75. // animation: {
  76. // duration: 400,
  77. // timingFunc: 'easeIn'
  78. // }
  79. // })
  80. },
  81. onShow() {
  82. this.getCompanyUser();
  83. },
  84. methods: {
  85. bindUser(data){
  86. var that=this;
  87. that.nickName=data.nickName;
  88. that.deptName=data.dept.deptName;
  89. that.phonenumber=data.phonenumber;
  90. that.email=data.email;
  91. if(data.sex==0){
  92. that.sex="男";
  93. }
  94. else if(data.sex==1){
  95. that.sex="女";
  96. }
  97. else if(data.sex==2){
  98. that.sex="未知";
  99. }
  100. if(!that.utils.isEmpty(data.avatar)){
  101. that.avatar=uni.getStorageSync('requestPath')+data.avatar;
  102. }
  103. },
  104. getCompanyUser(){
  105. var data = {};
  106. var that=this;
  107. getCompanyUser(data).then(
  108. res => {
  109. that.bindUser(res.user);
  110. },
  111. rej => {}
  112. );
  113. },
  114. // 拨打电话
  115. callPhone(tel){
  116. uni.makePhoneCall({
  117. phoneNumber: tel
  118. })
  119. },
  120. // 个人信息编辑
  121. editInfo() {
  122. uni.navigateTo({
  123. url: 'editUser'
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. page{
  131. background: #fff;
  132. }
  133. </style>
  134. <style scoped lang="scss">
  135. .content{
  136. // 个人信息
  137. .user-info{
  138. // background: #115296;
  139. background: linear-gradient(to right, #dae9ff, #e1e1fd);
  140. padding: 0 30upx;
  141. .info-box{
  142. display: flex;
  143. align-items: center;
  144. justify-content: space-between;
  145. .left{
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. padding: 20upx 0;
  150. .head-box{
  151. width: 120upx;
  152. height: 120upx;
  153. line-height: 100upx;
  154. font-size: 30upx;
  155. color: #fff;
  156. text-align: center;
  157. margin-right: 20upx;
  158. .img{
  159. border-radius: 50%;
  160. width: 100%;
  161. height: 100%;
  162. }
  163. }
  164. .info{
  165. height: 80upx;
  166. display: flex;
  167. flex-direction: column;
  168. justify-content: space-between;
  169. .name{
  170. font-size: 30upx;
  171. color: #878787;
  172. }
  173. .title{
  174. font-size: 28upx;
  175. color: #878787;
  176. }
  177. }
  178. }
  179. .right{
  180. width: 40upx;
  181. height: 40upx;
  182. }
  183. }
  184. .comp-info{
  185. padding: 20upx 0 40upx;
  186. display: flex;
  187. align-items: center;
  188. .img{
  189. width: 30upx;
  190. height: 30upx;
  191. margin-right: 20upx;
  192. }
  193. .text{
  194. font-size: 30upx;
  195. color: #878787;
  196. }
  197. }
  198. }
  199. // 详细信息
  200. .info-detail{
  201. padding: 0 24upx;
  202. .item{
  203. padding: 20upx 0;
  204. border-bottom: 1px solid #f7f7f7;
  205. .label{
  206. font-size: 30upx;
  207. color: #999;
  208. margin-right: 20upx;
  209. }
  210. .text{
  211. font-size: 30upx;
  212. color: #333;
  213. }
  214. &.column{
  215. display: flex;
  216. align-items: center;
  217. justify-content: flex-start;
  218. align-items: flex-start;
  219. flex-direction: row;
  220. .img{
  221. width: 50upx;
  222. height: 50upx;
  223. margin-right: 20rpx;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. </style>