userInfo.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="content">
  3. <!-- 个人信息 -->
  4. <view class="user-info">
  5. <view class="info-box">
  6. <view class="left">
  7. <view class="head-box">
  8. <image class="img" :src="avatar" mode="aspectFill"></image>
  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. <image class="img" src="/static/images/icon_phone.png" mode="aspectFill" ></image>
  39. </view>
  40. <view class="item">
  41. <text class="label">邮箱</text>
  42. <text class="text">{{email}}</text>
  43. </view>
  44. <view class="item">
  45. <text class="label">部门</text>
  46. <text class="text">{{deptName}}</text>
  47. </view>
  48. <view class="item">
  49. <text class="label">岗位</text>
  50. <text class="text">{{postNames}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import {getCompanyUser} from '@/api/user.js';
  57. export default {
  58. data() {
  59. return {
  60. avatar:"/static/images/detault_head.jpg",
  61. nickName:"",
  62. deptName:"",
  63. postNames:"",
  64. phonenumber:"",
  65. email:"",
  66. sex:"",
  67. isShow:false,
  68. userId:undefined,
  69. }
  70. },
  71. onLoad(option) {
  72. // 修改顶部导航背景色
  73. // uni.setNavigationBarColor({
  74. // frontColor: '#ffffff',
  75. // backgroundColor: '#4BC9B1',
  76. // animation: {
  77. // duration: 400,
  78. // timingFunc: 'easeIn'
  79. // }
  80. // })
  81. },
  82. onShow() {
  83. this.getCompanyUser();
  84. },
  85. methods: {
  86. bindUser(data){
  87. var that=this;
  88. that.nickName=data.nickName;
  89. that.deptName=data.dept.deptName;
  90. that.phonenumber=data.phonenumber;
  91. that.email=data.email;
  92. if(data.sex==0){
  93. that.sex="男";
  94. }
  95. else if(data.sex==1){
  96. that.sex="女";
  97. }
  98. else if(data.sex==2){
  99. that.sex="未知";
  100. }
  101. if(!that.utils.isEmpty(data.avatar)){
  102. that.avatar=uni.getStorageSync('requestPath')+data.avatar;
  103. }
  104. },
  105. getCompanyUser(){
  106. var data = {};
  107. var that=this;
  108. getCompanyUser(data).then(
  109. res => {
  110. that.bindUser(res.data);
  111. },
  112. rej => {}
  113. );
  114. },
  115. // 拨打电话
  116. callPhone(tel){
  117. uni.makePhoneCall({
  118. phoneNumber: tel
  119. })
  120. },
  121. // 个人信息编辑
  122. editInfo() {
  123. uni.navigateTo({
  124. url: 'editUser'
  125. })
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss">
  131. page{
  132. background: #fff;
  133. }
  134. </style>
  135. <style scoped lang="scss">
  136. .content{
  137. // 个人信息
  138. .user-info{
  139. background: #115296;
  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: #fff;
  172. }
  173. .title{
  174. font-size: 28upx;
  175. color: #fff;
  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: #fff;
  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: space-between;
  218. .img{
  219. width: 50upx;
  220. height: 50upx;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. </style>