log.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div id="log" style="width: 100%">
  3. <el-container v-loading="loading" >
  4. <el-aside width="400px" >
  5. </el-aside>
  6. <el-main style="padding: 5px;">
  7. </el-main>
  8. </el-container>
  9. </div>
  10. </template>
  11. <script>
  12. // import uiHeader from '../layout/UiHeader.vue'
  13. export default {
  14. name: 'log',
  15. components: {},
  16. data() {
  17. return {
  18. loading: false,
  19. };
  20. },
  21. created() {
  22. console.log('created');
  23. this.initData();
  24. },
  25. destroyed() {},
  26. methods: {
  27. initData: function () {
  28. console.log('initData');
  29. const websocket = new WebSocket("ws://localhost:18080/channel/log");
  30. websocket.onclose = e => {
  31. console.log(`conn closed: code=${e.code}, reason=${e.reason}, wasClean=${e.wasClean}`)
  32. }
  33. websocket.onmessage = e => {
  34. console.log(e.data);
  35. }
  36. websocket.onerror = e => {
  37. console.log(`conn err`)
  38. console.error(e)
  39. }
  40. websocket.onopen = e => {
  41. console.log(`conn open: ${e}`);
  42. }
  43. },
  44. }
  45. };
  46. </script>
  47. <style>
  48. .videoList {
  49. display: flex;
  50. flex-wrap: wrap;
  51. align-content: flex-start;
  52. }
  53. .video-item {
  54. position: relative;
  55. width: 15rem;
  56. height: 10rem;
  57. margin-right: 1rem;
  58. background-color: #000000;
  59. }
  60. .video-item-img {
  61. position: absolute;
  62. top: 0;
  63. bottom: 0;
  64. left: 0;
  65. right: 0;
  66. margin: auto;
  67. width: 100%;
  68. height: 100%;
  69. }
  70. .video-item-img:after {
  71. content: "";
  72. display: inline-block;
  73. position: absolute;
  74. z-index: 2;
  75. top: 0;
  76. bottom: 0;
  77. left: 0;
  78. right: 0;
  79. margin: auto;
  80. width: 3rem;
  81. height: 3rem;
  82. background-image: url("../assets/loading.png");
  83. background-size: cover;
  84. background-color: #000000;
  85. }
  86. .video-item-title {
  87. position: absolute;
  88. bottom: 0;
  89. color: #000000;
  90. background-color: #ffffff;
  91. line-height: 1.5rem;
  92. padding: 0.3rem;
  93. width: 14.4rem;
  94. }
  95. </style>