Browse Source

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

master
王泽彦 9 months ago
parent
commit
e7139f06af
  1. 46
      niucloud/app/api/controller/apiController/ClassApi.php
  2. 36
      niucloud/app/api/controller/member/Member.php
  3. 14
      niucloud/app/api/route/member.php
  4. 7
      niucloud/app/service/api/apiService/jlClassService.php
  5. 154
      niucloud/app/service/api/member/MemberService.php
  6. 174
      uniapp/pages/coach/my/due_soon.vue
  7. 9
      uniapp/pages/coach/my/index.vue
  8. 2
      uniapp/pages/coach/my/schooling_statistics.vue
  9. 129
      uniapp/pages/coach/student/student_list.vue

46
niucloud/app/api/controller/apiController/ClassApi.php

@ -111,32 +111,40 @@ class ClassApi extends BaseApiService
public function addJlPublishJob(Request $request)
{
$id = $this->member_id;
// $data = $this->request->params([
// ["class_id",0],
// ["classes_id_name",''],
// ["description",''],
// ["content_type",''],
// ["course_id",0],
// ["course_id_name",''],
// ["student_id",''],
// ["students_ids_name",''],
// ["type",''],
// ["personnel_id",$id],
// ]);
// if (isset($data['student_id'])) {
// if (is_string($data['student_id']) && strpos($data['student_id'], ',') !== false) {
// $studentIds = explode(',', $data['student_id']);
// $studentIds = array_map('trim', $studentIds);
// } elseif (is_array($data['student_id'])) {
// $studentIds = $data['student_id'];
// } else {
// $studentIds = [(string)$data['student_id']];
// }
// $studentIds = array_map('intval', $studentIds);
// } else {
// $studentIds = [];
// }
// $data['student_id'] = $studentIds;
$data = $this->request->params([
["class_id",0],
["classes_id_name",''],
["description",''],
["content_type",''],
["course_id",0],
["course_id_name",''],
["student_id",''],
["students_ids_name",''],
["type",''],
["personnel_id",$id],
]);
if (isset($data['student_id'])) {
if (is_string($data['student_id']) && strpos($data['student_id'], ',') !== false) {
$studentIds = explode(',', $data['student_id']);
$studentIds = array_map('trim', $studentIds);
} elseif (is_array($data['student_id'])) {
$studentIds = $data['student_id'];
} else {
$studentIds = [(string)$data['student_id']];
}
$studentIds = array_map('intval', $studentIds);
} else {
$studentIds = [];
}
$data['student_id'] = $studentIds;
return success('操作成功', (new jlClassService())->addPublishJob($data));
}
//获取我的页面统计个数

36
niucloud/app/api/controller/member/Member.php

@ -147,4 +147,40 @@ class Member extends BaseApiController
}
public function get_assignments_list(){
return success(( new MemberService() )->get_assignments_list());
}
public function assignments_info(){
$data = $this->request->params([
[ 'id', '' ]
]);
return success(( new MemberService() )->assignments_info($data));
}
public function service_detail(){
$data = $this->request->params([
[ 'id', '' ]
]);
return success(( new MemberService() )->service_detail($data));
}
public function service_list(){
return success(( new MemberService() )->service_list());
}
//教练下全部学员
public function student_list(){
$data = $this->request->params([
[ 'type', 'all' ]
]);
return success(( new MemberService() )->student_list($data));
}
public function sktj(){
return success(( new MemberService() )->sktj());
}
}

14
niucloud/app/api/route/member.php

@ -108,6 +108,20 @@ Route::group('member', function () {
Route::get('jl_index', 'member.Member/jl_index');
Route::get('get_assignments_list', 'member.Member/get_assignments_list');
Route::get('assignments_info', 'member.Member/assignments_info');
Route::get('service/detail', 'member.Member/service_detail');
Route::get('service/list', 'member.Member/service_list');
//教练下全部学员
Route::get('student_list', 'member.Member/student_list');
Route::get('sktj', 'member.Member/sktj');
})->middleware(ApiChannel::class)
->middleware(ApiPersonnelCheckToken::class, true)
->middleware(ApiLog::class);

7
niucloud/app/service/api/apiService/jlClassService.php

