--demand 面授课

This commit is contained in:
yuping
2023-03-17 03:07:58 +08:00
parent 2481ceebf4
commit b595cd6092
7 changed files with 113 additions and 277 deletions

View File

@@ -35,7 +35,7 @@ export const TASK_TYPES = {
},
path: {
1: ({courseId}) => window.open(window.location.protocol + import.meta.env.VITE_BOE_ONLINE_CLASS_URL + courseId), //在线
2: ({courseId}) => window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${courseId}`, '_top'),
2: ({targetId}) => window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${targetId}`, '_top'),
3: ({courseId}) => window.open(window.location.protocol + import.meta.env.VITE_BOE_CASS_DETAIL_URL + courseId), //案例
4: "/homeworkpage",
5: ({examType}) => examType === 2 ? '/externalexamination' : (window.location.protocol + import.meta.env.VITE_BOE_EXAM_DETAIL_URL), //考试

View File

@@ -23,7 +23,8 @@
class="img2"
style="margin-right: 11px; cursor: pointer"
src="../../assets/image/return.png"
/>返回</el-button
/>返回
</el-button
>
</div>
</div>
@@ -60,19 +61,10 @@
<botton
class="btn"
style="margin-right: 20px"
:style="{
background: isAllowSign
? data.signFlag
? '#999'
: 'rgb(57, 146, 249)'
: '#999',
}"
:style="{ background: isAllowSign && !data.signFlag ?'rgb(57, 146, 249)' : '#999' }"
@click="signClick"
>{{ data.signFlag ? "已签到" : "签到" }}
>{{ data.signFlag ? "已签到" : "签到" }}
</botton>
<!-- <botton style="background: #999" class="btn" @click="toSurvery" v-if="data.planDto?.evalFlag == 0">
评估
</botton> -->
<botton
v-if="data.planDto?.evalFlag !== 0"
:style="{
@@ -87,7 +79,7 @@
}"
class="btn"
@click="toSurvery"
>{{ data.isSurvery ? "已评估" : "评估" }}
>{{ data.isSurvery ? "已评估" : "评估" }}
</botton>
</div>
</div>
@@ -155,7 +147,7 @@
el.name
? el.name
: el.slice(el.lastIndexOf("/") + 1, el.indexOf("-")) +
el.slice(el.lastIndexOf("."))
el.slice(el.lastIndexOf("."))
}}
</div>
</div>
@@ -291,41 +283,39 @@
</div>
<!-- todo #面授课接口 讲师缺少img和介绍-->
<div class="teacheritem">
<img class="peopleimg" :src="teacherInfo.avatar" />
<img class="peopleimg" :src="teacherInfo.avatar"/>
<div class="nameSpan">
<div class="teacherName" style="margin-right: 5px">
{{ data.planDto?.teacher }}
</div>
<div class="introduce">{{ data.planDto?.bandDesc }}</div>
</div>
<!-- <div class="follow">+ 关注</div>-->
</div>
</div>
</div>
<!-- 详细信息 -->
</div>
</template>
<script setup>
import { computed, reactive, toRefs, watch, onUnmounted, ref } from "vue";
import {computed, onBeforeMount, onUnmounted, ref} from "vue";
import FileTypeImg from "@/components/FileTypeImg.vue";
import { request, useRequest } from "@/api/request";
import {
STU_OFFCOURSE_DETAIL,
TASK_OFFCOURSE_NOTASK_SIGN,
TASK_OFFCOURSE_SIGN,
TASK_BROADCAST_SIGN,
} from "@/api/api";
import { useRoute, useRouter } from "vue-router";
import { useUserInfo } from "@/api/utils";
import { ElMessage, messageConfig } from "element-plus";
import {request, useRequest} from "@/api/request";
import {STU_OFFCOURSE_DETAIL, TASK_OFFCOURSE_NOTASK_SIGN,} from "@/api/api";
import {useRoute, useRouter} from "vue-router";
import {useUserInfo} from "@/api/utils";
import {ElMessage} from "element-plus";
import dayjs from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
const router = useRouter();
onBeforeMount(() => dayjs.extend(isBetween));
const returnclick = () => {
router.back();
};
const {
query: { courseId, type, id: taskId },
query: { courseId },
} = useRoute();
const { data } = useRequest(STU_OFFCOURSE_DETAIL, {
@@ -333,140 +323,51 @@ const { data } = useRequest(STU_OFFCOURSE_DETAIL, {
usePermission: true,
});
const teacherInfo = useUserInfo(computed(() => data.value?.planDto?.teacherId));
const isAllowSign = computed(() => dayjs().isBetween(dayjs(data.value.planDto?.beginTime).subtract(data.value.beforeStart || 0, "minute"), dayjs(data.value.afterStart ? data.value.planDto?.beginTime : data.value.planDto?.endTime).add(data.value.afterStart || 0, "minute")));
const state = reactive({
activeName: "first",
enclosure: "",
isAllowSign: false,
});
const { activeName, enclosure, isAllowSign } = toRefs(state);
const handleClick = (tab, event) => {
console.log("附件", tab, event);
};
const activeName = ref("first");
const fielPath = ref(import.meta.env.VITE_FILE_PATH);
const download = (url) => {
console.log(fielPath.value+url)
window.open(fielPath.value+url);
console.log(fielPath.value + url);
window.open(fielPath.value + url);
};
const downloads = (url) => {
ElMessage.warning("未到开始时间,请耐心等待!");
};
function formateArr(strs) {
let newArr = [];
let newArr;
try {
newArr = JSON.parse(strs);
} catch {
newArr = strs?.split(",");
}
console.log("112233", newArr);
return newArr;
}
let timer = null;
//判断能否签到
function isSignClick() {
timer = setInterval(() => {
let beginTime = new Date(data.value.planDto?.beginTime).getTime();
let endTime =
!data.value.planDto?.afterStart || data.value.afterStart == "0"
? new Date(data.value.planDto?.endTime).getTime()
: new Date(data.value.planDto?.beginTime).getTime();
let nowTime = new Date().getTime();
if (
data.value.planDto?.beforeStart &&
data.value.planDto?.afterStart &&
data.value.beforeStart !== "0" &&
data.value.afterStart !== "0"
) {
//有开始前有开始后
beginTime = beginTime - data.value.planDto?.beforeStart * 60 * 1000;
endTime = endTime + data.value.planDto?.afterStart * 60 * 1000;
console.log("1111");
} else if (
data.value.planDto?.beforeStart &&
!data.value.planDto?.afterStart &&
data.value.beforeStart !== "0" &&
data.value.afterStart == "0"
) {
//只有开始前无开始后
beginTime = beginTime - data.value.planDto?.beforeStart * 60 * 1000;
console.log("11112222");
} else if (
!data.value.planDto?.beforeStart &&
data.value.planDto?.afterStart &&
data.value.beforeStart == "0" &&
data.value.afterStart !== "0"
) {
//无开始前有开始后
endTime = endTime + data.value.planDto?.afterStart * 60 * 1000;
console.log("1111333");
}
if (nowTime < endTime && nowTime > beginTime) {
state.isAllowSign = true;
} else {
state.isAllowSign = false;
}
// console.log(
// "isAllowSign",
// state.isAllowSign,
// nowTime,
// endTime,
// beginTime,
// nowTime < endTime,
// nowTime > beginTime
// );
}, 1000);
}
isSignClick();
//签到
const signClick = () => {
if (data.value.signFlag) {
return;
}
// console.log(
// "data.signFlag",
// data.value.signFlag,
// state.isAllowSign,
// !state.isAllowSign
// );
//if (data.value.planDto.beginTime) {
// let date1 = new Date(data.value.planDto.beginTime).getTime()
// let date2 = new Date().getTime()
// if (date1 > date2) {
// ElMessage.info("未到开始时间,请耐心等待!");
// return;
// }
//}
if (!state.isAllowSign) {
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
if (!isAllowSign.value) {
ElMessage.warning("未在允许签到时间范围内");
return;
}
data.value.signFlag = 1;
ElMessage.warning("签到成功");
let taskId = courseId
console.log("taskId:" + taskId)
console.log("courseId:" + courseId)
console.log("请求入参:" + JSON.stringify( { courseId: courseId,taskId: taskId,type:type }))
request(TASK_OFFCOURSE_NOTASK_SIGN, { courseId: courseId,taskId: taskId,type:type });
request(TASK_OFFCOURSE_NOTASK_SIGN, { courseId: courseId, taskId: courseId, type: 3 });
};
function toSurvery() {
if (data.value.isSurvery) {
// return;
}
if (
data.value.planDto.beginTime &&
dayjs().isBefore(data.value.planDto.beginTime)
) {
if (dayjs().isBefore(data.value.planDto.beginTime)) {
ElMessage.warning("课程未开始,请耐心等待!");
return;
}
if (data.value.planDto.evalFlag == 0) {
if (!data.value.planDto.evalFlag) {
ElMessage.warning("此课程无评估");
return;
}
@@ -485,13 +386,10 @@ function toSurvery() {
}
function toWork() {
console.log(data)
if (data.value.planDto.beginTime) {
let date1 = new Date(data.value.planDto.beginTime).getTime();
let date2 = new Date().getTime();
if (date1 > date2) {
ElMessage.warning("未到开始时间,请耐心等待!");
}
console.log(data);
if (dayjs().isBefore(data.value.planDto.beginTime)) {
ElMessage.warning("未到开始时间,请耐心等待!");
return;
}
router.push({
path: "/homeworkpage",
@@ -500,7 +398,7 @@ function toWork() {
id: taskId,
infoId: data.value.planDto.id,
chapterOrStageId: 0,
type,
type:3,
pName: "面授课",
sName: data.value.planDto.name,
},
@@ -517,29 +415,23 @@ function toExamItem(obj) {
}
console.log("obj", obj, obj.examType);
// 判断内部还是外部考试
if(obj.examType==2){
if (obj.examType == 2) {
router.push({
path: '/externalexamination',
query: {
courseId: obj.id,
type: 3,
exname: obj.examinationName, // 考试名称
pName: "面授课",
sName: data.value.planDto.name
},
});
}else{
path: "/externalexamination",
query: {
courseId: obj.id,
type: 3,
exname: obj.examinationName, // 考试名称
pName: "面授课",
sName: data.value.planDto.name
},
});
} else {
window.open(
window.location.protocol + import.meta.env.VITE_BOE_EXAM_DETAIL_URL + obj.examinationTestId,
"_top"
);
}
// window.open(
// window.location.protocol + import.meta.env.VITE_BOE_EXAM_DETAIL_URL + obj.examinationTestId,
// "_top"
// );
//测评
// router.push({ path: import.meta.env.VITE_BOE_EXAM_DETAIL_URL+ obj.examinationTestId });
}
onUnmounted(() => {
@@ -549,7 +441,6 @@ onUnmounted(() => {
});
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
.faceteach {
.crumb {

View File

@@ -158,7 +158,6 @@ const handleClick = (tab, event) => {
};
const download = (url) => {
console.log('下载url',url)
// window.open(url);
};
const downloads = (url) => {
ElMessage.warning("未在有效时间范围内,请耐心等待!");
@@ -177,7 +176,6 @@ function onLineSignUp() {
function formateArr(strs) {
let arrs = strs.split(',')
console.log('112233', arrs)
return arrs
}
</script>

View File

@@ -121,7 +121,7 @@
</template>
<script setup>
import {computed, reactive, toRefs, watch, onUnmounted} from "vue";
import {computed, reactive, toRefs, watch, onUnmounted, ref} from "vue";
import FileTypeImg from "@/components/FileTypeImg.vue";
import {request, useRequest} from "@/api/request";
import {
@@ -143,16 +143,9 @@ const {
const {data} = useRequest(STU_OFFCOURSE_DETAIL, {courseId});
const teacherInfo = useUserInfo(
computed(() => data.value?.planDto?.teacherId)
);
const teacherInfo = useUserInfo(computed(() => data.value?.planDto?.teacherId));
const activeName = ref("first");
const state = reactive({
activeName: "first",
enclosure: "",
isAllowSign: false,
});
const {activeName, enclosure, isAllowSign} = toRefs(state);
const handleClick = (tab, event) => {
console.log("附件", tab, event);
};
@@ -181,7 +174,6 @@ function formateArr(strs) {
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
.faceteach {
.crumb {

View File

@@ -321,7 +321,7 @@
</div>
</template>
<script setup>
import {computed, reactive, toRefs, watch, onUnmounted, ref} from "vue";
import {computed, reactive, toRefs, watch, onUnmounted, ref, onBeforeMount} from "vue";
import FileTypeImg from "@/components/FileTypeImg.vue";
import {request, useRequest} from "@/api/request";
import {
@@ -337,49 +337,30 @@ import {useRoute, useRouter} from "vue-router";
import {useUserInfo} from "@/api/utils";
import {ElMessage, messageConfig} from "element-plus";
import dayjs from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
const router = useRouter();
onBeforeMount(() => dayjs.extend(isBetween));
const returnclick = () => {
router.back();
};
const {
query: {courseId, type, id: taskId},
} = useRoute();
const { query: {courseId} } = useRoute();
const {data = {}} = useRequest(STU_OFFCOURSE_DETAIL, {courseId});
const teacherInfo = useUserInfo(
computed(() => data.value?.planDto?.teacherId)
);
const state = reactive({
activeName: "first",
enclosure: "",
isAllowSign: false,
});
const {activeName, enclosure, isAllowSign} = toRefs(state);
const teacherInfo = useUserInfo( computed(() => data.value?.planDto?.teacherId));
const activeName = ref("first");
const isAllowSign = computed(() => dayjs().isBetween(dayjs(data.value.planDto?.beginTime).subtract(data.value.beforeStart || 0, "minute"), dayjs(data.value.afterStart ? data.value.planDto?.beginTime : data.value.planDto?.endTime).add(data.value.afterStart || 0, "minute")));
const handleClick = (tab, event) => {
console.log("附件", tab, event);
};
const fielPath = ref(import.meta.env.VITE_FILE_PATH);
const download = (url) => {
// console.log('下载url',fielPath.value+url)
window.open(fielPath.value+url);
// window.open(url);
};
const downloads = (url) => {
ElMessage.warning("未在有效时间范围内,请耐心等待!");
};
//判断能否报名 (TODO-大于面授课截止时间就不能报名了,其余均可以)
function isSignClick() {
let endTime = new Date(data.value.planDto?.endTime).getTime()
let nowTime = new Date().getTime();
if (nowTime < endTime) {
state.isAllowSign = true;
} else {
state.isAllowSign = false;
}
console.log(state.isAllowSign)
}
watch(data,()=>{
isSignClick();
})
// 查看更多-展开回复列表
function lookMore(i) {
i == spreadReply.value ? spreadReply.value = -1 : spreadReply.value = i;
@@ -411,7 +392,6 @@ const getData = () => {
submitReplayLoading.value = false;
clearText()
}).catch(err=>{
console.log(err)
submitLoading.value = false;
submitReplayLoading.value = false;
})
@@ -536,8 +516,7 @@ function submitReplayComment() {
}
// 报名
function onLineSignUp(isAgain) {
if (!state.isAllowSign) {
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
if (!isAllowSign.value) {
ElMessage.warning("未在允许报名时间范围内");
return;
}
@@ -552,9 +531,7 @@ function onLineSignUp(isAgain) {
ElMessage.success(isAgain? "重新报名成功" : "报名成功");
}
function formateArr(strs) {
let arrs = strs.split(',')
console.log('112233', arrs)
return arrs
return strs?.split(',')
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->

View File

@@ -47,14 +47,6 @@
<div class="tag3" style="margin-right: 11px; margin-top: 16px">
{{ TASK_TYPES.typeName[value.type] || "" }}
</div>
<!-- <div-->
<!-- v-for="(item, key) in value.flag"-->
<!-- :key="key"-->
<!-- :class="{1:'tag1',2:'tag2',3:'tag3',4:'tag4'}[item.type]"-->
<!-- style="margin-right: 11px; margin-top: 16px"-->
<!-- >-->
<!-- {{ item.name }}-->
<!-- </div>-->
</div>
<div v-if="value.type == 1" class="progressBox">
<div>当前进度</div>
@@ -77,30 +69,18 @@
</div>
</div>
</div>
<div class="goclass" @click="toFinish(value, i.stageName, i.id)"
:style="{ background: (value.statusName !== '已结束' && (value.statusName || data.unlockMode === 1)) ? '#2478ff' : '#999' }">
{{ value.statusName || (data.unlockMode === 1 ? TASK_TYPES.toName[value.type] : '未解锁') }}
</div>
<!-- <div :style="{ display: value.status === 1 ? 'block' : 'none' }">-->
<!-- <div-->
<!-- class="goclass"-->
<!-- :style="{ display: value.currentRatio === 0 ? 'none' : 'flex' }">去上课-->
<!-- </div>-->
<!-- <img-->
<!-- style="width: 76px; height: 76px; margin-right: 61px"-->
<!-- :style="{ display: value.currentRatio === 0 ? 'flex' : 'none' }"-->
<!-- src="../../assets/image/pathdetails/notstarted.png"-->
<!-- />-->
<!-- </div>-->
<el-dropdown trigger="click">
<div class="goclass" @click="toFinish(value, i.stageName, i.id)" :style="{ background: (value.statusName !== '已结束' && (value.statusName || data.unlockMode === 1)) ? '#2478ff' : '#999' }">
{{ value.statusName || (data.unlockMode === 1 ? TASK_TYPES.toName[value.type] : '未解锁') }}
</div>
<template #dropdown v-if="value.type===2 && value.targetId?.split(',')?.length > 1">
<el-dropdown-menu>
<el-dropdown-item v-for="(name,key) in value.targetName?.split(',')" :key="key" @click="toOffcoursePlanPage(value.targetId?.split(',')[key])">{{ name }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<!-- <div ref="contentLoadingDom" id="loadings" v-else style="width:100%;height:400px;background:red;">
</div> -->
<!-- <div class="tag1">必修</div>
<div class="tag2">选修</div>
<div class="tag3">测评</div>
<div class="tag4">#通用力</div> -->
</div>
<div class="detailR">
<!-- todo #路径详情 课程公告及共享文档缺失-->
@@ -346,15 +326,22 @@
</div>
</template>
<script setup>
import { computed, onMounted, ref, watch } from "vue";
import { ElLoading, ElMessage } from 'element-plus'
import { request } from "@/api/request";
import { CompletionList, EvaluationToLearn, PointList, STUDY_RECORD, SubmitExternalExam, QueryEvaluationTaskStatusOne } from "@/api/api";
import { useRoute, useRouter } from "vue-router";
import { PROJECT, TASK_TYPES } from "@/api/CONST";
import {computed, onMounted, ref} from "vue";
import {ElMessage} from "element-plus";
import {request} from "@/api/request";
import {
CompletionList,
EvaluationToLearn,
PointList,
QueryEvaluationTaskStatusOne,
STUDY_RECORD,
SubmitExternalExam,
UPDATE_CURRENT_TASK
} from "@/api/api";
import {useRoute, useRouter} from "vue-router";
import {PROJECT, TASK_TYPES} from "@/api/CONST";
import FileTypeImg from "@/components/FileTypeImg.vue";
import { UPDATE_CURRENT_TASK } from "@/api/api";
import { useStore } from "vuex";
import {useStore} from "vuex";
const {
query: { courseId, projectId },
@@ -369,7 +356,6 @@ onMounted(() => {
dispatch('getProjectInfo', { projectId })
})
const tableRankData = ref([])
const studyProgress = [
{
value: 2,
@@ -462,14 +448,12 @@ async function toFinish(d, sName, chapterOrStageId) {
ElMessage.error("当前任务已结束")
return
}
if (d.type == 2) {
let date1 = new Date(d.endTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = '当前面授课已结束';
dialogVisible.value = true;
//return
if (d.type === 2) {
if(!d.targetId){
return ElMessage.error("还未添加开课,请联系管理员!")
}
if(d.targetId.split(',').length>1){
return
}
}
// 作业过期判断
@@ -702,6 +686,10 @@ async function toFinish(d, sName, chapterOrStageId) {
}
}
function toOffcoursePlanPage(id){
window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${id}`, '_top')
}
function whiteTypes(type) {
return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-");
}

View File

@@ -89,28 +89,21 @@
</div>
</div>
</div>
<div v-if="isStudy=='true'" class="goclass"
:style="{ background: (value.statusName !== '已结束' && (value.statusName || data.unlockMode === 1)) ? '#2478ff' : '#999' }"
@click="toFinish(value)">
{{ value.statusName || (data.unlockMode === 1 ? TASK_TYPES.toName[value.type] : "未解锁") }}
</div>
<!-- <div :style="{ display: value.status === 1 ? 'block' : 'none' }">-->
<!-- <div-->
<!-- class="goclass"-->
<!-- :style="{ display: value.currentRatio === 0 ? 'none' : 'flex' }">去上课-->
<!-- </div>-->
<!-- <img-->
<!-- style="width: 76px; height: 76px; margin-right: 61px"-->
<!-- :style="{ display: value.currentRatio === 0 ? 'flex' : 'none' }"-->
<!-- src="../../assets/image/pathdetails/notstarted.png"-->
<!-- />-->
<!-- </div>-->
<el-dropdown trigger="click">
<div v-if="isStudy=='true'" class="goclass"
:style="{ background: (value.statusName !== '已结束' && (value.statusName || data.unlockMode === 1)) ? '#2478ff' : '#999' }"
@click="toFinish(value)">
{{ value.statusName || (data.unlockMode === 1 ? TASK_TYPES.toName[value.type] : "未解锁") }}
</div>
<template #dropdown v-if="value.type===2 && value.targetId?.split(',')?.length > 1">
<el-dropdown-menu>
<el-dropdown-item v-for="(name,key) in value.targetName?.split(',')" :key="key" @click="toOffcoursePlanPage(value.targetId?.split(',')[key])">{{ name }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<!-- <div class="tag1">必修</div>
<div class="tag2">选修</div>
<div class="tag3">测评</div>
<div class="tag4">#通用力</div> -->
</div>
<div class="detailR">
<!-- 课程公告及共享文档 -->
@@ -296,7 +289,6 @@ const returnclick = () => {
const { commit, dispatch, state } = useStore();
const userInfo = computed(() => state.userInfo);
const data = computed(() => state.routerInfo);
console.log(data);
const activeName = ref("first");
onMounted(() => {
@@ -353,13 +345,11 @@ async function toFinish(d) {
return;
}
if (d.type == 2) {
let date1 = new Date(d.endTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = "当前面授课已结束";
dialogVisible.value = true;
//return
if(!d.targetId){
return ElMessage.error("还未添加开课,请联系管理员!")
}
if(d.targetId.split(',').length>1){
return
}
}
if (d.type == 4) {