mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +08:00
feat:增加项目设置积分规则数据接入
This commit is contained in:
@@ -18,10 +18,10 @@ export const editProj = (obj) => http.post('/admin/project/edit', obj)
|
||||
export const editTask = (obj) => http.post('/admin/router/editTask', obj)
|
||||
|
||||
//项目里获取项目积分规则
|
||||
export const scoreRule = (obj) => http.get('/admin/project/scoreRule', { params: obj })
|
||||
export const scoreRule = (obj) => http.get('/points/project/rule', { params: obj })
|
||||
|
||||
//项目里设置项目积分规则
|
||||
export const setScoreRule = (obj) => http.post('/admin/project/setScoreRule', obj)
|
||||
export const setScoreRule = (obj) => http.post('/points/project/rule/edit', obj)
|
||||
|
||||
//面授课开课列表
|
||||
export const planList = (obj) => http.post('/admin/offcourse/planList', obj)
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
|
||||
<script>
|
||||
import StuScoreDetail from "../../components/drawers/StuScoreDetail";
|
||||
import { reactive, toRefs, computed, onMounted } from "vue";
|
||||
import { reactive, toRefs, onMounted } from "vue";
|
||||
import * as api from "../../api/index1";
|
||||
// import { message } from "ant-design-vue";
|
||||
import { scoreRule } from "../../api/indexTaskadd"; //获取项目积分规则
|
||||
@@ -427,7 +427,8 @@ export default {
|
||||
searchNameValue: null, //学员获取的姓名
|
||||
checkStuId: null,
|
||||
proId: null,
|
||||
startTime: (new Date(new Date(new Date().toLocaleDateString()).getTime())).getTime().toString()
|
||||
startTime: (new Date(new Date(new Date().toLocaleDateString()).getTime())).getTime().toString(),
|
||||
scoresum: 0
|
||||
});
|
||||
const getTableData = () => {
|
||||
let datas = state.tabledataStu;
|
||||
@@ -450,23 +451,7 @@ export default {
|
||||
});
|
||||
state.tabledataStu = datas;
|
||||
};
|
||||
const scoresum = computed(() => {
|
||||
// console.log(Object.prototype.toString.call(Number(state.score1)));
|
||||
// if (Object.prototype.toString.call(state.score1) !== "[object Number]") {
|
||||
// message.destroy();
|
||||
// return message.warning("请输入合法数字");
|
||||
// }
|
||||
return (
|
||||
Number(state.score1) +
|
||||
Number(state.done3) +
|
||||
Number(state.four2) +
|
||||
Number(state.four5) +
|
||||
Number(state.five2) +
|
||||
Number(state.six1) +
|
||||
Number(state.seven1) +
|
||||
Number(state.seven2)
|
||||
);
|
||||
});
|
||||
|
||||
getTableData();
|
||||
|
||||
const tabsChange = (e) => {
|
||||
@@ -559,55 +544,60 @@ export default {
|
||||
const editRule = () => {
|
||||
console.log(props.projectId);
|
||||
let obj = {
|
||||
courseScore: state.score1,
|
||||
examItem: [
|
||||
projectId: Number(props.projectId),
|
||||
datas:[
|
||||
{
|
||||
id: 0,
|
||||
projectId: props.projectId,
|
||||
numLimit: 0,
|
||||
score: state.five2,
|
||||
scoreLimit: state.five1,
|
||||
type: 3,
|
||||
"type": 1,
|
||||
"pointsCount": Number(state.score1),
|
||||
"typeDesc": "完成【必修/选修】获得%p积分",
|
||||
"typeDescConfig": ""
|
||||
},
|
||||
],
|
||||
|
||||
homeworkItem: [
|
||||
//有名次要求的提交作业
|
||||
{
|
||||
id: 0,
|
||||
projectId: props.projectId,
|
||||
numLimit: state.four3,
|
||||
score: state.four5,
|
||||
scoreLimit: state.four4,
|
||||
type: 2,
|
||||
"type": 2,
|
||||
"pointsCount": Number(state.done3),
|
||||
"typeDesc": "完成作业成绩不低于%d分获得%p积分",
|
||||
"typeDescConfig": state.done2
|
||||
},
|
||||
//无名次要求的提交作业
|
||||
{
|
||||
id: 0,
|
||||
projectId: props.projectId,
|
||||
numLimit: 0,
|
||||
score: state.done3,
|
||||
scoreLimit: state.done2,
|
||||
type: 2,
|
||||
"type": 3,
|
||||
"pointsCount": Number(state.four2),
|
||||
"typeDesc": "前%d名学完在线课程获得%p积分",
|
||||
"typeDescConfig": state.four1
|
||||
},
|
||||
],
|
||||
leaderScore: state.seven1,
|
||||
projectId: props.projectId,
|
||||
signScore: state.six1,
|
||||
topCompleteCourseItem: [
|
||||
{
|
||||
id: 0,
|
||||
projectId: props.projectId,
|
||||
numLimit: state.four1,
|
||||
score: state.four2,
|
||||
scoreLimit: 0,
|
||||
type: 1,
|
||||
"type": 4,
|
||||
"pointsCount": Number(state.four5),
|
||||
"typeDesc": "前%d名提交作业且成绩不低于%d分获得%p积分",
|
||||
"typeDescConfig": state.four3 + ';' + state.four4
|
||||
},
|
||||
],
|
||||
topStudentScore: state.seven2,
|
||||
totalScore: scoresum.value,
|
||||
{
|
||||
"type": 5,
|
||||
"pointsCount": Number(state.five2),
|
||||
"typeDesc": "考试成绩高于%d分获得%p积分",
|
||||
"typeDescConfig": state.five1
|
||||
},
|
||||
{
|
||||
"type": 6,
|
||||
"pointsCount": Number(state.six1),
|
||||
"typeDesc": "考勤正常学员获得%p积分",
|
||||
"typeDescConfig": ""
|
||||
},
|
||||
{
|
||||
"type": 7,
|
||||
"pointsCount": Number(state.seven1),
|
||||
"typeDesc": "成为小组长获得%p积分",
|
||||
"typeDescConfig": ""
|
||||
},
|
||||
{
|
||||
"type": 8,
|
||||
"pointsCount": Number(state.seven2),
|
||||
"typeDesc": "优秀学员可获得%p积分",
|
||||
"typeDescConfig": ""
|
||||
}
|
||||
]
|
||||
};
|
||||
console.log(obj);
|
||||
|
||||
console.log('我是修改积分规则传递得参数', obj);
|
||||
setScoreRule(obj)
|
||||
.then((res) => {
|
||||
console.log(res.data, "修改成功");
|
||||
@@ -689,21 +679,30 @@ export default {
|
||||
.then((res) => {
|
||||
console.log("获取了项目积分规则", res.data.data);
|
||||
let result = res.data.data;
|
||||
scoresum.value = result.totalScore; //Write operation failed: computed value is readonly
|
||||
state.seven1 = result.leaderScore;
|
||||
state.score1 = result.courseScore;
|
||||
state.done2 = result.homeworkItem[1].scoreLimit;
|
||||
state.done3 = result.homeworkItem[1].score;
|
||||
state.four1 = result.topCompleteCourseItem[0].numLimit;
|
||||
state.four2 = result.topCompleteCourseItem[0].score;
|
||||
state.four3 = result.homeworkItem[0].numLimit;
|
||||
state.four4 = result.homeworkItem[0].scoreLimit;
|
||||
state.four5 = result.homeworkItem[0].score;
|
||||
state.five1 = result.examItem[0].scoreLimit;
|
||||
state.five2 = result.examItem[0].score;
|
||||
state.six1 = result.signScore;
|
||||
state.seven1 = result.leaderScore;
|
||||
state.seven2 = result.topStudentScore;
|
||||
//Write operation failed: computed value is readonly 总积分
|
||||
|
||||
state.scoresum = Number(result[0].pointsCount) + Number(result[1].pointsCount) + Number(result[2].pointsCount) + Number(result[3].pointsCount) + Number(result[4].pointsCount) + Number(result[5].pointsCount) + Number(result[6].pointsCount) + Number(result[7].pointsCount)
|
||||
|
||||
state.score1 = result[0].pointsCount;
|
||||
|
||||
state.done2 = result[1].typeDescConfig;
|
||||
state.done3 = result[1].pointsCount;
|
||||
|
||||
state.four1 = result[2].typeDescConfig;
|
||||
state.four2 = result[2].pointsCount;
|
||||
|
||||
state.four3 = result[3].typeDescConfig.slice(0,result[3].typeDescConfig.indexOf(';'));
|
||||
state.four4 = result[3].typeDescConfig.slice(result[3].typeDescConfig.indexOf(';')+1);
|
||||
state.four5 = result[3].pointsCount;
|
||||
|
||||
state.five1 = result[4].typeDescConfig;
|
||||
state.five2 = result[4].pointsCount;
|
||||
|
||||
state.six1 = result[5].pointsCount;
|
||||
|
||||
state.seven1 = result[6].pointsCount;
|
||||
|
||||
state.seven2 = result[7].pointsCount;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("获取项目积分规则失败了", err);
|
||||
@@ -721,7 +720,6 @@ export default {
|
||||
tabsChange,
|
||||
scoreRank,
|
||||
editRule,
|
||||
scoresum,
|
||||
getStu,
|
||||
setStuData,
|
||||
changePagination,
|
||||
|
||||
Reference in New Issue
Block a user