Files
fe-student/src/views/moreActive/MoreActive.vue
2022-12-25 18:30:25 +08:00

545 lines
14 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 style="margin-left: 6px; margin-right: 6px">/</div>
<div style="font-weight: 700; font-size: 16px">活动详情</div>
<!--
<div class="preNext">
<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">其他活动管理者进阶腾飞班 - 专属线下活动</div>-->
<div class="title">{{ data?.activityName }}</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?.activityStartTime + "至" + data?.activityEndTime }}
</div>
</div>
<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>
<botton v-if="!isAllowSign" class="btn" style="margin-right: 20px; background: #999" @click="signClick">签到
</botton>
<botton class="btn" :style="{background: `${data.signFlag ? '#999' : 'rgb(57, 146, 249)'}`, }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }}
</botton>
</div>
<!-- 基本信息 -->
<!-- 详细信息 -->
<div class="detailinfo">
<div class="detail">
<div class="detailT">
<div style="margin-left: 48px; margin-right: 48px">
<div class="title">
<img
style="width: 20px; height: 20px"
src="../../assets/image/book.png"
/>
<div class="text">活动详情</div>
<div class="box"></div>
</div>
<div class="activedetail">
<div>
<span>活动时长</span>
<span class="content">
{{
data?.activityDuration
? data?.activityDuration + "分钟"
: "-"
}}
</span>
</div>
<div>
<span>活动地点</span>
<span class="content">
{{ data?.activityAddress ? data?.activityAddress : "-" }}
</span>
</div>
<div>
<span>活动考勤</span>
<span class="content">
{{
data?.beforeSignIn
? "活动开始前" + data?.beforeSignIn + "分钟开始签到"
: "-"
}}
</span>
<span class="content">
{{
data?.afterSignIn
? "活动开始后" + data?.afterSignIn + "分钟结束签到"
: "-"
}}
</span>
</div>
<!--
<div>
<div>活动完成标准</div>
<div class="content">
{{ data?.standardSettings ? "仅签到" : "-" }}
</div>
</div>
-->
<div>
<span>活动说明</span>
<span class="content">
{{ data?.activityExplain ? data?.activityExplain : "-" }}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="teacher">
<div class="title">
<img
style="width: 24px; height: 20px"
src="../../assets/image/call.png"
/>
<div class="text">活动公告</div>
<div class="box"></div>
</div>
<!-- todo #活动任务详情 活动公告没有-->
<div class="content">
{{ data.activityNotice }}
</div>
</div>
</div>
<!-- 详细信息 -->
</div>
</template>
<script setup>
import { TAS_ACTIVITY_DETAIL, TASK_ACTIVITY_SIGN, ACTIVITY } from "@/api/api";
import { request, useRequest } from "@/api/request";
import { useRouter } from "vue-router";
import { useRoute } from "vue-router/dist/vue-router";
import { ElMessage } from "element-plus";
import { reactive, onUnmounted } from "vue";
const router = useRouter();
const returnclick = () => {
router.back();
};
const {
query: { courseId: activityId, id: taskId, type, pName, sName },
} = useRoute();
const state = reactive({
isAllowSign: false,
});
const { data } = useRequest(ACTIVITY, { activityId });
const signClick = (tab, event) => {
if (data.value.signFlag) {
return;
}
data.value.signFlag = true;
ElMessage.warning("签到成功");
request(TASK_ACTIVITY_SIGN, {
courseId: activityId,
taskId,
type,
});
};
let timer = null;
//判断能否签到
function isSignClick() {
timer = setInterval(() => {
let beginTime = new Date(data.activityStartTime).getTime();
let endTime = !data.afterSignIn
? new Date(data.activityEndTime).getTime()
: new Date(data.activityStartTime).getTime();
let nowTime = new Date().getTime();
if (data.beforeSignIn && data.afterSignIn) {
//有开始前有开始后
beginTime = beginTime - data.beforeSignIn * 60 * 1000;
endTime = endTime + data.afterSignIn * 60 * 1000;
console.log("1111");
} else if (
data.beforeSignIn &&
!data.afterSignIn
) {
//只有开始前无开始后
beginTime = beginTime - data.beforeSignIn * 60 * 1000;
console.log("11112222");
} else if (
!data.beforeSignIn &&
data.afterSignIn
) {
//无开始前有开始后
endTime = endTime + data.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();
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;
.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-right: 96px;
}
.title {
font-size: 20px;
font-weight: 800;
color: #333333;
line-height: 24px;
margin-left: -9px;
}
.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;
}
.activedetail {
margin-top: 30px;
font-size: 14px;
font-weight: 500;
color: #333330;
line-height: 36px;
.content {
color: #677d86;
}
}
}
.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;
}
}
}
.teacher {
width: 434px;
height: 10%;
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 {
margin-left: 4px;
width: 75px;
height: 10px;
background-color: rgba(36, 120, 255, 0.15);
position: absolute;
left: 23px;
top: 53px;
}
.content {
margin: 25px 24px 49px 49px;
color: #677d86;
width: 361px;
// height: 304px;
line-height: 24px;
font-size: 16px;
font-weight: bold;
}
}
}
}
</style>