diff --git a/admin/src/app/views/campus_pay/components/campus-pay-edit.vue b/admin/src/app/views/campus_pay/components/campus-pay-edit.vue
index 5ac15558..a9b3ebc7 100644
--- a/admin/src/app/views/campus_pay/components/campus-pay-edit.vue
+++ b/admin/src/app/views/campus_pay/components/campus-pay-edit.vue
@@ -1,216 +1,218 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/niucloud/app/adminapi/controller/campus_pay/CampusPay.php b/niucloud/app/adminapi/controller/campus_pay/CampusPay.php
index ae20ff05..965e2816 100644
--- a/niucloud/app/adminapi/controller/campus_pay/CampusPay.php
+++ b/niucloud/app/adminapi/controller/campus_pay/CampusPay.php
@@ -58,7 +58,6 @@ class CampusPay extends BaseAdminController
["wx_pay_key_id",""],
]);
- $this->validate($data, 'app\validate\campus_pay\CampusPay.add');
$id = (new CampusPayService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
@@ -79,7 +78,6 @@ class CampusPay extends BaseAdminController
["wx_pay_key_id",""],
]);
- $this->validate($data, 'app\validate\campus_pay\CampusPay.edit');
(new CampusPayService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
diff --git a/niucloud/app/api/controller/apiController/CoachStudent.php b/niucloud/app/api/controller/apiController/CoachStudent.php
index e4d3fa83..c53bdfb5 100644
--- a/niucloud/app/api/controller/apiController/CoachStudent.php
+++ b/niucloud/app/api/controller/apiController/CoachStudent.php
@@ -37,6 +37,8 @@ class CoachStudent extends BaseApiService
["status", 0], // 学员状态
["course_id", 0], // 课程ID搜索
["class_id", 0], // 班级ID搜索
+ ["page", 1], // 页码
+ ["limit", 10], // 每页数量
["debug", false] // 调试模式
]);
diff --git a/niucloud/app/job/schedule/HandleCourseSchedule.php b/niucloud/app/job/schedule/HandleCourseSchedule.php
index 9de59a8a..f793ae90 100644
--- a/niucloud/app/job/schedule/HandleCourseSchedule.php
+++ b/niucloud/app/job/schedule/HandleCourseSchedule.php
@@ -27,7 +27,7 @@ class HandleCourseSchedule extends BaseJob
$lockFile = runtime_path() . 'course_status_update.lock';
if (file_exists($lockFile) && (time() - filemtime($lockFile)) < 300) { // 5分钟锁定
Log::write('课程状态更新任务正在执行中,跳过');
- return ['status' => 'skipped', 'reason' => 'locked'];
+ return false;
}
// 创建锁文件
@@ -63,7 +63,19 @@ class HandleCourseSchedule extends BaseJob
$ongoingCount = 0;
$pendingCount = 0;
- // 1. 更新已完成课程:course_date < 当天的课程
+ // 1. 首先重置未来日期的课程为pending状态(待开始)
+ // 这是核心修正:course_date > 当前日期的所有课程状态改为pending
+ $futureRows = CourseSchedule::where('course_date', '>', $currentDate)
+ ->where('status', '<>', 'pending')
+ ->update([
+ 'status' => 'pending',
+ 'updated_at' => time()
+ ]);
+ $pendingCount += $futureRows;
+
+ Log::write("重置未来课程状态完成 - 重置为pending(待开始): {$futureRows}个");
+
+ // 2. 更新已完成课程:course_date < 当天的课程
$completedRows = CourseSchedule::where('course_date', '<', $currentDate)
->where('status', '<>', 'completed')
->update([
@@ -72,7 +84,7 @@ class HandleCourseSchedule extends BaseJob
]);
$completedCount = $completedRows;
- // 2. 处理今天的课程,需要根据时间段判断状态
+ // 3. 处理今天的课程,需要根据时间段判断状态
$todaySchedules = CourseSchedule::where('course_date', '=', $currentDate)
->whereIn('status', ['pending', 'upcoming', 'ongoing'])
->select();
@@ -124,36 +136,16 @@ class HandleCourseSchedule extends BaseJob
}
}
- // 3. 重置未来日期的课程为pending状态
- $futureRows = CourseSchedule::where('course_date', '>', $currentDate)
- ->where('status', '<>', 'pending')
- ->update([
- 'status' => 'pending',
- 'updated_at' => time()
- ]);
- $pendingCount += $futureRows;
-
- Log::write("课程状态更新完成 - 已完成: {$completedCount}个, 即将开始: {$upcomingCount}个, 进行中: {$ongoingCount}个, 待安排: {$pendingCount}个");
+ Log::write("课程状态更新完成 - 已完成: {$completedCount}个, 即将开始: {$upcomingCount}个, 进行中: {$ongoingCount}个, 待开始: {$pendingCount}个");
Db::commit();
- return [
- 'status' => 'success',
- 'completed_count' => $completedCount,
- 'upcoming_count' => $upcomingCount,
- 'ongoing_count' => $ongoingCount,
- 'pending_count' => $pendingCount
- ];
+ return true;
} catch (\Exception $e) {
Db::rollback();
Log::write('更新课程状态失败:' . $e->getMessage());
- return [
- 'status' => 'failed',
- 'total_count' => 0,
- 'updated_count' => 0,
- 'error' => $e->getMessage()
- ];
+ return false;
}
}
diff --git a/niucloud/app/service/admin/upload/UploadService.php b/niucloud/app/service/admin/upload/UploadService.php
index 356f6b48..eb9aaaaa 100644
--- a/niucloud/app/service/admin/upload/UploadService.php
+++ b/niucloud/app/service/admin/upload/UploadService.php
@@ -58,8 +58,13 @@ class UploadService extends BaseAdminService
$dir = $this->root_path.'/document/'.$type.'/'.date('Ym').'/'.date('d');
// $dir = $this->root_path.'/document/'.$type.'/'.$name[0];
+ if ($type != 'cert'){
+ $storage_type = StorageDict::TENCENT;
+ }else{
+ $storage_type = StorageDict::LOCAL;
+ }
$core_upload_service = new CoreUploadService();
- return $core_upload_service->document($file, $type, $dir, StorageDict::TENCENT);
+ return $core_upload_service->document($file, $type, $dir, $storage_type);
}
diff --git a/niucloud/app/service/api/apiService/CoachStudentService.php b/niucloud/app/service/api/apiService/CoachStudentService.php
index 5474d895..e9642cde 100644
--- a/niucloud/app/service/api/apiService/CoachStudentService.php
+++ b/niucloud/app/service/api/apiService/CoachStudentService.php
@@ -45,7 +45,14 @@ class CoachStudentService extends BaseApiService
if (empty($coachId)) {
$res['code'] = 1;
- $res['data'] = [];
+ $res['data'] = [
+ 'list' => [],
+ 'total' => 0,
+ 'page' => 1,
+ 'limit' => 10,
+ 'pages' => 0,
+ 'has_more' => false
+ ];
$res['msg'] = '获取成功';
return $res;
}
@@ -55,7 +62,14 @@ class CoachStudentService extends BaseApiService
if (empty($studentIds)) {
$res['code'] = 1;
- $res['data'] = [];
+ $res['data'] = [
+ 'list' => [],
+ 'total' => 0,
+ 'page' => 1,
+ 'limit' => 10,
+ 'pages' => 0,
+ 'has_more' => false
+ ];
$res['msg'] = '获取成功';
return $res;
}
@@ -82,12 +96,23 @@ class CoachStudentService extends BaseApiService
$where[] = ['s.status', '=', $data['status']];
}
- // 查询学员基础信息
+ // 分页参数处理
+ $page = max(1, intval($data['page'] ?? 1));
+ $limit = max(1, min(50, intval($data['limit'] ?? 10))); // 限制每页最多50条
+
+ // 查询总数
+ $total = Db::table('school_student s')
+ ->leftJoin('school_campus c', 's.campus_id = c.id')
+ ->where($where)
+ ->count();
+
+ // 查询学员基础信息(分页)
$list = Db::table('school_student s')
->leftJoin('school_campus c', 's.campus_id = c.id')
->where($where)
->field('s.*, c.campus_name as campus')
->order('s.created_at', 'desc')
+ ->page($page, $limit)
->select()
->toArray();
@@ -146,7 +171,14 @@ class CoachStudentService extends BaseApiService
}
$res['code'] = 1;
- $res['data'] = $list;
+ $res['data'] = [
+ 'list' => $list,
+ 'total' => $total,
+ 'page' => $page,
+ 'limit' => $limit,
+ 'pages' => ceil($total / $limit),
+ 'has_more' => $page * $limit < $total
+ ];
} catch (\Exception $e) {
$res['msg'] = '获取失败:' . $e->getMessage();
}
diff --git a/niucloud/app/service/api/apiService/PersonnelService.php b/niucloud/app/service/api/apiService/PersonnelService.php
index 9a430ce4..9437221f 100644
--- a/niucloud/app/service/api/apiService/PersonnelService.php
+++ b/niucloud/app/service/api/apiService/PersonnelService.php
@@ -832,22 +832,22 @@ class PersonnelService extends BaseApiService
$where = [];
// 查询销售部门(dept_id=3)下的所有角色ID
- $salesRoleIds = SysRole::where('dept_id', 3)
- ->where('status', 1)
- ->column('role_id');
-
- if (empty($salesRoleIds)) {
- return [
- 'code' => 1,
- 'msg' => '暂无销售部门角色',
- 'data' => []
- ];
- }
-
- // 构建校区人员角色关系查询条件
- $campusPersonWhere = [
- ['role_id', 'in', $salesRoleIds]
- ];
+// $salesRoleIds = SysRole::where('dept_id', 3)
+// ->where('status', 1)
+// ->column('role_id');
+//
+// if (empty($salesRoleIds)) {
+// return [
+// 'code' => 1,
+// 'msg' => '暂无销售部门角色',
+// 'data' => []
+// ];
+// }
+//
+// // 构建校区人员角色关系查询条件
+// $campusPersonWhere = [
+// ['role_id', 'in', $salesRoleIds]
+// ];
// 根据传入的校区进行筛选
if (!empty($campus)) {
@@ -857,7 +857,7 @@ class PersonnelService extends BaseApiService
// 查询符合条件的销售人员ID
$salesPersonIds = CampusPersonRole::where($campusPersonWhere)
->column('person_id');
-
+
if (empty($salesPersonIds)) {
return [
'code' => 1,
diff --git a/niucloud/test_upload.php b/niucloud/test_upload.php
deleted file mode 100644
index 4b3859ac..00000000
--- a/niucloud/test_upload.php
+++ /dev/null
@@ -1,78 +0,0 @@
- $cfile,
- 'type' => 'document'
-];
-
-$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, $url);
-curl_setopt($ch, CURLOPT_POST, true);
-curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
-curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-curl_setopt($ch, CURLOPT_HTTPHEADER, [
- 'Accept: application/json',
- 'token: test_token_for_upload_test',
- // 注意:不要设置 Content-Type,让curl自动设置为 multipart/form-data
-]);
-
-echo "🚀 发送上传请求...\n";
-$response = curl_exec($ch);
-$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-$error = curl_error($ch);
-curl_close($ch);
-
-echo "HTTP状态码: $httpCode\n";
-if ($error) {
- echo "CURL错误: $error\n";
-}
-
-echo "响应内容:\n";
-echo $response . "\n\n";
-
-// 解析响应
-$responseData = json_decode($response, true);
-if ($responseData) {
- if ($responseData['code'] == 1) {
- echo "✅ 上传成功!\n";
- echo "文件URL: " . $responseData['data']['url'] . "\n";
- echo "文件名: " . $responseData['data']['name'] . "\n";
- echo "扩展名: " . $responseData['data']['ext'] . "\n";
- } else {
- echo "❌ 上传失败: " . $responseData['msg'] . "\n";
- }
-} else {
- echo "❌ 响应解析失败\n";
-}
-
-// 清理测试文件
-unlink($testFile);
-echo "\n🗑️ 测试文件已清理\n";
-
-echo "\n📋 调试建议:\n";
-echo "1. 检查前端是否使用了正确的参数名 'file'\n";
-echo "2. 检查请求是否为 multipart/form-data 格式\n";
-echo "3. 检查文件大小是否超过限制\n";
-echo "4. 检查服务器错误日志\n";
-echo "5. 检查腾讯云COS配置和权限\n";
-?>
diff --git a/test-student-orders-api.js b/test-student-orders-api.js
deleted file mode 100644
index 8710743e..00000000
--- a/test-student-orders-api.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// 测试学员端订单接口
-const axios = require('axios');
-
-const BASE_URL = 'http://localhost:20080/api';
-
-async function testStudentOrdersAPI() {
- console.log('🧪 开始测试学员端订单接口...\n');
-
- try {
- // 测试订单列表接口
- console.log('📋 测试订单列表接口...');
- const listResponse = await axios.get(`${BASE_URL}/xy/student/orders`, {
- params: {
- student_id: 31,
- page: 1,
- limit: 10
- }
- });
-
- console.log('✅ 订单列表接口响应:');
- console.log('状态码:', listResponse.status);
- console.log('响应数据:', JSON.stringify(listResponse.data, null, 2));
- console.log('');
-
- // 测试订单统计接口
- console.log('📊 测试订单统计接口...');
- const statsResponse = await axios.get(`${BASE_URL}/xy/student/orders/stats`, {
- params: {
- student_id: 31
- }
- });
-
- console.log('✅ 订单统计接口响应:');
- console.log('状态码:', statsResponse.status);
- console.log('响应数据:', JSON.stringify(statsResponse.data, null, 2));
- console.log('');
-
- // 如果有订单数据,测试订单详情接口
- if (listResponse.data.code === 1 && listResponse.data.data && listResponse.data.data.data && listResponse.data.data.data.length > 0) {
- const firstOrder = listResponse.data.data.data[0];
- console.log('📄 测试订单详情接口...');
-
- const detailResponse = await axios.get(`${BASE_URL}/xy/student/orders/detail`, {
- params: {
- id: firstOrder.id,
- student_id: 31
- }
- });
-
- console.log('✅ 订单详情接口响应:');
- console.log('状态码:', detailResponse.status);
- console.log('响应数据:', JSON.stringify(detailResponse.data, null, 2));
- } else {
- console.log('ℹ️ 没有订单数据,跳过详情接口测试');
- }
-
- console.log('\n🎉 所有接口测试完成!');
-
- } catch (error) {
- console.error('❌ 接口测试失败:');
- if (error.response) {
- console.error('状态码:', error.response.status);
- console.error('响应数据:', JSON.stringify(error.response.data, null, 2));
- } else {
- console.error('错误信息:', error.message);
- }
- }
-}
-
-// 运行测试
-testStudentOrdersAPI();
diff --git a/uniapp/pages-coach/coach/schedule/schedule_table.vue b/uniapp/pages-coach/coach/schedule/schedule_table.vue
index c07f2787..b493526f 100644
--- a/uniapp/pages-coach/coach/schedule/schedule_table.vue
+++ b/uniapp/pages-coach/coach/schedule/schedule_table.vue
@@ -126,36 +126,31 @@
-
-
-
-
+
-
+
+
+
+
+
+
+
@@ -432,9 +428,7 @@ export default {
selectedClasses: [],
// 滚动相关
- scrollLeft: 0,
scrollTop: 0,
- scrollAnimationFrame: null, // 滚动动画帧
// 表格配置
tableWidth: 1500, // 表格总宽度,确保7天都能显示 (7*180+120=1380rpx)
@@ -526,23 +520,29 @@ export default {
this.initCurrentWeek()
this.initTimeSlots()
+ // 初始化响应式布局
+ this.handleResize()
+
// 先加载筛选选项,然后加载课程安排列表
this.loadFilterOptions().then(() => {
this.loadScheduleList()
})
- // 监听窗口大小变化,调整布局
- window.addEventListener('resize', this.handleResize)
+ // 监听窗口大小变化,调整布局(仅在H5环境下)
+ // #ifndef MP-WEIXIN
+ if (typeof window !== 'undefined') {
+ window.addEventListener('resize', this.handleResize)
+ }
+ // #endif
},
beforeDestroy() {
- // 移除事件监听
- window.removeEventListener('resize', this.handleResize)
-
- // 清除任何未完成的动画帧
- if (this.scrollAnimationFrame) {
- cancelAnimationFrame(this.scrollAnimationFrame)
+ // 移除事件监听(仅在H5环境下)
+ // #ifndef MP-WEIXIN
+ if (typeof window !== 'undefined') {
+ window.removeEventListener('resize', this.handleResize)
}
+ // #endif
},
methods: {
@@ -782,14 +782,8 @@ export default {
this.filterParams.class_id = '';
// 如果切换了模式,重置滚动位置
- this.scrollLeft = 0;
this.scrollTop = 0;
- // 清除任何未完成的动画帧
- if (this.scrollAnimationFrame) {
- cancelAnimationFrame(this.scrollAnimationFrame);
- }
-
// 切换模式后重新加载课程安排
this.loadScheduleList();
}
@@ -812,7 +806,6 @@ export default {
// 重新加载数据后,重置滚动位置
await this.loadScheduleList()
- this.scrollLeft = 0
this.scrollTop = 0
// 如果筛选改变了时间段,需要重新生成时间列
@@ -1162,24 +1155,12 @@ export default {
});
},
- // 滚动事件处理函数
+ // 滚动事件处理函数 - 只处理垂直滚动同步
onScroll(e) {
- if (this.scrollAnimationFrame) {
- cancelAnimationFrame(this.scrollAnimationFrame)
+ // 只需要同步垂直滚动位置给左侧时间列
+ if (e.detail.scrollTop !== undefined) {
+ this.scrollTop = e.detail.scrollTop
}
-
- this.scrollAnimationFrame = requestAnimationFrame(() => {
- // 获取滚动位置
- if (e.detail.scrollLeft !== undefined) {
- this.scrollLeft = e.detail.scrollLeft
- }
-
- if (e.detail.scrollTop !== undefined) {
- this.scrollTop = e.detail.scrollTop
-
- // 左侧冻结列的滚动会通过 :scroll-top 绑定自动同步
- }
- })
},
// 单元格点击
@@ -1334,7 +1315,24 @@ export default {
// 响应式调整
handleResize() {
// 根据窗口宽度调整表格尺寸
- const width = window.innerWidth
+ let width = 375 // 默认宽度
+
+ // #ifdef MP-WEIXIN
+ try {
+ const systemInfo = uni.getSystemInfoSync()
+ width = systemInfo.screenWidth || systemInfo.windowWidth || 375
+ } catch (e) {
+ console.warn('获取系统信息失败,使用默认宽度:', e)
+ width = 375
+ }
+ // #endif
+
+ // #ifndef MP-WEIXIN
+ if (typeof window !== 'undefined') {
+ width = window.innerWidth
+ }
+ // #endif
+
if (width <= 375) {
this.tableWidth = 1220 // 7*160+100=1220rpx
} else if (width <= 768) {
@@ -1531,15 +1529,20 @@ export default {
overflow: hidden;
}
-.date-header-scroll {
- overflow: hidden;
- border-bottom: 2px solid #29d3b4;
+// 合并滚动区域内部容器
+.schedule-container-inner {
+ display: flex;
+ flex-direction: column;
+ min-width: 1260rpx; /* 7天 * 180rpx = 1260rpx */
}
.date-header-container {
display: flex;
background: #434544;
- min-width: 1260rpx; /* 7天 * 180rpx = 1260rpx */
+ border-bottom: 2px solid #29d3b4;
+ position: sticky;
+ top: 0;
+ z-index: 2;
}
.date-header-cell {
diff --git a/uniapp/pages-coach/coach/student/student_list.vue b/uniapp/pages-coach/coach/student/student_list.vue
index b46f81ed..689ca2c1 100644
--- a/uniapp/pages-coach/coach/student/student_list.vue
+++ b/uniapp/pages-coach/coach/student/student_list.vue
@@ -4,37 +4,65 @@
搜索学员...
+
+
+
+ 共找到 {{ pagination.total }} 名学员
+
暂无学员数据
-
-
-
-
-
-
-
- {{item.name}}
-
- 所属校区:
- {{item.campus}}
-
-
- 剩余课程:
- {{ getRemainingCourses(item) }}节
-
-
- 到期时间:
- {{item.end_date}}
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+ 所属校区:
+ {{item.campus}}
+
+
+ 剩余课程:
+ {{ getRemainingCourses(item) }}节
+
+
+ 到期时间:
+ {{item.end_date}}
+
+
+
+
+
-
-
+
+
+
+
+
+
+ 加载中...
+
+
+ 上拉加载更多
+
+
+ 已显示全部 {{ pagination.total }} 名学员
-
+
@@ -141,13 +169,21 @@ import apiRoute from '@/api/apiRoute.js';
phone: '',
lessonCount: '',
leaveCount: '',
- courseId: null,
- classId: null,
+ course_id: null,
+ class_id: null,
},
selectedCourseName: '',
selectedClassName: '',
courseList: [],
classList: [],
+ // 分页相关
+ pagination: {
+ current: 1,
+ limit: 10,
+ total: 0,
+ hasMore: false,
+ loading: false
+ },
}
},
onLoad() {
@@ -158,14 +194,48 @@ import apiRoute from '@/api/apiRoute.js';
navigateBack() {
uni.navigateBack();
},
- async getStudentList() {
+ async getStudentList(reset = false) {
try {
- // 使用教练端专用接口,合并搜索表单参数
- const res = await apiRoute.coach_getMyStudents(this.searchForm);
+ // 如果是重置或首次加载,重置分页参数
+ if (reset) {
+ this.pagination.current = 1;
+ this.studentList = [];
+ }
+
+ // 防止重复加载
+ if (this.pagination.loading) {
+ return;
+ }
+
+ this.pagination.loading = true;
+
+ // 合并分页参数到搜索表单
+ const params = {
+ ...this.searchForm,
+ page: this.pagination.current,
+ limit: this.pagination.limit
+ };
+
+ const res = await apiRoute.coach_getMyStudents(params);
console.log('获取教练端学员列表响应:', res);
+
if(res.code == 1) {
- this.studentList = res.data || [];
+ const data = res.data || {};
+ const list = data.list || [];
+
+ // 更新分页信息
+ this.pagination.total = data.total || 0;
+ this.pagination.hasMore = data.has_more || false;
+
+ // 根据是否重置决定是覆盖还是追加数据
+ if (reset) {
+ this.studentList = list;
+ } else {
+ this.studentList = [...this.studentList, ...list];
+ }
+
console.log('教练端学员列表更新成功:', this.studentList);
+ console.log('分页信息:', this.pagination);
} else {
console.error('API返回错误:', res);
uni.showToast({
@@ -173,13 +243,14 @@ import apiRoute from '@/api/apiRoute.js';
icon: 'none'
});
}
- }catch ( error) {
+ } catch (error) {
console.error('获取学员列表错误', error);
uni.showToast({
title: '获取学员列表失败',
icon: 'none'
});
- return;
+ } finally {
+ this.pagination.loading = false;
}
},
goToDetail(student) {
@@ -204,6 +275,16 @@ import apiRoute from '@/api/apiRoute.js';
0) + (item.use_gift_hours || 0);
return totalHours - usedHours;
},
+
+ // 加载更多数据
+ async loadMore() {
+ if (!this.pagination.hasMore || this.pagination.loading) {
+ return;
+ }
+
+ this.pagination.current++;
+ await this.getStudentList(false);
+ },
// 输入处理方法
onNameInput(e) {
@@ -221,23 +302,23 @@ import apiRoute from '@/api/apiRoute.js';
// 选择器变更处理
onCourseChange(e) {
- this.searchForm.courseId = e.value;
+ this.searchForm.course_id = e.value;
this.selectedCourseName = e.text;
},
onClassChange(e) {
- this.searchForm.classId = e.value;
+ this.searchForm.class_id = e.value;
this.selectedClassName = e.text;
},
// 清除选择器选中项
clearCourseSelection(e) {
e.stopPropagation(); // 阻止事件冒泡到点击打开选择器
- this.searchForm.courseId = null;
+ this.searchForm.course_id = null;
this.selectedCourseName = '';
},
clearClassSelection(e) {
e.stopPropagation(); // 阻止事件冒泡到点击打开选择器
- this.searchForm.classId = null;
+ this.searchForm.class_id = null;
this.selectedClassName = '';
},
@@ -251,33 +332,50 @@ import apiRoute from '@/api/apiRoute.js';
this.showSearch = false;
},
- // 获取班级列表
+ // 获取课程和班级列表
async getClassesList() {
try {
- const res = await apiRoute.jlGetClassesList();
- if (res.code == 1) {
- // 确保API返回的数据是数组格式
- this.classList = res.data.classes || [];
- this.courseList = res.data.course || [];
+ // 并行调用两个接口获取课程和班级列表
+ const [courseRes, classRes] = await Promise.all([
+ apiRoute.getCourseListForSchedule(),
+ apiRoute.getClassListForSchedule()
+ ]);
+
+ // 处理课程列表数据
+ if (courseRes.code == 1) {
+ this.courseList = courseRes.data.list || courseRes.data || [];
} else {
- uni.showToast({
- title: res.msg || '获取班级列表失败',
- icon: 'none'
- });
+ console.warn('获取课程列表失败:', courseRes.msg);
+ this.courseList = [];
+ }
+
+ // 处理班级列表数据
+ if (classRes.code == 1) {
+ this.classList = classRes.data.list || classRes.data || [];
+ } else {
+ console.warn('获取班级列表失败:', classRes.msg);
+ this.classList = [];
}
+
+ console.log('课程列表:', this.courseList);
+ console.log('班级列表:', this.classList);
+
} catch (error) {
- console.error('获取班级列表错误', error);
+ console.error('获取课程和班级列表错误', error);
uni.showToast({
- title: '获取班级列表失败',
+ title: '获取筛选数据失败',
icon: 'none'
});
+ // 设置为空数组防止页面报错
+ this.courseList = [];
+ this.classList = [];
}
},
doSearch() {
// 这里可以根据 searchForm 的内容进行筛选或请求
this.showSearch = false;
- this.getStudentList()
+ this.getStudentList(true) // 重置分页数据
},
doSearchAndClose() {
@@ -290,12 +388,12 @@ import apiRoute from '@/api/apiRoute.js';
phone: '',
lessonCount: '',
leaveCount: '',
- courseId: null,
- classId: null,
+ course_id: null,
+ class_id: null,
};
this.selectedCourseName = '';
this.selectedClassName = '';
- this.getStudentList();
+ this.getStudentList(true); // 重置分页数据
}
}
}
@@ -708,4 +806,62 @@ import apiRoute from '@/api/apiRoute.js';
color: #fff;
}
}
+
+ // 统计信息栏
+ .stats-bar {
+ padding: 20rpx 30rpx;
+ background: #23232a;
+ border-bottom: 1px solid #333;
+ margin: 24rpx;
+ }
+
+ .stats-text {
+ color: #00d18c;
+ font-size: 28rpx;
+ font-weight: 500;
+ }
+
+ // 滚动容器
+ .student-list-scroll {
+ height: calc(100vh - 300rpx);
+ background: #18181c;
+ }
+
+ // 加载更多样式
+ .load-more {
+ padding: 30rpx;
+ text-align: center;
+ background: #18181c;
+ }
+
+ .loading {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 10rpx;
+ }
+
+ .loading-icon {
+ animation: spin 1s linear infinite;
+ }
+
+ @keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+
+ .loading-text {
+ color: #00d18c;
+ font-size: 28rpx;
+ }
+
+ .load-more-text {
+ color: #bdbdbd;
+ font-size: 26rpx;
+ }
+
+ .no-more {
+ color: #666;
+ font-size: 24rpx;
+ }
\ No newline at end of file