diff --git a/src/view/echarts_work/ePjz.vue b/src/view/echarts_work/ePjz.vue index 4f0de31..bb4fa0c 100644 --- a/src/view/echarts_work/ePjz.vue +++ b/src/view/echarts_work/ePjz.vue @@ -356,7 +356,7 @@ onBeforeMount(() => { data.year = data.list.year; data.list.data.forEach((item) => { data.list1.push(item.jzrs); - data.list2.push(item.jzje); + data.list2.push(Math.floor(item.jzje)); //向下取整 }); getOption(); setChart(); diff --git a/src/view/work.vue b/src/view/work.vue index 2882936..a6530d5 100644 --- a/src/view/work.vue +++ b/src/view/work.vue @@ -220,18 +220,6 @@ const jzChange = (index, value) => { } }; -const typeSwitching = ref(true); - -const onTypeSwitching = () => { - const toggleShow = () => { - typeSwitching.value = !typeSwitching.value; - const type = typeSwitching.value ? "1" : "2"; - jzChange(0, type); - jzChange(1, type); - }; - setInterval(toggleShow, 2000); // 每2秒切换一次 -}; - const data = reactive({ list: {}, list1: {}, @@ -438,12 +426,30 @@ const autoScroll = () => { } }; -onBeforeMount(() => { - getData(); -}); +const typeSwitching = ref(true); + +const toggleShow = () => { + typeSwitching.value = !typeSwitching.value; + const type = typeSwitching.value ? "1" : "2"; + jz.value[2].choose = (jz.value[2].choose % 3) + 1; + + jzChange(0, type); + jzChange(1, type); + jzChange(2, jz.value[2].choose); +}; + +let interval; +const startAutoSwitching = () => { + interval = setInterval(toggleShow, 6000); // 每6秒切换一次 +}; onMounted(() => { startAutoScroll(); - onTypeSwitching(); + startAutoSwitching(); +}); + +onBeforeMount(() => { + getData(); + clearInterval(interval); //清除定时器 });