diff --git a/src/api/request.js b/src/api/request.js index 9192e02..1e8f263 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,9 +1,11 @@ import router from "@/router"; -import { reactive, ref, toRefs, watch } from "vue"; +import {reactive, ref, toRefs, watch} from "vue"; import axios from 'axios'; -import { getCookie } from "@/api/utils"; +import {getCookie} from "@/api/utils"; import JSONBigInt from 'json-bigint'; -const JSONBigIntStr = JSONBigInt({ storeAsString: true }); + +const JSONBigIntStr = JSONBigInt({storeAsString: true}); + export function usePage(_url, param, callback) { const state = reactive({ @@ -12,11 +14,11 @@ export function usePage(_url, param, callback) { total: 0, size: 10, current: 1, - params: { pageNo: 1, pageSize: 10, ...param } + params: {pageNo: 1, pageSize: 10, ...param} }) watch(param, () => { - state.params = { ...state.params, ...param } + state.params = {...state.params, ...param} fetchData() }) @@ -88,14 +90,20 @@ export async function request(_url, params) { method, headers: { 'token': getCookie('token'), - ...method !== 'get' ? { 'Content-Type': 'application/json' } : {} + ...method !== 'get' ? {'Content-Type': 'application/json'} : {} }, baseURL: import.meta.env.VITE_BASE_API, - ...method !== 'get' ? { data: JSON.stringify(body) } : {} + ...method !== 'get' ? {data: JSON.stringify(body)} : {} }).then(resp => resp.data).then(response => { if (response.code !== 200 && response.code !== 0) { 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') + (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'}) @@ -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'}) }) } @@ -132,16 +136,16 @@ export async function boeRequest(_url, params) { } } const body = method !== 'get' ? params || {} : {} - return fetch(url,{ + return fetch(url, { method, - headers:{ + headers: { token: getCookie('token'), ...method !== 'get' ? {'Content-Type': 'application/json'} : {} }, ...method !== 'get' ? {body: JSON.stringify(body)} : {} - }).then(res=>{ + }).then(res => { return res.text() - }).then(res=>{ + }).then(res => { return JSONBigIntStr.parse(res) }) } \ No newline at end of file diff --git a/src/views/faceteach/FaceTeach.vue b/src/views/faceteach/FaceTeach.vue index 20ca5cd..9f66a63 100644 --- a/src/views/faceteach/FaceTeach.vue +++ b/src/views/faceteach/FaceTeach.vue @@ -34,25 +34,9 @@
{{ data.planDto?.address }}
-
-
- - {{ data.signFlag ? "已签到" : "签到" }} - - - {{ data.isSurvery ? "已评估" : "评估" }} - -
-
-
+
- + {{ data.signFlag ? "已签到" : "签到" }} @@ -99,50 +83,39 @@
{{ el.name? el.name : el.slice(el.lastIndexOf('/')+1,el.indexOf('-')) + el.slice(el.lastIndexOf('.')) }}
-
+
下载
-
- -
- 下载 -
-
+ + + + + +
-
-
-
{{ data.workDto?.workName }}
-
-
必修
-
作业
-
-
- - -
- 交作业 -
-
- 交作业 -
+
+
{{ data.workDto?.workName }}
+
+
必修
+
作业
+
+
+
+ 交作业 +
-
+
此课程无作业
@@ -160,9 +133,7 @@
考试
-
去考试 @@ -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 }); - } + 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: "面授课", diff --git a/src/views/faceteach/FaceTeachNoCommon.vue b/src/views/faceteach/FaceTeachNoCommon.vue index 979db7e..5c92105 100644 --- a/src/views/faceteach/FaceTeachNoCommon.vue +++ b/src/views/faceteach/FaceTeachNoCommon.vue @@ -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"; diff --git a/src/views/faceteach/FaceTeachSignUp.vue b/src/views/faceteach/FaceTeachSignUp.vue index 3e5b6e9..795530d 100644 --- a/src/views/faceteach/FaceTeachSignUp.vue +++ b/src/views/faceteach/FaceTeachSignUp.vue @@ -22,7 +22,7 @@
+ :src="data.offcourseDto?.picUrl" alt="">
【面授课】{{ data.planDto?.name }}
@@ -39,7 +39,7 @@
{{ data.planDto?.address }}
- {{data.isSignUp?'已报名':'立即报名'}} + {{data.isSignUp?'已报名':'立即报名'}}
@@ -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) diff --git a/src/views/project/ProjectDetails.vue b/src/views/project/ProjectDetails.vue index fd6fe30..ff69fd3 100644 --- a/src/views/project/ProjectDetails.vue +++ b/src/views/project/ProjectDetails.vue @@ -117,7 +117,7 @@
@@ -299,7 +299,7 @@ const { data } = useRequest(PROJECT_PROCESS, { console.log("datadata", data); const loading = ref(false); -loading.value = ElLoading.service({ +loading.value = ElLoading.service({ lock: true, text: 'Loading', background: 'rgba(0, 0, 0, 0.7)' @@ -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") { diff --git a/src/views/roadmap/PathDetails.vue b/src/views/roadmap/PathDetails.vue index b0477e3..1ec9a45 100644 --- a/src/views/roadmap/PathDetails.vue +++ b/src/views/roadmap/PathDetails.vue @@ -339,8 +339,8 @@ const types = ref({ }, path: { 1: import.meta.env.VITE_BOE_ONLINE_CLASS_URL, //在线 - 2: "/faceteach", - 3: import.meta.env.VITE_BOE_CASS_DETAIL_URL, //案例 + 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, //考试 6: "/livebroadcast",