diff --git a/src/api/index1.js b/src/api/index1.js index 1a2376f0..b4049d65 100644 --- a/src/api/index1.js +++ b/src/api/index1.js @@ -87,7 +87,8 @@ export const editLearnInfo = (obj) => http.post('/admin/router/editInfo', obj) //项目基础信息----------------------------------- //项目积分榜单 -export const scoreRank = (obj) => http.post("/admin/project/scoreRank", obj); +// export const scoreRank = (obj) => http.post("/admin/project/scoreRank", obj); +export const scoreRank = (params) => http.get('/points/top/list', { params }) //排行榜 export const billboard = (obj) => http.post("/admin/project/billboard", obj); //项目基础信息----------------------------------- diff --git a/src/components/drawers/ProjectScore.vue b/src/components/drawers/ProjectScore.vue index 0d322145..7fbbda9f 100644 --- a/src/components/drawers/ProjectScore.vue +++ b/src/components/drawers/ProjectScore.vue @@ -53,21 +53,21 @@
-
+
-
学员积分榜
+
学员积分榜
-
+
-
小组积分榜
+
小组积分榜
@@ -104,33 +104,33 @@
- + @@ -296,6 +296,7 @@ import { scoreRule } from "../../api/indexTaskadd"; //获取项目积分规则 import { setScoreRule } from "../../api/indexTaskadd"; //设置项目积分规则 import { getProjStu } from "../../api/indexProjStu"; import { message } from "ant-design-vue"; +import {checkPer} from "@/utils/utils"; export default { name: "ProjectScore", components: { @@ -390,67 +391,20 @@ export default { }, ], datascore: [ - { - id: 1, - name: "张三的名字很长很长很长", - score: "10分", - }, - { - id: 2, - name: "李四", - score: "10分", - }, - { - id: 3, - name: "王五的名字一定要比张三的还长", - score: "10分", - }, - { - id: 4, - name: "赵六", - score: "10分", - }, - { - id: 5, - name: "冯七", - score: "10分", - }, + ], datascoreg: [ - { - id: 1, - name: "第一组的同学们", - score: "10分", - }, - { - id: 2, - name: "第2组的同学们", - score: "9分", - }, - { - id: 3, - name: "第3组的同学们", - score: "8分", - }, - { - id: 4, - name: "第4组的同学们", - score: "7分", - }, - { - id: 5, - name: "第五组的同学们", - score: "6分", - }, + ], + scoreRankLoading:true, valueName: "", //排行榜输入姓名 valueDate: "", //排行榜输入日期 noticeChecked: true, noticeContent: "请输入要发布的公告", - activeKeyScore: "2", + activeKeyScore: "1", stuName: "请输入姓名", todayvalue: "1", - stuValue: false, + stuValue: 0, Svisible: false, score1: null, done2: null, @@ -466,13 +420,14 @@ export default { seven1: null, seven2: null, edit: true, - searchRankName: null, //榜单搜索名称 + searchRankName: "", //榜单搜索名称 pageSize: 10, currentPage: 1, tableDataTotal: null, searchNameValue: null, //学员获取的姓名 checkStuId: null, proId: null, + startTime: (new Date(new Date(new Date().toLocaleDateString()).getTime())).getTime().toString() }); const getTableData = () => { let datas = state.tabledataStu; @@ -517,52 +472,86 @@ export default { const tabsChange = (e) => { if (e == 2) { // console.log('获取项目积分-榜单') - scoreRank(1, 1); + scoreRank(); } else if (e == 3) { getScoreRule(); } rankReset(); state.todayvalue = "1"; - state.stuValue = 1; + state.stuValue = 0; }; //重置 const rankReset = () => { - state.searchRankName = null; + state.searchRankName = ""; + scoreRank(); }; // start -------榜单---------------榜单------------榜单------------------榜单--------- //学员积分还是小组积分 const typeChange = (num) => { - state.stuValue = num; - scoreRank(state.stuValue, state.todayvalue); + console.log(num) + state.stuValue = Number(num); + scoreRank(); }; //选择时间 const changeday = (e) => { state.todayvalue = e.target.value; - scoreRank(state.stuValue, state.todayvalue); + console.log('切换时间显示-今天-七天-近一个月', e.target.value) + if(e.target.value==1){ + state.startTime = (new Date(new Date(new Date().toLocaleDateString()).getTime())).getTime().toString() + }else if(e.target.value==2){ + state.startTime = ((new Date(new Date(new Date().toLocaleDateString()).getTime())).getTime() - 7*24*60*60*1000).toString() + }else{ + state.startTime = ((new Date(new Date(new Date().toLocaleDateString()).getTime())).getTime() - 31*24*60*60*1000).toString() + } + scoreRank(); }; //搜索 const searchRank = () => { - scoreRank(state.stuValue, state.todayvalue); + scoreRank(); }; //项目积分榜单 const scoreRank = (period, type) => { - console.log("projectId", props.projectId); + state.scoreRankLoading = true; + state.datascore = []; + state.datascoreg = []; + console.log("projectId----->", props.projectId,period, type); + console.log('我是查询榜单传递的数据',{ + projectId: props.projectId, // 项目id + name: state.searchRankName, // 名字,没有则传空字符串 + startTime:state.startTime, // 数据查询的起始时间 10位时间戳 + size: 5, // 前多少名 + type: Number(state.stuValue), // 查询类型 0 学员积分榜 1 小组积分榜 + }) let obj = { - name: state.searchRankName, - pageNo: 1, - pageSize: 5, - period: Number(period), - projectId: props.projectId, - type: Number(type), + projectId: props.projectId, // 项目id + name: state.searchRankName, // 名字,没有则传空字符串 + startTime: state.startTime, // 数据查询的起始时间 10位时间戳 + size: 5, // 前多少名 + type: Number(state.stuValue), // 查询类型 0 学员积分榜 1 小组积分榜 }; + api .scoreRank(obj) .then((res) => { console.log("获取项目积分-榜单", res); + if(res.data.code==200){ + state.datascore = res.data.data; + state.datascoreg = res.data.data; + state.scoreRankLoading = false; + }else{ + state.datascore = []; + state.datascoreg = []; + state.scoreRankLoading = false; + } }) .catch((err) => { console.log("获取项目积分-榜单失败", err); + message.destroy(); + message.error('榜单获取失败'); + state.datascore = []; + state.datascoreg = []; + state.scoreRankLoading = false; }); }; // end -----榜单----------------榜单----------------------榜单-----------榜单---------- @@ -739,6 +728,7 @@ export default { searchStu, resetStud, getScoreRule, + checkPer }; }, // computed: {