Files
learning-system-portal/src/api/modules/teacher.js
2022-12-14 22:52:09 +08:00

230 lines
4.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import ajax from '@/utils/xajax.js'
/**
* 按名称查询
* @param name
*/
const findByName = function(name) {
return ajax.get('/xboe/teacher/name?name=' + name);
}
const updateTeacher=function(data){
return ajax.postJson('/xboe/teacher/update-teacher',data);
}
/**
* 根据id得到教师的显示信息只是几个基本的显示字段
* @param {Object} id
*/
const getInfoById = function(id) {
return ajax.get('/xboe/teacher/simple?id=' + id);
}
const detailTeacher=function (id){
return ajax.get('/xboe/teacher/detail-teacher?id='+id);
}
/**
* 分页查询
* @param {
* pageIndex 起始页
* pageSize 每页条数
* name 姓名
* tlevelId级别
* salaryId发薪地
* tsystemId
* } query
* @returns
*/
const page = function(query) {
return ajax.post('/xboe/teacher/page', query);
}
/**
* 保存
* 字段较多,大部分是通过查询方法返回的,除页面可修改项外其他字段不用处理
* @param {
* account:{
* id:'',//id
* sysId:'';//原系统中的id
* loginName:'';//登录名
* avatar:'';//用户头像地址
* mobile:'';//手机号
* email:'';//email
* nickName:'';//昵称
* companyId:'';//关联的公司id
* status:1;//状态1, 正常2停用
* },
* user:{
* id:'',//id
* sysId:'';//旧系统id
* sysDepartId:'';//旧系统机构id
* name:'';//姓名
* userNo:'';//员工编号
* gender:1;//性别 1:男 2
* birthday:'';//生日 yyyy-MM-dd
* idNumber:'';//身份证号
* mobileNo:'';//手机号
* homePhoneNo:'';//家庭电话
* nationality:'';//国籍
* graduatedFrom:'';//毕业院校
* graduatedMajor:'';//毕业专业
* highestEducation:'';//最高学历
* telephoneNo:'';//办公电话
* duty:'';//职务
* rank:'';//职级
* description:'';//描述
* companyId:'';//所在公司
* departId:''; //所在部门
* domainId:'';//所在域
* sassId:'';//扩展字段,多租户系统的标识值
* userType:2;//用户类型1表学员2表教师3表管理员
* studyTotal:'';//学习总时长
* online:1;//在线状态0离线1在线
* },
* id:'',
* sysId:'',//系统id
* name:'',//姓名
* departId:'',//所属机构
* gender:1,//性别 1:男 2
* idNumber:'',//身份证号
* birthday:'',//生日 yyyy-MM-dd
* mobile:'';//手机号
* email:'';
* homePhoneNo:'';//家庭电话
* personalLabel:'';//个人标签
* companyId:'';//所在公司
* domainId:'';//所在域
* operatingPost:'';//岗位
* superiorManager:'';//直线经理
* address:'';//位置
* description:'';//描述
* teaching:'';//授课时长
* waitStatus:0;//在职状态 在职: 0 离职: 1
* courses:'';//擅长课程
* } data
* @returns
*/
const save = function(data) {
return ajax.postJson('/xboe/teacher/save', data);
}
/**
*
* @param {aid,本地教师的id} id
* @param {teacherId->sysId : 原系统的id,接口返回} sysId
*/
const updateSysId = function(id,sysId) {
return ajax.post('/xboe/teacher/update-sysid',{id,sysId});
}
/**
* 修改
* @param {
* 同保存接口一样
* } data
* @returns
*/
const update = function(data) {
return ajax.postJson('/xboe/teacher/update', data);
}
/**
* 删除
* @param {
* 教师ID
* } id
* @returns
*/
const del = function(id) {
return ajax.post('/xboe/teacher/delete?id=' + id);
}
/**
* 详情
* @param {
* 教师ID
* } id
* @returns
*/
const detail = function(id) {
return ajax.get('/xboe/teacher/detail?id=' + id);
}
/*
判断当前用户身份是否是教师
@param id 教师id
*/
const has=function(id){
return ajax.get('/xboe/teacher/has?id=' + id);
}
/*
启用
*/
const start=function(id){
return ajax.get('/xboe/teacher/start?id='+id);
}
/*
停用
*/
const end=function(id){
return ajax.get('/xboe/teacher/end?id='+id);
}
/*
导出
* @param {
* ids 教师id数组
* name 姓名
* } query
* @returns
*/
const exports=function(query){
return ajax.post('/xboe/teacher/export',query);
}
/**
* courseType // 课程类型1,2:面授,训练班0在线班
* sysId:教师的sysId
* tid 教师的id
* @param {tid,sysId,countType,pageSize:100,pageIndex} query
*/
const findAllCourses=function(query){
return ajax.post('/xboe/teacher/compose/find/courses',query);
}
/**
* 内部讲师-删除模块讲师接口
* @param {
courseId // 课程id
modId // 模块id
teacherId // 教师id
remark // 备注
*/
const syncUpdate = function(data) {
return ajax.postJson('/xboe/teacher/update-sync',data);
}
export default {
findByName,
getInfoById,
page,
save,
update,
del,
detail,
findByName,
updateSysId,
has,
start,
end,
exports,
syncUpdate,
detailTeacher,
updateTeacher
}