我报名的修改

This commit is contained in:
daihh
2023-03-06 19:18:44 +08:00
parent c11303b43b
commit 0c50b6e21c
4 changed files with 203 additions and 352 deletions

View File

@@ -59,6 +59,11 @@ 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获取用户的受众权限
*

View File

@@ -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
}

View File

@@ -183,6 +183,10 @@ const myStudyList = function(query) {
return ajax.post('/xboe/school/study/course/mylist',query);
}
const myStudyListFromES = function(query) {
return ajax.post('/xboe/school/study/es/search',query);
}
/**
* 保存课程考试
* @param {Object} data
@@ -349,6 +353,7 @@ export default {
getStudyContentItem,
studyExport,
myStudyList,
myStudyListFromES,
saveHomework,
saveExam,
saveAssess,

View File

@@ -1,9 +1,7 @@
<template>
<view style="background-color: #fff;">
<view class="listbox-top" style="background-color: #fff;">
<!-- <view class="top-ten" style="margin-top: 21px;margin-left: 13px;">
<text class="textbtn" @click="loadstatusSelecShow=!loadstatusSelecShow">状态</text>
</view> -->
<view class="searchView" v-show="tabIndex===0">
<u-search :clearabled="true" @search="loadBoeData(true)" @clear="loadBoeData(true)"
placeholder="搜索关键字" v-model="loadkeyword" :showAction="false" shape="square" bgColor="##F2F5F7">
@@ -68,9 +66,9 @@
<author-info :avatar="task.avatar" :name="task.authorName" :info="task.orgInfo" :sex="task.sex"></author-info>
</view> -->
<view class="coures-staus">
<text v-if="task.cmtask_status == 0">未开始</text>
<text v-if="task.cmtask_status == 1">进行中</text>
<text v-if="task.cmtask_status == 2">已完成</text>
<text v-if="task.cmtask_user_status == 0">未开始</text>
<text v-if="task.cmtask_user_status == 1">进行中</text>
<text v-if="task.cmtask_user_status == 2">已完成</text>
</view>
</view>
</view>
@@ -83,22 +81,17 @@
</view>
<!-- 自主学习 -->
<view class="listbox" v-show="tabIndex===1">
<view v-if="studyList.length == 0 && couresList.length == 0 && isOne" class="zan-wu">
您还没有学习课程快去学习吧
</view>
<view v-if="studyList.length == 0 && isOne" class="zan-wu">您还没有学习课程快去学习吧</view>
<u-toast ref="articleToast"></u-toast>
<view class="course content" v-for="(c, idxs) in studyList" :key="idxs" @click="toStudy(c)">
<view class="course-info">
<view class="course-info-left">
<view style="position: relative;">
<course-image class="uc-course-type" :course="c" width="265upx" height="154upx">
</course-image>
<!-- <text class="uc-course-type-text" v-if="c.courseType == 10">录播</text>
<course-image class="uc-course-type" :course="c" width="265upx" height="154upx"></course-image>
<text class="uc-course-type-text" v-if="c.courseType == 10">录播</text>
<text class="uc-course-type-text" v-if="c.courseType == 20">录播</text>
<text class="uc-course-type-text" v-if="c.courseType == 'online-course'">录播</text>
<text class="uc-course-type-text" v-if="c.courseType == 'face-course'">线下课</text>
<text v-if="c.courseType == 'project'" class="uc-course-type-text">学习项目</text> -->
<text class="uc-course-type-text" v-if="c.courseType == 30">线下课</text>
<text class="uc-course-type-text" v-if="c.courseType == 40" >学习项目</text>
</view>
<view class="course-text" style="justify-content: space-between;position: relative;">
<view class="course-title one-line-ellipsis" style="width: 90%;">
@@ -126,86 +119,11 @@
</view>
</view>
<!-- 用了display:none隐藏后期不需要删除 -->
<view style="display:none" class="course content" v-for="(c, idxs) in studyList" :key="idxs+'value'"
@click="toStudy(c)">
<view class="course-info">
<view class="course-titles" style="display: flex;align-items: center;">
<text class="Recording" v-if="c.courseType == 10">录播</text>
<text class="Recording" v-if="c.courseType == 20">录播</text>
<text v-if="c.courseType == 'online-course'" class="Recording">录播</text>
<text v-if="c.courseType == 'face-course'" class="uc-course-type3">面授</text>
<text v-if="c.courseType == 'project'" class="uc-course-type4">学习项目</text>
<!-- <u-parse :content="c.courseName"></u-parse> -->
<text v-html="$keywordActiveShow(c.courseName, autonomy.keyword)"></text>
</view>
<view class="course-info-left">
<!-- <img src="../../static/temp/course.png" style="width: 131px;height: 73px;"> -->
<view style="width: 152upx;height: 88upx;border-radius: 8px;">
<course-image :course="c" width="152upx" height="88upx"></course-image>
</view>
<view class="course-text">
<view>
<!-- :border-radius="50" -->
<progress :percent="c.progress" stroke-width="5" activeColor="#18C6FB"></progress>
</view>
<view class="course-btn" style="margin-top: 26upx;height:24upx">
<view class="btn-wz" v-if="c.addTime">报名时间:{{ c.addTime }}</view>
</view>
<view class="btn-bai"
style="position: absolute;right: 0;color: #2A2C31;font-size: 36upx;font-weight: 600;">
{{ c.progress }}%
</view>
</view>
</view>
</view>
</view>
<view style="margin-top: 60upx;">
<uni-load-more :status="loadStatus"></uni-load-more>
<uni-load-more :status="studyLoadStatus"></uni-load-more>
</view>
</view>
<!-- 历史记录 -->
<view class="listbox" v-if="tabIndex===2">
<view class="listboxtwo-top">
<!-- 历史记录类型查询 -->
<view class="top-ten">
<u-picker v-model="classType" :show="hisstatusSelectShow" @cancel="hisstatusSelectShow = false"
@confirm="hischooseStatus" :columns="typeArray" keyName="name"></u-picker>
<text class="textbtn" @click="hisstatusSelectShow = true">{{hisstatusBtnName}}</text>
</view>
<!-- <view class="top-ten">
<u-picker v-model="statust" :show="statusSelecShow" @cancel="statusSelecShow = false"
@confirm="chooseStatust" :columns="statustArray" keyName="name"></u-picker>
<text class="textbtn" @click="statusSelecShow = true">{{statusBtns}}</text>
</view> -->
<view class="searchView">
<u-search :clearabled="true" @search="history(true)" placeholder="搜索关键字" v-model="hiskeyword"
:showAction="false" shape="square" bgColor="#ffffff"></u-search>
</view>
</view>
<view class="course content" v-for="(c,idx) in historyList.list" :key="idx" @click="choose(c)">
<view class="course-info">
<view class="course-titles">
<text v-if="c.courseType==10">[录播]</text><text v-if="c.courseType==20">[录播]</text>
{{c.courseName}}
</view>
<view class="course-info-left">
<!-- <img src="../../static/temp/course.png" style="width: 131px;height: 73px;"> -->
<course-image :course="c"></course-image>
<view class="course-text">
<view>来源自主学习</view>
<view>完成时间: {{c.created_at}}</view>
</view>
</view>
</view>
</view>
<view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</view>
<u-modal :show="studyResetShow" :showCancelButton="true" @cancel="cancelResetStudy" @confirm="resetStudy"
ref="uModal" :asyncClose="true">
<u-modal :show="studyResetShow" :showCancelButton="true" @cancel="cancelResetStudy" @confirm="resetStudy" ref="uModal" :asyncClose="true">
您确定要重新学习吗
</u-modal>
<u-modal :show="btnsShow" @confirm="del()" @cancel="closeBtns()" :showCancelButton="true" confirmText="删除" ref="uModal" content='您确认要删除此课程吗'></u-modal>
@@ -214,7 +132,7 @@
<view @click="del()" class="big-button" style="color: #db0000;">删除</view>
<view @click="closeBtns()" class="big-button">取消</view>
</view> -->
</u-popup>
<!-- </u-popup> -->
<u-overlay :show="overlayShow && isOneStady === 0">
<view class="warp">
<!-- <view class="rect" @tap.stop></view> -->
@@ -239,7 +157,7 @@
</view>
</view>
</u-overlay>
<u-overlay :show="xuanShow">
<!-- <u-overlay :show="xuanShow">
<view class="warp xuan">
<view class="xuan-info">
<view class="xuan-close">
@@ -253,7 +171,7 @@
</view>
</view>
</view>
</u-overlay>
</u-overlay> -->
</view>
</template>
<script>
@@ -274,12 +192,12 @@
autonomyStatusShow: false,
delData: {},
btnsShow: false, // 我报名的删除弹出
xuanShow: false,
//xuanShow: false,
boeStatus: '',
authorInfo: {},
lastStudy: {},
overlayShow: false,
isOne: true,
isOne: true,//是否是第一次加载
isSelect: 0,
autonomy: { // 自主学习 筛选
status: 0,
@@ -300,35 +218,22 @@
classType: '',
hisclassType: '',
historyList: '',
studyList: [],
studyList: [],
studyPageIndex:1,
studyPageSize:10,
studyPages:1,
studyCount:0,
studyLoadStatus:'more',
studyData: [], //自主学习备份数据
type: "error",
value: 0,
tabIndex: 0, //当前tab索引
loadStatus: 'more', //more,loading,noMore
curNow: 1,
pageSize: 6,
studyResetShow: false,
statusBtnName: '状态',
stateBtn: '课程',
statusBtn: '类型',
statusBtns: '类型',
loadstatusBtns: '类型',
statusSelectShow: false,
statusSelecShow: false,
hisstatusBtnName: '类型',
hisstatusSelecShow: false,
hisstatusSelectShow: false,
statust: '',
status: '',
loadstatus: '',
typeArray: [
{name: '全部',value: ''},
{name: '录播课',value: 'online-course'},
{name: '线下课',value: 'face-course'},
{name: '学习项目',value: 'project'}
],
statustList: [
{name: '全部',value: ''},
{name: '未开始',value: 0},
@@ -336,16 +241,10 @@
{name: '已完成',value: 2}
],
autonomyStatustList: [
{name: '全部',value: 0},
{name: '未开始',value: 1},
{name: '进行中',value: 2},
{name: '已完成',value: 9}
],
statustArray: [
[{name: '在线课',value: 'online-course'},
{name: '面授班',value: 'face-course'},
{name: '学习项目',value: 'project'}
]
{name: '全部',value: ''},
{name: '未开始',value: 0},
{name: '进行中',value: 1},
{name: '已完成',value: 2}
],
windowHeight: 0,
taskPageIndex: 1,
@@ -364,29 +263,7 @@
},
onLoad() {
this.loadBoeData(true);
// this.getLearning(); //这里应该是切换时再调用
//检查是否显示弹窗
// let curTime = new Date();
// curTime = parseInt(curTime.getTime() / 1000);
// //console.log(curTime,'curTime');
// let hasDlgTime = uni.getStorageSync('user_dlg_temp');
// if (hasDlgTime) {
// let lastTime = parseInt(hasDlgTime);
// //console.log(lastTime,'lastTime2');
// if (curTime > (lastTime + 24 * 60 * 60)) {
// this.xuanShow = true;
// //console.log('显示');
// uni.setStorageSync('user_dlg_temp', curTime);
// } else {
// this.xuanShow = false;
// this.showOneStady();
// }
// } else {
// this.xuanShow = true;
// uni.setStorageSync('user_dlg_temp', curTime);
// }
let $this = this;
uni.getSystemInfo({
success: (res) => {
@@ -417,7 +294,13 @@
this.taskPageIndex++;
this.loadBoeData(false);
}
}else if(this.tabIndex == 1){
if(this.studyPageIndex<this.studyPages){
this.studyPageIndex++;
this.getLearning(false);
}else{
}
}
setTimeout(function() {
$this.loadStatus = 'noMore';
@@ -438,24 +321,23 @@
this.btnsShow = true;
},
del() {
if (this.delData.isOld) {
apiBoeCourse.delLearning(this.delData.kid).then(res => {
if (this.delData.source==1) {
apiBoeCourse.newDelLearning(this.delData.courseId).then(res => {
if (res.status == 200) {
this.$refs.articleToast.show({
message: '删除成功',
type: 'success'
});
var delIndex=-1;
this.studyList.forEach((item, index) => {
if (item.id === this.delData.id) {
// item.delcour = false;
this.studyList.splice(index, 1);
}
})
this.studyData.forEach((it, i) => {
if (this.delData.id == it.id) {
this.studyData.splice(i, 1);
delIndex=index;
}
})
if(delIndex>-1){
this.studyList.splice(delIndex, 1);
}
} else {
this.$refs.articleToast.show({
message: '删除失败,请稍后再试',
@@ -463,7 +345,7 @@
});
}
});
} else {
} else if(this.delData.source==2) {
apicourseStudy.deleteSignUp(this.delData.id, this.delData.courseId).then(res => {
this.btnsShow = false;
if (res.status = 200) {
@@ -471,16 +353,15 @@
message: '删除成功',
type: 'success'
});
var delIndex=-1;
this.studyList.forEach((item, index) => {
if (item.id === this.delData.id) {
this.studyList.splice(index, 1);
}
})
this.studyData.forEach((it, i) => {
if (this.delData.id == it.id) {
this.studyData.splice(i, 1);
delIndex=index;
}
})
if(delIndex>-1){
this.studyList.splice(delIndex, 1);
}
} else {
this.$refs.articleToast.show({
message: '删除失败,请稍后再试',
@@ -488,19 +369,39 @@
});
}
})
}else if(this.delData.source==3){
var reqData={ pid:item.courseId, student:item.accountId }
apiManage.userDeleteStudy(reqData).then(res=>{
if(res.code==200){
this.$refs.articleToast.show({message: '删除成功',type: 'success'});
var delIndex=-1;
this.studyList.forEach((item, index) => {
if (item.id === this.delData.id) {
delIndex=index;
}
})
if(delIndex>-1){
this.studyList.splice(delIndex, 1);
}
}else{
this.$refs.articleToast.show({message: '删除失败,请稍后再试',type: 'error'});
}
})
}else{
console.log('不支持的数据来源')
}
},
showOneStady() {
if (this.isOneStady === 0) {
this.getLastStudy();
}
},
xuanClose() {
this.xuanShow = false;
this.showOneStady();
},
// showOneStady() {
// if (this.isOneStady === 0) {
// this.getLastStudy();
// }
// },
// xuanClose() {
// this.xuanShow = false;
// this.showOneStady();
// },
closeShow() {
this.overlayShow = false;
this.$store.dispatch('SetIdentity', 1);
@@ -511,15 +412,9 @@
url: '/pages/study/studydetail?id=' + lastStudy.courseId + '&type=' + lastStudy.courseType
});
} else {
if (lastStudy.courseType == 10) {
uni.navigateTo({
url: '/pages/resource/microDetail?id=' + lastStudy.courseId
});
} else if (lastStudy.courseType == 20) {
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + lastStudy.courseId
});
}
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + lastStudy.courseId
});
}
},
getLastStudy() {
@@ -538,9 +433,7 @@
this.Applistatus = num;
this.autonomy.status = num;
this.statusSelectShow = false;
// console.log(this.Applistatus)
// this.getLearning();
this.searchData();
this.getLearning(true);
},
taskStatus(num) {
this.boeStatus = num;
@@ -607,6 +500,7 @@
this.taskPageIndex = 1; //回到首页
this.couresList = [];
}
this.loadStatus='loading';
let params = {
page: this.taskPageIndex,
size: this.taskPageSize,
@@ -623,13 +517,16 @@
this.couresList.push(...res.data.records);
if (this.taskCount > this.taskPageIndex * this.taskPageSize) {
this.taskHasMore = true;
this.loadStatus='more';
} else {
this.taskHasMore = false;
this.loadStatus='noMore';
}
//下面的isOne没有看太明白后续要去掉
if (this.isOne) {
this.value = this.taskCount;
}
if (this.isOne && res.result.records.length == 0) {
if (this.isOne && res.data.records.length == 0) {
this.tabIndex = 1;
}
this.isOne = false;
@@ -644,30 +541,7 @@
}).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)];
@@ -709,32 +583,12 @@
this.tabIndex = idx;
if (this.tabIndex == 1 && this.studyList.length == 0) {
this.getLearning()
// this.searchData();
} else if (this.tabIndex == 2) {
this.history()
//this.history()
} else if (this.tabIndex == 0 && this.couresList.length == 0) {
this.loadBoeData()
}
},
history(flag) {
let hist = {
courseName: this.hiskeyword,
courseType: this.hisclassType,
status: this.status,
isFinish: true
}
if (this.keyWord) {
hist.courseName = this.keyWord;
}
apicourseStudy.myStudyList(
hist
).then(res => {
if (res.status == 200) {
this.historyList = res.result;
}
})
},
loadCouserTeacher(list, ids) { //临时解决方案,单独的查询课程教师
let that = this;
//先查课程关联教师iD
@@ -759,54 +613,81 @@
}
})
},
async getLearning() {
uni.showLoading({
title: '加载中...'
});
this.loadStatus = 'loading';
let data = [];
async getLearning(flag) {
if(flag){
this.studyPageIndex=1;
this.studyList=[];
}
this.studyLoadStatus='loading'
uni.showLoading({title: '加载中...' });
let lear = {
pageIndex: 1, //第几页
pageSize: 200,
pageIndex: this.studyPageIndex, //第几页
pageSize: this.studyPageSize,
courseName: this.learkeyword,
status: this.Applistatus,
}
await apicourseStudy.myStudyList(lear).then(res => {
await apicourseStudy.myStudyListFromES(lear).then(res=>{
if (res.status == 200) {
// 我报名的接口
//console.log(res)
let courseIds = [];
res.result.list.forEach(item => {
res.result.list.forEach(item=>{
item.delcour = false;
item.teachersName = '';
item.addTime = item.addTime.split(' ')[0];
courseIds.push(item.courseId);
})
//console.log(courseIds,'courseIds')
this.loadCouserTeacher(res.result.list, courseIds);
data.push(...res.result.list);
}
})
let learData = {
page: 1,
size: 200,
type: this.classType
}
await apiBoeCourse.myLearning(learData).then(res => {
if (res.status == 200) {
res.result.dataList.forEach(item => {
item.delcour = false;
})
let list = this.filterConversion(res.result.dataList);
data.push(...list);
this.studyCount=res.result.count;
this.studyPages=res.result.totalPages;
if(this.studyPageIndex<this.studyPages){
this.studyLoadStatus = 'more';
}else{
this.studyLoadStatus = 'noMore';
}
this.studyList.push(...res.result.list);
}else{
this.loadStatus = 'noMore';
console.log('查询学习的课程错误'+res.message);
}
})
this.loadStatus = 'noMore';
this.studyList = data;
this.studyData = data;
uni.hideLoading();
// await apicourseStudy.myStudyList(lear).then(res => {
// if (res.status == 200) {
// // 我报名的接口
// //console.log(res)
// let courseIds = [];
// res.result.list.forEach(item => {
// item.delcour = false;
// item.teachersName = '';
// item.addTime = item.addTime.split(' ')[0];
// courseIds.push(item.courseId);
// })
// //console.log(courseIds,'courseIds')
// this.loadCouserTeacher(res.result.list, courseIds);
// data.push(...res.result.list);
// }
// })
// let learData = {
// page: 1,
// size: 200,
// type: this.classType
// }
// await apiBoeCourse.myLearning(learData).then(res => {
// if (res.status == 200) {
// res.result.dataList.forEach(item => {
// item.delcour = false;
// })
// let list = this.filterConversion(res.result.dataList);
// data.push(...list);
// }
// })
//this.studyList = data;
//this.studyData = data;
},
filterConversion(data) {
let list = [];
@@ -843,66 +724,23 @@
this.studyResetShow = false;
},
toStudy(citem) {
if (isNaN(citem.courseType)) {
if (citem.source==1) {
uni.navigateTo({
url: '/pages/study/studydetail?id=' + citem.id + '&type=' + citem.courseType
});
} else {
uni.navigateTo({
url: '/pages/study/courseStudy?studyId=' + citem.id + '&id=' + citem.courseId
})
}else if (citem.source==2){
uni.navigateTo({
url: '/pages/study/courseStudy?studyId=' + citem.id + '&id=' + citem.courseId
})
}else if (citem.source==3){
let params=encodeURIComponent('courseId='+citem.courseId);
uni.navigateTo({
url:'/pages/forward?to=/manageApi/stu/project/redirectDetail&params=&params='+params
});
}else{
console.log('不支持的数据来源 '+citem.source)
}
},
choose(citem) {
if (citem.courseType == 10) {
uni.navigateTo({
url: '../resource/microDetail?studyId=' + citem.id + '&id=' + citem.courseId
})
} else if (citem.courseType == 20) {
uni.navigateTo({
url: '/pages/study/onlineCourse?studyId=' + citem.id + '&id=' + citem.courseId
})
}
},
// 自主学习选择状态事件
// chooseStatus(e) {
// this.statusSelectShow = false;
// this.statusBtnName = e.value[0].name;
// this.autonomy.status = e.value[0].value;
// this.searchData();
// },
// 自主学习选择类型事件
// chooseStatust(e) {
// this.statusSelecShow = false;
// this.statusBtns = e.value[0].name;
// this.autonomy.type = e.value[0].value;
// // this.learning()
// this.searchData();
// },
// 历史记录选择类型事件
// hischooseStatus(e) {
// this.hisstatusSelectShow = false;
// this.hisstatusBtnName = e.value[0].name;
// this.hisswitch = e.value[0].value;
// if (this.hisswitch == 10) {
// this.hisclassType = 10
// this.history()
// } else {
// this.hisclassType = 20
// this.history()
// }
// },
// loadchooseStatust(e) {
// this.boeStatus = e;
// this.loadBoeData()
// },
// Application(e) {
// this.classType = e;
// this.autonomy.type = e;
// this.searchData();
// this.getLearning();
// },
displayWord(data) {
if (data.progress == 0) {
return '未开始'
@@ -911,9 +749,6 @@
} else {
return '进行中'
}
},
jumpToDetail(data) {
console.log(data, "是佛法和")
}
}
}
@@ -1065,36 +900,36 @@
}
}
.xuan {
width: 325px;
margin: 0px auto;
padding-top: 130px;
// .xuan {
// width: 325px;
// margin: 0px auto;
// padding-top: 130px;
.xuan-info {
height: 480px;
background: #99beff;
position: relative;
// .xuan-info {
// height: 480px;
// background: #99beff;
// position: relative;
.xuan-close {
position: absolute;
right: 10px;
top: 5px;
z-index: 19;
}
// .xuan-close {
// position: absolute;
// right: 10px;
// top: 5px;
// z-index: 19;
// }
.xuan-box {
width: 325px;
height: 407px;
}
// .xuan-box {
// width: 325px;
// height: 407px;
// }
.xuan-btn {
margin-top: 10px;
padding-left: 30px;
width: 100%;
height: 40px;
}
}
}
// .xuan-btn {
// margin-top: 10px;
// padding-left: 30px;
// width: 100%;
// height: 40px;
// }
// }
// }
.sea-show {
padding: 20upx 30upx 10upx 30upx;