VADirectChat.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <!-- DIRECT CHAT -->
  3. <div class="box direct-chat" :class="[boxColor, directChatColor]">
  4. <div class="box-header with-border">
  5. <h3 class="box-title">Direct Chat</h3>
  6. <div class="box-tools pull-right">
  7. <span data-toggle="tooltip" title="3 New Messages" class="badge" :class="badgeColor">3</span>
  8. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  9. </button>
  10. <button type="button" class="btn btn-box-tool" data-toggle="tooltip" title="Contacts" data-widget="chat-pane-toggle">
  11. <i class="fa fa-comments"></i></button>
  12. <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i>
  13. </button>
  14. </div>
  15. </div>
  16. <!-- /.box-header -->
  17. <div class="box-body">
  18. <!-- Conversations are loaded here -->
  19. <div class="direct-chat-messages">
  20. <va-direct-chat-item
  21. v-for="item in talkList"
  22. :name="item.name"
  23. :date="item.date"
  24. :profileImage="item.profileImage"
  25. :message="item.message"
  26. :isMine="item.isMine"
  27. ></va-direct-chat-item>
  28. </div>
  29. <!--/.direct-chat-messages-->
  30. <!-- Contacts are loaded here -->
  31. <div class="direct-chat-contacts">
  32. <ul class="contacts-list">
  33. <va-direct-chat-contact v-for="contact in contacts"
  34. :name="contact.name"
  35. :profileImage="contact.profileImage"
  36. :latestDate="contact.latestDate"
  37. :latestMessage="contact.latestMessage"
  38. ></va-direct-chat-contact>
  39. </ul>
  40. <!-- /.contatcts-list -->
  41. </div>
  42. <!-- /.direct-chat-pane -->
  43. </div>
  44. <!-- /.box-body -->
  45. <div class="box-footer">
  46. <form action="#" method="post">
  47. <div class="input-group">
  48. <input type="text" name="message" :placeholder="placeholder" class="form-control">
  49. <span class="input-group-btn">
  50. <button type="button" class="btn btn-warning btn-flat">Send</button>
  51. </span>
  52. </div>
  53. </form>
  54. </div>
  55. <!-- /.box-footer-->
  56. </div>
  57. <!--/.direct-chat -->
  58. </div>
  59. </template>
  60. <script>
  61. import VADirectChatItem from './VADirectChatItem.vue'
  62. import VADirectChatContact from './VADirectChatContact.vue'
  63. export default {
  64. name: 'va-direct-chat',
  65. props: {
  66. theme: {
  67. type: String,
  68. default: 'primary'
  69. },
  70. talkList: {
  71. type: Array
  72. },
  73. contacts: {
  74. type: Array
  75. },
  76. title: {
  77. type: String
  78. },
  79. badgeCount: {
  80. type: Number,
  81. default: 0
  82. },
  83. placeholder: {
  84. type: String,
  85. default: 'Type Message ...'
  86. }
  87. },
  88. computed: {
  89. badgeColor () {
  90. switch (this.theme) {
  91. case 'primary':
  92. return 'bg-light-blue'
  93. case 'success':
  94. return 'bg-green'
  95. case 'warning':
  96. return 'bg-yellow'
  97. case 'danger':
  98. return 'bg-red'
  99. default:
  100. return 'bg-light-blue'
  101. }
  102. },
  103. boxColor () {
  104. switch (this.theme) {
  105. case 'primary':
  106. case 'success':
  107. case 'warning':
  108. case 'danger':
  109. return `box-${this.theme}`
  110. default:
  111. return 'box-primary'
  112. }
  113. },
  114. directChatColor () {
  115. switch (this.theme) {
  116. case 'primary':
  117. case 'success':
  118. case 'warning':
  119. case 'danger':
  120. return `direct-chat-${this.theme}`
  121. default:
  122. return 'direct-chat-primary'
  123. }
  124. }
  125. },
  126. created () {
  127. },
  128. components: {
  129. 'va-direct-chat-item': VADirectChatItem,
  130. 'va-direct-chat-contact': VADirectChatContact
  131. }
  132. }
  133. </script>