我的任务对接

This commit is contained in:
daihh
2023-03-04 13:52:13 +08:00
parent c2af365ad8
commit c11303b43b
7 changed files with 283 additions and 56 deletions

View File

@@ -260,6 +260,7 @@
import apicourseStudy from "../../api/modules/courseStudy.js"
import apiCoursePortal from '@/api/modules/coursePortal.js'
import apiBoeCourse from '@/api/boe/course.js';
import apiManage from '@/api/manage/manage.js';
import { formatDate } from '@/utils/tools.js';
import apiUser from '@/api/system/user.js'
import { mapGetters } from 'vuex'
@@ -413,7 +414,7 @@
let $this = this;
if (this.tabIndex == 0) {
if (this.taskHasMore) {
this.taskPageSize++;
this.taskPageIndex++;
this.loadBoeData(false);
}
@@ -585,10 +586,20 @@
},
// 学习任务跳转详情
loaddetail(task) {
// uni.navigateTo({
// url: '/pages/study/loaddetail?id=' + task.cmtask_id
// });
let taskUrl='';
if(task.cmtask_type==1){ //学习路径图
let params=encodeURIComponent('routerId='+task.cmtask_id);
taskUrl='/pages/forward?to=/student-h5/pathdetails&params='+params;
}else if(task.cmtask_type==2){ //学习项目
let params=encodeURIComponent('projectId='+task.cmtask_id);
taskUrl='/pages/forward?to=/student-h5/projectdetails&params='+params;
}
uni.navigateTo({
url: '/pages/study/loaddetail?id=' + task.cmtask_id
url: taskUrl
});
// window.open(`/loaddetail?id=${task.cmtask_id}`)
},
loadBoeData(flag) {
@@ -605,29 +616,58 @@
if (this.cmtask_name) {
params.cmtask_name = this.keyWord;
}
apiBoeCourse.cmtaskList(params).then(res => {
this.taskCount = res.result.count;
res.result.list.forEach(item => {
let time = this.formatDate(item.created_at * 1000);
item.created_at = time.split(' ')[0];
});
this.couresList.push(...res.result.list);
if (this.taskCount > this.taskPageIndex * this.taskPageSize) {
this.taskHasMore = true;
} else {
this.taskHasMore = false;
apiManage.userTaskList(params).then(res => {
if(res.code==200){
this.taskCount = parseInt(res.data.total);
this.couresList.push(...res.data.records);
if (this.taskCount > this.taskPageIndex * this.taskPageSize) {
this.taskHasMore = true;
} else {
this.taskHasMore = false;
}
if (this.isOne) {
this.value = this.taskCount;
}
if (this.isOne && res.result.records.length == 0) {
this.tabIndex = 1;
}
this.isOne = false;
}else{
uni.showToast({
title: '获取任务失败',
icon: 'none'
});
}
if (this.isOne) {
this.value = res.result.count;
}
if (this.isOne && res.result.list.length == 0) {
this.tabIndex = 1;
}
this.isOne = false;
}).catch(err => {
})
// apiBoeCourse.cmtaskList(params).then(res => {
// this.taskCount = res.result.count;
// res.result.list.forEach(item => {
// let time = this.formatDate(item.created_at * 1000);
// item.created_at = time.split(' ')[0];
// });
// this.couresList.push(...res.result.list);
// if (this.taskCount > this.taskPageIndex * this.taskPageSize) {
// this.taskHasMore = true;
// } else {
// this.taskHasMore = false;
// }
// if (this.isOne) {
// this.value = res.result.count;
// }
// if (this.isOne && res.result.list.length == 0) {
// this.tabIndex = 1;
// }
// this.isOne = false;
// }).catch(err => {
// })
},
loadUserInfos(list, userIds) {
const noReapetIds = [...new Set(userIds)];