From d91cf2faaf00b286f7ee7fac1e5bee8e8bbbd0a4 Mon Sep 17 00:00:00 2001 From: Mr.Shi <1878285526@qq.com> Date: 星期一, 21 八月 2023 14:21:49 +0800 Subject: [PATCH] 大屏 --- screen_standard/src/views/index.vue | 173 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 142 insertions(+), 31 deletions(-) diff --git a/screen_standard/src/views/index.vue b/screen_standard/src/views/index.vue index 5b0d6f3..b8c1ff6 100644 --- a/screen_standard/src/views/index.vue +++ b/screen_standard/src/views/index.vue @@ -1,5 +1,5 @@ <template> - <div class="content"> + <div class="content1"> <div class="content_left"> <div class="content_left_item1"> <div class="content_left_item1_head"> @@ -26,34 +26,20 @@ <span>浠撳簱瀹炴椂浣欓噺缁熻</span> </div> <div class="content_left_item2_content"> - <div class="productProcess"> - - <!-- 濡傛灉椤甸潰鍒锋柊鏁版嵁姣旇緝棰戠箒锛屽彲浠ュ皢loading銆乻howFlag鐨勭浉鍏充唬鐮佸垹闄わ紝闃叉杩囦簬棰戠箒鐨勫嚭鐜板姞杞藉姩鐢� --> - <div class="loading_div" v-show="!showFlag"> - <div>Loading...</div> <!-- 杩欎釜loading鑷繁鍐欙紝浠g爜娌¤创鍑烘潵 --> - </div> - - <div class="success_info_body" v-show="showFlag"> - <!-- 鍙傛暟鍚嶇О銆佸垪鏁版牴鎹疄闄呮儏鍐佃皟鏁� --> - <div class="table_body"> - <div class="table_th"> - <div class="tr1 th_style">鎺掍骇缂栧彿</div> - <div class="tr2 th_style">绫诲瀷</div> - <div class="tr3 th_style">鏃ユ湡</div> - <div class="tr4 th_style">杩涘害</div> - </div> - <div class="table_main_body"> - <div class="table_inner_body" :style="{top: tableTop + 'px'}"> - <div class="table_tr" v-for="(item,index) in tableList" :key="index"> - <div class="tr1 tr">{{item.planNo}}</div> - <div class="tr2 tr">{{item.type}}</div> - <div class="tr3 tr" v-if="item.startDate!='-'">{{item.startDate}} ~ {{item.endDate}}</div> - <div class="tr3 tr" v-else>-</div> - <div class="tr4 tr" v-if="item.process!='-'">{{Number(item.process).toFixed(2)}} %</div> - <div class="tr4 tr" v-else>-</div> - </div> - </div> - </div> + <div class="item2_content_head"> + <div class="item2_content_head_item">鐗╂枡鍚嶇О / 宸ュ簭</div> + <div class="item2_content_head_item">浠撳簱</div> + <div class="item2_content_head_item">璐ф灦</div> + <div class="item2_content_head_item">鏁伴噺</div> + </div> + <div @mouseenter="handleMouseEnter" @mouseleave="handleMouseLeave" class="main_container"> + <div ref="scrollContainer" class="scroll_container"> + <div v-for="(item, index) in listData" :key="item.id" :class="index % 2 == 0 ? 'scroll_item scroll_item_bg1' : 'scroll_item scroll_item_bg2'"> + <span>{{ item.name }}</span> + <div class="scroll_item_row"></div> + <div class="scroll_item_row"></div> + <div class="scroll_item_row"></div> + <div class="scroll_item_row"></div> </div> </div> </div> @@ -66,11 +52,92 @@ </template> <script setup> + import {reactive, ref, onMounted, onBeforeUnmount, onUnmounted, nextTick} from 'vue' + let timer = ref(null) + let scrollContainer = ref(null) + let listData = reactive([ + {name: 'dom绗竴涓�'}, + {name: 'dom绗簩涓�'}, + {name: 'dom绗笁涓�'}, + {name: 'dom绗洓涓�'}, + {name: 'dom绗簲涓�'}, + {name: 'dom绗叚涓�'}, + {name: 'dom绗竷涓�'}, + {name: 'dom绗叓涓�'}, + {name: 'dom绗節涓�'}, + {name: 'dom绗崄涓�'}, + ]) + start() + // 娉細绀轰緥涓殑 listData 鍐欑殑鏄潤鎬佹暟鎹紝鍙互鐩存帴璋冪敤 start() + // 濡傛灉鏄帴鍙h幏鍙� listData 鍒楄〃鏃讹紝闇�瑕佸湪 nextTick 涓皟鐢� start() + // 鍚﹀垯锛岃繘鍏ラ〉闈笉浼氭粴鍔ㄣ�傚繀椤婚紶鏍囩Щ鍏ョЩ鍑烘墠浼氭粴鍔� + // 鐢� nextTick 鐨勫師鍥犳槸闇�瑕佺瓑 dom 鍏冪礌鍔犺浇瀹屾瘯鍚庡啀鎵ц鏂规硶 + + // let chartData = reactive({ + // data: [] + // }) + // function getSensorData() { + // GetSensorData().then(res=> { + // chartData.data = res.data.data + // nextTick(()=>{ + // start() + // }) + // }) + // } + + // onMounted(()=> { + // getSensorData() + // }) + + onBeforeUnmount(()=>{ + clearTimeout(timer.value) + }) + onUnmounted(()=>{ + clearTimeout(timer.value) + }) + + function handleMouseEnter() { + clearTimeout(timer.value) + } + function handleMouseLeave() { + start() + } + // 寮�鍚畾鏃跺櫒 + function start() { + clearTimeout(timer.value) + // 瀹氭椂鍣ㄨЕ鍙戝懆鏈� + let speed = ref(25) + timer.value = setInterval(ListScroll, speed.value) + } + function ListScroll() { + let scrollDom = scrollContainer.value + // 鍒よ缁勪欢鏄惁娓叉煋瀹屾垚 + if(scrollDom.offsetHeight == 0) { + scrollDom = scrollContainer.value + }else { + // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔� + if(scrollDom.children.length < 4) { + clearTimeout(timer.value) + return + } + // 缁勪欢杩涜婊氬姩 + scrollDom.scrollTop += 1 + // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮� + if(scrollDom.scrollTop == (scrollDom.scrollHeight - scrollDom.clientHeight)) { + // 鑾峰彇缁勪欢绗竴涓妭鐐� + let first = scrollDom.children[0] + // 鍒犻櫎鑺傜偣 + scrollDom.removeChild(first) + // 灏嗚鑺傜偣鎷兼帴鍒扮粍浠舵渶鍚� + scrollDom.append(first) + } + } + } </script> <style lang="scss" scoped> - .content { + .content1 { width: 100%; height: auto; display: flex; @@ -190,8 +257,52 @@ .content_left_item2_content { width: 100%; height: 361px; + padding: 20px; + box-sizing: border-box; background: linear-gradient(180deg, rgba(52,88,159,0) 0%, rgba(0,86,255,0.4) 100%); - + .item2_content_head { + width: 100%; + height: 36px; + display: flex; + align-items: center; + background: rgba(52,88,159,0.5); + .item2_content_head_item { + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-size: 13px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #01D9FE; + &:first-child { + flex: 1.5; + } + } + } + .main_container { + width: 100%; + height: calc(100% - 36px); + .scroll_container { + width: 100%; + height: 100%; + overflow: hidden; + .scroll_item_bg1 { + background: rgba(52,88,159,0.2); + } + .scroll_item_bg2 { + background: rgba(52,88,159,0.5); + } + .scroll_item { + width: 100%; + height: 36px; + display: flex; + align-items: center; + + } + } + } } } } -- Gitblit v1.9.3