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

学生端功能

上级 d1750965
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-13 16:35:08
* @Last Modified time: 2023-03-14 18:19:16
*/
import Vue from 'vue'
import Router from 'vue-router'
......@@ -153,11 +153,6 @@ export const asyncRoutes = [
name:'analysis',
component: () => import('@/views/analysis/index.vue'),
},
{
path:'test',
name:'test',
component: () => import('@/views/test/index.vue'),
},
]
},
......
/**
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-14 11:12:01
*/
/**
* Created by PanJiaChen on 16/11/18.
*/
......@@ -60,7 +66,8 @@ export function validAlphabets(str) {
* @returns {Boolean}
*/
export function validEmail(email) {
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
// const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const reg = /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,5}){1,2}$/;
return reg.test(email)
}
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-07 16:07:21
* @Last Modified time: 2023-03-14 19:25:14
*/
</script>
<template>
......@@ -26,33 +26,30 @@
ref="ruleForm"
class="demo-ruleForm"
>
<el-form-item prop="username">
<el-form-item prop="email">
<!-- 手机号 -->
<div>
<p style="font-weight: bold" class="pointer">邮箱</p>
<div>
<el-input
ref="username"
v-model="loginForm.phone"
v-model="loginForm.email"
placeholder="输入邮箱"
name="username"
type="text"
tabindex="1"
autocomplete="on"
>
</el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="password">
<el-form-item prop="verification_code">
<div>
<p style="font-weight: bold" class="pointer">验证码</p>
<div>
<el-row>
<el-col
:span="16"
prop="password"
style="padding-right: 10px"
>
<el-col :span="16" style="padding-right: 10px">
<el-input
:key="passwordType"
ref="password"
......@@ -64,7 +61,6 @@
@blur="capsTooltip = false"
@keyup.enter.native="handleLogin"
tabindex="2"
autocomplete="on"
>
</el-input>
</el-col>
......@@ -76,7 +72,10 @@
@click="sendMessage"
type="warning"
style="background-color: #e6a23c"
>{{timer?(time+'秒'):"获取验证码"}}</el-button
:disabled="time > 0"
>
<i class="el-icon-loading" v-if="is_loading"></i>
{{ timer ? time + '秒' : '获取验证码' }}</el-button
>
</el-col>
</el-row>
......@@ -101,7 +100,7 @@
</template>
<script>
import { validUsername,validEmail } from '@/utils/validate';
import { validUsername, validEmail } from '@/utils/validate';
import SocialSign from './components/SocialSignin';
import { getCode } from '@/api/user.js';
export default {
......@@ -109,6 +108,7 @@ export default {
components: { SocialSign },
data() {
const validateUsername = (rule, value, callback) => {
console.log(value);
if (!validEmail(value)) {
callback(new Error('邮箱号错误,请重新输入'));
} else {
......@@ -116,14 +116,17 @@ export default {
}
};
const validatePassword = (rule, value, callback) => {
if (value.length < 4) {
console.log(value);
if (!(value.length == 4)) {
callback(new Error('验证码错误,请重新输入'));
} else {
callback();
}
};
return {
is_loading: false,
loginForm: {
email: null,
phone: null,
username: '',
password: '',
......@@ -131,10 +134,10 @@ export default {
verification_code: null,
},
loginRules: {
username: [
email: [
{ required: true, trigger: 'blur', validator: validateUsername },
],
password: [
verification_code: [
{ required: true, trigger: 'blur', validator: validatePassword },
],
},
......@@ -144,8 +147,8 @@ export default {
showDialog: false,
redirect: undefined,
otherQuery: {},
timer:null,
time:60,
timer: null,
time: null,
};
},
watch: {
......@@ -174,15 +177,15 @@ export default {
// window.removeEventListener('storage', this.afterQRScan)
},
methods: {
countDown(){
this.time-=1
countDown() {
this.time = 60;
this.timer = setInterval(() => {
if (this.time>0) {
this.time -=1
if (this.time > 0) {
this.time -= 1;
} else {
this.time=60
this.time = null;
clearTimeout(this.timer);
this.timer=null
this.timer = null;
}
}, 1000);
},
......@@ -283,9 +286,12 @@ export default {
// }
// }
sendMessage() {
getCode({ email: this.loginForm.phone }).then((res) => {
this.is_loading = true;
// this.$refs.retrieveForm.validateField('email', (errMsg) => {});
getCode({ email: this.loginForm.email }).then((res) => {
this.loginForm.eamil_key = res.key || null;
this.countDown()
this.countDown();
this.is_loading = false;
});
this.$refs.ruleForm.validate((valid) => {
if (valid) {
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-02-23 15:52:52
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-13 18:55:27
* @Last Modified time: 2023-03-14 16:32:38
*/
</script><template>
<div class="person_container">
......@@ -150,9 +150,26 @@
<div class="tab_box_tight">
<div class="score_box">
<span style="margin-left: 30px">成绩:</span>
<span style="font-size: 48px; font-weight: bold">{{
item.score
}}</span>
<span
style="font-size: 48px; font-weight: bold"
v-if="
(item.examination_questions.status == 4 &&
item.status == 2) ||
(item.examination_questions.status == 3 &&
item.status == 2)
"
>***</span
>
<span
v-else-if="
(item.examination_questions.status == 4 &&
item.status == 3) ||
(item.examination_questions.status == 5 &&
item.status == 3)
"
style="font-size: 48px; font-weight: bold"
>{{ item.score }}</span
>
</div>
<div style="border-left: 1px solid #f4d6a9">
<el-button
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-02-28 10:03:17
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-01 18:35:50
* @Last Modified time: 2023-03-14 16:19:46
*/
</script><template>
<div class="content_container">
......@@ -12,27 +12,48 @@
</div>
<div class="result_container">
<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>
<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
? 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">
<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-col :span="24">
<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 style="padding:10px 40px" @click.native="start" type="primary">返回首页</el-button>
<el-button
style="padding: 10px 40px"
@click.native="start"
type="primary"
>返回首页</el-button
>
</div>
</el-card>
</div>
......@@ -47,7 +68,7 @@ export default {
data() {
return {
result_id: null,
test_result:{},
test_result: {},
};
},
created() {
......@@ -57,19 +78,18 @@ export default {
this.getTestData();
},
methods: {
start(){
this.$router.push({path: '/personal'});
start() {
this.$router.push({ path: '/personal' });
},
secondsToMinutesfun(time){
return secondsToMinutes(time)
secondsToMinutesfun(time) {
return secondsToMinutes(time);
},
getTestData() {
getResultsData(this.result_id).then((res) => {
this.test_result=res
this.test_result = res;
});
},
}
},
};
</script>
......
<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,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-03-01 16:25:21
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-13 14:22:51
* @Last Modified time: 2023-03-14 16:18:01
*/
</script>
......@@ -244,13 +244,14 @@ export default {
getResultsData(this.result_id, { is_begin: true }).then((res) => {
console.log('开始考试详情');
console.log(res);
this.test_result_sub_data = [];
//头部组件数据
this.test_card_info = {
idcard: res.idcard,
name: res.name,
// score: res.score,
begin_answer_time: res.begin_answer_time,
duration: res.examination_questions.duration,
duration: res.examination_questions.duration * 60,
const_down:
res.examination_questions.duration * 60 -
(res.begin_answer_duration ? res.begin_answer_duration : 0),
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论