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

学生端功能

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