提交 e229ada9 authored 作者: zfl's avatar zfl

试题提交

上级 91444907
......@@ -45,7 +45,7 @@
>
<span class="test_info"
>证件号<span class="test_info_show">{{
user_info.idcard
user_info.idcard.replace(/(\w{4})\w*(\w{4})/,'$1********$2')
}}</span></span
>
<span class="test_info"
......@@ -64,12 +64,12 @@
<div
v-for="(item, index) in data_keys"
:key="index"
class="info_unit"
class="info_unit" v-if="item.key"
v-show="examination_questions_info[item.key]"
>
<span class="test_info">{{ item.label }}</span>
<span class="test_info_show">{{
examination_questions_info[item.key] || '暂无'
item.key=='idcard'?examination_questions_info[item.key].replace(/(\w{4})\w*(\w{4})/,'$1********$2') :(examination_questions_info[item.key] || '暂无')
}}</span>
</div>
</el-card>
......@@ -110,9 +110,6 @@ export default {
this.examination_questions_info = { ...this.testdata };
},
mounted() {
// console.log(this.user_info);
// console.log(secondsToMinutes(timer));
// console.log(this.testdata.const_down);
this.time = secondsToMinutes(this.testdata.const_down);
this.countDownTimer();
},
......@@ -122,10 +119,12 @@ export default {
},
countDownTimer() {
this.timer = setInterval(() => {
if (this.testdata.const_down) {
if (this.testdata.const_down>0) {
this.time = secondsToMinutes(this.testdata.const_down--);
if(parseInt(this.testdata.const_down/10)==this.testdata.const_down/10){this.$emit('sub', false,false);}
} else {
clearTimeout(this.timer);
this.$emit('sub', true,true);
}
}, 1000);
},
......
......@@ -29,12 +29,12 @@
<el-form-item prop="username">
<!-- 手机号 -->
<div>
<p style="font-weight: bold" class="pointer">手机号</p>
<p style="font-weight: bold" class="pointer">邮箱</p>
<div>
<el-input
ref="username"
v-model="loginForm.phone"
placeholder="输入手机号"
placeholder="输入邮箱"
name="username"
type="text"
tabindex="1"
......@@ -53,9 +53,6 @@
prop="password"
style="padding-right: 10px"
>
<!--
-->
<el-input
:key="passwordType"
ref="password"
......@@ -79,7 +76,7 @@
@click="sendMessage"
type="warning"
style="background-color: #e6a23c"
>发送短信</el-button
>{{timer?(time+'秒'):"获取验证码"}}</el-button
>
</el-col>
</el-row>
......@@ -104,7 +101,7 @@
</template>
<script>
import { validUsername } from '@/utils/validate';
import { validUsername,validEmail } from '@/utils/validate';
import SocialSign from './components/SocialSignin';
import { getCode } from '@/api/user.js';
export default {
......@@ -112,14 +109,14 @@ export default {
components: { SocialSign },
data() {
const validateUsername = (rule, value, callback) => {
if (!validUsername(value)) {
callback(new Error('手机号错误,请重新输入'));
if (!validEmail(value)) {
callback(new Error('邮箱号错误,请重新输入'));
} else {
callback();
}
};
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
if (value.length < 4) {
callback(new Error('验证码错误,请重新输入'));
} else {
callback();
......@@ -147,6 +144,8 @@ export default {
showDialog: false,
redirect: undefined,
otherQuery: {},
timer:null,
time:60,
};
},
watch: {
......@@ -175,6 +174,18 @@ export default {
// window.removeEventListener('storage', this.afterQRScan)
},
methods: {
countDown(){
this.time-=1
this.timer = setInterval(() => {
if (this.time>0) {
this.time -=1
} else {
this.time=60
clearTimeout(this.timer);
this.timer=null
}
}, 1000);
},
checkCapslock(e) {
const { key } = e;
this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z';
......@@ -272,11 +283,9 @@ export default {
// }
// }
sendMessage() {
console.log('触发');
getCode({ email: this.loginForm.phone }).then((res) => {
console.log('验证码');
console.log(res);
this.loginForm.eamil_key = res.key || null;
this.countDown()
});
this.$refs.ruleForm.validate((valid) => {
if (valid) {
......
......@@ -146,8 +146,8 @@
{{ item.examination_questions_title }}
</h3>
<span
>开考时间:{{
item.examination_questions.begin_date
>考试时间:{{
item.answer_time
}}</span
>
</div>
......@@ -155,7 +155,7 @@
<div class="score_box">
<span style="margin-left: 30px">成绩:</span>
<span style="font-size: 48px; font-weight: bold">{{
item.examination_questions.score
item.score
}}</span>
</div>
<div style="border-left: 1px solid #f4d6a9">
......@@ -164,6 +164,7 @@
item.examination_questions.status == 4 &&
item.status == 3
"
@click="route(item)"
type="warning"
class="finish_btn"
>查看
......@@ -259,6 +260,13 @@ export default {
// );
},
methods: {
route(row){
this.$router.push({
path: '/analysis',
query: {id: row.id,},
});
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
},
......
......@@ -11,11 +11,28 @@
<img src="image/Frame.png" />
</div>
<div class="result_container">
<el-card class="box-card">
<h2>**中烟评级技能提升甩把测试</h2>
<div class="tag_warning">标签四</div>
<el-card class="box-card" v-if="test_result.examination_questions_title">
<h2>{{test_result.examination_questions_title}}</h2>
<p style="text-align: center;padding:20px 0px;">
<span style="padding-left:23px;">用户名 {{test_result.name}}</span>
<span style="padding-left:23px;">证件号 {{test_result.idcard.replace(/(\w{4})\w*(\w{4})/,'$1********$2')}}</span>
<span style="padding-left:23px;">考试开始时间 {{test_result.begin_answer_time}}</span>
<span style="padding-left:23px;">时长 {{test_result.examination_questions.duration}}分</span>
</p>
<div class="tag_warning">
<el-row style="text-align: center;">
<el-col :span="12">
<p style="padding:20px 0px;">本次考试成绩</p>
<p style="font-size: 24px;color:rgb(225, 76, 76)">{{test_result.score}}</p>
</el-col>
<el-col :span="12">
<p style="padding:20px 0px;">用时(分钟)</p>
<p style="font-size: 24px;">{{secondsToMinutesfun(test_result.answer_duration)}}</p>
</el-col>
</el-row>
</div>
<div class="back_btn">
<el-button @click.native="start" type="primary">返回首页</el-button>
<el-button style="padding:10px 40px" @click.native="start" type="primary">返回首页</el-button>
</div>
</el-card>
</div>
......@@ -23,11 +40,36 @@
</template>
<script>
import { secondsToMinutes } from '@/utils/tool';
import { getResultsData } from '@/api/user';
export default {
name: '',
data() {
return {};
return {
result_id: null,
test_result:{},
};
},
created() {
this.result_id = this.$route.query.id;
},
mounted() {
this.getTestData();
},
methods: {
start(){
this.$router.push({path: '/personal'});
},
secondsToMinutesfun(time){
return secondsToMinutes(time)
},
getTestData() {
getResultsData(this.result_id).then((res) => {
this.test_result=res
});
},
}
};
</script>
......@@ -49,7 +91,6 @@ export default {
text-align: center;
width: 160px;
height: 40px;
background-color: #00a580;
}
.tag_warning {
width: 380px;
......
......@@ -9,7 +9,7 @@
<template>
<div>
<test-info v-if="test_card_info" :testdata="test_card_info"></test-info>
<test-info v-if="test_card_info.title" :testdata="test_card_info" @sub="sub"></test-info>
<el-card class="box-card">
<el-row v-if="false">
<el-col :span="15">
......@@ -29,7 +29,10 @@
<el-row class="box_card_header" v-if="true">
<el-col :span="14">
<div class="grid-content">
<h3 class="photo_header_title">考试结果</h3>
<div>
<h3 class="photo_header_title" style="display: inline-block;">考试结果</h3>
<el-button type="primary" @click="sub(false)" style="float:right;">保存</el-button>
</div>
<div class="list_container">
<el-row>
<template>
......@@ -111,9 +114,7 @@
:headers="headers"
:show-file-list="false"
>
<el-button type="primary" style="margin-left: 159px"
>重新上传</el-button
>
<el-button type="primary" style="margin-left: 159px">重新上传</el-button>
</el-upload>
<!-- <el-upload
......@@ -160,9 +161,7 @@
</el-col>
</el-row>
<div class="btn_upload_result">
<el-button type="primary" style="width: 100%" @click="sub()"
>提交</el-button
>
<el-button type="primary" style="width: 100%" @click="sub()">提交</el-button>
</div>
</el-card>
</div>
......@@ -187,6 +186,7 @@ export default {
result_id: null,
imgrul: null,
test_card_info: {},
is_force:false,
};
},
created() {
......@@ -194,42 +194,38 @@ export default {
},
mounted() {
this.user_info = this.$store.state.user.user;
// console.log(getToken());
// this.getListData();
this.getTestData();
// this.splitArr();
// this.getResults();
},
methods: {
sub() {
sub(is_submit=true,is_force=false) {
var data = {};
let is_tip=false
for (let i of this.test_result_sub_data) {
data[i.id] = i.value;
if(!i.value){
is_tip=true
}
}
uploadTestResults(this.result_id, {
is_submit: true,
test_results: data,
}).then((res) => {
console.log(res);
if (res.code == 200) {
if(is_submit && is_tip && !is_force){
this.$confirm('您还有题目未答完成,是否强制提交?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then( () => {
this.sub(is_submit,true)
})
return
}
uploadTestResults(this.result_id, {is_submit: is_submit,test_results: data,}).then((res) => {
if (res.code == 200 && is_submit) {
this.$message.success(res.message);
this.$router.push({
path: '/test-result',
query: {
id: this.result_id,
},
query: {id: this.result_id,},
});
}
});
console.log('@@@@@@@' + data);
},
// getListData() {
// getResults().then((res) => {
// console.log('测试结果信息');
// this.test_results = res || [];
// console.log(res);
// });
// },
getTestData() {
getResultsData(this.result_id, { is_begin: true }).then((res) => {
console.log('开始考试详情');
......@@ -238,11 +234,11 @@ export default {
this.test_card_info = {
idcard: res.idcard,
name: res.name,
score: res.score,
// score: res.score,
begin_answer_time: res.begin_answer_time,
duration: res.examination_questions.duration,
const_down:
res.examination_questions.duration * 60 - res.begin_answer_duration,
res.examination_questions.duration * 60 - (res.begin_answer_duration?res.begin_answer_duration:0),
status: res.status,
title: res.examination_questions_title,
};
......@@ -253,10 +249,10 @@ export default {
this.test_result_sub_data.push({
id: this.test_results.examination_questions
.examination_question_detail[i].id,
value: this.test_results.test_results[i.id]
value: this.test_results.test_results[this.test_results.examination_questions
.examination_question_detail[i].id]
? this.test_results.test_results[
this.test_results.examination_questions
.examination_question_detail[i].id
this.test_results.examination_questions.examination_question_detail[i].id
]
: '',
});
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论