在线答题

This commit is contained in:
aixianling
2021-12-20 10:09:17 +08:00
parent b4613e9f6e
commit a715749c2a
5 changed files with 117 additions and 81 deletions

View File

@@ -1,7 +1,7 @@
<template>
<section class="home">
<section class="AppOnlineAnswer">
<div class="page" v-if="list.length">
<img src="../../static/img/answer-bg.png" alt="" class="bg-img">
<img src="./static/img/answer-bg.png" alt="" class="bg-img">
<div class="subject-content" v-if="!showAnwser">
<div class="btn" v-if="showTopBtn" @click="confirm()">{{ topBtnText }}</div>
<div class="bg-fff pad-b48">
@@ -16,24 +16,28 @@
<div class="text">{{ list[index].title }}</div>
<!-- 单选 -->
<div v-if="list[index].type == 1">
<div class="item" v-for="(item, i) in list[index].items" :key="i" @click="itemClick(i)" :class="{ 'item-click': clickIndex === i, 'item-success': showAnalysis && item.checked == 1, 'item-error': showAnalysis && clickIndex == i && item.checked == 0}">
<img src="../../static/img/success-icon.png" alt="" v-if="showAnalysis && item.checked == 1">
<img src="../../static/img/error-icon.png" alt="" v-if="showAnalysis && clickIndex == i && item.checked == 0">
<div class="item" v-for="(item, i) in list[index].items" :key="i" @click="itemClick(i)"
:class="{ 'item-click': clickIndex === i, 'item-success': showAnalysis && item.checked == 1, 'item-error': showAnalysis && clickIndex == i && item.checked == 0}">
<img src="./static/img/success-icon.png" alt="" v-if="showAnalysis && item.checked == 1">
<img src="./static/img/error-icon.png" alt=""
v-if="showAnalysis && clickIndex == i && item.checked == 0">
{{ item.sort }} &nbsp;{{ item.content }}
</div>
</div>
<!-- 多选 -->
<div v-if="list[index].type == 2">
<div class="item" v-for="(item, i) in list[index].items" :key="i" @click="itemClick(i)" :class="{ 'item-click': item.isCheked, 'item-success': showAnalysis && item.checked == 1, 'item-error': showAnalysis && item.isCheked && item.checked == 0}">
<img src="../../static/img/success-icon.png" alt="" v-if="showAnalysis && item.checked == 1">
<img src="../../static/img/error-icon.png" alt="" v-if="showAnalysis && clickIndex == i && item.checked == 0">
<div class="item" v-for="(item, i) in list[index].items" :key="i" @click="itemClick(i)"
:class="{ 'item-click': item.isCheked, 'item-success': showAnalysis && item.checked == 1, 'item-error': showAnalysis && item.isCheked && item.checked == 0}">
<img src="./static/img/success-icon.png" alt="" v-if="showAnalysis && item.checked == 1">
<img src="./static/img/error-icon.png" alt=""
v-if="showAnalysis && clickIndex == i && item.checked == 0">
{{ item.sort }} &nbsp;{{ item.content }}
</div>
</div>
<!-- <div class="item item-click">A. 吴起镇</div>
<div class="item item-success"> <img src="../../static/img/success-icon.png" alt="">吴起镇</div>
<div class="item item-error"> <img src="../../static/img/error-icon.png" alt="">吴起镇</div>
<div class="item item-success"> <img src="./static/img/success-icon.png" alt="">吴起镇</div>
<div class="item item-error"> <img src="./static/img/error-icon.png" alt="">吴起镇</div>
<div class="item">A. 吴起镇</div> -->
</div>
<div class="bg-fff mar-t32" v-if="showAnalysis">
@@ -43,13 +47,14 @@
</div>
</div>
<div class="success-title">正确答案{{ list[index].answer }}</div>
<div class="success-text"><u-parse :html="list[index].analysis"></u-parse></div>
<div class="success-text">
<u-parse :html="list[index].analysis"></u-parse>
</div>
</div>
</div>
<div class="subject-content" v-else>
<div class="bg-fff pad-b48">
<img src="../../static/img/answer-head.png" alt="" class="head-img">
<img src="./static/img/answer-head.png" alt="" class="head-img">
<div class="head-content">
<p>本次答对题目数</p>
<div>{{ resultInfo.right }}</div>
@@ -69,8 +74,10 @@
</template>
<script>
import {mapState} from "vuex";
export default {
name: "home",
name: "AppOnlineAnswer",
appName: "在线答题",
computed: {
...mapState(["user", "token"]),
},
@@ -89,7 +96,7 @@ export default {
resultInfo: {}
};
},
onLoad(options) {
onLoad() {
this.createdTime = Date.parse(new Date())
this.getList()
},
@@ -136,7 +143,7 @@ export default {
this.init()
} else { //
this.showTopBtn = false
this.endTime = Date.parse(new Date());var timestamp = Date.parse(new Date());
this.endTime = Date.parse(new Date());
this.useTime = this.intervalTime(this.endTime - this.createdTime)
this.getResult()
}
@@ -175,9 +182,7 @@ export default {
});
},
intervalTime(time) {
var date3 = time
var days = Math.floor(date3 / (24 * 3600 * 1000));
var leave1 = date3 % (24 * 3600 * 1000); //
var leave1 = time % (24 * 3600 * 1000); //
var hours = Math.floor(leave1 / (3600 * 1000));
hours = hours < 10 ? '0' + hours : hours
var leave2 = leave1 % (3600 * 1000); //
@@ -210,7 +215,8 @@ export default {
</script>
<style scoped lang="scss">
@import "../../../common/common.css";
.home {
.AppOnlineAnswer {
width: 100%;
height: 100%;
}
@@ -219,10 +225,12 @@ export default {
width: 100%;
height: 100%;
background-color: #F6F6F6;
.bg-img {
width: 100%;
height: 800px;
}
.subject-content {
width: 100%;
border-radius: 4px;
@@ -231,6 +239,7 @@ export default {
position: absolute;
top: 124px;
z-index: 9;
.btn {
padding: 0 30px;
height: 64px;
@@ -247,21 +256,26 @@ export default {
right: 36px;
z-index: 99;
}
.pad-top {
padding-top: 100px;
}
.pad-b48 {
padding-bottom: 48px;
}
.mar-t32 {
margin-top: 32px;
}
.bg-fff {
width: 100%;
background-color: #fff;
border-radius: 4px;
box-shadow: 0px 6px 8px 4px rgba(218, 227, 234, 0.42);
box-shadow: 0 6px 8px 4px rgba(218, 227, 234, 0.42);
position: relative;
.title {
width: 100%;
height: 100px;
@@ -270,12 +284,14 @@ export default {
box-sizing: border-box;
display: flex;
justify-content: space-between;
.left {
font-size: 36px;
font-family: PingFang-SC-Heavy, PingFang-SC;
font-weight: 800;
color: #333;
line-height: 50px;
.tips {
display: inline-block;
width: 8px;
@@ -284,12 +300,14 @@ export default {
margin-right: 16px;
}
}
.right {
font-size: 34px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #999;
line-height: 48px;
.big-num {
font-size: 72px;
font-family: PingFang-SC-Heavy, PingFang-SC;
@@ -298,6 +316,7 @@ export default {
}
}
}
.text {
padding: 48px 40px;
font-size: 32px;
@@ -307,6 +326,7 @@ export default {
line-height: 48px;
word-break: break-all;
}
.item {
width: 612px;
background: #FAFBFC;
@@ -321,6 +341,7 @@ export default {
font-weight: 500;
color: #687178;
line-height: 44px;
img {
width: 36px;
height: 36px;
@@ -328,21 +349,25 @@ export default {
margin-right: 14px;
}
}
.item-click {
background: #F5F5F2;
border: 1px solid #AD9B8D;
color: #B7A38E;
}
.item-success {
background: #E9FAF0;
border: 1px solid #E9FAF0;
color: #40BF6F;
}
.item-error {
background: #FDEBEB;
border: 1px solid #FDEBEB;
color: #D03A28;
}
.success-title {
padding: 32px 0 0 40px;
font-size: 32px;
@@ -351,6 +376,7 @@ export default {
color: #333;
line-height: 44px;
}
.success-text {
padding: 32px 40px 56px;
font-size: 32px;
@@ -360,10 +386,12 @@ export default {
line-height: 48px;
word-break: break-all;
}
.head-img {
width: 100%;
height: 260px;
}
.head-content {
position: absolute;
width: 100%;
@@ -372,6 +400,7 @@ export default {
left: 0;
padding: 56px 0 0 72px;
box-sizing: border-box;
p {
font-size: 38px;
font-family: PingFangSC-Medium, PingFang SC;
@@ -379,6 +408,7 @@ export default {
color: #FBE5E6;
line-height: 52px;
}
div {
font-size: 100px;
font-family: PingFangSC-Regular, PingFang SC;
@@ -387,8 +417,10 @@ export default {
line-height: 140px;
}
}
.info-content {
padding: 88px 32px 40px;
.info-item {
display: inline-block;
width: 300px;
@@ -399,10 +431,12 @@ export default {
line-height: 48px;
margin-bottom: 42px;
}
.mar-b132 {
margin-bottom: 132px;
}
}
.big-btn {
display: inline-block;
width: 296px;
@@ -416,11 +450,13 @@ export default {
font-weight: 400;
color: #666;
}
.bg-red {
border: 0;
background: #D03A28;
color: #fff;
}
.mar-r22 {
margin: 0 22px 0 32px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB