Commit 02a649b6862375003d79b1051fe268a189b41bdd
1 parent
590074cc
fix: 宽度不在动态计算,统一宽度
Showing
1 changed file
with
39 additions
and
28 deletions
src/views/home/index.vue
| ... | ... | @@ -59,7 +59,8 @@ |
| 59 | 59 | <div class="fleet-top-title">{{ item.title }}</div> |
| 60 | 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 | 65 | <div v-for="(childItem, childIndex) in item.fleetInfos" :key="childItem.lineName" |
| 65 | 66 | class="fleet-line-info-container"> |
| ... | ... | @@ -106,6 +107,7 @@ |
| 106 | 107 | </div> |
| 107 | 108 | </div> |
| 108 | 109 | </div> |
| 110 | + <!-- </vue3-seamless-scroll> --> | |
| 109 | 111 | </div> |
| 110 | 112 | </div> |
| 111 | 113 | </div> |
| ... | ... | @@ -114,7 +116,6 @@ |
| 114 | 116 | </template> |
| 115 | 117 | |
| 116 | 118 | <script setup name="Index"> |
| 117 | - | |
| 118 | 119 | import { queryLineInfo, querySignInfoByType } from '@/api/big_view/big_view.js'; |
| 119 | 120 | import ConstForm from '@/components/ConstForm/index.vue'; |
| 120 | 121 | import getWeek from "@/utils/dateUtils.js"; |
| ... | ... | @@ -128,6 +129,7 @@ import icon4 from "../../assets/bigview/image-icon-3.png"; |
| 128 | 129 | import icon5 from "../../assets/bigview/image-icon-4.png"; |
| 129 | 130 | import icon6 from "../../assets/bigview/image-icon-5.png"; |
| 130 | 131 | import icon1 from "../../assets/bigview/image-icon-6.png"; |
| 132 | +const fleetContentBox = ref() | |
| 131 | 133 | const currentDateKey = ref(); |
| 132 | 134 | const loading = ref(true); |
| 133 | 135 | /** 签到信息 */ |
| ... | ... | @@ -262,6 +264,7 @@ onMounted(() => { |
| 262 | 264 | console.log(); |
| 263 | 265 | currentDateKey.value = dateKey; |
| 264 | 266 | handleUpdateDataRequest(currentDateKey.value); |
| 267 | + | |
| 265 | 268 | }) |
| 266 | 269 | |
| 267 | 270 | /** 销毁之前触发 */ |
| ... | ... | @@ -324,6 +327,15 @@ const alterEnterHandler = (val, el) => { |
| 324 | 327 | /** 监听数据更新日期 */ |
| 325 | 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 | 339 | handleUpdateDataRequest(currentDateKey.value); |
| 328 | 340 | }) |
| 329 | 341 | |
| ... | ... | @@ -363,24 +375,24 @@ const handleUpdateDataRequest = (dateKey) => { |
| 363 | 375 | nextTick(() => { |
| 364 | 376 | const containerElement = fleetNbbmInfoContainer.value; |
| 365 | 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 | 396 | loading.value = false; |
| 385 | 397 | } else { |
| 386 | 398 | loading.value = false; |
| ... | ... | @@ -624,8 +636,9 @@ const handleGlobalInfo = (data, num) => { |
| 624 | 636 | .fleet-content-box { |
| 625 | 637 | height: calc(100% - clamp(0.8rem, -0.907rem + 5.71vw, 1.3rem)); |
| 626 | 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 | 644 | .fleet-line-info-container { |
| ... | ... | @@ -645,14 +658,16 @@ const handleGlobalInfo = (data, num) => { |
| 645 | 658 | box-sizing: border-box; |
| 646 | 659 | display: flex; |
| 647 | 660 | flex-wrap: wrap; |
| 661 | + justify-content: space-between; | |
| 662 | + justify-content: flex-start; | |
| 648 | 663 | font-size: 0.8vw; |
| 649 | 664 | |
| 650 | 665 | .fleet-nbbm-info-item { |
| 651 | - // width: 6vw; | |
| 666 | + width: 6vw; | |
| 652 | 667 | height: 2.4vh; |
| 653 | - margin-right: 0.4vw; | |
| 654 | 668 | box-sizing: border-box; |
| 655 | 669 | margin-top: 0.4vw; |
| 670 | + margin-right: 0.4vw; | |
| 656 | 671 | color: white; |
| 657 | 672 | |
| 658 | 673 | .fleet-nbbm-info-have-sale { |
| ... | ... | @@ -717,10 +732,6 @@ const handleGlobalInfo = (data, num) => { |
| 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 | } | ... | ... |