|
@@ -14,11 +14,11 @@
|
|
|
<div v-if="!isLogin"
|
|
<div v-if="!isLogin"
|
|
|
:style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
|
|
:style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
|
|
|
class="portal-card-main" style="cursor: pointer"
|
|
class="portal-card-main" style="cursor: pointer"
|
|
|
- @click="this.$router.push('/auth')">
|
|
|
|
|
|
|
+ @click="toAuth">
|
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
|
<Lock/>
|
|
<Lock/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
- <div style="font-size: small; font-weight: bold; color: #666666">登录以查看</div>
|
|
|
|
|
|
|
+ <div class="tip">登录以查看</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="isLogin && isStudent && myCourseList.length!==0"
|
|
<div v-if="isLogin && isStudent && myCourseList.length!==0"
|
|
@@ -32,21 +32,21 @@
|
|
|
<div v-if="isLogin && isStudent && myCourseList.length===0"
|
|
<div v-if="isLogin && isStudent && myCourseList.length===0"
|
|
|
:style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
|
|
:style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
|
|
|
class="portal-card-main" style="cursor: pointer"
|
|
class="portal-card-main" style="cursor: pointer"
|
|
|
- @click="this.$router.push('/course')">
|
|
|
|
|
|
|
+ @click="toCourse">
|
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
|
<ShoppingCart/>
|
|
<ShoppingCart/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
- <div style="font-size: small; font-weight: bold; color: #666666">去选择课程</div>
|
|
|
|
|
|
|
+ <div class="tip">去选择课程</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div v-show="isLogin && isTeacher"
|
|
<div v-show="isLogin && isTeacher"
|
|
|
:style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
|
|
:style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
|
|
|
class="portal-card-main" style="cursor: pointer"
|
|
class="portal-card-main" style="cursor: pointer"
|
|
|
- @click="this.$router.push('/manage')">
|
|
|
|
|
|
|
+ @click="toManage">
|
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
|
<SetUp/>
|
|
<SetUp/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
- <div style="font-size: small; font-weight: bold; color: #666666">去管理课程</div>
|
|
|
|
|
|
|
+ <div class="tip">去管理课程</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-card>
|
|
</el-card>
|
|
@@ -56,17 +56,17 @@
|
|
|
<el-card id="portal-course-card-main" :style="{height: this.courseRowHeight + 'px'}">
|
|
<el-card id="portal-course-card-main" :style="{height: this.courseRowHeight + 'px'}">
|
|
|
<div class="portal-card-title">
|
|
<div class="portal-card-title">
|
|
|
<div class="portal-card-title-main">精选课程</div>
|
|
<div class="portal-card-title-main">精选课程</div>
|
|
|
- <el-pagination v-if="isExpanding && courseList.length > 6"
|
|
|
|
|
|
|
+ <el-pagination v-if="isExpanding && exampleCourseList.length > 6"
|
|
|
:page-size="6"
|
|
:page-size="6"
|
|
|
- :total="courseList.length"
|
|
|
|
|
|
|
+ :total="exampleCourseList.length"
|
|
|
@current-change="handleCourseCurrentChange"
|
|
@current-change="handleCourseCurrentChange"
|
|
|
layout="prev, pager, next"
|
|
layout="prev, pager, next"
|
|
|
style="width: 200px; margin: 0 auto 0 auto"/>
|
|
style="width: 200px; margin: 0 auto 0 auto"/>
|
|
|
- <ElButton plain round type="primary" @click="this.$router.push('/course')">查看全部课程</ElButton>
|
|
|
|
|
|
|
+ <ElButton plain round type="primary" @click="toCourse">查看全部课程</ElButton>
|
|
|
</div>
|
|
</div>
|
|
|
<el-divider class="portal-card-divider"/>
|
|
<el-divider class="portal-card-divider"/>
|
|
|
<div class="portal-card-content">
|
|
<div class="portal-card-content">
|
|
|
- <CourseCard v-for="item in showCourseList" :key="item.id" :courseVO="item"/>
|
|
|
|
|
|
|
+ <CourseCard v-for="item in showExampleCourseList" :key="item.id" :courseVO="item"/>
|
|
|
</div>
|
|
</div>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</div>
|
|
</div>
|
|
@@ -81,11 +81,11 @@
|
|
|
<div v-if="!isLogin"
|
|
<div v-if="!isLogin"
|
|
|
:style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
|
|
:style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
|
|
|
class="portal-card-main" style="cursor: pointer"
|
|
class="portal-card-main" style="cursor: pointer"
|
|
|
- @click="this.$router.push('/auth')">
|
|
|
|
|
|
|
+ @click="toAuth">
|
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
|
<Lock/>
|
|
<Lock/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
- <div style="font-size: small; font-weight: bold; color: #666666">登录以查看</div>
|
|
|
|
|
|
|
+ <div class="tip">登录以查看</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="isLogin && isStudent && myTestList!==null && myTestList.length!==0"
|
|
<div v-if="isLogin && isStudent && myTestList!==null && myTestList.length!==0"
|
|
@@ -99,21 +99,21 @@
|
|
|
<div v-if="isLogin && isStudent && myTestList!==null && myTestList.length===0"
|
|
<div v-if="isLogin && isStudent && myTestList!==null && myTestList.length===0"
|
|
|
:style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
|
|
:style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
|
|
|
class="portal-card-main" style="cursor: pointer"
|
|
class="portal-card-main" style="cursor: pointer"
|
|
|
- @click="this.$router.push('/test')">
|
|
|
|
|
|
|
+ @click="toTest">
|
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
|
<ShoppingCart/>
|
|
<ShoppingCart/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
- <div style="font-size: small; font-weight: bold; color: #666666">去参加测试</div>
|
|
|
|
|
|
|
+ <div class="tip">去参加测试</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div v-show="isLogin && isTeacher"
|
|
<div v-show="isLogin && isTeacher"
|
|
|
:style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
|
|
:style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
|
|
|
class="portal-card-main" style="cursor: pointer"
|
|
class="portal-card-main" style="cursor: pointer"
|
|
|
- @click="this.$router.push('/manage')">
|
|
|
|
|
|
|
+ @click="toManage">
|
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
<el-icon :size="72" color="#bfbfbf">
|
|
|
<SetUp/>
|
|
<SetUp/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
- <div style="font-size: small; font-weight: bold; color: #666666">去管理测试</div>
|
|
|
|
|
|
|
+ <div class="tip">去管理测试</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -124,24 +124,23 @@
|
|
|
<el-card id="portal-test-card-main" ref="portalTestCardBodyMain">
|
|
<el-card id="portal-test-card-main" ref="portalTestCardBodyMain">
|
|
|
<div class="portal-card-title">
|
|
<div class="portal-card-title">
|
|
|
<div class="portal-card-title-main">智能测试</div>
|
|
<div class="portal-card-title-main">智能测试</div>
|
|
|
- <ElButton plain round type="primary" @click="this.$router.push('/test')">查看全部测试</ElButton>
|
|
|
|
|
|
|
+ <ElButton plain round type="primary" @click="toTest">查看全部测试</ElButton>
|
|
|
</div>
|
|
</div>
|
|
|
<el-divider class="portal-card-divider"/>
|
|
<el-divider class="portal-card-divider"/>
|
|
|
<el-tabs v-model="activeTestPaneName" @tab-click="changeTestPane">
|
|
<el-tabs v-model="activeTestPaneName" @tab-click="changeTestPane">
|
|
|
<el-tab-pane label="评测题" name="eval">
|
|
<el-tab-pane label="评测题" name="eval">
|
|
|
<div class="portal-card-content">
|
|
<div class="portal-card-content">
|
|
|
- <TestCard v-for="item in evalExamList" :key="item.id" :testVO="item"/>
|
|
|
|
|
|
|
+ <TestCard v-for="item in showExampleEvalTestList" :key="item.id" :testVO="item"/>
|
|
|
</div>
|
|
</div>
|
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="代码题" name="coder">
|
|
<el-tab-pane label="代码题" name="coder">
|
|
|
<div class="portal-card-content">
|
|
<div class="portal-card-content">
|
|
|
- <TestCard v-for="item in coderExamList" :key="item.id" :testVO="item"/>
|
|
|
|
|
|
|
+ <TestCard v-for="item in showExampleCoderTestList" :key="item.id" :testVO="item"/>
|
|
|
</div>
|
|
</div>
|
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -150,7 +149,7 @@ import CarouselCard from "@/views/PortalPage/components/CarouselCard";
|
|
|
import CourseCard from "@/components/CourseCard";
|
|
import CourseCard from "@/components/CourseCard";
|
|
|
import MyCourseCard from "@/views/PortalPage/components/MyCourseCard";
|
|
import MyCourseCard from "@/views/PortalPage/components/MyCourseCard";
|
|
|
import MyTestCard from "@/views/PortalPage/components/MyTestCard";
|
|
import MyTestCard from "@/views/PortalPage/components/MyTestCard";
|
|
|
-import {Lock, SetUp, ShoppingCart} from "@element-plus/icons-vue";
|
|
|
|
|
|
|
+import { Lock, SetUp, ShoppingCart } from "@element-plus/icons-vue";
|
|
|
import TestCard from "@/components/TestCard";
|
|
import TestCard from "@/components/TestCard";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -170,10 +169,10 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
isExpanding: false,
|
|
isExpanding: false,
|
|
|
activeTestPaneName: "eval",
|
|
activeTestPaneName: "eval",
|
|
|
- evalExamList: [],
|
|
|
|
|
- courseList: [],
|
|
|
|
|
|
|
+ exampleEvalTestList: [],
|
|
|
|
|
+ exampleCourseList: [],
|
|
|
showCourseList_current: 1,
|
|
showCourseList_current: 1,
|
|
|
- coderExamList: [],
|
|
|
|
|
|
|
+ exampleCoderTestList: [],
|
|
|
myCourseList: [],
|
|
myCourseList: [],
|
|
|
myEvalExamList: [],
|
|
myEvalExamList: [],
|
|
|
myCoderExamList: [],
|
|
myCoderExamList: [],
|
|
@@ -192,14 +191,24 @@ export default {
|
|
|
return this.$store.getters.isStudent;
|
|
return this.$store.getters.isStudent;
|
|
|
},
|
|
},
|
|
|
myTestList() {
|
|
myTestList() {
|
|
|
- if (!this.myEvalExamList || !this.myCoderExamList) {
|
|
|
|
|
- return [];
|
|
|
|
|
- } else {
|
|
|
|
|
- return [].concat(this.myEvalExamList).concat(this.myCoderExamList);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return []
|
|
|
|
|
+ .concat(this.myEvalExamList)
|
|
|
|
|
+ .concat(this.myCoderExamList)
|
|
|
|
|
+ .sort((a, b) => {
|
|
|
|
|
+ let a_time = a.startAt * 1000 || new Date(a.startTime).getTime();
|
|
|
|
|
+ let b_time = b.startAt * 1000 || new Date(b.startTime).getTime();
|
|
|
|
|
+ return a_time - b_time;
|
|
|
|
|
+ });
|
|
|
|
|
+ ;
|
|
|
|
|
+ },
|
|
|
|
|
+ showExampleCourseList() {
|
|
|
|
|
+ return this.exampleCourseList.slice((this.showCourseList_current - 1) * 6, this.showCourseList_current * 6);
|
|
|
|
|
+ },
|
|
|
|
|
+ showExampleCoderTestList() {
|
|
|
|
|
+ return this.exampleCoderTestList.filter(i => this.state(i) === "RUNNING").slice(0, 6);
|
|
|
},
|
|
},
|
|
|
- showCourseList() {
|
|
|
|
|
- return this.courseList.slice((this.showCourseList_current - 1) * 6, this.showCourseList_current * 6);
|
|
|
|
|
|
|
+ showExampleEvalTestList() {
|
|
|
|
|
+ return this.exampleEvalTestList.filter(i => this.state(i) === "RUNNING").slice(0, 6);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -213,39 +222,35 @@ export default {
|
|
|
async mounted() {
|
|
async mounted() {
|
|
|
const that = this;
|
|
const that = this;
|
|
|
|
|
|
|
|
- this.courseList = (await this.$apis.getExampleCourses()).data.data;
|
|
|
|
|
- this.evalExamList = (await this.$apis.getExampleEvalExams()).data.data.filter(i => {
|
|
|
|
|
- return this.state(i) === "RUNNING";
|
|
|
|
|
- }).slice(0, 6);
|
|
|
|
|
- this.coderExamList = (await this.$apis.getExampleCoderExams()).data.data.res.filter(i => {
|
|
|
|
|
- return this.state(i) === "RUNNING";
|
|
|
|
|
- }).slice(0, 6);
|
|
|
|
|
|
|
+ this.exampleCourseList = (await this.$apis.getExampleCourses()).data.data;
|
|
|
|
|
+ this.exampleEvalTestList = (await this.$apis.getExampleEvalExams()).data.data;
|
|
|
|
|
+ this.exampleCoderTestList = (await this.$apis.getExampleCoderExams({})).data.data.res.filter(i => this.state(i) === "RUNNING");
|
|
|
|
|
|
|
|
if (this.isLogin && this.isStudent) {
|
|
if (this.isLogin && this.isStudent) {
|
|
|
- this.$apis.getStudentCourses().then(res => {
|
|
|
|
|
- this.myCourseList = res.data.data;
|
|
|
|
|
- that.handleResize();
|
|
|
|
|
- });
|
|
|
|
|
- this.$apis.getStudentEvalExams({state: 0}).then(res => {
|
|
|
|
|
- this.myEvalExamList = res.data.data.examVOList;
|
|
|
|
|
- that.handleResize();
|
|
|
|
|
- });
|
|
|
|
|
- this.$apis.getStudentCoderExams({}).then(res => {
|
|
|
|
|
- this.myCoderExamList = res.data.data.res;
|
|
|
|
|
- that.handleResize();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.myCourseList = (await this.$apis.getStudentCourses()).data.data;
|
|
|
|
|
+ this.myEvalExamList = (await this.$apis.getStudentEvalExams({ state: 0 })).data.data["examVOList"];
|
|
|
|
|
+ this.myCoderExamList = (await this.$apis.getStudentCoderExams({})).data.data["res"];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- await this.$nextTick(() => {
|
|
|
|
|
- that.handleResize();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ await this.$nextTick(() => that.handleResize());
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
//其他函数
|
|
//其他函数
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ toAuth() {
|
|
|
|
|
+ this.$router.push("/auth");
|
|
|
|
|
+ },
|
|
|
|
|
+ toCourse() {
|
|
|
|
|
+ this.$router.push("/course");
|
|
|
|
|
+ },
|
|
|
|
|
+ toManage() {
|
|
|
|
|
+ this.$router.push("/manage");
|
|
|
|
|
+ },
|
|
|
|
|
+ toTest() {
|
|
|
|
|
+ this.$router.push("/test");
|
|
|
|
|
+ },
|
|
|
handleResize() {
|
|
handleResize() {
|
|
|
if (this.$route.path !== "/portal") return;
|
|
if (this.$route.path !== "/portal") return;
|
|
|
- // todo @DQJ 可能还得优化
|
|
|
|
|
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
|
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
if (scrollTop > 100) {
|
|
if (scrollTop > 100) {
|
|
|
this.courseRowHeight = 640;
|
|
this.courseRowHeight = 640;
|
|
@@ -255,15 +260,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
changeTestPane() {
|
|
changeTestPane() {
|
|
|
const that = this;
|
|
const that = this;
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- that.handleResize();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.$nextTick(() => that.handleResize());
|
|
|
},
|
|
},
|
|
|
state(testVO) {
|
|
state(testVO) {
|
|
|
|
|
+ const now = new Date();
|
|
|
if (testVO.examId) {
|
|
if (testVO.examId) {
|
|
|
- if (new Date(testVO.endTime) < new Date()) {
|
|
|
|
|
|
|
+ if (new Date(testVO.endTime) < now) {
|
|
|
return "FINISHED";
|
|
return "FINISHED";
|
|
|
- } else if (new Date(testVO.startTime) > new Date()) {
|
|
|
|
|
|
|
+ } else if (new Date(testVO.startTime) > now) {
|
|
|
return "NOT_STARTED";
|
|
return "NOT_STARTED";
|
|
|
} else {
|
|
} else {
|
|
|
return "RUNNING";
|
|
return "RUNNING";
|
|
@@ -271,9 +275,9 @@ export default {
|
|
|
} else {
|
|
} else {
|
|
|
if (testVO.status === "CLOSED") {
|
|
if (testVO.status === "CLOSED") {
|
|
|
return "CLOSED";
|
|
return "CLOSED";
|
|
|
- } else if (testVO.startAt * 1000 > new Date()) {
|
|
|
|
|
|
|
+ } else if (testVO.startAt * 1000 > now) {
|
|
|
return "NOT_STARTED";
|
|
return "NOT_STARTED";
|
|
|
- } else if (testVO.endAt * 1000 < new Date()) {
|
|
|
|
|
|
|
+ } else if (testVO.endAt * 1000 < now) {
|
|
|
return "FINISHED";
|
|
return "FINISHED";
|
|
|
} else {
|
|
} else {
|
|
|
return "RUNNING";
|
|
return "RUNNING";
|