friend-item.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. uni.navigateTo({
  23. url: "/pages/common/user-info?id=" + this.friend.id
  24. })
  25. },
  26. },
  27. props: {
  28. friend: {
  29. type: Object
  30. }
  31. }
  32. }
  33. </script>
  34. <style scope lang="scss">
  35. .friend-item {
  36. height: 90rpx;
  37. display: flex;
  38. margin-bottom: 1rpx;
  39. position: relative;
  40. padding: 10rpx;
  41. padding-left: 20rpx;
  42. align-items: center;
  43. background-color: white;
  44. white-space: nowrap;
  45. &:hover {
  46. background-color: $im-bg;
  47. }
  48. .friend-info {
  49. flex: 1;
  50. display: flex;
  51. padding-left: 20rpx;
  52. text-align: left;
  53. .friend-name {
  54. flex: 1;
  55. font-size: $im-font-size;
  56. white-space: nowrap;
  57. overflow: hidden;
  58. }
  59. .friend-online {
  60. margin-top: 4rpx;
  61. .online {
  62. padding-right: 4rpx;
  63. width: 24rpx;
  64. height: 24rpx;
  65. }
  66. }
  67. }
  68. }
  69. </style>