You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
3.6 KiB
133 lines
3.6 KiB
import http from '../common/axios.js'
|
|
import { Api_url } from '../common/config.js'
|
|
|
|
export default {
|
|
//↓↓↓↓↓↓↓↓↓↓↓↓-----学员信息管理接口-----↓↓↓↓↓↓↓↓↓↓↓↓
|
|
// 获取当前用户的学员列表
|
|
async getStudentList(data = {}) {
|
|
return await http.get('/student/mychild', data);
|
|
},
|
|
|
|
// 获取学员概览信息(首页用)
|
|
async getStudentSummary(studentId) {
|
|
return await http.get(`/student/summary/${studentId}`);
|
|
},
|
|
|
|
// 获取学员详细信息(包含体测信息)
|
|
async getStudentInfo(studentId) {
|
|
return await http.get(`/student/info/${studentId}`);
|
|
},
|
|
|
|
// 更新学员信息
|
|
async updateStudentInfo(data = {}) {
|
|
return await http.put('/student/update', data);
|
|
},
|
|
|
|
// 上传学员头像
|
|
async uploadStudentAvatar(data = {}) {
|
|
return await http.post('/student/avatar', data);
|
|
},
|
|
|
|
// 获取未读消息数量(如果有接口的话,暂时模拟)
|
|
async getUnreadMessageCount(data = {}) {
|
|
// 这里可以调用真实的消息接口,暂时返回模拟数据
|
|
return {
|
|
code: 1,
|
|
data: {
|
|
unread_count: Math.floor(Math.random() * 5)
|
|
}
|
|
};
|
|
},
|
|
|
|
//↓↓↓↓↓↓↓↓↓↓↓↓-----体测数据管理接口-----↓↓↓↓↓↓↓↓↓↓↓↓
|
|
// 获取学员体测数据列表(从school_physical_test表)
|
|
async getPhysicalTestList(data = {}) {
|
|
return await http.get('/physical-test/list', data);
|
|
},
|
|
|
|
// PDF转图片接口
|
|
async convertPdfToImage(data = {}) {
|
|
return await http.post('/physical-test/pdf-to-image', data);
|
|
},
|
|
|
|
// 生成体测分享图片
|
|
async generateShareImage(data = {}) {
|
|
return await http.post('/share-image', data);
|
|
},
|
|
|
|
//↓↓↓↓↓↓↓↓↓↓↓↓-----添加孩子相关接口-----↓↓↓↓↓↓↓↓↓↓↓↓
|
|
// 添加孩子
|
|
async addChild(data = {}) {
|
|
return await http.post('/student/add-child', data);
|
|
},
|
|
|
|
// 上传头像
|
|
async uploadAvatar(filePath, studentId) {
|
|
return new Promise((resolve, reject) => {
|
|
uni.uploadFile({
|
|
url: Api_url + '/student/avatar',
|
|
filePath: filePath,
|
|
name: 'image',
|
|
formData: {
|
|
'student_id': studentId
|
|
},
|
|
header: {
|
|
'token': uni.getStorageSync('token') || ''
|
|
},
|
|
success: (uploadFileRes) => {
|
|
console.log('上传文件响应:', uploadFileRes)
|
|
try {
|
|
const result = JSON.parse(uploadFileRes.data)
|
|
resolve(result)
|
|
} catch (e) {
|
|
console.error('响应数据解析失败:', e)
|
|
reject(new Error('响应数据解析失败'))
|
|
}
|
|
},
|
|
fail: (error) => {
|
|
console.error('文件上传失败:', error)
|
|
reject(error)
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
// 添加孩子时上传头像(不需要student_id)
|
|
async uploadAvatarForAdd(filePath) {
|
|
return new Promise((resolve, reject) => {
|
|
uni.uploadFile({
|
|
url: Api_url + '/file/avatar',
|
|
filePath: filePath,
|
|
name: 'file',
|
|
header: {
|
|
'token': uni.getStorageSync('token') || ''
|
|
},
|
|
success: (uploadFileRes) => {
|
|
console.log('上传文件响应:', uploadFileRes)
|
|
try {
|
|
const result = JSON.parse(uploadFileRes.data)
|
|
resolve(result)
|
|
} catch (e) {
|
|
console.error('响应数据解析失败:', e)
|
|
reject(new Error('响应数据解析失败'))
|
|
}
|
|
},
|
|
fail: (error) => {
|
|
console.error('文件上传失败:', error)
|
|
reject(error)
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
//↓↓↓↓↓↓↓↓↓↓↓↓-----员工工资管理接口-----↓↓↓↓↓↓↓↓↓↓↓↓
|
|
// 获取员工工资列表
|
|
async getSalaryList(data = {}) {
|
|
return await http.get('/member/salary/list', data);
|
|
},
|
|
|
|
// 获取员工工资详情
|
|
async getSalaryInfo(data = {}) {
|
|
return await http.get(`/member/salary/info/${data.id}`);
|
|
},
|
|
}
|