Commit 02a649b6862375003d79b1051fe268a189b41bdd

Authored by guzijian
1 parent 590074cc

fix: 宽度不在动态计算,统一宽度

Showing 1 changed file with 39 additions and 28 deletions
src/views/home/index.vue
@@ -59,7 +59,8 @@ @@ -59,7 +59,8 @@
59 <div class="fleet-top-title">{{ item.title }}</div> 59 <div class="fleet-top-title">{{ item.title }}</div>
60 </div> 60 </div>
61 <!-- 内容盒子 --> 61 <!-- 内容盒子 -->
62 - <div class="fleet-content-box"> 62 + <div ref="fleetContentBox" class="fleet-content-box">
  63 + <!-- <vue3-seamless-scroll :list="item.fleetInfos" :step="1" :hoverStop="true" :hover="true"> -->
63 <!-- 线路信息 --> 64 <!-- 线路信息 -->
64 <div v-for="(childItem, childIndex) in item.fleetInfos" :key="childItem.lineName" 65 <div v-for="(childItem, childIndex) in item.fleetInfos" :key="childItem.lineName"
65 class="fleet-line-info-container"> 66 class="fleet-line-info-container">
@@ -106,6 +107,7 @@ @@ -106,6 +107,7 @@
106 </div> 107 </div>
107 </div> 108 </div>
108 </div> 109 </div>
  110 + <!-- </vue3-seamless-scroll> -->
109 </div> 111 </div>
110 </div> 112 </div>
111 </div> 113 </div>
@@ -114,7 +116,6 @@ @@ -114,7 +116,6 @@
114 </template> 116 </template>
115 117
116 <script setup name="Index"> 118 <script setup name="Index">
117 -  
118 import { queryLineInfo, querySignInfoByType } from '@/api/big_view/big_view.js'; 119 import { queryLineInfo, querySignInfoByType } from '@/api/big_view/big_view.js';
119 import ConstForm from '@/components/ConstForm/index.vue'; 120 import ConstForm from '@/components/ConstForm/index.vue';
120 import getWeek from "@/utils/dateUtils.js"; 121 import getWeek from "@/utils/dateUtils.js";
@@ -128,6 +129,7 @@ import icon4 from &quot;../../assets/bigview/image-icon-3.png&quot;; @@ -128,6 +129,7 @@ import icon4 from &quot;../../assets/bigview/image-icon-3.png&quot;;
128 import icon5 from "../../assets/bigview/image-icon-4.png"; 129 import icon5 from "../../assets/bigview/image-icon-4.png";
129 import icon6 from "../../assets/bigview/image-icon-5.png"; 130 import icon6 from "../../assets/bigview/image-icon-5.png";
130 import icon1 from "../../assets/bigview/image-icon-6.png"; 131 import icon1 from "../../assets/bigview/image-icon-6.png";
  132 +const fleetContentBox = ref()
