/** * 企业自评相关数据接口 */ import { get, post } from '../baseRequset'; import { getHistoryPointList, getGradeList } from '../../model/assessment'; const app = getApp(); //查找用户历史得分 function fetchHistoryPoint({ userId, period, page = 1, per_page = 30 }) { const options = { url: `/evaluation/historyPoint/${userId}`, params: { page: page, per_page: per_page, platform: 'weixin', }, }; if (period) options.params.period = period; return get(options).then(res => { res.data = getHistoryPointList(res.data); return res; }); } //查找用户测评详情 function fetchAssessmentDetail({ userId, period }) { return get({ url: `/evaluation/detail`, params: { userId: userId, period: period, }, }); } // 查找当前所有用户评分列表 function fetchGradeList({ page = 1, per_page = 30, data }) { return post({ url: `/evaluation/gradeList`, params: { userId: app.globalData.accessToken.userId, page: page, per_page: per_page, }, data: data, }).then(res => { res.data.data = getGradeList(res.data.data, data.period); return res.data; }); } //查找评分规则子项表以及对应的具体得分 function fetchRuleAndScore({userId, period}) { return get({ url: `/evaluationsubrule/score`, params: { userId: userId, time: period, platform: 'weixin' }, }); } export { fetchHistoryPoint, fetchAssessmentDetail, fetchGradeList, fetchRuleAndScore };