diff --git a/.env.development b/.env.development index 6fa89ea..2ed5c5c 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ # 开发环境 VITE_APP_TITLE=教室智能人脸考勤系统(开发) -VITE_API_BASE_URL=http://localhost:8080/api +VITE_API_BASE_URL=http://10.23.22.43:8088/api VITE_WS_URL=ws://localhost:8080/ws diff --git a/package-lock.json b/package-lock.json index 3ed6c50..1839c25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "echarts": "^5.5.0", "element-plus": "^2.6.2", "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.3", "vue": "^3.4.21", "vue-router": "^4.3.0" }, @@ -1970,6 +1971,7 @@ "resolved": "https://registry.npmmirror.com/pinia/-/pinia-2.3.1.tgz", "integrity": "sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==", "license": "MIT", + "peer": true, "dependencies": { "@vue/devtools-api": "^6.6.3", "vue-demi": "^0.14.10" @@ -1987,6 +1989,15 @@ } } }, + "node_modules/pinia-plugin-persistedstate": { + "version": "3.2.3", + "resolved": "https://registry.npmmirror.com/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.3.tgz", + "integrity": "sha512-Cm819WBj/s5K5DGw55EwbXDtx+EZzM0YR5AZbq9XE3u0xvXwvX2JnWoFpWIcdzISBHqy9H1UiSIUmXyXqWsQRQ==", + "license": "MIT", + "peerDependencies": { + "pinia": "^2.0.0" + } + }, "node_modules/postcss": { "version": "8.5.15", "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.15.tgz", diff --git a/package.json b/package.json index e1cae7f..2d8cd1f 100644 --- a/package.json +++ b/package.json @@ -9,17 +9,18 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.4.21", - "vue-router": "^4.3.0", - "pinia": "^2.1.7", - "element-plus": "^2.6.2", "@element-plus/icons-vue": "^2.3.1", + "axios": "^1.6.8", "echarts": "^5.5.0", - "axios": "^1.6.8" + "element-plus": "^2.6.2", + "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.3", + "vue": "^3.4.21", + "vue-router": "^4.3.0" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.4", - "vite": "^5.2.0", - "sass": "^1.72.0" + "sass": "^1.72.0", + "vite": "^5.2.0" } } diff --git a/src/api/attendance.js b/src/api/attendance.js new file mode 100644 index 0000000..ca482bb --- /dev/null +++ b/src/api/attendance.js @@ -0,0 +1,6 @@ +import request from '@/utils/request' + +/** 分页查询考勤任务 */ +export const getTaskPage = (params) => { + return request.get('/attendance/task/page', { params }) +} diff --git a/src/api/auth.js b/src/api/auth.js new file mode 100644 index 0000000..92e7006 --- /dev/null +++ b/src/api/auth.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +/** 登录 */ +export const login = (params) => { + return request.post('/auth/login', params) +} + +/** 退出登录 */ +export const logout = () => { + return request.post('/auth/logout') +} diff --git a/src/api/dashboard.js b/src/api/dashboard.js new file mode 100644 index 0000000..908e50a --- /dev/null +++ b/src/api/dashboard.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' + +/** 获取首页核心统计数据 */ +export const getStats = () => { + return request.get('/dashboard/stats') +} + +/** 获取近7天出勤趋势 */ +export const getTrend = () => { + return request.get('/dashboard/trend') +} + +/** 获取各班级出勤率排名 */ +export const getRanking = () => { + return request.get('/dashboard/ranking') +} diff --git a/src/components/TopNavbar.vue b/src/components/TopNavbar.vue index 013f365..a0e269f 100644 --- a/src/components/TopNavbar.vue +++ b/src/components/TopNavbar.vue @@ -42,7 +42,7 @@
- {{ userStore.userInfo.name }} + {{ userStore.name }}