index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <script setup>
  2. import { ref, onMounted, onUnmounted } from "vue";
  3. import autofit from 'autofit.js';
  4. import dayjs from 'dayjs';
  5. import WaterYield from "./components/WaterYield";
  6. import WaterQuality from "./components/WaterQuality";
  7. import ContinueData from "./components/ContinueData";
  8. import DataBox from "./components/dataBox";
  9. import GongYi from "./components/gongyi";
  10. import { editPassword } from '@/components';
  11. import TheUserAvatar from '@/components/Layout/TheUserAvatar.vue';
  12. import { screenApi } from "@/api/screen"
  13. let timer = "";
  14. let dataTimer = "";
  15. const updateTime = ref();
  16. const gongyiData = ref([])
  17. const screenData = ref({});
  18. const reportData = ref({})
  19. const currentTime = ref({
  20. time: '',
  21. weekday: '',
  22. date: '',
  23. })
  24. // 日期 - header使用
  25. const getCurrentWeekDay = () => {
  26. const weekEnum = { 0: '星期日', 1: '星期一', 2: '星期二', 3: '星期三', 4: '星期四', 5: '星期五', 6: '星期六' };
  27. const time = dayjs(new Date()).format('HH:mm:ss');
  28. const weekday = weekEnum[dayjs().day()];
  29. const date = dayjs().format('YYYY-MM-DD');
  30. currentTime.value = { time, weekday, date };
  31. }
  32. // 获取大屏分析数据
  33. const getRealTimeData = () => {
  34. screenApi.realTimeData().then(res => {
  35. screenData.value = res.data;
  36. updateTime.value = `更新时间:${res.data.testHour}`
  37. })
  38. }
  39. // 获取工艺管控 助手
  40. const getWarningList = () => {
  41. screenApi.warningList().then(res => {
  42. gongyiData.value = res.data || []
  43. })
  44. }
  45. // 获取文字数据
  46. const getLeastShortReport = () => {
  47. screenApi.getLeastShortReport().then(res => {
  48. reportData.value = res.data
  49. })
  50. }
  51. onMounted(() => {
  52. // 时钟开始计时
  53. getCurrentWeekDay();
  54. // 图表数据
  55. getRealTimeData();
  56. // 文字数据
  57. getLeastShortReport();
  58. // 工艺
  59. getWarningList();
  60. autofit.init({
  61. dw: 1920,
  62. dh: 1080,
  63. el: "#screen-view-black",
  64. resize: true,
  65. })
  66. timer = setInterval(getCurrentWeekDay, 1 * 1000);
  67. dataTimer = setInterval(() => {
  68. getRealTimeData();
  69. getLeastShortReport();
  70. getWarningList();
  71. }, 60 * 60 * 1000);
  72. })
  73. onUnmounted(() => {
  74. clearInterval(timer);
  75. clearInterval(dataTimer);
  76. })
  77. </script>
  78. <template>
  79. <div class="screen-view-black" id="screen-view-black">
  80. <header class="header">
  81. <div class="header-left">
  82. <div class="time">{{ currentTime.time }}</div>
  83. <div class="line"></div>
  84. <ul class="date">
  85. <li>{{ currentTime.weekday }}</li>
  86. <li>{{ currentTime.date }}</li>
  87. </ul>
  88. </div>
  89. <div class="header-right flex items-center justify-end pr-[18px]">
  90. <div class="select-factory"></div>
  91. <TheUserAvatar></TheUserAvatar>
  92. <editPassword></editPassword>
  93. </div>
  94. </header>
  95. <main class="main">
  96. <!-- 导航菜单 -->
  97. <div class="menu-container">
  98. <ul class="menu-list justify-end">
  99. <li class="item mr-[20px] active">
  100. <RouterLink to="/"><span>智慧总控</span></RouterLink>
  101. </li>
  102. <li class="item">
  103. <RouterLink to="/answer"><span>专家问答</span></RouterLink>
  104. </li>
  105. </ul>
  106. <ul class="menu-list justify-start">
  107. <li class="item mr-[20px]">
  108. <RouterLink to="/water-warn"><span>智能分析</span></RouterLink>
  109. </li>
  110. <li class="item">
  111. <RouterLink to="/work"><span>智能助手</span></RouterLink>
  112. </li>
  113. </ul>
  114. </div>
  115. <div class="screen-container">
  116. <div class="factory">
  117. <img class="w-full h-full" src="@/assets/images/screenViewBlack/img-factory.png" alt="">
  118. <img class="coord img-a" src="@/assets/images/screenViewBlack/img-coord-a.png" alt="">
  119. <img class="coord img-b" src="@/assets/images/screenViewBlack/img-coord-b.png" alt="">
  120. <img class="coord img-c" src="@/assets/images/screenViewBlack/img-coord-c.png" alt="">
  121. </div>
  122. <div class="content">
  123. <div class="left">
  124. <WaterYield :screenData="screenData"></WaterYield>
  125. <WaterQuality :screenData="screenData" class="pt-[20px]"></WaterQuality>
  126. </div>
  127. <div class="middle">
  128. <div class="middle-wrap">
  129. <span class="text-[#9E9E9E] pb-[8px] text-[12px]">{{ updateTime }}</span>
  130. <RouterLink to="/answer" class="inp-box">
  131. <span>输入您的问题或需求</span>
  132. <img src="@/assets/images/screenViewBlack/img-start.png" alt="">
  133. </RouterLink>
  134. </div>
  135. </div>
  136. <div class="right">
  137. <ContinueData :screenData="screenData"></ContinueData>
  138. <DataBox :reportData="reportData" class="pt-[20px]"></DataBox>
  139. <GongYi :gongyiData="gongyiData"></GongYi>
  140. </div>
  141. </div>
  142. </div>
  143. </main>
  144. </div>
  145. </template>
  146. <style lang="scss" scoped>
  147. // 主体背景颜色
  148. $primary-bg-color: #040d1c;
  149. .screen-view-black {
  150. position: relative;
  151. display: flex;
  152. flex-flow: column;
  153. width: 100vw;
  154. height: 100vh;
  155. min-width: 1200px;
  156. min-height: 700px;
  157. background: $primary-bg-color;
  158. background-size: 100% 100%;
  159. overflow: hidden;
  160. }
  161. .header {
  162. display: flex;
  163. align-items: start;
  164. justify-content: space-between;
  165. flex-shrink: 0;
  166. height: 98px;
  167. padding: 20px 50px 0 50px;
  168. background: url(@/assets/images/screenViewBlack/bg-header.png) center center no-repeat;
  169. background-size: 100% 100%;
  170. .header-left {
  171. display: flex;
  172. align-items: center;
  173. .time {
  174. width: 160px;
  175. color: #FFF;
  176. text-shadow: 0px 1px 3px rgba(5, 12, 25, 0.54);
  177. font-family: D-DIN-PRO-700-Bold;
  178. font-size: 36px;
  179. font-style: normal;
  180. font-weight: 700;
  181. line-height: normal;
  182. letter-spacing: 4.32px;
  183. }
  184. .line {
  185. width: 1px;
  186. height: 28px;
  187. margin: 0 20px 0 15px;
  188. background: rgba(157, 197, 232, 0.36);
  189. }
  190. .date {
  191. color: #CDD6E3;
  192. text-align: center;
  193. font-size: 16px;
  194. font-weight: bold;
  195. letter-spacing: 1.92px;
  196. line-height: normal;
  197. font-style: normal;
  198. li:nth-child(1) {
  199. color: #CDD6E3;
  200. }
  201. li:nth-child(2) {
  202. color: #CDD6E3;
  203. font-family: D-DIN-PRO-700-Bold;
  204. font-size: 12px;
  205. letter-spacing: 1.44px;
  206. }
  207. }
  208. }
  209. .header-right {
  210. .select-factory {
  211. width: 114px;
  212. height: 34px;
  213. margin-right: 16px;
  214. background: url(@/assets/images/screenViewBlack/bg-select.png) center center no-repeat;
  215. background-size: 100% 100%;
  216. cursor: pointer;
  217. }
  218. }
  219. }
  220. .main {
  221. flex: 1;
  222. display: flex;
  223. flex-flow: column;
  224. padding: 0 30px 14px 30px;
  225. .menu-container {
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. .menu-list {
  230. display: flex;
  231. align-items: center;
  232. width: 540px;
  233. height: 86px;
  234. .item {
  235. width: 172px;
  236. height: 46px;
  237. text-align: center;
  238. font-family: YouSheBiaoTiHei;
  239. font-size: 24px;
  240. font-style: normal;
  241. font-weight: 400;
  242. line-height: 40px;
  243. letter-spacing: 1px;
  244. cursor: pointer;
  245. transition: all 0.8s;
  246. span {
  247. transition: all 0.3s;
  248. background: linear-gradient(182deg, #02A3F8 11.72%, #83D2FB 38.89%, #FFF 98.7%);
  249. background-clip: text;
  250. -webkit-background-clip: text;
  251. -webkit-text-fill-color: transparent;
  252. }
  253. }
  254. }
  255. .menu-list:nth-child(1) {
  256. .item {
  257. background: url(@/assets/images/screenViewBlack/bg-left.png) center center no-repeat;
  258. background-size: 100% 100%;
  259. &:hover {
  260. background: url(@/assets/images/screenViewBlack/bg-left-active.png) center center no-repeat;
  261. background-size: 100% 100%;
  262. span {
  263. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  264. background-clip: text;
  265. }
  266. }
  267. }
  268. .active {
  269. background: url(@/assets/images/screenViewBlack/bg-left-active.png) center center no-repeat;
  270. background-size: 100% 100%;
  271. span {
  272. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  273. background-clip: text;
  274. }
  275. }
  276. }
  277. .menu-list:nth-child(2) {
  278. .item {
  279. background: url(@/assets/images/screenViewBlack/bg-right.png) center center no-repeat;
  280. background-size: 100% 100%;
  281. &:hover {
  282. background: url(@/assets/images/screenViewBlack/bg-right-active.png) center center no-repeat;
  283. background-size: 100% 100%;
  284. span {
  285. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  286. background-clip: text;
  287. }
  288. }
  289. }
  290. .active {
  291. background: url(@/assets/images/screenViewBlack/bg-right-active.png) center center no-repeat;
  292. background-size: 100% 100%;
  293. span {
  294. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  295. background-clip: text;
  296. }
  297. }
  298. }
  299. }
  300. @keyframes jump {
  301. 0%, 100% {
  302. transform: translateY(0);
  303. }
  304. 50% {
  305. transform: translateY(-10px); /* 调整这个值来控制跳跃的高度 */
  306. }
  307. }
  308. .screen-container {
  309. position: relative;
  310. background: $primary-bg-color;
  311. .factory {
  312. position: absolute;
  313. top: 50%;
  314. left: 50%;
  315. transform: translate(-50%, -50%);
  316. width: 1408px;
  317. height: 792px;
  318. .coord {
  319. position: absolute;
  320. width: 108px;
  321. height: 82px;
  322. }
  323. .img-a {
  324. top: 370px;
  325. left: 320px;
  326. animation: jump 1.5s ease-in-out infinite;
  327. animation-delay: 0.2s;
  328. }
  329. .img-b {
  330. top: 280px;
  331. left: 650px;
  332. animation: jump 1.5s ease-in-out infinite;
  333. animation-delay: 0.6s;
  334. }
  335. .img-c {
  336. top: 226px;
  337. right: 330px;
  338. animation: jump 1.5s ease-in-out infinite;
  339. animation-delay: 0.4s;
  340. }
  341. }
  342. .content {
  343. position: relative;
  344. display: flex;
  345. ;
  346. justify-content: space-between;
  347. .left,
  348. .right {
  349. width: 540px;
  350. }
  351. .middle {
  352. flex-shrink: 0;
  353. flex: 1;
  354. display: flex;
  355. flex-flow: column;
  356. justify-content: flex-end;
  357. padding: 0 50px 30px 50px;
  358. .middle-wrap {
  359. display: flex;
  360. flex-flow: column;
  361. align-items: flex-end;
  362. .inp-box {
  363. display: flex;
  364. align-items: center;
  365. justify-content: space-between;
  366. width: 100%;
  367. height: 60px;
  368. padding: 0 14px;
  369. background: url(@/assets/images/screenViewBlack/bg-input.png) center center no-repeat;
  370. background-size: 100% 100%;
  371. span {
  372. color: rgba(255, 255, 255, 0.80);
  373. text-shadow: 0px 0px 8px rgba(201, 253, 243, 0.50);
  374. font-size: 15px;
  375. font-weight: 400;
  376. line-height: 22px;
  377. }
  378. img {
  379. width: 56px;
  380. height: 36px;
  381. }
  382. }
  383. }
  384. }
  385. }
  386. }
  387. }
  388. </style>
  389. <style lang="scss">
  390. #screen-view-black {
  391. .header .header-right {
  392. .name {
  393. color: #fff;
  394. }
  395. }
  396. }
  397. </style>