employee_card.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="employee_card" @click="selectOne">
  3. <view :class="{employee_card_left_box:right_nativate==true,
  4. employee_card_box:right_nativate==false}" >
  5. <view >
  6. <image class="image" mode="aspectFill" :src="imgUrl" />
  7. </view>
  8. <view class="employee_card_column">
  9. <label class="employee_card_top_box">{{name}}</label>
  10. <label class="employee_card_bottom_box">{{position}}</label>
  11. </view>
  12. </view>
  13. <view v-if="right_nativate" class="employee_card_right_box">
  14. <label class="right_label">></label>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'employee-card',
  21. props: {
  22. right_nativate:
  23. {
  24. type:Boolean,
  25. default:true
  26. },
  27. employeeId:
  28. {
  29. type:String,
  30. default:'asdf'
  31. },
  32. name: {
  33. type: String,
  34. default: ''
  35. },
  36. position:{
  37. type:String,
  38. default:'程序员'
  39. },
  40. imgUrl:{
  41. type:String,
  42. default:'/static/userpic.png'
  43. },
  44. },
  45. methods:{
  46. selectOne(i, event) {
  47. let _id = this.employeeId;
  48. let _name = this.name;
  49. let response = {
  50. id: _id,
  51. name: _name
  52. };
  53. this.$emit('onEmployeeClick',response);
  54. }
  55. }
  56. }
  57. </script>
  58. <style>
  59. .image {
  60. margin:20rpx 20rpx 20rpx 20rpx;
  61. width: 100rpx;
  62. height: 100rpx;
  63. }
  64. .employee_card_column
  65. {
  66. display: flex;
  67. flex-direction: column;
  68. }
  69. .employee_card
  70. {
  71. display: flex;
  72. flex-direction: row;
  73. justify-content: space-around;
  74. position: relative;
  75. height: 140rpx;
  76. top:0rpx;
  77. left:0rpx;
  78. background-color: #FFFFFF!important;
  79. width: auto;
  80. }
  81. .employee_card_left_box
  82. {
  83. display: flex;
  84. flex-direction: row;
  85. height: 100%;
  86. width: 90%;
  87. }
  88. .employee_card_box
  89. {
  90. display: flex;
  91. flex-direction: row;
  92. height: 100%;
  93. width: 100%;
  94. }
  95. .employee_card_right_box
  96. {
  97. height: 100%;
  98. width: 10%;
  99. display: flex;
  100. justify-content: flex-end;
  101. padding-right: 20rpx;
  102. }
  103. .right_label
  104. {
  105. color: #C8C8C8;
  106. line-height: 140rpx;
  107. font-size: 40rpx;
  108. }
  109. .employee_card_top_box
  110. {
  111. height: 60%;
  112. font-weight: bold;
  113. line-height: 84rpx;
  114. font-size: 44rpx;
  115. margin-left: 20rpx;
  116. }
  117. .employee_card_bottom_box
  118. {
  119. height: 40%;
  120. line-height: 56rpx;
  121. font-size: 30rpx;
  122. margin-left: 20rpx;
  123. }
  124. </style>