mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
我报名的 切换成新的接口,包括 删除,跳转
This commit is contained in:
@@ -54,16 +54,21 @@ const courseList = function(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程
|
||||
* 删除学习的课程,已经不再使用,换成新的
|
||||
* @param {Object} ms_timeline_kid
|
||||
*/
|
||||
const delLearning = function(ms_timeline_kid) {
|
||||
return ajax.post('/b1/system/user/ms-timeline-delete',{ms_timeline_kid});
|
||||
}
|
||||
|
||||
/**新的删除学习的课程的接口,参数courseRegId, 对应的课程的id */
|
||||
const newDelLearning = function(courseRegId) {
|
||||
return ajax.post('/b1/system/user/delete-course-reg',{courseRegId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户的kid,获取用户的受众权限
|
||||
*
|
||||
*
|
||||
* @param {Object} kid
|
||||
*/
|
||||
const audience = function(kid) {
|
||||
@@ -76,5 +81,6 @@ export default {
|
||||
reportList,
|
||||
courseList,
|
||||
delLearning,
|
||||
newDelLearning,
|
||||
audience
|
||||
}
|
||||
|
||||
@@ -21,7 +21,13 @@ const userTaskList = function(data){
|
||||
return ajax.postJson(baseURL,'/todoTask/queryTodoTaskDetail',data);
|
||||
}
|
||||
|
||||
/**删除学习,取消报名*/
|
||||
const userDeleteStudy = function(data){
|
||||
return ajax.postJson(baseURL,'/stu/project/stuCancelEnrollment',data);
|
||||
}
|
||||
|
||||
export default {
|
||||
getTaskNum,
|
||||
userTaskList
|
||||
userTaskList,
|
||||
userDeleteStudy
|
||||
}
|
||||
|
||||
@@ -370,6 +370,12 @@ const ids=function (data){
|
||||
const followIds=function (data){
|
||||
return ajax.postJson('/xboe/school/study/course/follow-ids',data);
|
||||
}
|
||||
|
||||
/**从ES中查询我学习的课程数据*/
|
||||
const myStudysFromES=function (data){
|
||||
return ajax.post('/xboe/school/study/es/search',data);
|
||||
}
|
||||
|
||||
export default {
|
||||
hasSignup,
|
||||
signup,
|
||||
@@ -399,6 +405,7 @@ export default {
|
||||
myAssessList,
|
||||
myExamList2,
|
||||
myCourseStudy,
|
||||
myStudysFromES,
|
||||
deleteSignUp,
|
||||
ids,
|
||||
followIds
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
<!-- <el-option label="已停用" :value="3"></el-option> -->
|
||||
</el-select>
|
||||
<div style="padding-left: 12px;"><el-input class="uc-input" v-model="params.courseName" clearable placeholder="搜索名称"></el-input></div>
|
||||
<div style="padding-left: 12px;"><el-button type="primary" class="search-btn" icon="el-icon-search" @click="searchData()">搜索</el-button></div>
|
||||
<div style="padding-left: 12px;"><el-button type="primary" class="search-btn" icon="el-icon-search" @click="findStudys(true)">搜索</el-button></div>
|
||||
<div style="padding-left: 12px"><el-button type="primary" class="search-btn" icon="el-icon-refresh-right" @click="reset()">重置</el-button></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uc-list" v-loading="loading">
|
||||
<div class="uc-course" v-for="(item,idx) in pageChange" :key="idx">
|
||||
<div class="uc-course" v-for="(item,idx) in couresList" :key="idx">
|
||||
<div class="uc-course-img" style="width: 260px;height:144px" @click="jumpRouter(item)">
|
||||
<course-image :course="item"></course-image>
|
||||
<div class="uc-type">
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
<div class="uc-course-info" @click="jumpRouter(item)">
|
||||
<div class="uc-course-name" style="cursor: pointer;">
|
||||
|
||||
|
||||
<div style="flex:1;">
|
||||
<a v-html="$keywordActiveShow(item.courseName,params.courseName)" class="uc-title two-line-ellipsis"></a>
|
||||
</div>
|
||||
@@ -74,7 +74,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="pageChange.length > 0 " style="text-align: center;margin-top:57px;">
|
||||
<div v-if="couresList.length > 0 " style="text-align: center;margin-top:57px;">
|
||||
<el-pagination background
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@@ -82,20 +82,21 @@
|
||||
:page-sizes="[10, 20, 30, 40]"
|
||||
:page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="couresList.length">
|
||||
:total="page.count">
|
||||
</el-pagination>
|
||||
</div>
|
||||
<div class="list-wu">
|
||||
<div v-if="loading">
|
||||
<span v-if="dataList.length==0">正在加载数据...</span>
|
||||
<span v-else>查询中...</span>
|
||||
</div>
|
||||
<div v-if="loading"> <span>加载中...</span> </div>
|
||||
<div v-else class="home-no-list">
|
||||
<!-- <span v-if="dataList.length==0">当前列表无数据</span>
|
||||
<span v-else-if="couresList.length==0" >未找到您要搜索的内容</span> -->
|
||||
<img v-if="dataList.length==0 || couresList.length==0" class="img" style="width:360px;height:226px" :src="`${webBaseUrl}/images/homeWu/no-madel.png`" alt="" srcset="">
|
||||
<p v-if="dataList.length==0" class="text" style="color: #333333;margin-top:50px;font-size: 14px">您还没有报名课程哦~</p>
|
||||
<p v-else-if="couresList.length==0" class="text" style="color: #333333;margin-top:50px;font-size: 14px">未找到您要搜索的内容</p>
|
||||
<div v-if="page.count==0 && !loading">
|
||||
<div v-if="isSearch">
|
||||
<p class="text" style="color: #333333;margin-top:50px;font-size: 14px">未找到您要搜索的内容</p>
|
||||
</div>
|
||||
<div v-else >
|
||||
<img class="img" style="width:360px;height:226px" :src="`${webBaseUrl}/images/homeWu/no-madel.png`" alt="" srcset="">
|
||||
<p class="text" style="color: #333333;margin-top:50px;font-size: 14px">您还没有报名课程哦~</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,8 +105,9 @@
|
||||
|
||||
<script>
|
||||
import studyItem from '@/components/Course/studyItem.vue';
|
||||
import apicourseStudy from '@/api/modules/courseStudy.js';
|
||||
import apiCourseStudy from '@/api/modules/courseStudy.js';
|
||||
import apiBoeCourse from '@/api/boe/course.js';
|
||||
import apiManage from '@/api/manage/manage.js';
|
||||
import studyImage from '@/components/Course/studyImage.vue';
|
||||
import courseImage from "@/components/Course/courseImage.vue";
|
||||
export default {
|
||||
@@ -115,6 +117,7 @@ export default {
|
||||
return {
|
||||
courseType: '',
|
||||
status: '',
|
||||
isSearch:false,
|
||||
loading: true,
|
||||
fileUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
page: {
|
||||
@@ -124,231 +127,101 @@ export default {
|
||||
},
|
||||
dataList: [],//总数据
|
||||
isNextPage: false,
|
||||
pageIndex:1,
|
||||
isListOne: true,
|
||||
params: { courseName: '', courseType: '',status:''},
|
||||
couresList: [],//显示的数据
|
||||
options: [
|
||||
{
|
||||
value: 1,
|
||||
label: '项目'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '课程',
|
||||
children: [
|
||||
{
|
||||
value: 10,
|
||||
label: '微课'
|
||||
},
|
||||
{
|
||||
value: 21,
|
||||
label: '录播课'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
pageChange() {
|
||||
let list = this.couresList.slice((this.page.pageIndex -1)* this.page.pageSize,this.page.pageIndex*this.page.pageSize);
|
||||
return list;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// this.searchData();
|
||||
// this.getMyLearning()
|
||||
this.getData();
|
||||
this.findStudys(true);
|
||||
},
|
||||
methods: {
|
||||
delItem(item,itemIdx){
|
||||
this.$confirm('您确定要删除所选课程吗?', '删除提示', {
|
||||
delItem(item,itemIdx){
|
||||
this.$confirm('您确定要删除所选课程吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() =>{
|
||||
if(item.isOld){
|
||||
apiBoeCourse.delLearning(item.kid).then(res=>{
|
||||
if(item.source==1){ //老系统删除
|
||||
//this.$message({ type: 'error', message: '此类型的报名删除还无对接接口'});
|
||||
apiBoeCourse.newDelLearning(item.courseId).then(res=>{
|
||||
if(res.status==200){
|
||||
this.$message({ type: 'success',center: true, message: '课程删除成功!' });
|
||||
this.couresList.forEach((ic,index)=>{
|
||||
if(item.kid == ic.kid) {
|
||||
this.couresList.splice(index,1);
|
||||
}
|
||||
})
|
||||
this.dataList.forEach((it,i)=>{
|
||||
if(item.id == it.id) {
|
||||
this.dataList.splice(i,1);
|
||||
}
|
||||
})
|
||||
this.$message({ type: 'success',center: true, message: '课程删除成功!' });
|
||||
this.couresList.splice(itemIdx,1);
|
||||
} else {
|
||||
this.$message({ type: 'error', message: res.message });
|
||||
}
|
||||
});
|
||||
}else{
|
||||
apicourseStudy.deleteSignUp(item.id,item.courseId).then(res =>{
|
||||
}else if(item.source==2){ //本地删除
|
||||
apiCourseStudy.deleteSignUp(item.id,item.courseId).then(res =>{
|
||||
if(res.status==200){
|
||||
this.$message({ type: 'success', message: '删除成功!' });
|
||||
this.couresList.forEach((ic,index)=>{
|
||||
if(item.id == ic.id) {
|
||||
this.couresList.splice(index,1);
|
||||
}
|
||||
})
|
||||
this.dataList.forEach((it,i)=>{
|
||||
if(item.id == it.id) {
|
||||
this.dataList.splice(i,1);
|
||||
}
|
||||
})
|
||||
this.$message({ type: 'success', message: '删除成功!' });
|
||||
this.couresList.splice(itemIdx,1);
|
||||
} else {
|
||||
this.$message({ type: 'error', message: res.message });
|
||||
}
|
||||
})
|
||||
}else if(item.source==3){ //管理端删除
|
||||
var reqData={ pid:item.courseId, student:item.accountId }
|
||||
apiManage.userDeleteStudy(reqData).then(res=>{
|
||||
if(res.code==200){
|
||||
this.$message({ type: 'success', message: '删除成功!' });
|
||||
this.couresList.splice(itemIdx,1);
|
||||
}else{
|
||||
this.$message({ type: 'success', message: '删除失败!' });
|
||||
this.couresList.splice(itemIdx,1);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.$message({ type: 'error', message: '此报名未关联源,请与管理员联系'});
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
async getData() { //当前方案,此处只是加载一次
|
||||
let type = '';
|
||||
// if(this.params.courseType){
|
||||
if(this.params.courseType==20){
|
||||
type='online-course';
|
||||
}else if(this.params.courseType==30){
|
||||
type='face-course';
|
||||
}else if(this.params.courseType==40){
|
||||
type='project';
|
||||
findStudys(flag){ //新的
|
||||
if(flag){
|
||||
this.page.pageIndex=1;
|
||||
}
|
||||
// }
|
||||
// if(this.params.courseType ==20 ){
|
||||
// this.params.courseType = [10,20]
|
||||
// }
|
||||
this.loading = true;
|
||||
let data = {
|
||||
type:type,
|
||||
page:this.pageIndex,
|
||||
size:100
|
||||
this.isSearch=false;
|
||||
let reqData={
|
||||
courseName:this.params.courseName,
|
||||
courseType:this.courseType,
|
||||
status:this.status,
|
||||
progress:'',
|
||||
pageIndex:this.page.pageIndex,
|
||||
pageSize:this.page.pageSize
|
||||
}
|
||||
this.isListOne = true;
|
||||
this.params.pageSize = 100;
|
||||
this.params.pageIndex = 1;
|
||||
let list = this.dataList;
|
||||
let clist = this.couresList;
|
||||
// Promise.all([apiBoeCourse.myLearning(data),apicourseStudy.myStudyList(this.params)]).then(res=>{
|
||||
// let list = [];
|
||||
// list.push(...res[1].result.list);
|
||||
// res[1].result.list.forEach(item=>{
|
||||
// item.courseImage = this.fileUrl + item.courseImage;
|
||||
// })
|
||||
// let data = this.filterConversion(res[0].result.dataList);
|
||||
// list.push(...data);
|
||||
// this.couresList = list;
|
||||
// this.dataList = list;
|
||||
// this.loading = false;
|
||||
// }).catch(err=>{
|
||||
// console.log(err,'err');
|
||||
// })
|
||||
await apicourseStudy.myStudyList(this.params).then(res =>{
|
||||
if(res.status == 200) {
|
||||
res.result.list.forEach(item=>{
|
||||
if(item.courseImage){
|
||||
item.courseImage = this.fileUrl + item.courseImage;
|
||||
}
|
||||
})
|
||||
list.push(...res.result.list);
|
||||
clist.push(...res.result.list);
|
||||
}else{
|
||||
console.log('加载报名数据失败:'+res.message);
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
await apiBoeCourse.myLearning(data).then(rs=>{
|
||||
if(rs.status == 200) {
|
||||
let data = this.filterConversion(rs.result.dataList);
|
||||
list.push(...data);
|
||||
clist.push(...data);
|
||||
}else{
|
||||
console.log('加载原报名数据失败:'+rs.message);
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
filterConversion(data){
|
||||
let list = [];
|
||||
data.forEach((item,index)=>{
|
||||
let type = null;
|
||||
if(item.type=='online-course'){
|
||||
type=20;
|
||||
}else if(item.type=='face-course'){
|
||||
type=30;
|
||||
}else if(item.type=='project'){
|
||||
type=40;
|
||||
if(reqData.courseName || reqData.courseType || reqData.status){
|
||||
this.isSearch=true;
|
||||
}
|
||||
this.loading=true;
|
||||
apiCourseStudy.myStudysFromES(reqData).then(res=>{
|
||||
if(res.status==200){
|
||||
this.couresList=res.result.list;
|
||||
this.page.count=res.result.count;
|
||||
}else{
|
||||
this.$message({ type: 'error', message: res.message });
|
||||
}
|
||||
let status = null;
|
||||
if(item.status == '0') {
|
||||
status = 1;
|
||||
} else if(item.status == '1') {
|
||||
status = 2;
|
||||
}else if(item.status == '2') {
|
||||
status = 9;
|
||||
}
|
||||
let num = item.completeProgress.replace('%',"");
|
||||
item.completeProgress = Number(num);
|
||||
list.push({
|
||||
courseImage: item.cover[0].url,
|
||||
courseName: item.title,
|
||||
courseType: type,
|
||||
id: item.id,
|
||||
addTime:item.enrollTime,
|
||||
progress: item.completeProgress,
|
||||
status: status,
|
||||
isOld: true,
|
||||
kid:item.ms_timeline_kid
|
||||
})
|
||||
this.loading=false;
|
||||
})
|
||||
return list;
|
||||
},
|
||||
|
||||
},
|
||||
jumpRouter(item) {
|
||||
if(item.isOld){
|
||||
if(item.sourse==1){
|
||||
location.href=`${this.webBaseUrl}/course/boeframe?id=${item.id}&type=${item.courseType}`
|
||||
}else if(item.sourse==2){
|
||||
this.$router.push({path:'/course/studyindex',query:{id:item.courseId}})
|
||||
}else if(item.sourse==3){
|
||||
//管理端跳转,只有30,没有40了
|
||||
//let params=encodeURIComponent('routerId='+courseId);
|
||||
//this.$router.push('/forward?to=/fe-student/pathdetails¶ms='+params);
|
||||
let manageApi=process.env.VUE_APP_MANAGER_API_PATH;
|
||||
let uparams=encodeURIComponent('courseId='+item.courseId);
|
||||
this.$router.push('/forward?to='+manageApi+'/stu/project/redirectDetail¶ms='+uparams);
|
||||
} else {
|
||||
// if(item.courseType==10){
|
||||
// this.$router.push({path:'/course/micro',query:{id:item.courseId}})
|
||||
// }
|
||||
// if(item.courseType==20){
|
||||
// if(item.progress>0 && item.progress<100) {
|
||||
this.$router.push({path:'/course/studyindex',query:{id:item.courseId}})
|
||||
// } else {
|
||||
// this.$router.push({path:'/course/detail',query:{id:item.courseId}})
|
||||
// }
|
||||
// }
|
||||
console.log('未识别的来源 '+item.sourse);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
// getMyLearning() {
|
||||
// let params = {
|
||||
// type:this.params.courseType,
|
||||
// page:this.pageIndex,
|
||||
// size:200
|
||||
// }
|
||||
// apiBoeCourse.myLearning(params).then(res=>{
|
||||
// if(res.status == 200) {
|
||||
// res.result.dataList.forEach(item => {
|
||||
// let num = item.completeProgress.replace('%',"");
|
||||
// item.completeProgress = Number(num);
|
||||
// item.url = item.cover[0].url;
|
||||
// });
|
||||
// // if(this.page == 1) {
|
||||
// this.dataList = res.result.dataList;
|
||||
// // } else {
|
||||
// // this.dataList.push(...res.result.dataList);
|
||||
// // }
|
||||
|
||||
// this.isNextPage = res.result.isNextPage;
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
reset(){
|
||||
this.params.courseName = '',
|
||||
this.params.courseType = '',
|
||||
@@ -357,55 +230,16 @@ computed: {
|
||||
this.couresList = this.dataList;
|
||||
this.courseType = '';
|
||||
this.status = '';
|
||||
},
|
||||
searchData() {
|
||||
this.loading=false;//因为是页面搜索,所以直接设置为false
|
||||
this.page.pageIndex = 1;
|
||||
this.isListOne = true;
|
||||
let list = this.dataList;
|
||||
if(this.courseType == '1') {
|
||||
this.params.courseType = '';
|
||||
} else {
|
||||
this.params.courseType = this.courseType;
|
||||
}
|
||||
let type;
|
||||
if(this.params.courseType == 20) {
|
||||
type = 10;
|
||||
}
|
||||
if(this.status == '0') {
|
||||
this.params.status = '';
|
||||
} else {
|
||||
this.params.status = this.status;
|
||||
}
|
||||
if(this.params.courseType != '') {
|
||||
list= list.filter(item => {
|
||||
if(item.courseType === this.params.courseType || item.courseType === type) {
|
||||
return item;
|
||||
}
|
||||
});
|
||||
}
|
||||
if(this.params.status !== '') {
|
||||
list= list.filter(item => {
|
||||
if(item.status === this.params.status){
|
||||
return item;
|
||||
}
|
||||
});
|
||||
}
|
||||
if(this.params.courseName !== '') {
|
||||
list= list.filter(item => {
|
||||
return item.courseName.toLowerCase()
|
||||
.indexOf(this.params.courseName.toLowerCase()) > -1;
|
||||
});
|
||||
}
|
||||
this.couresList = list;
|
||||
|
||||
this.findStudys();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.page.pageSize = val;
|
||||
this.page.pageIndex = 1;
|
||||
this.page.pageSize = val;
|
||||
this.page.pageIndex = 1;
|
||||
this.findStudys();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page.pageIndex = val;
|
||||
this.page.pageIndex = val;
|
||||
this.findStudys();
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user