@ -149,10 +149,11 @@ class jlClassService extends BaseApiService
public function addPublishJob($data)
{
$Assignment = new Assignment();
foreach ($data['student_id'] as $v) {
$data['student_id'] = $v;
// foreach ($data['student_id'] as $v) {
// $data['student_id'] = $v;
// $Assignment->create($data);
// }
$Assignment->create($data);
}
return true;
}

154
niucloud/app/service/api/member/MemberService.php

@ -12,12 +12,15 @@
namespace app\service\api\member;
use app\model\assignment\Assignment;
use app\model\attendance\Attendance;
use app\model\campus\Campus;
use app\model\class_resources_rel\ClassResourcesRel;
use app\model\communication_records\CommunicationRecords;
use app\model\course_schedule\CourseSchedule;
use app\model\member\Member;
use app\model\person_course_schedule\PersonCourseSchedule;
use app\model\service_logs\ServiceLogs;
use app\model\student_courses\StudentCourses;
use app\service\core\member\CoreMemberService;
use core\base\BaseApiService;
use core\exception\ApiException;
@ -243,4 +246,155 @@ class MemberService extends BaseApiService
return ['course_list' => $course_list,'task_list' => $task_list,'service_list' => $service_list];
}
public function get_assignments_list(){
$Assignment = new Assignment();
$search_model = $Assignment
->alias("a")
->join(['school_class' => 'b'],"a.class_id = b.id","left")
->join(['school_course' => 'c'],"a.course_id = c.id","left")
->field("a.id,a.create_time,b.class_name,c.course_name,a.status")
->where([
'a.personnel_id' => $this->member_id
])->order("a.create_time desc");
$list = $this->pageQuery($search_model, function ($item){
});
return $list;
}
public function assignments_info($data){
$Assignment = new Assignment();
$info = $Assignment
->alias("a")
->join(['school_personnel' => 'b'],'a.personnel_id = b.id','left')
->where(['a.id' => $data['id']])
->field("a.*,b.name as coach_name,b.head_img as coach_pic")
->find();
return $info ? $info->toArray() : [];
}
public function service_detail($data){
$service_logs = new ServiceLogs();
$info = $service_logs->alias("a")
->join(['school_customer_resources' => 'b'],'a.resource_id = b.id',"left")
->join(['school_course' => 'c'],'a.course_id = c.id',"left")
->join(['school_service' => 'd'],'a.service_id = d.id',"left")
->join(['school_personnel' => 'e'],'a.staff_id = e.id',"left")
->join(['school_campus' => 'f'],'b.campus = f.id',"left")
->where(['a.id' => $data['id']])
->field("
a.id,b.name as resource_id,c.course_name as course_id,d.service_name as service_id,a.service_remark,a.status,
e.name as staff_id,a.score,a.feedback,a.feedback_time,a.created_at,a.updated_at,f.campus_name as campus,
b.source_channel,b.source
")
->find();
$info['source'] = get_dict_value('source',$info['source']);
$info['channel'] = get_dict_value('SourceChannel',$info['source_channel']);
return $info ? $info->toArray() : [];
}
public function service_list(){
$service_logs = new ServiceLogs();
$search_model = $service_logs
->alias("a")
->join(['school_service' => 'd'],'a.service_id = d.id',"left")
->where([
'a.staff_id' => $this->member_id
])
->field("a.*,d.service_name,d.description")
->order("a.created_at desc");
$list = $this->pageQuery($search_model, function ($item){
});
return $list;
}
//教练下全部学员
public function student_list($data)
{
$where = [];
if($data['type'] == "daoqi"){
$where[] = ['a.end_date', 'between', [date('Y-m-d', strtotime('-6 days')), date('Y-m-d')]];
}
$student_courses = new StudentCourses();
$list = $student_courses
->alias("a")
->join(['school_student' => 'b'],"a.student_id = b.id","left")
->join(['school_campus' => 'c'],'b.campus_id = c.id',"left")
->join(['school_customer_resources' => 'e'],'e.id = b.user_id',"left")
->join(['school_member' => 'f'],'f.member_id = e.member_id',"left")
->join(['school_resource_sharing' => 'g'],'g.resource_id = e.id',"left")
->where($where)
->where("a.main_coach_id = {$this->member_id} OR a.education_id = {$this->member_id} OR find_in_set('{$this->member_id}', a.assistant_ids) ")
->field("
b.id,b.name,c.campus_name as campus,
a.total_hours,a.gift_hours,a.use_total_hours,a.use_gift_hours,a.end_date,f.headimg as avatar,g.id as resource_sharing_id
")
->select();
return $list ? $list->toArray() : [];
}
public function sktj(){
$course_schedule = new CourseSchedule();
$student_courses = new StudentCourses();
$class_resources_rel = new ClassResourcesRel();
$attendance = new Attendance();
$year = date('Y');
$currentMonth = date('n');
$results = [];
for ($m = $currentMonth; $m >= 1; $m--) {
$start = date("Y-m-01", strtotime("$year-$m"));
$end = date("Y-m-t", strtotime("$year-$m"));
$count = $course_schedule
->where("coach_id = {$this->member_id} OR education_id = {$this->member_id} OR find_in_set('{$this->member_id}', assistant_ids) ")
->where('course_date', 'between', [$start, $end])
->count();
$list = $student_courses
->where("main_coach_id = {$this->member_id} OR education_id = {$this->member_id} OR find_in_set('{$this->member_id}', assistant_ids) ")
->where('start_date', 'between', [$start, $end])
->select();
$yfzxy = count($list);
$class_id = [];
foreach($list as $k=>$v){
$class_id[] = $class_resources_rel->where(['resource_id' => $v['resource_id']])->value("class_id");
}
$class_id = array_unique($class_id);
$dk_count = $attendance->where(['staff_id' => $this->member_id])->where('attendance_date', 'between', [$start, $end])->count();
if ($count > 0) {
$rate = round($dk_count / $count * 100, 2); // 保留两位小数
} else {
$rate = 0;
}
$results[] = ['month_date' => "$year-$m",'ysks' => $count,'yfzxy' => $yfzxy,'zsbj' => count($class_id),'ydkl' => $rate];
}
return $results;
}
}

174
uniapp/pages/coach/my/due_soon.vue

@ -11,150 +11,35 @@
<view class="section_4">
<view class="ul">
<!-- @click="openViewStudentInfo({id:1})" -->
<view class="li">
<view class="li" v-for="(item, index) in studentList" :key="index">
<view class="left">
<view class="box_1">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<image :src="item.avatar || '/static/icon-img/avatar.png'" mode="aspectFill" class="pic"></image>
<view class="tag_box">
即将到期
</view>
</view>
<view class="box_2">
<view class="name">黄明明</view>
<view class="date">课程截止时间2020.05:25</view>
<view class="name">{{item.name}}</view>
<view class="date">课程截止时间{{item.end_date}}</view>
</view>
</view>
<view class="right">
<view class="item">
<view>24</view>
<view>{{
(item.use_total_hours + item.use_gift_hours)
}}</view>
<view>已上课时</view>
</view>
<view class="item">
<view>24</view>
<view>剩余课时</view>
</view>
</view>
</view>
<view class="li">
<view class="left">
<view class="box_1">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<view class="tag_box">
即将到期
</view>
</view>
<view class="box_2">
<view class="name">黄明明</view>
<view class="date">课程截止时间2020.05:25</view>
</view>
</view>
<view class="right">
<view class="item">
<view>24</view>
<view>已上课时</view>
</view>
<view class="item">
<view>24</view>
<view>剩余课时</view>
</view>
</view>
</view>
<view class="li">
<view class="left">
<view class="box_1">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<view class="tag_box">
即将到期
</view>
</view>
<view class="box_2">
<view class="name">黄明明</view>
<view class="date">课程截止时间2020.05:25</view>
</view>
</view>
<view class="right">
<view class="item">
<view>24</view>
<view>已上课时</view>
</view>
<view class="item">
<view>24</view>
<view>剩余课时</view>
</view>
</view>
</view>
<view class="li">
<view class="left">
<view class="box_1">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<view class="tag_box">
即将到期
</view>
</view>
<view class="box_2">
<view class="name">黄明明</view>
<view class="date">课程截止时间2020.05:25</view>
</view>
</view>
<view class="right">
<view class="item">
<view>24</view>
<view>已上课时</view>
</view>
<view class="item">
<view>24</view>
<view>剩余课时</view>
</view>
</view>
</view>
<view class="li">
<view class="left">
<view class="box_1">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<view class="tag_box">
即将到期
</view>
</view>
<view class="box_2">
<view class="name">黄明明</view>
<view class="date">课程截止时间2020.05:25</view>
</view>
</view>
<view class="right">
<view class="item">
<view>24</view>
<view>已上课时</view>
</view>
<view class="item">
<view>24</view>
<view>剩余课时</view>
</view>
</view>
</view>
<view class="li">
<view class="left">
<view class="box_1">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<!-- <view class="tag_box">-->
<!-- 即将到期-->
<!-- </view>-->
</view>
<view class="box_2">
<view class="name">黄明明</view>
<view class="date">课程截止时间2020.05:25</view>
</view>
</view>
<view class="right">
<view class="item">
<view>24</view>
<view>已上课时</view>
</view>
<view class="item">
<view>24</view>
<view>{{
(item.total_hours + item.gift_hours) - (item.use_total_hours + item.use_gift_hours)
}}</view>
<view>剩余课时</view>
</view>
</view>
</view>
</view>
</view>
</view>
@ -165,7 +50,7 @@
</template>
<script>
// import user from '@/api/user.js';
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
@ -177,16 +62,31 @@ export default {
return {
formData: {},
tabType: '1', //1=,2=
studentList: []
}
},
onLoad() {
this.getStudentList();
},
methods: {
//tab
tabChange(tabType) {
this.tabType = tabType
},
async getStudentList() {
// API
const res = await memberApi.jlGetStudentList({
'type': 'daoqi'
});
if (res.code == 1) {
this.studentList = res.data || [];
} else {
uni.showToast({
title: res.msg || '获取学员列表失败',
icon: 'none'
});
}
},
//
openViewCourseInfo(item) {
this.$navigateTo({
@ -204,7 +104,6 @@ export default {
</script>
<style lang="less" scoped>
.main_box {
background: #292929;
}
@ -215,6 +114,7 @@ export default {
justify-content: center;
align-items: center;
background: #292929;
.title {
padding: 40rpx 0rpx;
@ -236,22 +136,26 @@ export default {
padding-bottom: 150rpx;
font-size: 24rpx;
color: #FFFFFF;
//
.section_4 {
.ul {
display: flex;
flex-direction: column;
gap: 10rpx;
.li {
padding: 20rpx 0;
padding-bottom: 40rpx;
border-bottom: 2px solid #D7D7D7;
display: flex;
justify-content: space-between;
.left {
display: flex;
align-items: center;
gap: 30rpx;
.box_1 {
padding-left: 20rpx;
display: flex;
@ -259,11 +163,13 @@ export default {
align-items: center;
justify-content: center;
position: relative;
.pic {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
}
.tag_box {
position: absolute;
bottom: -30rpx;
@ -276,38 +182,46 @@ export default {
font-size: 20rpx;
}
}
.box_2 {
display: flex;
flex-direction: column;
gap: 20rpx;
.name {
font-size: 28rpx;
}
.date {
font-size: 24rpx;
}
}
}
.right {
display: flex;
align-items: center;
gap: 14rpx;
.item {
border: 1px solid #00E5BB;
border-radius: 10rpx;
width: 102rpx;
display: flex;
flex-direction: column;
view {
text-align: center;
height: 50rpx;
line-height: 50rpx;
}
view:nth-child(1) {
font-size: 32rpx;
background-color: #fff;
color: #00e5bb;
}
view:nth-child(2) {
font-size: 20rpx;
background-color: #00e5bb;
@ -318,6 +232,4 @@ export default {
}
}
}
</style>

9
uniapp/pages/coach/my/index.vue

@ -56,10 +56,10 @@
<view class="main_section">
<view class="section_box">
<view class="item" @click="openViewSportsVenue()">
<!-- <view class="item" @click="openViewSportsVenue()">
<view>我的体育场</view>
<view>xxx场馆</view>
</view>
</view> -->
<view class="item" @click="openViewDueSoon()">
<view>即将到期</view>
@ -128,13 +128,14 @@ export default {
}
},
onLoad() {
},
onShow() {
this.init();
},
methods: {
async init(){
this.getMemberInfo()
this.getStatistics()
},
@ -162,6 +163,8 @@ export default {
return
}
this.statisticsInfo = res.data
this.getMemberInfo()
},
//

2
uniapp/pages/coach/my/schooling_statistics.vue

@ -10,7 +10,7 @@
<view class="box">
<view class="top">
<view class="top_item">
<view class="num">34</view>
<view class="num">{{v.ysks}}</view>
<view class="explain">月授课数/</view>
</view>
<view class="top_item">

129
uniapp/pages/coach/student/student_list.vue

@ -19,11 +19,13 @@
</view>
<view class="info-row">
<text class="info-label">剩余课程</text>
<text class="info-value">{{item.remainingCourses}}</text>
<text class="info-value">{{
(item.total_hours + item.gift_hours) - (item.use_total_hours + item.use_gift_hours)
}}</text>
</view>
<view class="info-row">
<text class="info-label">到期时间</text>
<text class="info-value">{{item.expiryDate}}</text>
<text class="info-value">{{item.end_date}}</text>
</view>
</view>
<view class="arrow-right">
@ -38,6 +40,7 @@
</template>
<script>
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
export default {
components: {
@ -55,73 +58,73 @@
navigateBack() {
uni.navigateBack();
},
getStudentList() {
async getStudentList() {
// API
// const res = await memberApi.getStudentList({});
// if(res.code == 1) {
// this.studentList = res.data || [];
// } else {
// uni.showToast({
// title: res.msg || '',
// icon: 'none'
// });
// }
const res = await memberApi.jlGetStudentList({});
if(res.code == 1) {
this.studentList = res.data || [];
} else {
uni.showToast({
title: res.msg || '获取学员列表失败',
icon: 'none'
});
}
// 使
this.studentList = [
{
id: 1,
name: '张三',
avatar: '/static/icon-img/avatar.png',
campus: '总部校区',
remainingCourses: 10,
expiryDate: '2023-12-31'
},
{
id: 2,
name: '李四',
avatar: '/static/icon-img/avatar.png',
campus: '西区校区',
remainingCourses: 5,
expiryDate: '2023-11-15'
},
{
id: 3,
name: '王五',
avatar: '/static/icon-img/avatar.png',
campus: '东区校区',
remainingCourses: 15,
expiryDate: '2024-01-20'
},
{
id: 4,
name: '赵六',
avatar: '/static/icon-img/avatar.png',
campus: '南区校区',
remainingCourses: 8,
expiryDate: '2023-11-30'
},
{
id: 5,
name: '刘七',
avatar: '/static/icon-img/avatar.png',
campus: '北区校区',
remainingCourses: 20,
expiryDate: '2024-02-15'
},
{
id: 6,
name: '陈八',
avatar: '/static/icon-img/avatar.png',
campus: '总部校区',
remainingCourses: 3,
expiryDate: '2023-10-30'
}
];
// this.studentList = [
// {
// id: 1,
// name: '',
// avatar: '/static/icon-img/avatar.png',
// campus: '',
// remainingCourses: 10,
// expiryDate: '2023-12-31'
// },
// {
// id: 2,
// name: '',
// avatar: '/static/icon-img/avatar.png',
// campus: '西',
// remainingCourses: 5,
// expiryDate: '2023-11-15'
// },
// {
// id: 3,
// name: '',
// avatar: '/static/icon-img/avatar.png',
// campus: '',
// remainingCourses: 15,
// expiryDate: '2024-01-20'
// },
// {
// id: 4,
// name: '',
// avatar: '/static/icon-img/avatar.png',
// campus: '',
// remainingCourses: 8,
// expiryDate: '2023-11-30'
// },
// {
// id: 5,
// name: '',
// avatar: '/static/icon-img/avatar.png',
// campus: '',
// remainingCourses: 20,
// expiryDate: '2024-02-15'
// },
// {
// id: 6,
// name: '',
// avatar: '/static/icon-img/avatar.png',
// campus: '',
// remainingCourses: 3,
// expiryDate: '2023-10-30'
// }
// ];
},
goToDetail(student) {
uni.navigateTo({
url: `/pages/market/clue/clue_info?resource_sharing_id=25`
url: `/pages/market/clue/clue_info?resource_sharing_id=`+student.resource_sharing_id
});
}
}

Loading…
Cancel
Save