Files
fe-student/src/views/liveBroadcast/LiveBroadcast.vue
2022-12-25 19:09:01 +08:00

716 lines
17 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div style=" background: #0078fc;height: 150px;width: 100%;position: absolute;top: 0;z-index:-9999;"></div>
<div class="moreactive" style="padding: 30px">
<!-- 面包屑导航 -->
<div class="crumb">
<div>{{ pName }}</div>
<div style="margin-left: 6px; margin-right: 6px">/</div>
<div>{{ sName }}</div>
<div v-if="sName" style="margin-left: 6px; margin-right: 6px">/</div>
<div style="font-weight: 700; font-size: 16px">直播详情</div>
<!--
<div class="preNext">
2022-12-15注释 李晓鸽 后面打开 -->
<!-- <button class="btn btn01"></button>
<span class="content" style="margin-left: 6px">上一个</span>
<span class="content" style="margin-left: 31px">下一个</span>
<button class="btn btn02" style="margin-left: 6px"></button>
</div>-->
<div class="return">
<div style="display: flex" @click="returnclick">
<el-button style="color:#0073FB"> <img class="img2" style="margin-right:11px;cursor: pointer;"
src="../../assets/image/return.png" />返回</el-button>
</div>
</div>
</div>
<!-- 面包屑导航 -->
<!-- 基本信息 -->
<div class="bascinfo">
<div style="margin-left: 46px">
<div class="title">直播{{ data?.liveName }}</div>
<div class="time" style="margin-top: 26px">
<img style="width: 15px; height: 17px" src="../../assets/image/time.png" />
<div style="margin-left: 8px">
{{ data?.liveStartTime + " 至 " + data?.liveEndTime }}
</div>
</div>
<!-- todo #直播详情 没有位置字段-->
<!-- <div class="time" style="margin-top: 23px">
<img
style="width: 16px; height: 18px"
src="../../assets/image/position.png"
/>
<div style="margin-left: 8px">{{ data?.activityAddress }}</div>
</div> -->
</div>
<div class="threeBtn">
<botton class="btn" :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : 'rgb(59, 191, 252)'}`,
}" @click="showClick">观看
</botton>
<botton class="btn" :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.signFlag ? '#999' : 'rgb(57, 146, 249)'}`,
}" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }}
</botton>
<botton style="background: #999" class="btn" @click="commitClick" v-if="data.isEvaluate == 0 ">
评估
</botton>
<botton :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}" class="btn" @click="commitClick" v-if="data.isEvaluate && data.isEvaluate == 1">{{ data.isSurvery ? "已评估": "评估"}}
</botton>
</div>
</div>
<!-- 基本信息 -->
<!-- 详细信息 -->
<div class="detailinfo">
<div class="detail">
<div class="detailT">
<div class="" style="margin-left: 48px; margin-right: 48px">
<div class="title">
<img style="width: 20px; height: 20px" src="../../assets/image/course.png" />
<div class="text">直播说明</div>
<div class="box"></div>
</div>
<div style="display: flex; align-items: center">
<!-- todo #直播 没有课前预习字段-->
<div class="content">
{{ data.liveExplain }}
</div>
</div>
<!-- <div class="title">-->
<!-- <img-->
<!-- style="width: 20px; height: 20px"-->
<!-- src="../../assets/image/write.png"-->
<!-- />-->
<!-- &lt;!&ndash; todo #直播 课后作业&ndash;&gt;-->
<!-- <div class="text">课后作业</div>-->
<!-- <div class="box"></div>-->
<!-- </div>-->
<!-- <div style="display: flex; align-items: center">-->
<!-- <div class="content">-->
<!-- <span style="font-weight: 600"-->
<!-- >网易有道词典现有功能结构拆解+问题分析</span-->
<!-- ><br/>-->
<!-- 查找资料介绍一种国外日本美国欧洲道路公路铁路城市道路地铁设计规范的演变过程可以一种或几种主要技术指标为例并说明其原因<br/>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
<div>
<div class="tell">
<div class="title">
<img style="width: 21px; height: 23px" src="../../assets/image/tv.png" />
<div class="text">直播公告</div>
<div class="box"></div>
</div>
<div class="content" v-html="data?.liveNotice"></div>
</div>
<div class="teacher">
<div class="title">
<img style="width: 21px; height: 23px" src="../../assets/image/livelecturer.png" />
<!-- todo #直播详情 没有直播讲师-->
<div class="text">直播讲师</div>
<div class="box"></div>
</div>
<div class="teacheritem" :style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }">
<img class="peopleimg" :src="teacherInfo.avatar" />
<div style="margin-left: 17px; width: 190px">
<div class="teacherName" style="margin-right: 5px">
{{ data.userInfoBo?.userName }}
</div>
<div class="introduce">{{ data.userInfoBo?.bandDesc }}</div>
</div>
<!-- <div class="follow">+ 关注</div>-->
</div>
</div>
</div>
</div>
<!-- 详细信息 -->
</div>
</template>
<script setup>
import { computed, reactive, toRefs,onUnmounted } from "vue";
import img from "@/assets/image/uploadimg.png";
import { request, useRequest } from "@/api/request";
import { TASK_BROADCAST_DETAIL, TASK_BROADCAST_SIGN } from "@/api/api";
import { useRoute } from "vue-router/dist/vue-router";
import { useRouter } from "vue-router";
import { useUserInfo } from "@/api/utils";
import { ElMessage } from "element-plus";
import dayjs from "dayjs";
const {
query: { courseId: liveId, id: taskId, type, pName, sName },
} = useRoute();
const router = useRouter();
const returnclick = () => {
router.back();
};
const { data } = useRequest(TASK_BROADCAST_DETAIL, { liveId });
console.log('直播信息', data)
const teacherInfo = useUserInfo(
computed(() => data.value.userInfoBo?.userId)
);
const state = reactive({
activeName: "first",
teacher: [
{
id: 1,
name: "王星天(显示事业)",
introduce:
"教师是学生的镜子,学生是老师的影子。教师是学生的镜子,学生是老师的影子。教师是学生的镜子,学生是老师的影子。",
peopleimg: img,
},
],
});
const { activeName, teacher } = toRefs(state);
const signClick = () => {
if (!state.isAllowSign) {
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
ElMessage.warning("未在允许签到时间范围内");
return;
}
if (data.value.signFlag) {
return;
}
data.value.signFlag = 1;
ElMessage.warning("签到成功");
request(TASK_BROADCAST_SIGN, { courseId: liveId, taskId, type });
};
let timer = null;
//判断能否签到
function isSignClick() {
timer = setInterval(() => {
let beginTime = new Date(data.value.liveStartTime).getTime();
let endTime = !data.value.afterSignIn
? new Date(data.value.liveEndTime).getTime()
: new Date(data.value.liveStartTime).getTime();
let nowTime = new Date().getTime();
if (data.value.beforeSignIn && data.value.afterSignIn) {
//有开始前有开始后
beginTime = beginTime - data.value.beforeSignIn * 60 * 1000;
endTime = endTime + data.value.afterSignIn * 60 * 1000;
console.log("1111");
} else if (
data.value.beforeSignIn &&
!data.value.afterSignIn
) {
//只有开始前无开始后
beginTime = beginTime - data.value.beforeSignIn * 60 * 1000;
console.log("11112222");
} else if (
!data.value.beforeSignIn &&
data.value.afterSignIn
) {
//无开始前有开始后
endTime = endTime + data.value.afterSignIn * 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 commitClick = () => {
if (data.value.liveStartTime) {
let date1 = new Date(data.value.liveStartTime).getTime()
let date2 = new Date().getTime()
if (date1 > date2) {
ElMessage.warning("未到时间,请耐心等待!");
return;
}
}
if (data.value.isSurvery) {
// return;
}
if (data.value.isEvaluate == 0) {
ElMessage.warning("此直播无评估");
return;
}
console.log({
courseId: data.value.assessmentId,
taskIds: taskId,
chapterOrStageId: 0,
pName: "直播",
sName: data.value.liveName,
type: 4
})
router.push({
path: "/surveydetail",
query: {
courseId: data.value.assessmentId,
taskId: data.value.liveId,
taskIds: data.value.liveId,
chapterOrStageId: 0,
pName: "直播",
sName: data.value.liveName,
type: 4
},
});
};
function showClick() {
if (data.value.liveStartTime) {
let date1 = new Date(data.value.liveStartTime).getTime()
let date2 = new Date().getTime()
if (date1 > date2) {
ElMessage.warning("未到开始时间,请耐心等待!");
return;
}
}
window.open(data.value.liveLink);
}
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.moreactive {
.crumb {
color: #fff;
display: flex;
font-size: 14px;
line-height: 24px;
position: relative;
}
.return {
position: absolute;
right: 10%;
.text {
text-align: center;
display: flex;
flex-direction: row;
align-items: center;
}
}
.preNext {
position: absolute;
right: 0px;
.content {
font-size: 14px;
color: #fff;
width: 43px;
height: 14px;
display: inline-block;
position: relative;
top: -6px;
cursor: pointer;
}
.btn {
width: 23px;
height: 23px;
border-radius: 50%;
border: 0;
cursor: pointer;
}
.btn01 {
background-image: url("../../assets/image/prev.png");
}
.btn02 {
background-image: url("../../assets/image/next.png");
}
}
.bascinfo {
width: 100%;
height: 180px;
border-radius: 8px;
background-color: rgba(255, 255, 255, 1);
margin-top: 37px;
display: flex;
justify-content: space-between;
align-items: center;
.threeBtn {
display: flex;
width: 490px;
margin-right: 87px;
.btn {
width: 146px;
height: 46px;
background: #2478ff;
border-radius: 4px;
box-shadow: 0px 1px 8px 0px rgba(56, 125, 247, 0.7);
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 14px;
font-weight: 800;
line-height: 24px;
cursor: pointer;
margin-left: 20px;
}
}
.title {
font-size: 20px;
font-weight: 800;
color: #333333;
line-height: 24px;
margin-left: -9px;
}
@media screen and (max-width: 1030px) {
// .threeBtn {
// margin-right: 30px;
// }
.title {
margin-bottom: -24px;
}
}
// @media screen and(max-width:) {
// }
.time {
font-size: 14px;
color: #6e7b84;
line-height: 24px;
display: flex;
align-items: center;
}
}
.detailinfo {
width: 100%;
margin-top: 20px;
display: flex;
.detail {
flex: 1;
margin-right: 20px;
.detailT {
min-height: 646px;
background: #ffffff;
border-radius: 8px;
color: rgba(51, 51, 51, 1);
.title {
display: flex;
align-items: center;
padding-top: 39px;
position: relative;
}
.title .text {
margin-left: 8px;
font-size: 16px;
color: rgba(51, 51, 51, 1);
font-weight: 800;
}
.title .box {
width: 75px;
height: 10px;
background-color: rgba(36, 120, 255, 0.15);
position: absolute;
left: 23px;
top: 53px;
}
.content {
margin-left: 8px;
font-size: 14px;
color: rgba(51, 51, 48, 1);
font-weight: 500;
line-height: 35px;
margin-top: 30px;
}
}
.detailB {
min-height: 363px;
background: #ffffff;
border-radius: 8px;
margin-top: 20px;
.el-tabs__item {
height: 69px;
padding: 25px 7px 0px 52px;
font-size: 14px;
font-weight: 500;
}
.el-tabs__nav-wrap::after {
background-color: rgba(56, 125, 247, 0.2);
}
.enclosure {
height: 89px;
margin-left: 51px;
margin-right: 40px;
// border-bottom: 1px solid rgba(56, 125, 247, 0.2);
display: flex;
justify-content: space-between;
align-items: center;
.enclosureL {
display: flex;
align-items: center;
font-size: 14px;
font-weight: 400;
color: #677d86;
line-height: 24px;
}
.download {
display: flex;
align-items: center;
font-size: 16px;
font-weight: 400;
color: #2478ff;
line-height: 24px;
cursor: pointer;
}
}
.work {
margin-left: 51px;
margin-right: 40px;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 37px;
}
.work .question {
font-size: 14px;
font-weight: 500;
color: #333330;
line-height: 18px;
}
.work .active {
width: 82px;
height: 28px;
background: linear-gradient(90deg, #a5d4e0 0%, #b4dce6 100%);
border-radius: 4px;
font-size: 14px;
font-weight: 500;
color: #ffffff;
line-height: 24px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
margin-right: 11px;
}
.work .unactive {
width: 80px;
height: 26px;
border: 1px solid #a5d4e0;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
color: #a5d4e0;
line-height: 24px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 11px;
cursor: pointer;
}
.work .btncolor {
background: linear-gradient(90deg, #84aad2 0%, #a4c5e9 100%);
}
.work .bordercolor {
border: 1px solid #85aad2;
}
.work .fontcolor {
color: rgba(133, 170, 210, 1);
}
.work .submit {
width: 126px;
height: 46px;
background: #2478ff;
box-shadow: 0px 1px 8px 0px rgba(56, 125, 247, 0.7);
border-radius: 4px;
font-size: 16px;
font-weight: 800;
color: #ffffff;
line-height: 24px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
}
}
.tell {
width: 434px;
// height: 10%;
// min-height: 557px;
background-color: rgba(255, 255, 255, 1);
border-radius: 8px;
background: linear-gradient(180deg,
rgba(36, 120, 255, 0.15) 0%,
rgba(255, 255, 255) 50%);
.title {
display: flex;
align-items: center;
padding-top: 39px;
position: relative;
margin-left: 48px;
}
.title .text {
margin-left: 8px;
font-size: 16px;
color: rgba(51, 51, 51, 1);
font-weight: 800;
}
.title .box {
width: 75px;
height: 10px;
background-color: rgba(36, 120, 255, 0.15);
position: absolute;
left: 23px;
top: 53px;
}
.content {
margin: 25px 24px 0px 49px;
padding-bottom: 55px;
color: #677d86;
width: 361px;
// height: 304px;
line-height: 24px;
font-size: 16px;
font-weight: bold;
}
}
}
.teacher {
margin-top: 22px;
width: 434px;
// height: 328px;
background-color: rgba(255, 255, 255, 1);
border-radius: 8px;
padding-bottom: 40px;
.title {
display: flex;
align-items: center;
padding-top: 39px;
position: relative;
margin-left: 48px;
}
.title .text {
margin-left: 8px;
font-size: 16px;
color: rgba(51, 51, 51, 1);
font-weight: 800;
}
.title .box {
width: 75px;
height: 10px;
background-color: rgba(36, 120, 255, 0.15);
position: absolute;
left: 23px;
top: 53px;
}
.teacheritem {
margin-left: 48px;
margin-right: 48px;
// min-height: 115px;
padding: 25px 0px;
display: flex;
// align-items: center;
position: relative;
}
.teacheritem .peopleimg {
width: 60px;
height: 60px;
border-radius: 30px;
margin-top: 2px;
}
.teacheritem .teacherName {
font-size: 14px;
font-weight: bold;
color: #394145;
display: flex;
align-items: center;
}
.teacheritem .introduce {
font-size: 14px;
font-weight: 500;
color: #394145;
margin-top: 14px;
}
.teacheritem .follow {
width: 80px;
height: 30px;
background: #387df7;
border-radius: 4px;
margin-top: 28px;
position: absolute;
right: -25px;
font-size: 14px;
font-weight: 500;
color: #ffffff;
line-height: 24px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
}
}
</style>