-- fix 课程公开报名

This commit is contained in:
yuping
2023-01-17 04:32:33 +08:00
parent 56e935dfce
commit b4458895ee
6 changed files with 56 additions and 95 deletions

View File

@@ -3,7 +3,9 @@ import { reactive, ref, toRefs, watch } from "vue";
import axios from 'axios';
import {getCookie} from "@/api/utils";
import JSONBigInt from 'json-bigint';
const JSONBigIntStr = JSONBigInt({storeAsString: true});
export function usePage(_url, param, callback) {
const state = reactive({
@@ -97,6 +99,12 @@ export async function request(_url, params) {
if (response.code === 1000) {
(import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') ? router.push({path: '/login'}) : window.open(import.meta.env.VITE_BASE_LOGIN_URL, '_top')
}
if (response.code === 2001) {
router.push({path: '/FaceTeachSignUp', query: {courseId: router.currentRoute.value.query.courseId,type:3}})
}
if (response.code === 2002) {
router.push({path: '/FaceTeachNoCommon', query: {courseId: router.currentRoute.value.query.courseId,type:3}})
}
// if (import.meta.env.DEV && response.code === 1000) {
// router.push({path: '/login'})
// } else {
@@ -106,12 +114,8 @@ export async function request(_url, params) {
// duration: 2,
// });
// }
throw new Error('接口异常')
}
return response
}).catch(e => {
console.log('eeeee', e)
// router.push({path: '/login'})
})
}

View File

@@ -34,23 +34,7 @@
<div style="margin-left: 8px">{{ data.planDto?.address }}</div>
</div>
</div>
<div v-if="projectStatus && projectEndTime">
<div v-if="projectStatus !=='3' && new Date(projectEndTime).getTime() > new Date().getTime()" style="display: flex">
<botton class="btn" style="margin-right: 20px" :style="{
background: isAllowSign? data.signFlag ? '#999' : 'rgb(57, 146, 249)':'#999',
}" @click="signClick">{{ 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="{
background: `${new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}" class="btn" @click="toSurvery">{{ data.isSurvery ? "已评估" : "评估" }}
</botton>
</div>
</div>
<div v-else>
<div >
<div style="display: flex">
<botton class="btn" style="margin-right: 20px" :style="{
@@ -99,25 +83,24 @@
<FileTypeImg :v-model="el.name? el.name : el.slice(el.lastIndexOf('/')+1,el.indexOf('-')) + el.slice(el.lastIndexOf('.'))" :style="{width: '22px',height: '26px',marginLeft: '10px',}"></FileTypeImg>
<div style="margin-left: 20px">{{ el.name? el.name : el.slice(el.lastIndexOf('/')+1,el.indexOf('-')) + el.slice(el.lastIndexOf('.')) }}</div>
</div>
<div v-if="projectStatus !=='3' && new Date(projectEndTime).getTime() > new Date().getTime()" >
<div>
<div v-if="new Date(data.planDto.beginTime).getTime() > new Date().getTime()" class="download">
<img style="width: 16px; height: 15px" src="../../assets/image/download.png" />
<div style="margin-left: 5px;color:#999;" @click="downloads(el)">
下载
</div>
</div>
<div v-else class="download">
<img style="width: 16px; height: 15px" src="../../assets/image/download.png" />
<div style="margin-left: 5px" @click="download(el.name? el.response.data : el)">
下载
</div>
</div>
<!-- <div v-else class="download">-->
<!-- <img style="width: 16px; height: 15px" src="../../assets/image/download.png" />-->
<!-- <div style="margin-left: 5px" @click="download(el.name? el.response.data : el)">-->
<!-- 下载-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="课程作业" name="second">
<div class="work" v-if="data.workDto">
<div>
<div class="question">{{ data.workDto?.workName }}</div>
@@ -126,23 +109,13 @@
<div class="tag3" style="margin-left: 11px">作业</div>
</div>
</div>
<div
v-if="projectStatus !=='3' && new Date(projectEndTime).getTime() > new Date().getTime()"
:style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }"
class="submit" @click="toWork">
交作业
</div>
<div
v-else-if="projectStatus == undefined && projectEndTime==undefined"
:style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }"
class="submit" @click="toWork">
交作业
</div>
</div>
<div v-else
style=" font-size: 14px; font-weight: 400; line-height: 24px; cursor: pointer;margin-left: 40px;margin-top: 20px; ">
<div v-else style=" font-size: 14px; font-weight: 400; line-height: 24px; cursor: pointer;margin-left: 40px;margin-top: 20px; ">
此课程无作业
</div>
</el-tab-pane>
@@ -160,9 +133,7 @@
<div class="tag3" style="margin-left: 11px">考试</div>
</div>
</div>
<div
v-if="projectStatus !=='3' && new Date(projectEndTime).getTime() > new Date().getTime()"
:style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }"
class="submit" @click="toExamItem(data.examinationDto)">
去考试
@@ -218,12 +189,10 @@ const returnclick = () => {
router.back();
};
const {
query: { courseId, type, id: taskId, projectStatus, projectEndTime },
query: { courseId, type, id: taskId },
} = useRoute();
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
console.log("datadatadatadatadatadatadata", data);
console.log("项目状态字段传递", projectStatus, projectEndTime);
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId,usePermission:true });
const teacherInfo = useUserInfo(
computed(() => data.value?.planDto?.teacherId)
);
@@ -249,7 +218,7 @@ function formateArr(strs) {
try{
newArr = JSON.parse(strs)
} catch {
newArr = strs.split(',')
newArr = strs?.split(',')
}
console.log('112233', newArr)
return newArr
@@ -330,11 +299,7 @@ const signClick = () => {
data.value.signFlag = 1;
ElMessage.warning("签到成功");
if (taskId) {
request(TASK_OFFCOURSE_SIGN, { courseId: courseId, taskId, type });
} else {
request(TASK_OFFCOURSE_NOTASK_SIGN, { courseId: courseId });
}
};
function toSurvery() {
@@ -379,7 +344,7 @@ function toWork() {
query: {
courseId: data.value.workDto.workId,
id: taskId,
infoId: data.value.offcourseDto.offcourseId,
infoId: data.value.planDto.offcoursePlanId,
chapterOrStageId: 0,
type,
pName: "面授课",

View File

@@ -126,9 +126,6 @@ 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,
FACETEACH_SIGNUP
} from "@/api/api";
import {useRoute, useRouter} from "vue-router";

View File

@@ -22,7 +22,7 @@
<div class="bascinfo">
<div style="display:flex;">
<img style="width:405px;height:230px;margin-left: 48px;border-radius: 8px;margin-top: 40px;"
:src="data.offcourseDto.picUrl" alt="">
:src="data.offcourseDto?.picUrl" alt="">
<div style="margin-left: 40px;margin-top: 56px;">
<div class="title">面授课{{ data.planDto?.name }}</div>
<div class="time" style="margin-top: 30px">
@@ -39,7 +39,7 @@
<div style="margin-left: 8px">{{ data.planDto?.address }}</div>
</div>
<div class="time" style="margin-top: 37px">
<botton class="btn" style="margin-right: 20px;width: 160px;height: 46px;" v-if="data.planDto.applyFlag" @click="onLineSignUp" :style="{ background: data.isSignUp ? '#999' : 'rgb(57, 146, 249)'}">{{data.isSignUp?'已报名':'立即报名'}}</botton>
<botton class="btn" style="margin-right: 20px;width: 160px;height: 46px;" v-if="data.hasTask || data.planDto.applyFlag" @click="onLineSignUp" :style="{ background: data.isSignUp ? '#999' : 'rgb(57, 146, 249)'}">{{data.isSignUp?'已报名':'立即报名'}}</botton>
</div>
</div>
</div>
@@ -126,9 +126,6 @@ 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,
FACETEACH_SIGNUP
} from "@/api/api";
import {useRoute, useRouter} from "vue-router";
@@ -144,7 +141,7 @@ const {
query: {courseId, type, id: taskId},
} = useRoute();
const {data} = useRequest(STU_OFFCOURSE_DETAIL, {courseId});
const {data = {}} = useRequest(STU_OFFCOURSE_DETAIL, {courseId});
const teacherInfo = useUserInfo(
computed(() => data.value?.planDto?.teacherId)

View File

@@ -361,7 +361,7 @@ const types = ref({
},
path: {
1: import.meta.env.VITE_BOE_ONLINE_CLASS_URL, //在线
2: "/faceteach",
2: ({ courseId }) => window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${courseId}`, '_top'),
3: import.meta.env.VITE_BOE_CASS_DETAIL_URL, //案例
4: "/homeworkpage",
5: import.meta.env.VITE_BOE_EXAM_DETAIL_URL, //考试
@@ -526,8 +526,6 @@ function toFinish(d, sName, chapterOrStageId) {
pName: data.value.name,
sName,
chapterOrStageId,
projectStatus: data.value.status?data.value.status:0, // 项目状态 -- 用于判断当前项目是否已经结束
projectEndTime: data.value.endTime?data.value.endTime:0 // 项目结束 -- 用于判断当前项目是否已经结束
},
});
} else if (typeof types.value.path[d.type] === "function") {

View File

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