于添 5 meses atrás
pai
commit
967c2814f0

+ 45 - 7
src/api/statisticalAnalysis/analysisLearningBehaviors.js

@@ -458,7 +458,7 @@ Mock.mock(/\/api\/webapp\/analysis\/college-course-details/, 'get', {
 			totalVisits: 4123,
 			avgCompletionRate: 76.8,
 			assignmentSubmissionRate: 83.5,
-			dropoutRate: 11.7
+			homeworkFinishRate: 11.7
 		}
 	]
 })
@@ -518,23 +518,61 @@ export const getCollegeList = async (params) => {
 
 export const getCollegeStats = async (params) => {
 	let res = await request('disk/studyBehavior/courseVisitProgress', params, 'get')
+		// /disk/studyBehavior/userLoginProgress
 	console.log('courseVisitProgress', res)
 	let json = {
 		code: 200,
+		data : res
 	}
 	return json
 }
 
-export const getLoginTimeDistribution = (params) => {
-	return request('analysis/login-time-distribution', params, 'get')
+export const getLoginTimeDistribution = async (params) => {
+	let res = await request('disk/studyBehavior/loginFrameDistribution', params, 'get')
+	let hours = []
+	let loginCounts = []
+	ForEach(res.records,(item) => {
+		hours.push(item.createTime)
+		loginCounts.push(item.COUNT)
+	})
+
+
+	let json = {
+		code: 200,
+		hours,
+		loginCounts
+	}
+	return json
+
+
 }
 
-export const getCourseHeat = (params) => {
-	return request('analysis/course-heat', params, 'get')
+export const getCourseHeat = async (params) => {
+	let res = await request('disk/studyBehavior/courseVisitHeatRank', params, 'get')
+	let courses = []
+	let visits = []
+	ForEach(res.records,(item) => {
+		courses.push(item.courseName)
+		visits.push(item.watchCount)
+	})
+
+
+	let json = {
+		code: 200,
+		courses,
+		visits
+	}
+	return json
 }
 
-export const getCollegeCourseDetails = (params) => {
-	return request('analysis/college-course-details', params, 'get')
+export const getCollegeCourseDetails = async (params) => {
+	let res = await request('/disk/studyBehavior/collegeCourseDetailProgress', params, 'get')
+	console.log('1233123',res)
+	let json = {
+		code: 200,
+		data : res.records
+	}
+	return json
 }
 
 export const searchStudents = (params) => {

+ 52 - 32
src/views/statisticalAnalysis/analysisLearningBehaviors/index.vue

@@ -49,11 +49,11 @@
 			<div class="stats-grid">
 				<div class="stat-card">
 					<h3>📚 课程访问统计</h3>
-					<div class="stat-number">{{ collegeStats.totalCourses }}</div>
+					<div class="stat-number">{{ collegeStats.allCourseCount }}</div>
 					<div class="stat-label">总课程数</div>
-					<div class="stat-number">{{ collegeStats.activeCourses }}</div>
+					<div class="stat-number">{{ collegeStats.activeCourseCount }}</div>
 					<div class="stat-label">活跃课程数</div>
-					<div class="stat-number">{{ collegeStats.courseAccessRate }}%</div>
+					<div class="stat-number">{{ collegeStats.courseVisitCount }}%</div>
 					<div class="stat-label">课程访问率</div>
 				</div>
 
@@ -205,7 +205,10 @@
 		avgLoginPerUser: 3.85,
 		totalOnlineTime: 2456,
 		avgSessionTime: 45.2,
-		peakOnlineUsers: 234
+		peakOnlineUsers: 234,
+		activeCourseCount : 0,
+		allCourseCount : 0,
+		courseVisitCount : 0
 	})
 
 	// 图表引用
@@ -218,8 +221,8 @@
 	const collegeColumns = [
 		{
 			title: '学院名称',
-			dataIndex: 'name',
-			key: 'name'
+			dataIndex: 'collegeIdName',
+			key: 'collegeIdName'
 		},
 		{
 			title: '课程数量',
@@ -228,37 +231,37 @@
 		},
 		{
 			title: '总访问量',
-			dataIndex: 'totalVisits',
-			key: 'totalVisits'
+			dataIndex: 'watchCount',
+			key: 'watchCount'
 		},
 		{
 			title: '平均完成率',
-			dataIndex: 'avgCompletionRate',
-			key: 'avgCompletionRate',
+			dataIndex: 'completeRate',
+			key: 'completeRate',
 			customRender: ({ text }) => `${text}%`
 		},
 		{
 			title: '作业提交率',
-			dataIndex: 'assignmentSubmissionRate',
-			key: 'assignmentSubmissionRate',
+			dataIndex: 'homeworkFinishRate',
+			key: 'homeworkFinishRate',
 			customRender: ({ text }) => `${text}%`
 		},
-		{
-			title: '退课率',
-			dataIndex: 'dropoutRate',
-			key: 'dropoutRate',
-			customRender: ({ text }) => `${text}%`
-		}
+		// {
+		// 	title: '退课率',
+		// 	dataIndex: 'homeworkFinishRate',
+		// 	key: 'homeworkFinishRate',
+		// 	customRender: ({ text }) => `${text}%`
+		// }
 	]
 
 	// 学院表格数据
 	const collegeTableData = ref([
 		{
-			id: 1,
-			name: '计算机学院',
+			collegeId: 1,
+			collegeIdName: '计算机学院',
 			courseCount: 45,
 			totalVisits: 5234,
-			avgCompletionRate: 78.5,
+			completeRate: 78.5,
 			assignmentSubmissionRate: 85.2,
 			dropoutRate: 10.2
 		},
@@ -414,23 +417,34 @@
 			})
 		}
 	}
+	const formatDateWithDays = (days = 0) => {
+		const date = new Date();
+		date.setDate(date.getDate() + days); // 设置天数偏移
 
+		const year = date.getFullYear();
+		const month = String(date.getMonth() + 1).padStart(2, '0');
+		const day = String(date.getDate()).padStart(2, '0');
+
+		return `${year}-${month}-${day}`;
+	}
 	// 更新学院数据
 	const updateCollegeData = async () => {
 		try {
 			// 获取学院统计数据 船锚
 			const statsResponse = await getCollegeStats({
-				collegeId: collegeFilters.collegeId,
-				timeRange: collegeFilters.timeRange
+				orgId: collegeFilters.collegeId,
+				startTime : formatDateWithDays(0),
+				endTime : formatDateWithDays(collegeFilters.timeRange)
 			})
-			Object.assign(collegeStats, statsResponse)
+			Object.assign(collegeStats, statsResponse.data)
 
 			// 获取课程详细统计
 			const detailsResponse = await getCollegeCourseDetails({
-				collegeId: collegeFilters.collegeId,
-				timeRange: collegeFilters.timeRange
+				orgId: collegeFilters.collegeId,
+				startTime : formatDateWithDays(0),
+				endTime : formatDateWithDays(collegeFilters.timeRange)
 			})
-			collegeTableData.value = detailsResponse
+			collegeTableData.value = detailsResponse.data
 
 			// 重新初始化图表
 			await initCollegeCharts()
@@ -482,10 +496,13 @@
 
 		try {
 			const response = await getLoginTimeDistribution({
-				collegeId: collegeFilters.collegeId,
-				timeRange: collegeFilters.timeRange
+				orgId: collegeFilters.collegeId,
+				startTime : formatDateWithDays(0),
+				endTime : formatDateWithDays(1),
+				current : 1,
+				size : 24
 			})
-
+			console.log('结果呢',response)
 			const { hours, loginCounts } = response
 
 			const option = {
@@ -590,8 +607,11 @@
 
 		try {
 			const response = await getCourseHeat({
-				collegeId: collegeFilters.collegeId,
-				timeRange: collegeFilters.timeRange
+				orgId: collegeFilters.collegeId,
+				startTime : formatDateWithDays(0),
+				endTime : formatDateWithDays(1),
+				current : 1,
+				size : 8
 			})
 
 			const { courses, visits } = response