From 0d6eae17ca4a8ae54410fc1c359eb76f3b170dc2 Mon Sep 17 00:00:00 2001 From: yaoyuhao Date: Wed, 22 May 2024 15:12:28 +0800 Subject: [PATCH] 1 --- src/router/index.js | 44 ++++++++++---------- src/utils/request.js | 56 +++++++++++++------------- src/view/hygiene.vue | 96 +++++++++++++++++++++++++++++++++----------- 3 files changed, 122 insertions(+), 74 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 2b69a7d..f3d31e4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -71,27 +71,27 @@ function getCookie(cname) { // return '' } -router.beforeEach((to, form, next) => { - var token = getCookie('lytoken') - console.log('token', token) - if (token == '') { - window.location.href = - 'http://220.191.238.50:996/api/login?returnURL=' + - window.location.href - } else { - // http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => { - // if (res.code == '500') { - // window.location.href = - // 'http://220.191.238.50:996/api/login?returnURL=' + - // window.location.href - // } else { - // tools.data.set('token',token) - // next(); - // } - // }); - tools.data.set('token', token) - next(); - } -}) +// router.beforeEach((to, form, next) => { +// var token = getCookie('lytoken') +// console.log('token', token) +// if (token == '') { +// window.location.href = +// 'http://220.191.238.50:996/api/login?returnURL=' + +// window.location.href +// } else { +// // http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => { +// // if (res.code == '500') { +// // window.location.href = +// // 'http://220.191.238.50:996/api/login?returnURL=' + +// // window.location.href +// // } else { +// // tools.data.set('token',token) +// // next(); +// // } +// // }); +// tools.data.set('token', token) +// next(); +// } +// }) export default router \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 7ce055b..e141e71 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -21,34 +21,34 @@ axios.interceptors.request.use( ); // HTTP response 拦截器 -axios.interceptors.response.use( - (response) => { - return response; - }, - (error) => { - if (error.response) { - if (error.response.status == 401) { - ElMessage.error("请重新登录!"); - // window.location.href = '/#/login?returnURL=' + window.location.href - window.location.href = - 'http://220.191.238.50:996/api/login?returnURL=' + - window.location.href - } else if (error.response.status == 404) { - ElMessage.error("Status:404,正在请求不存在的服务器记录!"); - } else if (error.response.status == 500) { - ElMessage.error({ - title: '请求错误', - message: "Status:500,服务器发生错误!" - }); - } else { - ElMessage.error(`Status:${error.response.status},未知错误!`); - } - } else { - ElMessage.error("请求服务器无响应!"); - } - return Promise.reject(error.response); - } -); +// axios.interceptors.response.use( +// (response) => { +// return response; +// }, +// (error) => { +// if (error.response) { +// if (error.response.status == 401) { +// ElMessage.error("请重新登录!"); +// // window.location.href = '/#/login?returnURL=' + window.location.href +// window.location.href = +// 'http://220.191.238.50:996/api/login?returnURL=' + +// window.location.href +// } else if (error.response.status == 404) { +// ElMessage.error("Status:404,正在请求不存在的服务器记录!"); +// } else if (error.response.status == 500) { +// ElMessage.error({ +// title: '请求错误', +// message: "Status:500,服务器发生错误!" +// }); +// } else { +// ElMessage.error(`Status:${error.response.status},未知错误!`); +// } +// } else { +// ElMessage.error("请求服务器无响应!"); +// } +// return Promise.reject(error.response); +// } +// ); var http = { diff --git a/src/view/hygiene.vue b/src/view/hygiene.vue index cfbbca5..ff17bde 100644 --- a/src/view/hygiene.vue +++ b/src/view/hygiene.vue @@ -30,16 +30,24 @@ /> - - + +
- +
- +
@@ -51,7 +59,7 @@
门急诊人次
-
{{data.mz.mjzrc}}
+
{{ data.mz.mjzrc }}
@@ -59,7 +67,7 @@
住院人数
-
{{data.mz.zyrs}}
+
{{ data.mz.zyrs }}
@@ -96,7 +104,7 @@
- + @@ -105,12 +113,12 @@
-
{{data.fyglrs.ycfrc}}
+
{{ data.fyglrs.ycfrc }}
孕产妇系统管理人数
-
{{data.fyglrs.etrs}}
+
{{ data.fyglrs.etrs }}
0-6岁儿童系统管理人数
@@ -118,13 +126,19 @@
- +
-
-
- {{item.jkhd }} +
+
+
+ {{ item.jkhd }} +
@@ -144,7 +158,7 @@ import eP4 from "./echarts_hygiene/eP4.vue"; import eP4_1 from "./echarts_hygiene/eP4_1.vue"; import tnb from "./echarts_hygiene/tnb.vue"; import gxy from "./echarts_hygiene/gxy.vue"; -import { ref,reactive, onMounted, onBeforeMount } from "vue"; +import { ref, reactive, onMounted, onBeforeMount } from "vue"; import http from "@/utils/request.js"; const leftchoose = ref({ first: "1", @@ -155,18 +169,52 @@ const change = (name, index) => { leftchoose.value[name] = index; }; const data = reactive({ - medicalInsurance:{},//医疗保险 - lmb:{},//两慢病 - mz:{},//门诊住院 - jkda:[],//健康档案 - jsbgl:[],//精神病管理 - fyglrs:{},//系统管理 - jktj:{},//65岁健康体检 - jkhd:[],//健康活动 -}) -onBeforeMount( async () => { + medicalInsurance: {}, //医疗保险 + lmb: {}, //两慢病 + mz: {}, //门诊住院 + jkda: [], //健康档案 + jsbgl: [], //精神病管理 + fyglrs: {}, //系统管理 + jktj: {}, //65岁健康体检 + jkhd: [], //健康活动 +}); +//自动滚动 +const mainRef = ref(null); +let isAutoScrolling = true; + +const stopAutoScroll = () => { + isAutoScrolling = false; +}; + +const startAutoScroll = () => { + isAutoScrolling = true; + autoScroll(); +}; + +const autoScroll = () => { + if (!isAutoScrolling) return; + + const mainEl = mainRef.value; + mainEl.scrollTop += 1; // 每次滚动的距离 + + if (mainEl.scrollTop+1 >= mainEl.scrollHeight - mainEl.clientHeight) { + setTimeout(() => { + mainEl.scrollTo({ top: 0, behavior: "smooth" }); + setTimeout(autoScroll, 2000); // 2秒后再次滚动到底部 + }, 1000); // 暂停1秒后开始快速滚回顶部 + } else { + + requestAnimationFrame(autoScroll); + } +}; + +onBeforeMount(async () => { getData(); }); +onMounted(() => { + startAutoScroll(); + console.log(mainRef.value.scrollTop,mainRef.value.scrollHeight,mainRef.value.clientHeight); +}); const getData = async () => { await http.get("/api/ggfwyth/health").then((res) => { if (res.code == 200) {