elecindex.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div id="elec-index" ref="appRef">
  3. <dv-loading v-if="loading">Loading...</dv-loading>
  4. <div v-else class="host-body">
  5. <div class="d-flex jc-center">
  6. <dv-decoration-10 style="width:33.3%;height:.0625rem;" />
  7. <div class="d-flex jc-center">
  8. <dv-decoration-8 :color="['#568aea', '#000000']" style="width:2.5rem;height:.625rem;" />
  9. <div class="title">
  10. <span class="title-text">电厂监控大屏</span>
  11. <dv-decoration-6
  12. class="title-bototm"
  13. :reverse="true"
  14. :color="['#50e3c2', '#67a1e5']"
  15. style="width:3.125rem;height:.1rem;"
  16. />
  17. </div>
  18. <dv-decoration-8
  19. :reverse="true"
  20. :color="['#568aea', '#000000']"
  21. style="width:2.5rem;height:.625rem;"
  22. />
  23. </div>
  24. <dv-decoration-10 style="width:33.3%;height:.0625rem; transform: rotateY(180deg);" />
  25. </div>
  26. <!-- 第二行 -->
  27. <div class="d-flex jc-between px-2">
  28. <div class="d-flex" style="width: 40%">
  29. <div
  30. class="react-right ml-4"
  31. style="width: 3.25rem; text-align: left;background-color: #0f1325;"
  32. >
  33. <span class="react-before"></span>
  34. <span class="text"></span>
  35. </div>
  36. <div class="react-right ml-3" style="background-color: #0f1325;" >
  37. <span class="text colorBlue"></span>
  38. </div>
  39. <div class="react-right ml-3" style="background-color: #0f1325;" >
  40. <span class="text colorBlue"></span>
  41. </div>
  42. </div>
  43. <div style="width: 40%" class="d-flex">
  44. <div class="react-left bg-color-blue mr-3">
  45. <span class="text fw-b">北京时间</span>
  46. </div>
  47. <div
  48. class="react-left mr-3"
  49. style="width: 6.25rem; background-color: #0f1325;"
  50. >
  51. <span style="text-align: center" class="text">{{dateYear}} {{dateWeek}} {{dateDay}}</span>
  52. </div>
  53. <div class="react-left mr-3" style="width: 2.25rem; background-color: #0f1325;" @click="openNewWindow">
  54. <span class="text fw-b"> <svg-icon icon-class="fullscreen" /></span>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="body-box">
  59. <!-- 第三行数据 -->
  60. <div class="content-box">
  61. <div>
  62. <dv-border-box-12>
  63. <centerLeft1 />
  64. </dv-border-box-12>
  65. </div>
  66. <!-- 中间 -->
  67. <div>
  68. <center />
  69. </div>
  70. <!-- 中间 -->
  71. <div>
  72. <centerRight2 />
  73. </div>
  74. <div>
  75. <dv-border-box-13>
  76. <centerRight1 />
  77. </dv-border-box-13>
  78. </div>
  79. </div>
  80. <!-- 第四行数据 -->
  81. <div class="bototm-box">
  82. <dv-border-box-13>
  83. <bottomLeft />
  84. </dv-border-box-13>
  85. <dv-border-box-12>
  86. <bottomRight />
  87. </dv-border-box-12>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import centerLeft1 from "./centerLeft1";
  95. import centerLeft2 from "./centerLeft2";
  96. import centerRight1 from "./centerRight1";
  97. import centerRight2 from "./centerRight2";
  98. import center from "./center";
  99. import bottomLeft from "./bottomLeft";
  100. import bottomRight from "./bottomRight";
  101. import '@/assets/styles/index.scss' // global css
  102. import '@/common/flexible.js';
  103. import dayjs from "dayjs";
  104. export default {
  105. data() {
  106. return {
  107. loading: true,
  108. dashboard: 1,
  109. dateDay: null,
  110. dateYear: null,
  111. dateWeek: null,
  112. weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
  113. timer:null
  114. };
  115. },
  116. components: {
  117. centerLeft1,
  118. centerLeft2,
  119. centerRight1,
  120. centerRight2,
  121. center,
  122. bottomLeft,
  123. bottomRight
  124. },
  125. mounted() {
  126. this.timer = setInterval(()=>{
  127. const date= dayjs(new Date());
  128. this.dateDay = date.format('HH:mm:ss');
  129. this.dateYear = date.format('YYYY年MM月DD日');
  130. this.dateWeek = date.format(this.weekday[date.day()]);
  131. },1000),
  132. this.setScale();
  133. window.addEventListener("resize", this.debounce(this.setScale, 100));
  134. // * 适配处理
  135. this.cancelLoading();
  136. },
  137. methods: {
  138. cancelLoading() {
  139. setTimeout(() => {
  140. this.loading = false;
  141. }, 500);
  142. },
  143. getScale() {
  144. let { width, height } = this;
  145. let wh = window.innerHeight / height;
  146. let ww = window.innerWidth / width;
  147. console.log(ww < wh ? ww : wh);
  148. return ww < wh ? ww : wh;
  149. },
  150. setScale() {
  151. if(window.innerHeight ==1080){
  152. this.height = 1080
  153. }else{
  154. this.height = 937
  155. }
  156. this.scale = this.getScale();
  157. if (this.$refs.ScaleBox) {
  158. this.$refs.ScaleBox.style.setProperty("--scale", this.scale);
  159. }
  160. },
  161. debounce(fn, delay) {
  162. let delays = delay || 500;
  163. let timer;
  164. return function () {
  165. let th = this;
  166. let args = arguments;
  167. if (timer) {
  168. clearTimeout(timer);
  169. }
  170. timer = setTimeout(function () {
  171. timer = null;
  172. fn.apply(th, args);
  173. }, delays);
  174. };
  175. },
  176. openNewWindow() {
  177. let routeData = this.$router.resolve({
  178. path: "/elecDashboard",
  179. });
  180. window.open(routeData.href, '_blank');
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. #elec-index {
  187. color: #d3d6dd;
  188. background-color: #000000;
  189. width: 100%;
  190. height: 100vh;
  191. .bg {
  192. padding: 0.2rem 0.2rem 0 0.2rem;
  193. background-size: cover;
  194. background-position: center center;
  195. background-image: url("../../../assets/image/pageBg.png");
  196. }
  197. .host-body {
  198. .title {
  199. position: relative;
  200. width: 6.25rem;
  201. text-align: center;
  202. background-size: cover;
  203. background-repeat: no-repeat;
  204. .title-text {
  205. font-size: 0.4rem;
  206. position: absolute;
  207. bottom: 0;
  208. left: 50%;
  209. top: 30%;
  210. transform: translate(-50%);
  211. font-weight: 600;
  212. }
  213. .title-bototm {
  214. position: absolute;
  215. bottom: -0.375rem;
  216. left: 50%;
  217. transform: translate(-50%);
  218. }
  219. }
  220. // 平行四边形
  221. .react-left {
  222. cursor: pointer;
  223. font-size: 0.225rem;
  224. width: 3.75rem;
  225. height: 0.625rem;
  226. line-height: 0.625rem;
  227. text-align: center;
  228. transform: skewX(-45deg);
  229. .react-after {
  230. position: absolute;
  231. right: -0.3125rem;
  232. top: 0;
  233. height: 0.625rem;
  234. width: 0.625rem;
  235. background-color: #0f1325;
  236. transform: skewX(45deg);
  237. }
  238. .text {
  239. display: inline-block;
  240. transform: skewX(45deg);
  241. }
  242. }
  243. .react-right {
  244. cursor: pointer;
  245. font-size: 0.225rem;
  246. width: 3.75rem;
  247. height: 0.625rem;
  248. line-height: 0.625rem;
  249. text-align: center;
  250. transform: skewX(45deg);
  251. .react-before {
  252. position: absolute;
  253. left: -0.3125rem;
  254. top: 0;
  255. height: 0.625rem;
  256. width: 0.625rem;
  257. background-color: #0f1325;
  258. transform: skewX(-45deg);
  259. }
  260. .text {
  261. display: inline-block;
  262. transform: skewX(-45deg);
  263. }
  264. }
  265. .body-box {
  266. margin-top: 0.2rem;
  267. display: flex;
  268. flex-direction: column;
  269. //下方区域的布局
  270. .content-box {
  271. display: grid;
  272. grid-template-columns: 6fr 7fr 2fr 2fr;
  273. }
  274. // 底部数据
  275. .bototm-box {
  276. margin-top: 0.125rem;
  277. display: grid;
  278. grid-template-columns: repeat(2, 50%);
  279. }
  280. }
  281. }
  282. }
  283. .fs-xl {
  284. font-size: 0.14rem;
  285. }
  286. </style>