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

学生端功能

上级 e229ada9
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-02-22 11:31:31 * @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD * @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' import request from '@/utils/request'
...@@ -83,6 +83,14 @@ export function uploadTestResults(id,data) { ...@@ -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() { export function logout() {
return request({ return request({
url: '/vue-element-admin/user/logout', url: '/vue-element-admin/user/logout',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-01 15:29:44 * @Date: 2023-03-01 15:29:44
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 16:59:11 * @Last Modified time: 2023-03-13 16:33:45
*/ */
</script><template> </script><template>
<div class="header_container"> <div class="header_container">
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
>{{ e.label }}</el-tag >{{ e.label }}</el-tag
> >
<el-tag <el-tag
v-if="time"
type="warning" type="warning"
style="margin-left: 30px; backgound-color: #fcf6ec" style="margin-left: 30px; backgound-color: #fcf6ec"
>{{ time }}</el-tag >{{ time }}</el-tag
...@@ -44,9 +45,14 @@ ...@@ -44,9 +45,14 @@
}}</span></span }}</span></span
> >
<span class="test_info" <span class="test_info"
>证件号<span class="test_info_show">{{ >证件号<span class="test_info_show">
user_info.idcard.replace(/(\w{4})\w*(\w{4})/,'$1********$2') <!-- {{
}}</span></span 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"
>考试时间<span class="test_info_show">{{ >考试时间<span class="test_info_show">{{
...@@ -64,13 +70,30 @@ ...@@ -64,13 +70,30 @@
<div <div
v-for="(item, index) in data_keys" v-for="(item, index) in data_keys"
:key="index" :key="index"
class="info_unit" v-if="item.key" class="info_unit"
v-if="item.key"
v-show="examination_questions_info[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">{{ item.label }}</span>
<span class="test_info_show">{{ <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> 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> </div>
</el-card> </el-card>
</div> </div>
...@@ -79,7 +102,7 @@ ...@@ -79,7 +102,7 @@
<script> <script>
import { secondsToMinutes } from '@/utils/tool'; import { secondsToMinutes } from '@/utils/tool';
export default { export default {
name: '', name: 'TestInfo',
props: ['testdata'], props: ['testdata'],
data() { data() {
return { return {
...@@ -119,15 +142,42 @@ export default { ...@@ -119,15 +142,42 @@ export default {
}, },
countDownTimer() { countDownTimer() {
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (this.testdata.const_down>0) { if (this.testdata.const_down > 0) {
this.time = secondsToMinutes(this.testdata.const_down--); 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 { } else {
clearTimeout(this.timer); clearTimeout(this.timer);
this.$emit('sub', true,true); this.$emit('sub', true, true);
} }
}, 1000); }, 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> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-02-22 11:31:31 * @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD * @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 Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
...@@ -153,6 +153,11 @@ export const asyncRoutes = [ ...@@ -153,6 +153,11 @@ export const asyncRoutes = [
name:'analysis', name:'analysis',
component: () => import('@/views/analysis/index.vue'), component: () => import('@/views/analysis/index.vue'),
}, },
{
path:'test',
name:'test',
component: () => import('@/views/test/index.vue'),
},
] ]
}, },
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-11 11:04:16 * @Date: 2023-03-11 11:04:16
* @Last Modified by: AnthonyD * @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){ export function secondsToMinutes(sec){
if (!sec) return false
const totalSeconds = sec; const totalSeconds = sec;
/* 获取完整分钟数 */ /* 获取完整分钟数 */
const minutes = Math.floor(totalSeconds / 60); const minutes = Math.floor(totalSeconds / 60);
...@@ -19,3 +20,19 @@ const padTo2Digits = (num)=> { ...@@ -19,3 +20,19 @@ const padTo2Digits = (num)=> {
const result = `${padTo2Digits(minutes)}分${padTo2Digits(seconds)}秒`; const result = `${padTo2Digits(minutes)}分${padTo2Digits(seconds)}秒`;
return result; 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 @@ ...@@ -3,7 +3,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-07 19:34:46 * @Date: 2023-03-07 19:34:46
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-10 20:07:00 * @Last Modified time: 2023-03-13 16:44:07
*/ */
</script> </script>
<template> <template>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div> <div>
<el-button <el-button
v-if=" v-if="
test_node.examination_questions.status == 2 && test_node.examination_questions.status == 3 &&
test_node.status == 1 test_node.status == 1
" "
type="primary" type="primary"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-02-23 15:52:52 * @Date: 2023-02-23 15:52:52
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 09:57:16 * @Last Modified time: 2023-03-13 18:55:27
*/ */
</script><template> </script><template>
<div class="person_container"> <div class="person_container">
...@@ -145,11 +145,7 @@ ...@@ -145,11 +145,7 @@
<h3 style="margin-top: 0px"> <h3 style="margin-top: 0px">
{{ item.examination_questions_title }} {{ item.examination_questions_title }}
</h3> </h3>
<span <span>考试时间:{{ item.answer_time }}</span>
>考试时间:{{
item.answer_time
}}</span
>
</div> </div>
<div class="tab_box_tight"> <div class="tab_box_tight">
<div class="score_box"> <div class="score_box">
...@@ -161,8 +157,10 @@ ...@@ -161,8 +157,10 @@
<div style="border-left: 1px solid #f4d6a9"> <div style="border-left: 1px solid #f4d6a9">
<el-button <el-button
v-if=" v-if="
item.examination_questions.status == 4 && (item.examination_questions.status == 4 &&
item.status == 3 item.status == 3) ||
(item.examination_questions.status == 5 &&
item.status == 3)
" "
@click="route(item)" @click="route(item)"
type="warning" type="warning"
...@@ -260,13 +258,13 @@ export default { ...@@ -260,13 +258,13 @@ export default {
// ); // );
}, },
methods: { methods: {
route(row){ route(row) {
this.$router.push({ this.$router.push({
path: '/analysis', path: '/analysis',
query: {id: row.id,}, query: { id: row.id },
}); });
}, },
handleAvatarSuccess(res, file) { handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw); this.imageUrl = URL.createObjectURL(file.raw);
}, },
......
<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 @@ ...@@ -3,13 +3,17 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-01 16:25:21 * @Date: 2023-03-01 16:25:21
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-11 17:07:10 * @Last Modified time: 2023-03-13 14:22:51
*/ */
</script> </script>
<template> <template>
<div> <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-card class="box-card">
<el-row v-if="false"> <el-row v-if="false">
<el-col :span="15"> <el-col :span="15">
...@@ -30,8 +34,12 @@ ...@@ -30,8 +34,12 @@
<el-col :span="14"> <el-col :span="14">
<div class="grid-content"> <div class="grid-content">
<div> <div>
<h3 class="photo_header_title" style="display: inline-block;">考试结果</h3> <h3 class="photo_header_title" style="display: inline-block">
<el-button type="primary" @click="sub(false)" style="float:right;">保存</el-button> 考试结果
</h3>
<el-button type="primary" @click="sub(false)" style="float: right"
>保存</el-button
>
</div> </div>
<div class="list_container"> <div class="list_container">
<el-row> <el-row>
...@@ -114,7 +122,9 @@ ...@@ -114,7 +122,9 @@
:headers="headers" :headers="headers"
:show-file-list="false" :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>
<!-- <el-upload <!-- <el-upload
...@@ -161,7 +171,9 @@ ...@@ -161,7 +171,9 @@
</el-col> </el-col>
</el-row> </el-row>
<div class="btn_upload_result"> <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> </div>
</el-card> </el-card>
</div> </div>
...@@ -171,7 +183,6 @@ ...@@ -171,7 +183,6 @@
import TestInfo from '@/components/TestInfo/index'; import TestInfo from '@/components/TestInfo/index';
import { getResultsData, uploadTestResults } from '@/api/user'; import { getResultsData, uploadTestResults } from '@/api/user';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { secondsToMinutes } from '@/utils/tool';
export default { export default {
name: '', name: '',
components: { TestInfo }, components: { TestInfo },
...@@ -186,7 +197,7 @@ export default { ...@@ -186,7 +197,7 @@ export default {
result_id: null, result_id: null,
imgrul: null, imgrul: null,
test_card_info: {}, test_card_info: {},
is_force:false, is_force: false,
}; };
}, },
created() { created() {
...@@ -197,31 +208,34 @@ export default { ...@@ -197,31 +208,34 @@ export default {
this.getTestData(); this.getTestData();
}, },
methods: { methods: {
sub(is_submit=true,is_force=false) { sub(is_submit = true, is_force = false) {
var data = {}; var data = {};
let is_tip=false let is_tip = false;
for (let i of this.test_result_sub_data) { for (let i of this.test_result_sub_data) {
data[i.id] = i.value; data[i.id] = i.value;
if(!i.value){ if (!i.value) {
is_tip=true is_tip = true;
} }
} }
if(is_submit && is_tip && !is_force){ if (is_submit && is_tip && !is_force) {
this.$confirm('您还有题目未答完成,是否强制提交?', '提示', { this.$confirm('您还有题目未答完成,是否强制提交?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}).then( () => { }).then(() => {
this.sub(is_submit,true) this.sub(is_submit, true);
}) });
return 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) { if (res.code == 200 && is_submit) {
this.$message.success(res.message); this.$message.success(res.message);
this.$router.push({ this.$router.push({
path: '/test-result', path: '/test-result',
query: {id: this.result_id,}, query: { id: this.result_id },
}); });
} }
}); });
...@@ -238,7 +252,8 @@ export default { ...@@ -238,7 +252,8 @@ export default {
begin_answer_time: res.begin_answer_time, begin_answer_time: res.begin_answer_time,
duration: res.examination_questions.duration, duration: res.examination_questions.duration,
const_down: 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, status: res.status,
title: res.examination_questions_title, title: res.examination_questions_title,
}; };
...@@ -249,10 +264,13 @@ export default { ...@@ -249,10 +264,13 @@ export default {
this.test_result_sub_data.push({ this.test_result_sub_data.push({
id: this.test_results.examination_questions id: this.test_results.examination_questions
.examination_question_detail[i].id, .examination_question_detail[i].id,
value: this.test_results.test_results[this.test_results.examination_questions value: this.test_results.test_results[
.examination_question_detail[i].id] this.test_results.examination_questions
.examination_question_detail[i].id
]
? this.test_results.test_results[ ? 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 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论