friend-item.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="friend-item" @click="showFriendInfo()">
  3. <head-image :name="friend.nickName" :online="friend.online" :url="friend.headImage" size="small"></head-image>
  4. <view class="friend-info">
  5. <view class="friend-name">{{ friend.nickName }}</view>
  6. <view class="friend-online">
  7. <image v-show="friend.onlineWeb" class="online" src="/static/image/online_web.png" title="电脑设备在线" />
  8. <image v-show="friend.onlineApp" class="online" src="/static/image/online_app.png" title="移动设备在线" />
  9. </view>
  10. <slot></slot>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name: "frined-item",
  17. data() {
  18. return {}
  19. },
  20. methods: {
  21. showFriendInfo() {
  22. if (this.detail) {
  23. uni.navigateTo({
  24. url: "/pages/common/user-info?id=" + this.friend.id
  25. })
  26. }
  27. }
  28. },
  29. props: {
  30. friend: {
  31. type: Object
  32. },
  33. detail: {
  34. type: Boolean,
  35. default: true
  36. }
  37. }
  38. }
  39. </script>
  40. <style scope lang="scss">
  41. .friend-item {
  42. height: 90rpx;
  43. display: flex;
  44. margin-bottom: 1rpx;
  45. position: relative;
  46. padding: 10rpx;
  47. padding-left: 20rpx;
  48. align-items: center;
  49. background-color: white;
  50. white-space: nowrap;
  51. &:hover {
  52. background-color: $im-bg;
  53. }
  54. .friend-info {
  55. flex: 1;
  56. display: flex;
  57. padding-left: 20rpx;
  58. text-align: left;
  59. .friend-name {
  60. flex: 1;
  61. font-size: $im-font-size;
  62. white-space: nowrap;
  63. overflow: hidden;
  64. }
  65. .friend-online {
  66. margin-top: 4rpx;
  67. .online {
  68. padding-right: 4rpx;
  69. width: 24rpx;
  70. height: 24rpx;
  71. }
  72. }
  73. }
  74. }
  75. </style>