App.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <el-config-provider :locale="locale">
  3. <div id="nav" class="lingdu_main" v-if="host !== ''">
  4. <!-- <router-link to="/">栏目</router-link> |
  5. <router-link to="/channel">频道</router-link> |
  6. <router-link to="/realData">直播数据</router-link> -->
  7. <router-view />
  8. </div>
  9. <div
  10. class="baseData"
  11. ref="baseData"
  12. style="opacity: 0;position: absolute; z-index= -1;top:0"
  13. ></div>
  14. </el-config-provider>
  15. </template>
  16. <script>
  17. import locale from "element-plus/lib/locale/lang/zh-cn";
  18. import config from "./config/index";
  19. let nanoid = (t = 21) => {
  20. let e = "",
  21. r = crypto.getRandomValues(new Uint8Array(t));
  22. for (; t--; ) {
  23. let n = 63 & r[t];
  24. e +=
  25. n < 36
  26. ? n.toString(36)
  27. : n < 62
  28. ? (n - 26).toString(36).toUpperCase()
  29. : n < 63
  30. ? "_"
  31. : "-";
  32. }
  33. return e;
  34. };
  35. export default {
  36. name: "Program",
  37. data() {
  38. return {
  39. locale,
  40. host: "",
  41. };
  42. },
  43. mounted() {
  44. let n = nanoid();
  45. const li = [
  46. {
  47. url: "http://172.16.101.20:8877/test.html?url=http://172.16.101.20&uuid=",
  48. },
  49. {
  50. url: "http://10.0.254.67:8877/test.html?url=http://10.0.254.67&uuid=",
  51. },
  52. ];
  53. for (let i = 0; i < li.length; i++) {
  54. const v = li[i];
  55. const iframe = document.createElement("iframe");
  56. iframe.src = v.url + n;
  57. this.$refs.baseData.appendChild(iframe);
  58. }
  59. if (window.fetch) this.getdata(n);
  60. },
  61. methods: {
  62. getdata(n) {
  63. window
  64. .fetch("http://47.108.249.49:8877/result?id=" + n, {
  65. method: "GET",
  66. // method: "OPTIONS",
  67. })
  68. .then(res => {
  69. if (res.status !== 200) return { err: "请求失败" };
  70. try {
  71. return res.json();
  72. } catch (err) {
  73. return { err };
  74. }
  75. })
  76. .then(res => {
  77. this.$refs.baseData.innerHTML = "";
  78. if (res.err) {
  79. document.querySelector(".showText").style.display = "block";
  80. document.querySelector(".loader").style.display = "none";
  81. return;
  82. }
  83. config.base.Intranet = res.Host;
  84. this.host = res.Host;
  85. });
  86. },
  87. },
  88. components: {},
  89. };
  90. </script>
  91. <style>
  92. * {
  93. padding: 0;
  94. margin: 0;
  95. font-weight: 400;
  96. box-sizing: border-box;
  97. }
  98. *::-webkit-scrollbar {
  99. /*滚动条整体样式*/
  100. width: 5px;
  101. /*高宽分别对应横竖滚动条的尺寸*/
  102. height: 1px;
  103. }
  104. *::-webkit-scrollbar-thumb {
  105. /*滚动条里面小方块*/
  106. border-radius: 10px;
  107. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  108. background: #babcc0;
  109. }
  110. *::-webkit-scrollbar-track {
  111. /*滚动条里面轨道*/
  112. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  113. border-radius: 10px;
  114. background: #ededed;
  115. }
  116. #app {
  117. font-family: Avenir, Helvetica, Arial, sans-serif;
  118. -webkit-font-smoothing: antialiased;
  119. -moz-osx-font-smoothing: grayscale;
  120. color: #2c3e50;
  121. }
  122. body {
  123. position: relative;
  124. }
  125. body .el-date-table td.current:not(.disabled) span,
  126. body .el-date-table td.end-date span,
  127. body .el-date-table td.start-date span {
  128. background-color: #313759;
  129. }
  130. body .el-range-editor.is-active,
  131. body .el-select .el-input.is-focus .el-input__inner,
  132. body .el-select .el-input__inner:focus {
  133. border-color: #313759;
  134. }
  135. body .el-date-table td.today span,
  136. body .el-select-dropdown__item.selected,
  137. body .el-select-dropdown.is-multiple .el-select-dropdown__item.selected {
  138. color: #313759;
  139. }
  140. body .el-date-editor--daterange.el-input__inner,
  141. body .el-date-editor--timerange.el-input__inner {
  142. width: 220px;
  143. }
  144. .nav {
  145. min-height: 100vh;
  146. }
  147. .lingdu_main .el-breadcrumb {
  148. margin-bottom: 10px !important;
  149. }
  150. .lingdu_main .el-breadcrumb__item .el-breadcrumb__inner {
  151. font-weight: 700 !important;
  152. }
  153. </style>