71 lines
1.4 KiB
JavaScript
71 lines
1.4 KiB
JavaScript
const http = require('../utils/request')
|
|
|
|
/**
|
|
* 教练登录(账号密码)
|
|
*/
|
|
function login(username, password) {
|
|
return http.post('/auth/login', { username, password })
|
|
}
|
|
|
|
/**
|
|
* 获取教练负责的团课列表
|
|
*/
|
|
function getCoachCourses(coachId) {
|
|
return http.get('/coach/' + coachId + '/courses')
|
|
}
|
|
|
|
/**
|
|
* 教练手动开课
|
|
*/
|
|
function startCourse(courseId) {
|
|
return http.post('/coach/courses/' + courseId + '/start')
|
|
}
|
|
|
|
/**
|
|
* 教练手动结课
|
|
*/
|
|
function endCourse(courseId) {
|
|
return http.post('/coach/courses/' + courseId + '/end')
|
|
}
|
|
|
|
/**
|
|
* 获取团课详情
|
|
*/
|
|
function getCourseDetail(courseId) {
|
|
return http.get('/groupCourse/' + courseId + '/detail')
|
|
}
|
|
|
|
/**
|
|
* 获取教练违规记录
|
|
*/
|
|
function getCoachViolations(coachId) {
|
|
return http.get('/coach/' + coachId + '/violations')
|
|
}
|
|
|
|
/**
|
|
* 获取课程的预约列表(实时预约人数)
|
|
*/
|
|
function getCourseBookings(courseId) {
|
|
return http.get('/groupCourse/bookings/course/' + courseId)
|
|
}
|
|
|
|
/**
|
|
* 获取教练业绩统计
|
|
* @param {number} coachId - 教练ID
|
|
* @param {string} periodType - 统计周期: MONTH / WEEK
|
|
*/
|
|
function getCoachPerformance(coachId, periodType) {
|
|
return http.get('/datacount/coach-performance/' + coachId + '?periodType=' + (periodType || 'MONTH'))
|
|
}
|
|
|
|
module.exports = {
|
|
login,
|
|
getCoachCourses,
|
|
startCourse,
|
|
endCourse,
|
|
getCourseDetail,
|
|
getCoachViolations,
|
|
getCourseBookings,
|
|
getCoachPerformance
|
|
}
|