diff --git a/src/api/request.js b/src/api/request.js index 85f175f..a792cce 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,7 +1,7 @@ import router from "@/router"; import { reactive, ref, toRefs, watch } from "vue"; import axios from 'axios'; -import { getCookie } from "@/api/utils"; +import { getCookie, delCookie } from "@/api/utils"; import JSONBigInt from 'json-bigint'; const JSONBigIntStr = JSONBigInt({ storeAsString: true }); @@ -99,7 +99,8 @@ export async function request(_url, params) { if (response.code !== 200 && response.code !== 0) { console.log('window.location.', window, router) if (response.code === 1000) { - (import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') ? router.push({ path: '/login', query: { returnUrl: router.currentRoute.value.fullPath } }) : window.open(window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL + window.location.protocol + import.meta.env.VITE_BOE_BASE_URL + import.meta.env.VITE_BASE + router.currentRoute.value.fullPath, '_top') + delCookie() + (import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') ? router.push({ path: '/login', query: { returnUrl: router.currentRoute.value.fullPath } }) : window.open(window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL + window.location.protocol + import.meta.env.VITE_BOE_BASE_URL + import.meta.env.VITE_BASE + router.currentRoute.value.fullPath, '_top') } if (response.code === 2001) { router.push({ path: '/FaceTeachSignUp', query: { courseId: router.currentRoute.value.query.courseId, type: 3 } }) diff --git a/src/api/utils.js b/src/api/utils.js index e4818cd..caa69d6 100644 --- a/src/api/utils.js +++ b/src/api/utils.js @@ -2,7 +2,7 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2023-01-17 19:47:07 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2023-03-04 13:22:53 + * @LastEditTime: 2023-03-07 20:25:25 * @FilePath: /stu_h5/src/api/utils.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -23,7 +23,9 @@ export function setCookie(name, value, perpetual) { export function getCookie(name) { return document.cookie?.split(";").find(e => e.includes(name))?.replace(`${name}=`, '') || '' } - +export function delCookie() { + setCookie("token", "", -1) +} export function useUserInfo(id) { const userInfo = ref({}) watch(id, () => { diff --git a/src/views/discuss/DiscussDetail.vue b/src/views/discuss/DiscussDetail.vue index 38967f4..8bd22a1 100644 --- a/src/views/discuss/DiscussDetail.vue +++ b/src/views/discuss/DiscussDetail.vue @@ -20,7 +20,10 @@
{{ disDetail?.title }}
-
+
{{ discussInfo ? discussInfo : "-" }} @@ -625,18 +628,18 @@ function send() { } } -watch(disDetail, () => { - console.log(" disDetail.value.content", disDetail.value.content); - if (disDetail.value.content) { - let obj = disDetail.value.content; - let regex = new RegExp(" { +// console.log(" disDetail.value.content", disDetail.value.content); +// if (disDetail.value.content) { +// let obj = disDetail.value.content; +// let regex = new RegExp(" @@ -649,6 +652,9 @@ watch(disDetail, () => { } .discussdetail { width: 100%; + .discussdetail_img_class img { + max-width: 100%; + } .tithead { margin-top: 10px; height: 77px; @@ -759,6 +765,7 @@ watch(disDetail, () => { font-size: 13px; line-height: 24px; } + .tt { margin-top: 20px; background-color: #f0f3f6; diff --git a/src/views/discuss/DiscussPage.vue b/src/views/discuss/DiscussPage.vue index bf74a46..a72591d 100644 --- a/src/views/discuss/DiscussPage.vue +++ b/src/views/discuss/DiscussPage.vue @@ -53,7 +53,10 @@
{{ item.title }}
-
+
@@ -274,18 +277,18 @@ function handleCurrentChange(e, k) { getPostList(state.info.discussDtoList[0].id); } -watch(state.postList, () => { - console.log("state.postList", state.postList); - // if (data.value.offcourseDto && data.value.offcourseDto.outline) { - // let obj = data.value.offcourseDto.outline; - // let regex = new RegExp(" { +// console.log("state.postList", state.postList); +// // if (data.value.offcourseDto && data.value.offcourseDto.outline) { +// // let obj = data.value.offcourseDto.outline; +// // let regex = new RegExp(" @@ -298,6 +301,9 @@ watch(state.postList, () => { } .discusspage { width: 100%; + .discusspage_img_class img { + max-width: 100%; + } .head { margin-top: 10px; display: flex; diff --git a/src/views/faceteach/FaceTeachNoCommon.vue b/src/views/faceteach/FaceTeachNoCommon.vue index d7fcc35..5068fb3 100644 --- a/src/views/faceteach/FaceTeachNoCommon.vue +++ b/src/views/faceteach/FaceTeachNoCommon.vue @@ -73,9 +73,8 @@
@@ -232,18 +231,18 @@ function formateArr(strs) { return arrs; } -watch(data, () => { - console.log("data.offcourseDto", data.value.offcourseDto); - if (data.value.offcourseDto && data.value.offcourseDto.outline) { - let obj = data.value.offcourseDto.outline; - let regex = new RegExp(" { +// console.log("data.offcourseDto", data.value.offcourseDto); +// if (data.value.offcourseDto && data.value.offcourseDto.outline) { +// let obj = data.value.offcourseDto.outline; +// let regex = new RegExp(" @@ -251,6 +250,9 @@ watch(data, () => { .faceteachnocommon { width: 100%; padding-bottom: 20px; + .faceteachnocommon_img_class img { + max-width: 100%; + } .main { width: 100%; display: flex; diff --git a/src/views/faceteach/FaceTeachNoCourse.vue b/src/views/faceteach/FaceTeachNoCourse.vue index ba84ff9..5bae2ad 100644 --- a/src/views/faceteach/FaceTeachNoCourse.vue +++ b/src/views/faceteach/FaceTeachNoCourse.vue @@ -79,7 +79,7 @@
@@ -226,18 +226,18 @@ function formateArr(strs) { console.log("112233", arrs); return arrs; } -watch(data, () => { - console.log("data.offcourseDto", data.value.offcourseDto); - if (data.value.offcourseDto && data.value.offcourseDto.outline) { - let obj = data.value.offcourseDto.outline; - let regex = new RegExp(" { +// console.log("data.offcourseDto", data.value.offcourseDto); +// if (data.value.offcourseDto && data.value.offcourseDto.outline) { +// let obj = data.value.offcourseDto.outline; +// let regex = new RegExp(" @@ -245,6 +245,9 @@ watch(data, () => { .faceteachnocourse { width: 100%; padding-bottom: 20px; + .faceteachnocourse_img_class img { + max-width: 100%; + } .main { width: 100%; display: flex; diff --git a/src/views/faceteach/FaceTeachSignUp.vue b/src/views/faceteach/FaceTeachSignUp.vue index d6c00a2..74a5b84 100644 --- a/src/views/faceteach/FaceTeachSignUp.vue +++ b/src/views/faceteach/FaceTeachSignUp.vue @@ -46,8 +46,13 @@ v-if="data?.hasTask || data.planDto?.applyFlag" @click="onLineSignUp" :style="{ - background: data.isSignUp ? '#999' : 'rgb(57, 146, 249)', + background: isAllowSign + ? data.isSignUp || data.isRefused + ? '#999' + : 'rgb(57, 146, 249)' + : '#999', }" + , >{{ data.isRefused ? "审核拒绝" @@ -104,7 +109,7 @@
@@ -219,7 +224,6 @@ const closeLoading = () => { const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId }, () => { closeLoading(); }); - const teacherInfo = useUserInfo(computed(() => data.value?.planDto?.teacherId)); const state = reactive({ @@ -242,10 +246,28 @@ const download = (url) => { ); }; -let timer = null; +//判断能否报名 (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 onLineSignUp() { + if (!state.isAllowSign) { + // console.log("data.signFlag", data.value.signFlag, isAllowSign); + ElMessage.warning("未在允许报名时间范围内"); + return; + } if (data.value.isSignUp && data.value.isSignUp) { return; } @@ -259,18 +281,18 @@ function formateArr(strs) { console.log("112233", arrs); return arrs; } -watch(data, () => { - console.log("data.offcourseDto", data.value.offcourseDto); - if (data.value.offcourseDto && data.value.offcourseDto.outline) { - let obj = data.value.offcourseDto.outline; - let regex = new RegExp(" { +// console.log("data.offcourseDto", data, data.value.offcourseDto); +// if (data.value.offcourseDto && data.value.offcourseDto.outline) { +// let obj = data.value.offcourseDto.outline; +// let regex = new RegExp(" { // console.log("data.offcourseDto?.outline", data.value); // // console.log("document", document.getElementById("face_img_id")); @@ -318,6 +340,9 @@ function getImgInfo(url, i, imgs) { .faceteachsignup { width: 100%; padding-bottom: 20px; + .faceteachsignup_img_class img { + max-width: 100%; + } .main { width: 100%; display: flex; diff --git a/src/views/homeworkpage/HomeworkPage.vue b/src/views/homeworkpage/HomeworkPage.vue index 49e7bad..d62ad99 100644 --- a/src/views/homeworkpage/HomeworkPage.vue +++ b/src/views/homeworkpage/HomeworkPage.vue @@ -144,21 +144,24 @@ const state = reactive({ const { hour, minute, seconds } = toRefs(state); let timer = setInterval(() => { - let endTime = parseInt(new Date(data.value.submitEndTime).getTime() / 1000); - let nowTime = parseInt(new Date().getTime() / 1000); - if (endTime > nowTime) { - state.hour = parseInt( - dayjs(data.value.submitEndTime).diff(dayjs(), "minute") / 60 - ); - state.minute = parseInt( - dayjs(data.value.submitEndTime).diff(dayjs(), "minute") % 60 - ); - state.seconds = parseInt( - dayjs(data.value.submitEndTime).diff(dayjs(), "seconds") - - (state.hour * 60 + state.minute) * 60 - ); - } else { - clearInterval(timer); + console.log("endTime", data.value.submitEndTime); + if (data && data.value.submitEndTime) { + let endTime = parseInt(new Date(data.value.submitEndTime).getTime() / 1000); + let nowTime = parseInt(new Date().getTime() / 1000); + if (endTime > nowTime) { + state.hour = parseInt( + dayjs(data.value.submitEndTime).diff(dayjs(), "minute") / 60 + ); + state.minute = parseInt( + dayjs(data.value.submitEndTime).diff(dayjs(), "minute") % 60 + ); + state.seconds = parseInt( + dayjs(data.value.submitEndTime).diff(dayjs(), "seconds") - + (state.hour * 60 + state.minute) * 60 + ); + } else { + clearInterval(timer); + } } }, 1000); onUnmounted(() => {