Browse Source

Merge branch 'master' of http://gitlab.frkj.cc/php/zhjwxt

master
于宏哲PHP 9 months ago
parent
commit
6d18f2218e
  1. 2
      niucloud/app/api/route/route.php
  2. 14
      niucloud/app/model/school_student_courses.php
  3. 44
      niucloud/app/service/api/apiService/PersonCourseScheduleService.php
  4. 2
      niucloud/app/service/api/login/LoginService.php
  5. 154
      uniapp/pages/market/clue/clue_info.vue

2
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);
//↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑-----学生用户端相关-----↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

14
niucloud/app/model/school_student_courses.php

@ -0,0 +1,14 @@
<?php
declare (strict_types = 1);
namespace app\model;
use think\Model;
/**
* @mixin \think\Model
*/
class school_student_courses extends Model
{
//
}

44
niucloud/app/service/api/apiService/PersonCourseScheduleService.php

@ -19,6 +19,7 @@ use app\model\student_course_usage\StudentCourseUsage;
use app\model\student_courses\StudentCourses;
use app\model\student\Student;
use app\model\customer_resources\CustomerResources;
use app\model\campus_person_role\CampusPersonRole;
use app\model\venue\Venue;
use core\base\BaseApiService;
use think\facade\Db;
@ -366,7 +367,7 @@ class PersonCourseScheduleService extends BaseApiService
];
// 通过客户资源ID查找对应的学员
$student = Student::where('resource_id', $where['resource_id'])->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' => '获取成功',

2
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);

154
uniapp/pages/market/clue/clue_info.vue

@ -233,12 +233,12 @@
</uni-popup>
<!-- 教练配置编辑弹窗 -->
<uni-popup ref="courseEditPopup" type="dialog">
<uni-popup-dialog
title="修改教练配置"
:before-close="true"
@confirm="confirmCourseEdit"
@close="closeCourseEdit">
<uni-popup ref="courseEditPopup" type="center">
<view class="popup-container">
<view class="popup-header">
<view class="popup-title">修改教练配置</view>
<view class="popup-close" @click="closeCourseEdit"></view>
</view>
<view class="course-edit-container">
<view class="edit-section">
<view class="section-title">主教练单选</view>
@ -285,7 +285,11 @@
</view>
</view>
</view>
</uni-popup-dialog>
<view class="popup-footer">
<view class="popup-btn cancel-btn" @click="closeCourseEdit">取消</view>
<view class="popup-btn confirm-btn" @click="confirmCourseEdit">确认</view>
</view>
</view>
</uni-popup>
</view>
</view>
@ -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;
}
</style>
Loading…
Cancel
Save