diff --git a/src/api/api.ts b/src/api/api.ts index 8d62f92..4d80fc6 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1,6 +1,14 @@ +/* + * @Author: 张宁 18339727226@163.com + * @Date: 2024-05-22 08:40:55 + * @LastEditors: 张宁 18339727226@163.com + * @LastEditTime: 2024-06-03 13:59:14 + * @FilePath: \welcome-system-screen\src\api\api.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ /* * @LastEditors: 张宁 18339727226@163.com - * @LastEditTime: 2024-05-30 09:15:55 + * @LastEditTime: 2024-06-03 11:39:31 */ import axios from "axios"; import type { AxiosRequestConfig, AxiosResponse } from "axios"; @@ -51,19 +59,30 @@ axios.interceptors.response.use( if (response.status !== 200) { return Promise.reject(response); } + /** - * @code 登录过期 token验证失败 根据后端调 + * @code 登录过期 token验证失败 根据后端调-----放错地方了? */ - if (response.data.code == UtilVar.code) { + /* if (response.data.code == UtilVar.code) { // router.push("/login") - // window.location.href = 'http://nclg.yx.zheke.com/#/login'; + window.location.href = 'http://nclg.yx.zheke.com/#/login'; return Promise.resolve(response); - } + } */ return Promise.resolve(response); }, (error: any) => { console.log("error", error); + /** + * @code 登录过期 token验证失败 根据后端调 + */ + if (error.response.status == UtilVar.code) { + // router.push("/login") + // 目前放测试地址 发布后放到正是地址---待修改 + window.location.href = 'http://nclg.yx.zheke.com/#/login'; + + return Promise.resolve(response); + } let err = { success: false, msg: "未知异常,请联系管理员!", diff --git a/src/components/chart/chart.vue b/src/components/chart/chart.vue index abffdb4..a067875 100644 --- a/src/components/chart/chart.vue +++ b/src/components/chart/chart.vue @@ -2,135 +2,130 @@
+ - \ No newline at end of file diff --git a/src/components/chart/pieChart.vue b/src/components/chart/pieChart.vue index f9b4746..28f423b 100644 --- a/src/components/chart/pieChart.vue +++ b/src/components/chart/pieChart.vue @@ -4,134 +4,120 @@ - \ No newline at end of file diff --git a/src/config/UtilVar.ts b/src/config/UtilVar.ts index 087eaf1..3503301 100644 --- a/src/config/UtilVar.ts +++ b/src/config/UtilVar.ts @@ -3,13 +3,18 @@ interface UtilVarType { code:string|number, noContentCode:number, ENC:boolean,//是否进行加密 + errCode:string|number, + notAllow:string|number } - +// 这里放的是测试地址,发布后改为正式地址 ---- 待修改 const UtilVar:UtilVarType = { baseUrl:"http://api.nclg.yx.zheke.com", code:401, //登陆过期 noContentCode:204, //请求成功但没有内容 ENC:false, + errCode:'ERR_BAD_REQUEST', + notAllow:403 + } const runtimeType:any = { diff --git a/src/stores/data/data.ts b/src/stores/data/data.ts index 882e227..bbd6b5c 100644 --- a/src/stores/data/data.ts +++ b/src/stores/data/data.ts @@ -2,7 +2,7 @@ * @Author: 张宁 18339727226@163.com * @Date: 2024-05-27 08:45:53 * @LastEditors: 张宁 18339727226@163.com - * @LastEditTime: 2024-05-31 16:39:38 + * @LastEditTime: 2024-06-04 09:34:13 * @FilePath: \welcome-system-screen\src\stores\time\time.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -34,6 +34,14 @@ export const useDataStore = defineStore("data", () => { const today=computed(() => allData.value.today); const totalDto=computed(() => allData.value.totalDto); + // 当日预报到报到率 + const forecastRate = computed(() => { + forecast.value.reported / forecast.value.total + }); + // 当日预报到总人数报到率 + const totalRate = computed(() => { + totalDto.value.reportNumber / totalDto.value.totalNumber + }); // 选中的学院id const collageId = ref() @@ -70,5 +78,5 @@ export const useDataStore = defineStore("data", () => { }; - return { allData,degreeDto,forecast,forecastFill,nationStudent,payDto,provinceDto,rankingDto,sexDto,today,totalDto,setData,bkPay,zkPay,zsbPay,setBkPay,setZkPay,setZsbPay,setCollageId,collageId,professionRank,setProfessionRank}; + return { allData,degreeDto,forecast,forecastFill,nationStudent,payDto,provinceDto,rankingDto,sexDto,today,totalDto,setData,bkPay,zkPay,zsbPay,setBkPay,setZkPay,setZsbPay,setCollageId,collageId,professionRank,setProfessionRank,forecastRate,totalRate}; }); diff --git a/src/stores/time/time.ts b/src/stores/time/time.ts index 2a4c7a9..c7ef73e 100644 --- a/src/stores/time/time.ts +++ b/src/stores/time/time.ts @@ -2,7 +2,7 @@ * @Author: 张宁 18339727226@163.com * @Date: 2024-05-27 08:45:53 * @LastEditors: 张宁 18339727226@163.com - * @LastEditTime: 2024-05-31 15:32:52 + * @LastEditTime: 2024-06-03 09:15:30 * @FilePath: \welcome-system-screen\src\stores\time\time.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -35,15 +35,15 @@ export const useTimeStore = defineStore("time", () => { } // 根据年、月、日的切换,展示不同的标题 --- 具体问问产品怎么展示 -----待修改 const computDate = computed(() => { - let dates = '今日' + let dates = '当日' if (years.value) { dates = years.value + '年' if (months.value) { dates += months.value + '月' + }if (days.value) { + dates = '当日' } - } else { - dates = '今日' - } + } return dates }) const nowTitle = computed(() => { @@ -52,9 +52,9 @@ export const useTimeStore = defineStore("time", () => { titles = '当年' if(months.value) { titles = '当月' + }if (days.value) { + titles = '当日' } - }else{ - titles = '当日' } return titles }) diff --git a/src/views/header.vue b/src/views/header.vue index faf4391..cbf34d9 100644 --- a/src/views/header.vue +++ b/src/views/header.vue @@ -57,10 +57,10 @@ const myDate = ref({ // 获取选择的日期(年 || 月 ||日) const getDate = (val: any) => { myDate.value = val - /* // 根据年、月、日的切换,展示不同的标题 --- 具体问问产品怎么展示 -----待修改 + // 根据年、月、日的切换,展示不同的标题 --- 具体问问产品怎么展示 -----待修改 timeStore.setYears(val.year) timeStore.setMounths(val.month) - timeStore.setDays(val.day) */ + timeStore.setDays(val.day) let params = { "Year":val.year || void 0, "Month":val.month || void 0, diff --git a/src/views/index/center-top.vue b/src/views/index/center-top.vue index 3fab95b..7ad7cd6 100644 --- a/src/views/index/center-top.vue +++ b/src/views/index/center-top.vue @@ -2,7 +2,7 @@ * @Author: 张宁 18339727226@163.com * @Date: 2024-05-22 08:40:56 * @LastEditors: 张宁 18339727226@163.com - * @LastEditTime: 2024-05-31 14:53:27 + * @LastEditTime: 2024-06-04 09:34:34 * @FilePath: \welcome-system-screen\src\views\index\center-top.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE --> @@ -13,7 +13,7 @@ const { computDate } = storeToRefs(timeStore) import { ElMessage } from "element-plus"; import { useDataStore } from "@/stores/index"; const dataStore = useDataStore(); -const { today } = storeToRefs(dataStore) +const { today, forecastRate,totalRate } = storeToRefs(dataStore) @@ -25,17 +25,17 @@ const { today } = storeToRefs(dataStore)
{{ computDate }}迎新人数
-
{{ today.nowStuden??'-' }}
+
{{ today.nowStuden ?? '0' }}
{{ computDate }}预报到人数
-
{{ today.forecastStuden??'-' }}
+
{{ today.forecastStuden ?? '0' }}
{{ computDate }}预报到报到率
-
95%
+
{{ forecastRate ?? '0' }}%
@@ -43,7 +43,7 @@ const { today } = storeToRefs(dataStore)
预报到总人数报到率
-
95%
+
{{totalRate ?? '0'}}%
diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 80a7b99..a616532 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -21,15 +21,15 @@ import { useDataStore } from "@/stores/index"; const dataStore = useDataStore(); const { allData, rankingDto, collageId, professionRank } = storeToRefs(dataStore) -const rightCenterRef = ref(null) +const rightCenterRef: any = ref(null) -const mapRef = ref(null) +const mapRef: any = ref(null) const tableData = ref() const showRight = ref(true) const changeRight = () => { showRight.value = !showRight.value if (!showRight.value && rbtwoRef) { - setTimeout(()=>{ + setTimeout(() => { rbtwoRef.value.getData(professionRank.value) }) @@ -77,7 +77,7 @@ const divideAndFormat = (divisor: any, dividend: any) => { let result = (divisor / dividend) * 100; return result.toFixed(1) + "%"; } -const rbtwoRef = ref(null) +const rbtwoRef: any = ref(null) const getProfession = () => { let params = { "id": collageId.value @@ -102,7 +102,12 @@ watch(collageId, () => { * @return {*} */ const getAdminPCIndex = () => { - AdminPCIndex().then((res: any) => { + let params = { + "Year": years.value, + "Month": months.value, + "Day": days.value + } + AdminPCIndex(params).then((res: any) => { dataStore.setData(res.data); dataStore.setCollageId(res.data.rankingDto[0].collegeId) dealMapData(res.data) @@ -151,11 +156,21 @@ const payData = () => { }); } - +const timer: any = ref(null) +const startTimer = () => { + timer.value = setInterval(() => { + getAdminPCIndex(); + payData(); + }, 60000) +} +const clearTimer = () => { + clearInterval(timer.value) +} onMounted(() => { getAdminPCIndex(); payData(); + startTimer() }); diff --git a/src/views/index/left-bottom.vue b/src/views/index/left-bottom.vue index 66d10f2..99147de 100644 --- a/src/views/index/left-bottom.vue +++ b/src/views/index/left-bottom.vue @@ -2,7 +2,7 @@ * @Author: 张宁 18339727226@163.com * @Date: 2024-05-23 20:42:55 * @LastEditors: 张宁 18339727226@163.com - * @LastEditTime: 2024-05-30 13:49:47 + * @LastEditTime: 2024-06-03 15:28:11 * @FilePath: \welcome-system-screen\src\views\index\left-bottom.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE --> @@ -13,14 +13,26 @@ const {forecast,forecastFill} = storeToRefs(dataStore) const chartRef = ref(null) const pieChartRef = ref(null) -onMounted(()=>{ +watch(forecast,()=>{ if (chartRef) { chartRef.value.init(forecast.value.total,forecast.value.reported) } +},{ + deep:true, +}) +watch(forecastFill,()=>{ if (pieChartRef) { pieChartRef.value.init(forecastFill.value.total,forecastFill.value.reported) } }) +onMounted(()=>{ + // if (chartRef) { + // chartRef.value.init(forecast.value.total,forecast.value.reported) + // } + // if (pieChartRef) { + // pieChartRef.value.init(forecastFill.value.total,forecastFill.value.reported) + // } +})