提交 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>
......@@ -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 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论