131 const currentDateKey = ref(); 133 const currentDateKey = ref();
132 const loading = ref(true); 134 const loading = ref(true);
133 /** 签到信息 */ 135 /** 签到信息 */
@@ -262,6 +264,7 @@ onMounted(() =&gt; { @@ -262,6 +264,7 @@ onMounted(() =&gt; {
262 console.log(); 264 console.log();
263 currentDateKey.value = dateKey; 265 currentDateKey.value = dateKey;
264 handleUpdateDataRequest(currentDateKey.value); 266 handleUpdateDataRequest(currentDateKey.value);
  267 +
265 }) 268 })
266 269
267 /** 销毁之前触发 */ 270 /** 销毁之前触发 */
@@ -324,6 +327,15 @@ const alterEnterHandler = (val, el) =&gt; { @@ -324,6 +327,15 @@ const alterEnterHandler = (val, el) =&gt; {
324 /** 监听数据更新日期 */ 327 /** 监听数据更新日期 */
325 watch(timeTaskObject.updateDateObject, (val1, val2) => { 328 watch(timeTaskObject.updateDateObject, (val1, val2) => {
326 // 发送请求更新数据 329 // 发送请求更新数据
  330 + const currentTime = moment().format('HH:mm');
  331 + let dateKey;
  332 + if (currentTime < '03:00') {
  333 + dateKey = moment().subtract(1, 'day').format('YYYY-MM-DD');
  334 + } else {
  335 + dateKey = moment().format("YYYY-MM-DD");
  336 + }
  337 + console.log();
  338 + currentDateKey.value = dateKey;
327 handleUpdateDataRequest(currentDateKey.value); 339 handleUpdateDataRequest(currentDateKey.value);
328 }) 340 })
329 341
@@ -363,24 +375,24 @@ const handleUpdateDataRequest = (dateKey) =&gt; { @@ -363,24 +375,24 @@ const handleUpdateDataRequest = (dateKey) =&gt; {
363 nextTick(() => { 375 nextTick(() => {
364 const containerElement = fleetNbbmInfoContainer.value; 376 const containerElement = fleetNbbmInfoContainer.value;
365 if (containerElement != null) { 377 if (containerElement != null) {
366 - containerElement.forEach((el) => {  
367 - const nbbmHaveSaleInfo = el.firstElementChild.firstElementChild;  
368 - if ("fleet-nbbm-info-have-sale" == nbbmHaveSaleInfo.className) {  
369 - const textWidth = nbbmHaveSaleInfo.children[1].firstElementChild.offsetWidth;  
370 - // 有售票员  
371 - for (let index = 0; index < el.children.length; index++) {  
372 - const element = el.children[index];  
373 - element.style.width = `${textWidth}px`;  
374 - }  
375 - // 无售票员  
376 - } else {  
377 - const textWidth = nbbmHaveSaleInfo.firstElementChild.offsetWidth;  
378 - for (let index = 0; index < el.children.length; index++) {  
379 - const element = el.children[index];  
380 - element.style.width = `${textWidth}px`;  
381 - }  
382 - }  
383 - }) 378 + // containerElement.forEach((el) => {
  379 + // const nbbmHaveSaleInfo = el.firstElementChild.firstElementChild;
  380 + // if ("fleet-nbbm-info-have-sale" == nbbmHaveSaleInfo.className) {
  381 + // const textWidth = nbbmHaveSaleInfo.children[1].firstElementChild.offsetWidth;
  382 + // // 有售票员
  383 + // for (let index = 0; index < el.children.length; index++) {
  384 + // const element = el.children[index];
  385 + // element.style.width = `${textWidth}px`;
  386 + // }
  387 + // // 无售票员
  388 + // } else {
  389 + // const textWidth = nbbmHaveSaleInfo.firstElementChild.offsetWidth;
  390 + // for (let index = 0; index < el.children.length; index++) {
  391 + // const element = el.children[index];
  392 + // element.style.width = `${textWidth}px`;
  393 + // }
  394 + // }
  395 + // })
384 loading.value = false; 396 loading.value = false;
385 } else { 397 } else {
386 loading.value = false; 398 loading.value = false;
@@ -624,8 +636,9 @@ const handleGlobalInfo = (data, num) =&gt; { @@ -624,8 +636,9 @@ const handleGlobalInfo = (data, num) =&gt; {
624 .fleet-content-box { 636 .fleet-content-box {
625 height: calc(100% - clamp(0.8rem, -0.907rem + 5.71vw, 1.3rem)); 637 height: calc(100% - clamp(0.8rem, -0.907rem + 5.71vw, 1.3rem));
626 width: 100%; 638 width: 100%;
627 - overflow-y: scroll;  
628 - overflow-x: hidden; 639 + // overflow-y: hidden;
  640 + // overflow-x: hidden;
  641 + overflow: auto;
629 642
630 // 线路信息 643 // 线路信息
631 .fleet-line-info-container { 644 .fleet-line-info-container {
@@ -645,14 +658,16 @@ const handleGlobalInfo = (data, num) =&gt; { @@ -645,14 +658,16 @@ const handleGlobalInfo = (data, num) =&gt; {
645 box-sizing: border-box; 658 box-sizing: border-box;
646 display: flex; 659 display: flex;
647 flex-wrap: wrap; 660 flex-wrap: wrap;
  661 + justify-content: space-between;
  662 + justify-content: flex-start;
648 font-size: 0.8vw; 663 font-size: 0.8vw;
649 664
650 .fleet-nbbm-info-item { 665 .fleet-nbbm-info-item {
651 - // width: 6vw; 666 + width: 6vw;
652 height: 2.4vh; 667 height: 2.4vh;
653 - margin-right: 0.4vw;  
654 box-sizing: border-box; 668 box-sizing: border-box;
655 margin-top: 0.4vw; 669 margin-top: 0.4vw;
  670 + margin-right: 0.4vw;
656 color: white; 671 color: white;
657 672
658 .fleet-nbbm-info-have-sale { 673 .fleet-nbbm-info-have-sale {
@@ -717,10 +732,6 @@ const handleGlobalInfo = (data, num) =&gt; { @@ -717,10 +732,6 @@ const handleGlobalInfo = (data, num) =&gt; {
717 } 732 }
718 } 733 }
719 } 734 }
720 -  
721 - .fleet-nbbm-info-item:last-child {  
722 - margin-right: 0;  
723 - }  
724 } 735 }
725 } 736 }
726 } 737 }