mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-07 01:46:46 +08:00
fix:修改面授课签到时间范围
This commit is contained in:
1
.env
1
.env
@@ -13,3 +13,4 @@ VITE_BOE_EXAM_DETAIL_URL=https://u-pre.boe.com/pc/exam/test?id=
|
||||
VITE_BOE_API_URL=https://u-pre.boe.com
|
||||
|
||||
VITE_TASK_WHITE_TYPE=-8-,-12-,-13-
|
||||
# VITE_TASK_WHITE_TYPE=-8-,-12-
|
||||
@@ -2,13 +2,13 @@
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-12-11 16:57:58
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2022-12-17 14:59:41
|
||||
* @LastEditTime: 2022-12-17 19:19:17
|
||||
* @FilePath: /fe-stu/src/api/api.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
export const LOGIN = '/admin/CheckUser/userLogin post'
|
||||
// export const FILE_UPLOAD = 'http://111.231.196.214:30001/file/upload'
|
||||
export const FILE_UPLOAD = import.meta.env.VITE_BASE_API + '/file/upload'
|
||||
export const FILE_UPLOAD = '/file/upload'
|
||||
export const COMMON_TOKEN = 'https://upload-z2.qiniup.com'
|
||||
export const ROUTER_CHAPTER_LIST = '/stu/router/chapterList'
|
||||
export const ROUTER_LIST = '/stu/router/list post'
|
||||
|
||||
@@ -42,8 +42,7 @@
|
||||
class="btn"
|
||||
style="margin-right: 20px"
|
||||
:style="{
|
||||
background:
|
||||
data.signFlag || !isAllowSign ? '#999' : 'rgb(57, 146, 249)',
|
||||
background: data.signFlag ? '#999' : 'rgb(57, 146, 249)',
|
||||
}"
|
||||
@click="signClick"
|
||||
>{{ data.signFlag ? "已签到" : "签到" }}
|
||||
@@ -226,10 +225,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, toRefs, watch } from "vue";
|
||||
import { computed, reactive, toRefs, watch, onUnmounted } from "vue";
|
||||
import FileTypeImg from "@/components/FileTypeImg.vue";
|
||||
import { request, useRequest } from "@/api/request";
|
||||
import { STU_OFFCOURSE_DETAIL } from "@/api/api";
|
||||
import { STU_OFFCOURSE_DETAIL, TASK_BROADCAST_SIGN } from "@/api/api";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useUserInfo } from "@/api/utils";
|
||||
import { ElMessage } from "element-plus";
|
||||
@@ -263,56 +262,45 @@ let timer = null;
|
||||
//判断能否签到
|
||||
function isSignClick() {
|
||||
timer = setInterval(() => {
|
||||
let beginTime = new Date(data.value.planDto.beginTime).getTime();
|
||||
let endTime = !data.value.planDto.afterStart
|
||||
? 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) {
|
||||
//有开始前有开始后
|
||||
let beginTime =
|
||||
new Date(data.value.planDto.beginTime).getTime() -
|
||||
data.value.planDto.beforeStart * 60 * 1000;
|
||||
let endTime =
|
||||
new Date(data.value.planDto.beginTime).getTime() +
|
||||
data.value.planDto.afterStart * 60 * 1000;
|
||||
let nowTime = new Date().getTime();
|
||||
if (nowTime < endTime && nowTime > beginTime) {
|
||||
state.isAllowSign = true;
|
||||
} else {
|
||||
state.isAllowSign = false;
|
||||
}
|
||||
} else if (
|
||||
!data.value.planDto.beforeStart &&
|
||||
!data.value.planDto.afterStart
|
||||
) {
|
||||
//开始前开始后都没有
|
||||
state.isAllowSign = true;
|
||||
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
|
||||
) {
|
||||
//只有开始前无开始后
|
||||
let beginTime =
|
||||
new Date(data.value.planDto.beginTime).getTime() -
|
||||
data.value.planDto.beforeStart * 60 * 1000;
|
||||
let nowTime = new Date().getTime();
|
||||
if (nowTime > beginTime) {
|
||||
state.isAllowSign = true;
|
||||
} else {
|
||||
state.isAllowSign = false;
|
||||
}
|
||||
beginTime = beginTime - data.value.planDto.beforeStart * 60 * 1000;
|
||||
console.log("11112222");
|
||||
} else if (
|
||||
!data.value.planDto.beforeStart &&
|
||||
data.value.planDto.afterStart
|
||||
) {
|
||||
//无开始前有开始后
|
||||
let endTime =
|
||||
new Date(data.value.planDto.beginTime).getTime() +
|
||||
data.value.planDto.afterStart * 60 * 1000;
|
||||
let nowTime = new Date().getTime();
|
||||
if (nowTime < endTime) {
|
||||
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);
|
||||
// console.log(
|
||||
// "isAllowSign",
|
||||
// state.isAllowSign,
|
||||
// nowTime,
|
||||
// endTime,
|
||||
// beginTime,
|
||||
// nowTime < endTime,
|
||||
// nowTime > beginTime
|
||||
// );
|
||||
}, 1000);
|
||||
}
|
||||
isSignClick();
|
||||
@@ -322,13 +310,20 @@ const signClick = () => {
|
||||
if (data.value.signFlag) {
|
||||
return;
|
||||
}
|
||||
console.log("data.signFlag", data.value.signFlag);
|
||||
if (!isAllowSign) {
|
||||
// console.log(
|
||||
// "data.signFlag",
|
||||
// data.value.signFlag,
|
||||
// state.isAllowSign,
|
||||
// !state.isAllowSign
|
||||
// );
|
||||
if (!state.isAllowSign) {
|
||||
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
|
||||
ElMessage.info("未在签到范围内");
|
||||
return;
|
||||
}
|
||||
data.value.signFlag = 1;
|
||||
ElMessage.info("签到成功");
|
||||
console.log("courseId", courseId, taskId, type);
|
||||
request(TASK_BROADCAST_SIGN, { courseId: courseId, taskId, type });
|
||||
};
|
||||
|
||||
@@ -368,6 +363,12 @@ function toExamItem(obj) {
|
||||
window.open(import.meta.env.VITE_BOE_EXAM_DETAIL_URL + obj.examinationTestId); //测评
|
||||
// router.push({ path: import.meta.env.VITE_BOE_EXAM_DETAIL_URL+ obj.examinationTestId });
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
<div class="title">
|
||||
<div class="titleL">{{ i.stageName }}</div>
|
||||
<div class="titleR" :style="{ display: 'flex' }">
|
||||
<img src="../../assets/image/pathdetails/circle.png"/>
|
||||
<img src="../../assets/image/pathdetails/circle.png" />
|
||||
<div class="titleRT">进行中</div>
|
||||
</div>
|
||||
<div
|
||||
class="titleR"
|
||||
:style="{ display: i.status === 2 ? 'flex' : 'none' }"
|
||||
>
|
||||
<img src="../../assets/image/pathdetails/circle2.png"/>
|
||||
<img src="../../assets/image/pathdetails/circle2.png" />
|
||||
<div class="titleRT" style="color: rgba(102, 102, 102, 1)">
|
||||
未开始
|
||||
</div>
|
||||
@@ -30,7 +30,9 @@
|
||||
</div>
|
||||
<div
|
||||
class="course"
|
||||
v-for="(value, index) in i.taskProcessList.filter(e=>!whiteTypes(e.type))"
|
||||
v-for="(value, index) in i.taskProcessList.filter(
|
||||
(e) => !whiteTypes(e.type)
|
||||
)"
|
||||
:key="index"
|
||||
>
|
||||
<div>
|
||||
@@ -98,7 +100,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="goclass" @click="toFinish(value,i.name)">
|
||||
<div class="goclass" @click="toFinish(value, i.name)">
|
||||
{{
|
||||
value.status === 1
|
||||
? "已完成"
|
||||
@@ -132,7 +134,7 @@
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="课程公告" name="first">
|
||||
<div class="notice">
|
||||
{{ data.remark || '暂无公告' }}
|
||||
{{ data.remark || "暂无公告" }}
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!--
|
||||
@@ -178,15 +180,15 @@
|
||||
class="teacheritem"
|
||||
:style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }"
|
||||
>
|
||||
<img class="peopleimg" :src="`/upload${userInfo.avatar}`"/>
|
||||
<img class="peopleimg" :src="`/upload${userInfo.avatar}`" />
|
||||
<div style="margin-left: 17px">
|
||||
<div class="teacherName">
|
||||
<div style="margin-right: 5px">
|
||||
{{ userInfo?.realName }}
|
||||
</div>
|
||||
<!-- <div v-for="(item, key) in data.userInfoBo?.medal" :key="key">-->
|
||||
<!-- <img class="teacherMedal" :src="item"/>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div v-for="(item, key) in data.userInfoBo?.medal" :key="key">-->
|
||||
<!-- <img class="teacherMedal" :src="item"/>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<div class="introduce">{{ userInfo?.bandDesc }}</div>
|
||||
</div>
|
||||
@@ -207,7 +209,6 @@
|
||||
<div class="ratebtn">继续学习</div>
|
||||
</div>-->
|
||||
|
||||
|
||||
<div style="margin-top: 16px">
|
||||
<div class="progressBox">
|
||||
<div>总进度</div>
|
||||
@@ -301,7 +302,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {computed, reactive, ref} from "vue";
|
||||
import { computed, reactive, ref } from "vue";
|
||||
import word from "@/assets/image/file/word.png";
|
||||
import ppt from "@/assets/image/file/ppt.png";
|
||||
import pdf from "@/assets/image/file/pdf.png";
|
||||
@@ -311,20 +312,22 @@ import medal1 from "@/assets/image/medal/medal1.png";
|
||||
import medal2 from "@/assets/image/medal/medal2.png";
|
||||
import medal3 from "@/assets/image/medal/medal3.png";
|
||||
import img from "@/assets/image/uploadimg.png";
|
||||
import {useRequest, request} from "@/api/request";
|
||||
import {PROJECT_PROCESS, ROUTER_PROCESS, LINK_DETAILS} from "@/api/api";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import { useRequest, request } from "@/api/request";
|
||||
import { PROJECT_PROCESS, ROUTER_PROCESS, LINK_DETAILS } from "@/api/api";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import store from "@/store";
|
||||
import {ElMessage} from "element-plus";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const {
|
||||
query: {courseId, projectId},
|
||||
query: { courseId, projectId },
|
||||
} = useRoute();
|
||||
const router = useRouter();
|
||||
const returnclick = () => {
|
||||
router.back();
|
||||
};
|
||||
const {data} = useRequest(PROJECT_PROCESS, {projectId: projectId || courseId});
|
||||
const { data } = useRequest(PROJECT_PROCESS, {
|
||||
projectId: projectId || courseId,
|
||||
});
|
||||
const userInfo = computed(() => store.state.userInfo);
|
||||
|
||||
const activeName = ref("first");
|
||||
@@ -332,7 +335,7 @@ const activeName = ref("first");
|
||||
const handleClick = (tab, event) => {
|
||||
console.log(tab, event);
|
||||
};
|
||||
const path = {1: "path"};
|
||||
const path = { 1: "path" };
|
||||
|
||||
const types = ref({
|
||||
typeName: {
|
||||
@@ -372,34 +375,52 @@ const types = ref({
|
||||
4: "/homeworkpage",
|
||||
5: import.meta.env.VITE_BOE_EXAM_DETAIL_URL, //考试
|
||||
6: "/livebroadcast",
|
||||
7: ({courseId}) => request(LINK_DETAILS(courseId), {}).then(({data: {linkAddress}}) => window.open(linkAddress)),//外联
|
||||
7: ({ courseId }) =>
|
||||
request(LINK_DETAILS(courseId), {}).then(({ data: { linkAddress } }) =>
|
||||
window.open(linkAddress)
|
||||
), //外联
|
||||
8: "/discusspage",
|
||||
9: "/moreactive",
|
||||
10: ({evaTyp, targetId}) => window.open((evaTyp === 1 ? import.meta.env.VITE_BOE_TEST_DETAIL_URL : import.meta.env.VITE_BOE_TEST_OUT_DETAIL_URL) + targetId), //测评
|
||||
10: ({ evaType, targetId }) =>
|
||||
window.open(
|
||||
(evaType == 0
|
||||
? import.meta.env.VITE_BOE_TEST_DETAIL_URL
|
||||
: import.meta.env.VITE_BOE_TEST_OUT_DETAIL_URL) + targetId
|
||||
), //测评
|
||||
11: "/surveydetail",
|
||||
12: "/ballotpage",
|
||||
13: "/projectdetails",
|
||||
},
|
||||
});
|
||||
|
||||
function toFinish(d,sName) {
|
||||
function toFinish(d, sName) {
|
||||
if (!types.value.path[d.type]) {
|
||||
ElMessage.error("暂时未开放");
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof types.value.path[d.type] === 'string') {
|
||||
types.value.path[d.type] && types.value.path[d.type].startsWith("http") && window.open(types.value.path[d.type] + d.targetId)
|
||||
types.value.path[d.type] && types.value.path[d.type].startsWith("/") && router.push({
|
||||
if (typeof types.value.path[d.type] === "string") {
|
||||
types.value.path[d.type] &&
|
||||
types.value.path[d.type].startsWith("http") &&
|
||||
window.open(types.value.path[d.type] + d.targetId);
|
||||
types.value.path[d.type] &&
|
||||
types.value.path[d.type].startsWith("/") &&
|
||||
router.push({
|
||||
path: types.value.path[d.type],
|
||||
query: {id: d.routerTaskId, type: 2, courseId: d.courseId, pName: data.value.name, sName},
|
||||
})
|
||||
} else if (typeof types.value.path[d.type] === 'function') {
|
||||
types.value.path[d.type](d)
|
||||
query: {
|
||||
id: d.routerTaskId,
|
||||
type: 2,
|
||||
courseId: d.courseId,
|
||||
pName: data.value.name,
|
||||
sName,
|
||||
},
|
||||
});
|
||||
} else if (typeof types.value.path[d.type] === "function") {
|
||||
types.value.path[d.type](d);
|
||||
}
|
||||
}
|
||||
function whiteTypes(type){
|
||||
return import.meta.env.VITE_TASK_WHITE_TYPE.includes('-' + type +'-')
|
||||
function whiteTypes(type) {
|
||||
return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -343,9 +343,9 @@ const returnclick = () => {
|
||||
router.back();
|
||||
};
|
||||
const { data } = useRequest(ROUTER_PROCESS, { routerId });
|
||||
|
||||
console.log("data", data);
|
||||
const userInfo = computed(() => store.state.userInfo);
|
||||
console.log("userInfo", userInfo);
|
||||
|
||||
const activeName = ref("first");
|
||||
|
||||
const handleClick = (tab, event) => {
|
||||
@@ -416,6 +416,7 @@ function toFinish(d, sName) {
|
||||
}
|
||||
|
||||
if (typeof types.value.path[d.type] === "string") {
|
||||
// console.log("dddddd", d);
|
||||
types.value.path[d.type] &&
|
||||
types.value.path[d.type].startsWith("http") &&
|
||||
window.open(types.value.path[d.type] + d.targetId);
|
||||
|
||||
Reference in New Issue
Block a user