chat_users.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <el-tabs v-model="activeTabName" type="border-card">
  3. <el-tab-pane label="企业方" name="first">
  4. <div>
  5. <div class="content" v-if="comChatUsers && comChatUsers.list">
  6. <el-table :data="comChatUsers.list" border>
  7. <el-table-column :className="`clickable`" prop="username" label="企业名称" width="400">
  8. <template slot-scope="scope">
  9. <span @click="goCompany(scope.row)">{{scope.row.username}}</span>
  10. </template>
  11. </el-table-column>
  12. <el-table-column prop="lastChatTimeFormat" label="最近聊天" width="160"></el-table-column>
  13. <el-table-column prop="totalChatTime" label="总计聊天时长" width="160"></el-table-column>
  14. <el-table-column prop="totalChatUsers" label="总计聊天用户数" width="120"></el-table-column>
  15. <el-table-column prop="totalSendMessage" label="总计发送消息数" width="120"></el-table-column>
  16. </el-table>
  17. </div>
  18. <el-pagination
  19. class="order-footer"
  20. background
  21. layout="prev, pager, next"
  22. :page-size="20"
  23. :total="Number(comChatUsers.total)"
  24. @current-change="handleCurrentChangeCom"
  25. />
  26. </div>
  27. </el-tab-pane>
  28. <el-tab-pane label="开发者" name="second">
  29. <div>
  30. <div class="content" v-if="devChatUsers && devChatUsers.list">
  31. <el-table :data="devChatUsers.list" border>
  32. <el-table-column :className="`clickable`" prop="username" label="开发者名称" width="400">
  33. <template slot-scope="scope">
  34. <span @click="goRooterUser(scope.row)">{{scope.row.username}}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column prop="lastChatTimeFormat" label="最近聊天" width="160"></el-table-column>
  38. <el-table-column prop="totalChatTime" label="总计聊天时长" width="160"></el-table-column>
  39. <el-table-column prop="totalChatUsers" label="总计聊天用户数" width="120"></el-table-column>
  40. <el-table-column prop="totalSendMessage" label="总计发送消息数" width="120"></el-table-column>
  41. </el-table>
  42. </div>
  43. <el-pagination
  44. class="order-footer"
  45. background
  46. layout="prev, pager, next"
  47. :page-size="20"
  48. :total="Number(devChatUsers.total)"
  49. @current-change="handleCurrentChangeDev"
  50. />
  51. </div>
  52. </el-tab-pane>
  53. </el-tabs>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. activeTabName: "first",
  60. pageDev: 1,
  61. pageCom: 1,
  62. devChatUsers: "",
  63. comChatUsers: ""
  64. };
  65. },
  66. mounted() {
  67. this.getDevChatUsers();
  68. this.getComChatUsers();
  69. },
  70. methods: {
  71. async getDevChatUsers() {
  72. const page = this.pageDev;
  73. const homePageType = 2;
  74. const data = {
  75. page,
  76. homePageType
  77. };
  78. let res = await this.$post("/api/admin/chat/chatUsers", data);
  79. if (res && res.status === 1) {
  80. this.devChatUsers = res.data;
  81. console.log(this.devChatUsers);
  82. }
  83. },
  84. async getComChatUsers() {
  85. const page = this.pageCom;
  86. const homePageType = 1;
  87. const data = {
  88. page,
  89. homePageType
  90. };
  91. let res = await this.$post("/api/admin/chat/chatUsers", data);
  92. if (res && res.status === 1) {
  93. this.comChatUsers = res.data;
  94. console.log(this.comChatUsers);
  95. }
  96. },
  97. handleCurrentChangeCom(val) {
  98. this.pageCom = val;
  99. this.getComChatUsers();
  100. },
  101. handleCurrentChangeDev(val) {
  102. this.pageDev = val;
  103. this.getDevChatUsers();
  104. },
  105. goCompany(row) {
  106. window.open(
  107. this.$store.state.domainConfig.siteUrl + `/company/${row.uid}`
  108. );
  109. },
  110. goRooterUser() {
  111. window.open(
  112. this.$store.state.domainConfig.siteUrl + `/rooter/user/${row.uid}`
  113. );
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. .count-list {
  120. padding-bottom: 10px;
  121. display: flex;
  122. align-items: center;
  123. }
  124. .count-item {
  125. margin-right: 20px;
  126. font-size: 16px;
  127. }
  128. .content {
  129. white-space: nowrap;
  130. overflow-x: hidden;
  131. }
  132. .btn {
  133. width: 80px;
  134. }
  135. .order-footer {
  136. margin-top: 10px;
  137. }
  138. .clickable {
  139. cursor: pointer;
  140. color: #409eff;
  141. }
  142. </style>