diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 8a415cf5..991c3fd5 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -442,7 +442,7 @@ Route::group(function () { })->middleware(ApiChannel::class) - ->middleware(ApiCheckToken::class, true) + ->middleware(ApiPersonnelCheckToken::class, true) ->middleware(ApiLog::class); //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑-----学生用户端相关-----↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ diff --git a/niucloud/app/model/school_student_courses.php b/niucloud/app/model/school_student_courses.php new file mode 100644 index 00000000..ab03591a --- /dev/null +++ b/niucloud/app/model/school_student_courses.php @@ -0,0 +1,14 @@ +find(); + $student = Student::where('user_id', $where['resource_id'])->find(); if (!$student) { return $res; } @@ -462,12 +463,47 @@ class PersonCourseScheduleService extends BaseApiService ]; try { - // 获取所有人员,可以通过角色或者其他字段来区分角色类型 - $personnel = Personnel::field('id,name,role_type,role_name') - ->where('status', 1) // 假设1表示正常状态 + // 先从校区人员角色关系表查询dept_id=2的所有人员ID + $personIds = CampusPersonRole::where('dept_id', 2) + ->where('deleted_at', 0) // 未删除 + ->distinct(true) + ->column('person_id'); + + if (empty($personIds)) { + $res['msg'] = '暂无相关人员'; + return $res; + } + + // 根据获取到的人员ID查询人员详情,并关联角色信息 + $personnel = Personnel::whereIn('id', $personIds) + ->field('id,name') + ->where('status', 1) // 正常状态 ->select() ->toArray(); + // 为每个人员获取角色信息 + foreach ($personnel as &$person) { + $roles = CampusPersonRole::where('person_id', $person['id']) + ->where('dept_id', 2) + ->where('deleted_at', 0) + ->with(['sysRole' => function($query) { + $query->field('role_id,role_name'); + }]) + ->select() + ->toArray(); + + // 提取角色名称 + $roleNames = []; + foreach ($roles as $role) { + if (!empty($role['sys_role']['role_name'])) { + $roleNames[] = $role['sys_role']['role_name']; + } + } + + $person['role_name'] = implode(',', $roleNames); + $person['roles'] = $roleNames; // 保留数组格式便于前端判断 + } + $res = [ 'code' => 1, 'msg' => '获取成功', diff --git a/niucloud/app/service/api/login/LoginService.php b/niucloud/app/service/api/login/LoginService.php index fd51c820..70918280 100644 --- a/niucloud/app/service/api/login/LoginService.php +++ b/niucloud/app/service/api/login/LoginService.php @@ -177,7 +177,7 @@ class LoginService extends BaseApiService try { $token_info = TokenAuth::parseToken($token, AppTypeDict::API); - dd($token_info); + dd($token_info,$token,AppTypeDict::PERSONNEL); } catch (Throwable $e) { // if(env('app_debug', false)){ // throw new AuthException($e->getMessage(), 401); diff --git a/uniapp/pages/market/clue/clue_info.vue b/uniapp/pages/market/clue/clue_info.vue index 9b4ec39a..dc751845 100644 --- a/uniapp/pages/market/clue/clue_info.vue +++ b/uniapp/pages/market/clue/clue_info.vue @@ -233,12 +233,12 @@ - - + + + + 修改教练配置 + + 主教练(单选) @@ -285,7 +285,11 @@ - + + 取消 + 确认 + + @@ -853,9 +857,27 @@ const personnel = res.data || []; // 按角色分类人员 - 根据实际数据结构调整 - this.coachList = personnel.filter(p => p.role_name === '教练' || p.role_type === 'coach' || p.role_name === '教师'); - this.educationList = personnel.filter(p => p.role_name === '教务' || p.role_type === 'education'); - this.assistantList = personnel.filter(p => p.role_name === '助教' || p.role_type === 'assistant'); + this.coachList = personnel.filter(p => { + return p.role_name && ( + p.role_name.includes('教练') || + p.role_name.includes('教师') || + (p.roles && p.roles.some(role => role.includes('教练') || role.includes('教师'))) + ); + }); + + this.educationList = personnel.filter(p => { + return p.role_name && ( + p.role_name.includes('教务') || + (p.roles && p.roles.some(role => role.includes('教务'))) + ); + }); + + this.assistantList = personnel.filter(p => { + return p.role_name && ( + p.role_name.includes('助教') || + (p.roles && p.roles.some(role => role.includes('助教'))) + ); + }); console.log('getPersonnelList - 人员列表获取成功'); console.log('教练列表:', this.coachList); @@ -1571,55 +1593,133 @@ } // 教练配置编辑弹窗样式 + .popup-container { + width: 90vw; + max-width: 600rpx; + background: #fff; + border-radius: 20rpx; + box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.3); + overflow: hidden; + } + + .popup-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 30rpx 40rpx; + background: #29d3b4; + color: #fff; + } + + .popup-title { + font-size: 36rpx; + font-weight: bold; + } + + .popup-close { + font-size: 40rpx; + width: 60rpx; + height: 60rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 50%; + background: rgba(255, 255, 255, 0.2); + } + + .popup-footer { + display: flex; + border-top: 1px solid #eee; + } + + .popup-btn { + flex: 1; + padding: 30rpx; + text-align: center; + font-size: 32rpx; + font-weight: bold; + } + + .cancel-btn { + color: #666; + border-right: 1px solid #eee; + } + + .confirm-btn { + color: #29d3b4; + } + + .popup-btn:active { + background: #f5f5f5; + } + .course-edit-container { - max-height: 600rpx; + width: 100%; + max-height: 60vh; overflow-y: auto; - padding: 20rpx 0; + padding: 30rpx 20rpx; + box-sizing: border-box; } .edit-section { - margin-bottom: 30rpx; + margin-bottom: 40rpx; + width: 100%; } .section-title { - font-size: 30rpx; + font-size: 32rpx; font-weight: bold; color: #333; - margin-bottom: 15rpx; - padding-bottom: 10rpx; - border-bottom: 1px solid #eee; + margin-bottom: 20rpx; + padding-bottom: 15rpx; + border-bottom: 2px solid #29d3b4; } .coach-list { - max-height: 200rpx; + width: 100%; + max-height: 300rpx; overflow-y: auto; + border: 1px solid #eee; + border-radius: 12rpx; + background: #fff; } .coach-item { display: flex; justify-content: space-between; align-items: center; - padding: 15rpx 20rpx; - border: 1px solid #ddd; - border-radius: 8rpx; - margin-bottom: 10rpx; - background: #f8f8f8; + padding: 25rpx 30rpx; + border-bottom: 1px solid #f0f0f0; + background: #fff; transition: all 0.3s ease; + min-height: 80rpx; + box-sizing: border-box; + } + + .coach-item:last-child { + border-bottom: none; } .coach-item.selected { - background: #e8f5e8; - border-color: #29d3b4; + background: #f0f9ff; + border-left: 4rpx solid #29d3b4; + } + + .coach-item:active { + background: #f5f5f5; } .coach-name { - font-size: 28rpx; + font-size: 30rpx; color: #333; + flex: 1; } .coach-check { color: #29d3b4; - font-size: 32rpx; + font-size: 36rpx; font-weight: bold; + width: 40rpx; + text-align: center; } \ No newline at end of file