提交 d1750965 authored 作者: Yroc's avatar Yroc

学生端功能

上级 e229ada9
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 15:51:01
* @Last Modified time: 2023-03-13 10:11:24
*/
import request from '@/utils/request'
......@@ -83,6 +83,14 @@ export function uploadTestResults(id,data) {
})
}
//考试结果查看
export function viewExamResults(id) {
return request({
url: `/student/test_results/getResults/${id}`,
method: 'get',
})
}
export function logout() {
return request({
url: '/vue-element-admin/user/logout',
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-03-01 15:29:44
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 16:59:11
* @Last Modified time: 2023-03-13 16:33:45
*/
</script><template>
<div class="header_container">
......@@ -31,6 +31,7 @@
>{{ e.label }}</el-tag
>
<el-tag
v-if="time"
type="warning"
style="margin-left: 30px; backgound-color: #fcf6ec"
>{{ time }}</el-tag
......@@ -44,9 +45,14 @@
}}</span></span
>
<span class="test_info"
>证件号<span class="test_info_show">{{
user_info.idcard.replace(/(\w{4})\w*(\w{4})/,'$1********$2')
}}</span></span
>证件号<span class="test_info_show">
<!-- {{
user_info.idcard.replace(/(\w{4})\w*(\w{4})/, '$1********$2') ||
'暂无'
}} -->
{{ id_card(user_info.idcard) }}</span
></span
>
<span class="test_info"
>考试时间<span class="test_info_show">{{
......@@ -64,13 +70,30 @@
<div
v-for="(item, index) in data_keys"
:key="index"
class="info_unit" v-if="item.key"
class="info_unit"
v-if="item.key"
v-show="examination_questions_info[item.key]"
>
<!-- examination_questions_info[item.key].replace(
/(\w{4})\w*(\w{4})/,
'$1********$2'
) -->
<span class="test_info">{{ item.label }}</span>
<span class="test_info_show">{{
item.key=='idcard'?examination_questions_info[item.key].replace(/(\w{4})\w*(\w{4})/,'$1********$2') :(examination_questions_info[item.key] || '暂无')
<span class="test_info_show">
<!-- {{
item.key == 'idcard'
? id_card(examination_questions_info[item.key])
: examination_questions_info[item.key] || '暂无'
}} -->
<span v-if="item.key == 'idcard'">{{
id_card(examination_questions_info['idcard'])
}}</span>
<span v-else-if="item.key == 'duration'">
{{ change_time(examination_questions_info['duration']) }}
</span>
<span v-else>{{ examination_questions_info[item.key] }}</span>
</span>
</div>
</el-card>
</div>
......@@ -79,7 +102,7 @@
<script>
import { secondsToMinutes } from '@/utils/tool';
export default {
name: '',
name: 'TestInfo',
props: ['testdata'],
data() {
return {
......@@ -119,15 +142,42 @@ export default {
},
countDownTimer() {
this.timer = setInterval(() => {
if (this.testdata.const_down>0) {
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);}
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);
this.$emit('sub', true, true);
}
}, 1000);
},
//
id_card(str) {
if (str) {
return str.replace(/(\w{4})\w*(\w{4})/, '$1********$2');
} else {
return '暂无';
}
},
// id_card_next(str) {
// if (str) {
// return str.replace(/(\w{4})\w*(\w{4})/, '$1********$2');
// } else {
// return '暂无';
// }
// },
change_time(str) {
if (str) {
return secondsToMinutes(str);
} else {
return '暂无';
}
},
},
};
</script>
......
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-07 10:40:29
* @Last Modified time: 2023-03-13 16:35:08
*/
import Vue from 'vue'
import Router from 'vue-router'
......@@ -153,6 +153,11 @@ export const asyncRoutes = [
name:'analysis',
component: () => import('@/views/analysis/index.vue'),
},
{
path:'test',
name:'test',
component: () => import('@/views/test/index.vue'),
},
]
},
......
......@@ -2,9 +2,10 @@
* @Author: AnthonyD
* @Date: 2023-03-11 11:04:16
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 12:09:07
* @Last Modified time: 2023-03-13 14:26:44
*/
export function secondsToMinutes(sec){
if (!sec) return false
const totalSeconds = sec;
/* 获取完整分钟数 */
const minutes = Math.floor(totalSeconds / 60);
......@@ -19,3 +20,19 @@ const padTo2Digits = (num)=> {
const result = `${padTo2Digits(minutes)}分${padTo2Digits(seconds)}秒`;
return result;
}
//一维转换二维数组
export function array_conversion(arr, nums) {
const length = arr.length;
const n = nums // 假设每段显示n个
const Num = length % n === 0 ? length / n : Math.floor((length / n) + 1)  //得出多少份
const res = [] //定义数组接受最终的数据
for (let i = 0; i < Num; i++) {
// slice() 方法返回一个从开始到结束(不包括结束)的数组。且原始数组不会被修改。
const newArr = arr.slice(i * n, i * n + n) //得到每份的数据
res.push(JSON.parse(JSON.stringify(newArr))) //往res数组里加数据
}
return res;
}
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-03 17:24:48
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-04 17:01:03
*/
</script><template>
<div class="hover_card">
<el-row>
<el-col :span="12">
<h3 class="card_header_title">错误点分析</h3>
</el-col>
<el-col :span="12" style="text-align: right">
<el-button class="card_header_button" icon="el-icon-close"
>关闭</el-button
>
</el-col>
</el-row>
<div class="table_box">
<div v-for="(e, i) in 6" :key="i" class="table_line">
<div class="left">1</div>
<div class="right">2</div>
</div>
</div>
<!-- <el-table :data="gridData" class="hover_card">
<el-table-column width="150" prop="date" label="日期"></el-table-column>
<el-table-column width="100" prop="name" label="姓名"></el-table-column>
<el-table-column
width="300"
prop="address"
label="地址"
></el-table-column>
</el-table> -->
<!-- <div>
</div>
<div>
<div class="row_box" v-for="e in 4" :key="e">
<div class="row_line row_header">
<div class="left">序号</div>
<div class="right">结果</div>
</div>
</div>
</div> -->
</div>
</template>
<script>
export default {
props: ['gridData'],
name: '',
data() {
return {
info_data: {
result: 'C3F',
area: '南方',
conclusion: 'C2F',
breed: '中烟',
detail: '1111',
image: '',
},
};
},
mounted() {
// console.log(this.gridData);
},
};
</script>
<style lang="scss" scoped>
.hover_card {
width: 100%;
height: 400px;
}
.card_header_title {
margin: 8px 0;
color: #000;
}
.card_header_button {
background-color: #ebedf0;
padding: 5px 16px;
margin: 8px 0;
color: #000;
}
/* .row_box {
width: 100%;
display: inline-block;
.row_line .left {
width: 60px;
display: inline-block;
background-color: #f5f7fa;
}
.row_line .right {
width: calc(100% - 60px);
display: inline-block;
padding: 8px 25px;
}
}
*/
.table_box {
border: 1px solid #e5e7ed;
border-radius: 4px;
overflow: hidden;
.table_line {
border-bottom: 1px solid #e5e7ed;
.left {
width: 130px;
padding: 10px 15px;
box-sizing: border-box;
float: left;
background: #f5f7fa;
border-right: 1px solid #e5e7ed;
}
.right {
width: calc(100% - 130px);
padding: 10px 15px;
box-sizing: border-box;
float: left;
}
}
.table_line::after {
content: '';
display: block;
clear: both;
}
}
.table_box:last-child {
border-bottom: none;
}
</style>
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-02 14:19:33
* @Date: 2023-03-13 09:56:01
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-10 11:39:26
* @Last Modified time: 2023-03-13 19:01:05
*/
</script><template>
<div class="content_container">
<test-info v-if=""></test-info>
<div class="body_container">
<el-card class="box-card card_first">
<div class="list_container">
<div class="row_box" v-for="e in 4" :key="e">
<div class="row_line row_header">
</script>
<template>
<div class="module_container">
<div class="card_container">
<!-- <examination-header
v-if="student_brief_introduction"
:examination_questions="student_brief_introduction"
:key="new Date().getTime()"
></examination-header> -->
<!-- <test-info></test-info> -->
<test-info v-if="test_card_info" :testdata="test_card_info"></test-info>
<el-card class="box-card" v-if="questions_list.length > 0">
<div class="table_container">
<div class="header_box">
<div class="row_box" v-for="(item, index) in 5" :key="index">
<div class="left">序号</div>
<div class="right">结果</div>
</div>
<div class="row_line" v-for="obj in 10" :key="obj">
<div class="left">zuo</div>
<div class="right">
<span v-if="obj % 2">you</span>
<el-popover
v-else
placement="right"
width="560"
trigger="click"
>
<div>
<popover-view
:gridData="gridData"
width="300"
></popover-view>
</div>
<span slot="reference">you</span>
</el-popover>
</div>
</div>
<div
class="lin_box"
v-for="(items, index) in questions_list"
:key="index"
>
<div class="row_box" v-for="(e, i) in items" :key="i">
<div class="left">{{ e.index_number + 1 }}</div>
<div
class="right"
:class="
e.grades_code &&
detailed_information.test_results[e.id] != e.grades_code
? 'wrong_answer'
: ''
"
>
<el-popover placement="right" trigger="click">
<div class="table_box">
<!-- <div><h3>错误点分析</h3></div> -->
<table border="1" cellspacing="0">
<tr>
<td class="title_box">
<div class="left_box">我的结果</div>
</td>
<td>
<div
class="right_box"
:class="
e.grades_code &&
detailed_information.test_results[e.id] !=
e.grades_code
? 'wrong_answer'
: ''
"
>
{{
detailed_information.test_results[e.id] || '暂无'
}}
</div>
</td>
</tr>
<tr>
<td class="title_box">
<div class="left_box">烟草区域</div>
</td>
<td>
<div class="right_box">
{{ e.place_of_production || '暂无' }}
</div>
</el-card>
</div>
<div class="foot_container">
<el-card class="box-card card_next">
<div>
<el-radio-group>
<el-radio-button label="1"></el-radio-button>
<el-radio-button label="2"></el-radio-button>
<el-radio-button label="3"></el-radio-button>
</el-radio-group>
</div>
<div></div>
<!-- <div>
<card-view :card_style="card_style" :table_data="list"> </card-view>
</div> -->
<!-- 1 -->
<div>
<el-row>
<el-col :span="8">
<div class="card_father">
<card-view :card_style="card_style" :table_data="list">
</card-view>
</td>
</tr>
<tr>
<td class="title_box">
<div class="left_box">试题结论</div>
</td>
<td>
<div class="right_box">
{{ e.grades_code || '暂无' }}
</div>
</el-col>
<el-col :span="8">
<div class="card_father">
<card-view :card_style="card_style1" :table_data="list">
</card-view>
</td>
</tr>
<tr>
<td class="title_box">
<div class="left_box">烟草品种</div>
</td>
<td>
<div class="right_box">
{{ e.breed_name || '暂无' }}
</div>
</el-col>
<el-col :span="8">
<div class="card_father">
<card-view
:card_style="card_style2"
:table_data="list"
></card-view>
</td>
</tr>
<tr>
<td class="title_box">
<div class="left_box">试题详解</div>
</td>
<td>
<div class="right_box">
{{ e.explain_in_detail || '暂无' }}
</div>
</el-col>
</el-row>
</td>
</tr>
<tr>
<td class="title_box">
<div class="left_box">烟草实物</div>
</td>
<td>
<div class="right_box">
<div
v-if="e.image && e.image != '/'"
class="image_box"
>
<img :src="IP + e.image" alt="" />
</div>
<div>
<el-row>
<el-col :span="8">
<div class="card_father">
<card-view :card_style="card_style3" :table_data="list">
</card-view>
<div v-else>暂无</div>
</div>
</el-col>
<el-col :span="16">
<div class="card_father">
<card-view :card_style="card_style4" :chart_data="chart_data">
</card-view>
</td>
</tr>
</table>
</div>
</el-col>
</el-row>
<!-- <span slot="reference"> {{ e.grades_code || '暂无' }}</span> -->
<span slot="reference">
{{
detailed_information.test_results[e.id] || '暂无'
}}</span
>
</el-popover>
</div>
<!-- 2 -->
<div>
<el-row>
<el-col :span="12">
<div class="card_father">
<card-view :card_style="card_style3" :table_data="list">
</card-view>
</div>
</el-col>
<el-col :span="12">
<div class="card_father">
<card-view :card_style="card_style4" :table_data="list">
</card-view>
</div>
</el-col>
</el-row>
</div>
<!-- 3 -->
<el-row>
<el-col :span="12">
<div class="card_father">
<card-view :card_style="card_style3" :table_data="list">
</card-view>
</el-card>
</div>
</el-col>
</el-row>
<!-- 4 -->
<div>
<el-row>
<el-col :span="8">
<div class="card_father">
<card-view :card_style="card_style3" :table_data="list">
</card-view>
</div>
</el-col>
<el-col :span="16">
<div class="card_father">
<card-view :card_style="card_style5" :chart_data="chart_data1">
</card-view>
</div>
</el-col>
</el-row>
</div>
</el-card>
<el-dialog title="提示" :visible.sync="is_dialogVisible" width="60%">
<div class="table_box">
<!-- -->
</div>
<span slot="footer" class="dialog-footer">
<el-button>取 消</el-button>
<el-button type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import TestInfo from '@/components/TestInfo/index';
import CardView from '@/components/CardView/index';
import PopoverView from './components/popover-view';
import TestInfo from '@/components/TestInfo/index.vue';
import { viewExamResults } from '@/api/user';
import { array_conversion } from '@/utils/tool';
export default {
name: '',
components: { TestInfo, CardView, PopoverView },
components: { TestInfo },
data() {
return {
card_style: {
tltle: '成绩分值段',
color: '#038d6e',
},
card_style1: {
tltle: '南方烟北方烟得分情况',
color: '#e6a23c',
},
card_style2: {
tltle: '省级产区得分情况',
color: '#505f79',
},
card_style3: {
tltle: '品种得分情况',
color: '#038d6e',
},
card_style4: {
tltle: '最高分、最低分、平均分,中位数、众数、离散(变异系数)',
color: '#99a9bf',
},
card_style5: {
tltle: '最高分、最低分、平均分,中位数、众数、离散(变异系数)',
color: '#99a9bf',
},
list: [
{
type: 1,
num: 2,
person: 3,
proportion: 4,
},
{
type: 1,
num: 2,
person: 3,
proportion: 4,
},
{
type: 1,
num: 2,
person: 3,
proportion: 4,
},
{
type: 1,
num: 2,
person: 3,
proportion: 4,
},
],
chart_data: [
[150, 230, 224, 218, 135, 147, 260, 184, 348, 376, 222, 333],
[110, 290, 334, 288, 735, 647, 230, 184, 638, 176, 222, 111],
],
chart_data1: [
[850, 230, 124, 618, 35, 147, 160, 184, 398, 476, 222, 333],
[410, 190, 134, 588, 235, 647, 230, 484, 238, 176, 222, 111],
],
tableData: [
{
date: '2016',
name: '王小虎',
},
{
date: '2016',
name: '王小虎',
},
{
date: '2016',
name: '王小虎',
},
{
date: '2016',
name: '王小虎',
},
{
date: '2016',
name: '王小虎',
IP: process.env.VUE_APP_BASE_API,
//初始化请求参数
request_params: {
val: '',
page: 1,
limit: 10,
total: null,
},
],
gridData: [
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
is_loading: false,
tableData: [],
is_dialogVisible: false,
is_updata_type: 'add',
//头部信息
student_brief_introduction: null,
//详细信息
detailed_information: {},
//考试结果id
test_results_id: null,
//试题结果
questions_list: [],
test_card_info: null,
};
},
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
computed: {},
created() {
let id = this.$route.query.id;
if (id) this.test_results_id = id;
},
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
mounted() {
this.init();
},
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
methods: {
init() {
this.getTestResultsDetail();
},
],
//考试结果详情
getTestResultsDetail() {
viewExamResults(this.test_results_id).then((res) => {
console.log('考试结果详情');
console.log(res);
this.test_card_info = {
title: res.examination_questions_title,
status: res.status,
name: res.name,
begin_answer_time: res.begin_answer_time,
duration: res.answer_duration,
score: res.score,
};
// this.student_brief_introduction = {
// title: res.examination_questions_title || '',
// user_name: res.name || '',
// score: res.score || '',
// duration: res.answer_duration || '',
// status: res.status,
// examination_status: [
// { id: 1, label: '预约完成', type: 'success' },
// { id: 2, label: '考试完成', type: 'success' },
// { id: 3, label: '已发布', type: 'success' },
// { id: 4, label: '取消', type: 'info' },
// { id: 5, label: '失效', type: 'danger' },
// ],
// };
this.questions_list = [];
// if (res.examination_questions) this.questions_list = || [];
res.examination_questions.examination_question_detail.forEach(
(element, index) => {
let obj = JSON.parse(JSON.stringify(element));
element['index_number'] = index; //用来记录在原始数据中的索引
}
);
console.log('表格数据源');
console.log(res.examination_questions.examination_question_detail);
let new_arr = array_conversion(
res.examination_questions.examination_question_detail,
5
);
console.log('二维数据@@@');
console.log(new_arr);
// console.log(JSON.stringify(new_arr));
this.questions_list = new_arr;
this.detailed_information = res;
});
},
},
};
</script>
<style lang="scss" scoped>
.box-card {
width: 1280px;
@import '@/styles/element-variables';
.table_container {
width: 80%;
margin: 0 auto;
border-radius: 10px;
border: 1px solid #ebeef5;
border-radius: 8px;
overflow: hidden;
.table_info {
background-color: forestgreen;
.header_box {
background-color: $--color-primary;
.row_box {
.left,
.right {
color: #fff !important;
}
}
.list_container {
border: 1px solid #ababad;
border-radius: 4px;
overflow: hidden;
}
.row_box {
width: 25%;
display: inline-block;
box-sizing: border-box;
.row_header {
background: #038d6e;
}
}
.row_line {
border-top: 1px solid #dcdfe6;
}
.row_box .row_line:nth-child(1) {
border-top: none;
}
.row_line .left {
}
.lin_box {
border-bottom: 1px solid #ebeef5;
}
.row_box {
width: 20%;
float: left;
display: flex;
font-size: 14px;
color: #303133;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
border-right: 1px solid #ebeef5;
.left {
width: 60px;
text-align: center;
padding: 15px 0;
}
.right {
width: calc(100% - 60px);
text-align: center;
display: inline-block;
border-left: 2px solid #dcdfe6;
border-right: 1px solid #dcdfe6;
padding: 15px 0;
border-right: 1px solid #ebeef5;
}
}
}
.list_container .row_box:nth-child(1) .row_line .left {
border-left: none;
.header_box::after,
.lin_box::after {
display: block;
content: '';
clear: both;
}
.row_header .left {
border-right: none;
.lin_box .row_box .left {
border-right: 1px solid #ebeef5;
}
.row_line .left {
padding: 10px;
.table_container .lin_box:last-child,
.lin_box .row_box:last-child,
.header_box .row_box:last-child {
border: none;
}
.row_line .right {
width: calc(100% - 60px);
display: inline-block;
.table_box {
width: 100%;
table {
width: 100%;
border-top: 1px solid #e4e7ed;
border-left: 1px solid #e4e7ed;
border-collapse: collapse;
td {
margin: 0;
padding: 0;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
}
.title_box {
width: 100px;
}
}
}
.left_box {
padding: 10px 10px;
color: #606266;
text-align: center;
padding: 10px;
}
.body_container {
.card_first {
padding: 0 135px;
}
.right_box {
width: 400px;
padding: 10px 10px;
color: #303133;
}
.card_father {
.image_box {
width: 100%;
box-sizing: border-box;
padding: 0 10px 20px;
height: 400px;
img {
max-width: 100%;
max-height: 100%;
}
}
.wrong_answer {
background-color: #fdf0f0;
}
.box-card {
width: 1280px;
margin: 0px auto;
}
</style>
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-03-07 19:34:46
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-10 20:07:00
* @Last Modified time: 2023-03-13 16:44:07
*/
</script>
<template>
......@@ -31,7 +31,7 @@
<div>
<el-button
v-if="
test_node.examination_questions.status == 2 &&
test_node.examination_questions.status == 3 &&
test_node.status == 1
"
type="primary"
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-02-23 15:52:52
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 09:57:16
* @Last Modified time: 2023-03-13 18:55:27
*/
</script><template>
<div class="person_container">
......@@ -145,11 +145,7 @@
<h3 style="margin-top: 0px">
{{ item.examination_questions_title }}
</h3>
<span
>考试时间:{{
item.answer_time
}}</span
>
<span>考试时间:{{ item.answer_time }}</span>
</div>
<div class="tab_box_tight">
<div class="score_box">
......@@ -161,8 +157,10 @@
<div style="border-left: 1px solid #f4d6a9">
<el-button
v-if="
item.examination_questions.status == 4 &&
item.status == 3
(item.examination_questions.status == 4 &&
item.status == 3) ||
(item.examination_questions.status == 5 &&
item.status == 3)
"
@click="route(item)"
type="warning"
......@@ -260,10 +258,10 @@ export default {
// );
},
methods: {
route(row){
route(row) {
this.$router.push({
path: '/analysis',
query: {id: row.id,},
query: { id: row.id },
});
},
......
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-13 16:34:30
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-13 18:15:25
*/
</script>
<template>
<div class="person_container">
<div class="table_box">
<div class="left"></div>
<div class="right"><el-input></el-input></div>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
// test_arr: [
// { as },
// { bs },
// { cs },
// { ds },
// { es },
// { fs },
// { gs },
// { hs },
// { is },
// { gs },
// { as },
// { bs },
// { cs },
// { ds },
// { es },
// { fs },
// { gs },
// { hs },
// { is },
// { gs },
// ],
};
},
};
</script>
<style lang="scss" scoped>
.table_box {
width: 1000px;
height: 100px;
border: 1px solid #000;
margin: 0px auto;
}
</style>
......@@ -3,13 +3,17 @@
* @Author: AnthonyD
* @Date: 2023-03-01 16:25:21
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 17:07:10
* @Last Modified time: 2023-03-13 14:22:51
*/
</script>
<template>
<div>
<test-info v-if="test_card_info.title" :testdata="test_card_info" @sub="sub"></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">
......@@ -30,8 +34,12 @@
<el-col :span="14">
<div class="grid-content">
<div>
<h3 class="photo_header_title" style="display: inline-block;">考试结果</h3>
<el-button type="primary" @click="sub(false)" style="float:right;">保存</el-button>
<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>
......@@ -114,7 +122,9 @@
: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
......@@ -161,7 +171,9 @@
</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>
......@@ -171,7 +183,6 @@
import TestInfo from '@/components/TestInfo/index';
import { getResultsData, uploadTestResults } from '@/api/user';
import { getToken } from '@/utils/auth';
import { secondsToMinutes } from '@/utils/tool';
export default {
name: '',
components: { TestInfo },
......@@ -186,7 +197,7 @@ export default {
result_id: null,
imgrul: null,
test_card_info: {},
is_force:false,
is_force: false,
};
},
created() {
......@@ -197,31 +208,34 @@ export default {
this.getTestData();
},
methods: {
sub(is_submit=true,is_force=false) {
sub(is_submit = true, is_force = false) {
var data = {};
let is_tip=false
let is_tip = false;
for (let i of this.test_result_sub_data) {
data[i.id] = i.value;
if(!i.value){
is_tip=true
if (!i.value) {
is_tip = true;
}
}
if(is_submit && is_tip && !is_force){
if (is_submit && is_tip && !is_force) {
this.$confirm('您还有题目未答完成,是否强制提交?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then( () => {
this.sub(is_submit,true)
})
return
}).then(() => {
this.sub(is_submit, true);
});
return;
}
uploadTestResults(this.result_id, {is_submit: is_submit,test_results: data,}).then((res) => {
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 },
});
}
});
......@@ -238,7 +252,8 @@ export default {
begin_answer_time: res.begin_answer_time,
duration: res.examination_questions.duration,
const_down:
res.examination_questions.duration * 60 - (res.begin_answer_duration?res.begin_answer_duration:0),
res.examination_questions.duration * 60 -
(res.begin_answer_duration ? res.begin_answer_duration : 0),
status: res.status,
title: res.examination_questions_title,
};
......@@ -249,10 +264,13 @@ 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[this.test_results.examination_questions
.examination_question_detail[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 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论