提交 42b0dc8d authored 作者: Yroc's avatar Yroc

'后台部分功能优化'

上级 a8a78a0c
......@@ -147,6 +147,16 @@ export function get_examination_questions_detail(id, params) {
method: 'get',
})
}
//试题得分设置
export function get_examination_questions_select(id, data) {
return request({
url: `/api/examination_question_detail/set_fraction/${id}`,
method: 'post',
data
})
}
//试题信息管理详情-图片上传
export function upload_examination_question_image(data) {
return request({
......
......@@ -8,22 +8,37 @@
<template>
<div>
<div>
<el-button type="text" icon="el-icon-arrow-left" size="mini" class="back_btn" @click="back">返回</el-button>
<el-button
type="text"
icon="el-icon-arrow-left"
size="mini"
class="back_btn"
@click="back"
>返回</el-button
>
<h2 class="title_box">{{ info_data.title }}</h2>
<span v-for="(item, index) in info_data.examination_status" :key="index">
<el-tag :type="item.type" v-if="info_data.status == item.id">{{ item.label }}</el-tag>
<el-tag :type="item.type" v-if="info_data.status == item.id">{{
item.label
}}</el-tag>
</span>
</div>
<div style="margin-top: 15px;">
<div class="person_attribute_box" v-for="(item, index) in data_keys" :key="index"
v-show="info_data[item.key] != undefined">
<div style="margin-top: 15px">
<div
class="person_attribute_box"
v-for="(item, index) in data_keys"
:key="index"
v-show="info_data[item.key] != undefined"
>
<span v-if="item.key == 'duration'">
<span class="label">{{ item.label }}</span>
<span>{{ info_data[item.key] }}分钟</span>
</span>
<span v-else-if="item.key == 'answer_duration'">
<span class="label">{{ item.label }}</span>
<span class="label">{{ seconds_to_minutes(info_data[item.key]) }}</span>
<span class="label">{{
seconds_to_minutes(info_data[item.key])
}}</span>
</span>
<span v-else>
<span class="label">{{ item.label }}</span>
......@@ -48,7 +63,7 @@ export default {
{ label: '成绩', key: 'score' },
{ label: '考试时长', key: 'duration' },
{ label: '考试时长', key: 'answer_duration' },
{ label: '本套题满分', key: 'full_marks' },
],
strong_keys: ['user_name', 'score'],
};
......@@ -60,7 +75,7 @@ export default {
created() {
this.info_data = { ...this.examination_questions };
},
mounted() { },
mounted() {},
methods: {
back() {
......@@ -68,21 +83,20 @@ export default {
},
seconds_to_minutes(str) {
if (str) {
return secondsToMinutes(str)
return secondsToMinutes(str);
} else {
return '暂无'
return '暂无';
}
},
}
}
},
};
</script>
<style lang="scss" scoped>
.back_btn {
/* font-size: 16px; */
color: #303133;
border-right: 1px solid #DCDFE6;
border-right: 1px solid #dcdfe6;
padding: 3px 10px 3px 0;
border-radius: none;
}
......
......@@ -34,15 +34,85 @@
<span
v-for="(item, index) in head_data.right_buttons"
:key="index"
style="margin: 0 8px"
style="margin: 0 5px"
>
<el-button
v-if="upload_btns.indexOf(item.event) == -1"
v-if="
upload_btns.indexOf(item.event) == -1 &&
item.event !== 'template_download' &&
item.event !== 'select_score'
"
type="primary"
:icon="item.icon"
@click="btnClick(item.event)"
>{{ item.text }}</el-button
>
<el-popover
v-else-if="item.event == 'template_download'"
placement="bottom"
width="400"
trigger="hover"
>
<el-table :data="examination_questions_data">
<el-table-column prop="name" label="题目数量"> </el-table-column>
<el-table-column align="center" label="操作" width="100">
<template slot-scope="scope">
<el-button
type="primary"
@click="btnClick('template_download', scope.row.data)"
>下载</el-button
>
</template>
</el-table-column>
</el-table>
<el-button type="primary" slot="reference" :icon="item.icon">{{
item.text
}}</el-button>
</el-popover>
<el-popover
v-else-if="item.event == 'select_score'"
placement="bottom"
width="300"
trigger="hover"
>
<!-- <el-table height="400" :data="examination_questions_select_data">
<el-table-column
align="center"
prop="name"
label="每道题得分选择"
>
</el-table-column>
<el-table-column align="center" label="操作" width="100">
<template slot-scope="scope">
>
</template>
</el-table-column>
</el-table> -->
<el-row>
<el-col :span="16">
<el-input
v-model="examination_questions_select_data"
placeholder="请输每道题新的得分"
></el-input
></el-col>
<el-col :span="8"></el-col
><el-button
style="margin-left: 20px"
type="primary"
@click="
btnClick('select_score', examination_questions_select_data)
"
>确认</el-button
>
</el-row>
<el-button type="primary" slot="reference" :icon="item.icon">{{
item.text
}}</el-button>
</el-popover>
<el-upload
v-else
id="upload_moudel"
......@@ -61,6 +131,7 @@
</el-upload>
</span>
</el-col>
<!-- <el-col :span="2"
><span v-if="head_data.ensembel_btn"
><el-badge :value="head_data.number_value">
......@@ -88,6 +159,13 @@ export default {
'examination_questions_upload',
'batch_reservation',
],
examination_questions_data: [
{ name: '100道题', data: 'setThemeCard100.docx' },
{ name: '50道题', data: 'setThemeCard50.docx' },
{ name: '25道题', data: 'setThemeCard25.docx' },
{ name: '20道题', data: 'setThemeCard20.docx' },
],
examination_questions_select_data: null,
btn_code: '',
};
},
......@@ -123,8 +201,10 @@ export default {
},
//右侧按钮事件
btnClick(val) {
this.$emit('btnClick', val);
btnClick(val, data) {
// console.log(val);
// console.log(data);
this.$emit('btnClick', { val, data });
},
uploadCode(val) {
this.btn_code = val;
......
......@@ -8,49 +8,98 @@
<div class="login-container">
<div class="mask_container_background">
<div class="content_box">
<img src="/image/login/Vector.png" alt="" class="content_box_logo">
<img src="/image/login/Vector.png" alt="" class="content_box_logo" />
</div>
</div>
<div class="mask_container">
<img src="/image/log.svg" alt="" class="object_logo">
<img src="/image/log.svg" alt="" class="object_logo" />
<div class="content_box">
<img src="/image/login/Vector.png" alt="" class="content_box_logo" style="opacity: 0;">
<img
src="/image/login/Vector.png"
alt=""
class="content_box_logo"
style="opacity: 0"
/>
<div class="content_body">
<div class="content_body_left">
<h1>你好,</h1>
<h1>欢迎登录国家烟草质检中心</h1>
<div class="translated_text">National Tobacco Quality Inspection Center</div>
<div class="translated_text">
National Tobacco Quality Inspection Center
</div>
</div>
<div class="content_body_right">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on"
label-position="left">
<el-form
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login-form"
autocomplete="on"
label-position="left"
>
<div class="title-container">
<h3 class="title">账号登录</h3>
</div>
<el-form-item prop="username">
<el-input ref="username" v-model="loginForm.name" placeholder="Username" name="username" type="text"
tabindex="1" autocomplete="on">
<i slot="prefix" class="el-input__icon el-icon-user-solid"></i>
<el-input
ref="username"
v-model="loginForm.name"
placeholder="Username"
name="username"
type="text"
tabindex="1"
autocomplete="on"
>
<i
slot="prefix"
class="el-input__icon el-icon-user-solid"
></i>
</el-input>
</el-form-item>
<el-tooltip v-model="capsTooltip" content="大写锁定打开" placement="right" manual>
<el-tooltip
v-model="capsTooltip"
content="大写锁定打开"
placement="right"
manual
>
<el-form-item prop="password">
<el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
placeholder="Password" name="password" tabindex="2" autocomplete="on" @keyup.native="checkCapslock"
@blur="capsTooltip = false" @keyup.enter.native="handleLogin">
<el-input
:key="passwordType"
ref="password"
v-model="loginForm.password"
:type="passwordType"
placeholder="Password"
name="password"
tabindex="2"
autocomplete="on"
@keyup.native="checkCapslock"
@blur="capsTooltip = false"
@keyup.enter.native="handleLogin"
>
<i slot="prefix" class="el-input__icon el-icon-lock"></i>
<i slot="suffix" class="el-input__icon el-icon-view" @click="showPwd"></i>
<i
slot="suffix"
class="el-input__icon el-icon-view"
@click="showPwd"
></i>
</el-input>
</el-form-item>
</el-tooltip>
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;"
@click.native.prevent="handleLogin">登录</el-button>
</el-form>
<div style="text-align: center;">
<el-button size="mini" @click="retrievePassword">忘记密码</el-button>
</div>
<!-- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on"
<el-button
:loading="loading"
type="primary"
style="width: 100%; margin-bottom: 30px"
@click.native.prevent="handleLogin"
>登录</el-button
>
</el-form>
<div style="text-align: center">
<el-button size="mini" @click="retrievePassword"
>忘记密码</el-button
>
</div>
<!-- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on"
label-position="left" v-if="false">
<div class="title-container">
<h3 class="title">账号登录</h3>
......@@ -100,25 +149,25 @@
</template>
<script>
import { validUsername } from '@/utils/validate'
import { validUsername } from '@/utils/validate';
export default {
name: 'Login',
components: {},
data() {
const validateUsername = (rule, value, callback) => {
if (!validUsername(value)) {
callback(new Error('请输入正确的用户名'))
callback(new Error('请输入正确的用户名'));
} else {
callback()
callback();
}
}
};
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error('密码不能少于6位'))
callback(new Error('密码不能少于6位'));
} else {
callback()
callback();
}
}
};
return {
loginForm: {
// username: 'admin',
......@@ -130,44 +179,45 @@ export default {
password: '',
grant_type: 'password',
client_id: 2,
client_secret: 'yTahrwHlHby7JhKGHXjJ6mvqnSVZn2JOTnVNZK4Q'
client_secret: 'yTahrwHlHby7JhKGHXjJ6mvqnSVZn2JOTnVNZK4Q',
},
loginRules: {
name: [{ required: true, trigger: 'blur', validator: validateUsername }],
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
name: [
{ required: true, trigger: 'blur', validator: validateUsername },
],
password: [
{ required: true, trigger: 'blur', validator: validatePassword },
],
},
passwordType: 'password',
capsTooltip: false,
loading: false,
showDialog: false,
redirect: undefined,
otherQuery: {}
}
otherQuery: {},
};
},
watch: {
$route: {
handler: function (route) {
const query = route.query
const query = route.query;
if (query) {
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
this.redirect = query.redirect;
this.otherQuery = this.getOtherQuery(query);
}
},
immediate: true
}
immediate: true,
},
},
created() {
// window.addEventListener('storage', this.afterQRScan)
},
mounted() {
if (this.loginForm.username === '') {
this.$refs.username.focus()
this.$refs.username.focus();
} else if (this.loginForm.password === '') {
this.$refs.password.focus()
this.$refs.password.focus();
}
},
destroyed() {
......@@ -175,50 +225,55 @@ export default {
},
methods: {
checkCapslock(e) {
const { key } = e
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
const { key } = e;
this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z';
},
showPwd() {
if (this.passwordType === 'password') {
this.passwordType = ''
this.passwordType = '';
} else {
this.passwordType = 'password'
this.passwordType = 'password';
}
this.$nextTick(() => {
this.$refs.password.focus()
})
this.$refs.password.focus();
});
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true
this.loading = true;
let data = JSON.parse(JSON.stringify(this.loginForm));
let params = this.$removeProperty(data);
params.password = this.$Aesencrypt(params.password);
console.log('登录数据加密');
console.log(params);
this.$store.dispatch('user/login', params).then(() => {
this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
/* this.$router.push('/') */
this.loading = false
})
.catch(() => {
this.loading = false
// console.log('登录数据加密');
// console.log(params);
this.$store
.dispatch('user/login', params)
.then(() => {
this.$router.push({
path: this.redirect || '/',
query: this.otherQuery,
});
/* this.$router.push('/') */
this.loading = false;
})
.catch(() => {
this.loading = false;
});
} else {
console.log('error submit!!')
return false
console.log('error submit!!');
return false;
}
})
});
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
if (cur !== 'redirect') {
acc[cur] = query[cur]
acc[cur] = query[cur];
}
return acc
}, {})
return acc;
}, {});
},
// afterQRScan() {
// if (e.key === 'x-admin-oauth-code') {
......@@ -243,8 +298,8 @@ export default {
retrievePassword() {
this.$router.push('/retrieve');
},
}
}
},
};
</script>
<!-- <style lang="scss">
......@@ -374,24 +429,13 @@ $light_gray: #eee;
}
}
.mask_container_background {
position: absolute;
left: 0;
right: 0;
width: 100%;
height: 100%;
background: linear-gradient(to bottom, #006851, #00A05D);
background: linear-gradient(to bottom, #006851, #00a05d);
opacity: 0.7;
}
......@@ -451,7 +495,7 @@ $light_gray: #eee;
.translated_text {
width: 80%;
border: 4px solid;
border-image: linear-gradient(to right, #E6A25D, #3d8362) 4;
border-image: linear-gradient(to right, #e6a25d, #3d8362) 4;
border-left: none;
border-right: none;
border-top: none;
......
......@@ -707,7 +707,7 @@ export default {
},
};
},
//错误等级
//错误上下一级
changeErrorLevel(datas) {
if (!datas) return false;
let keys = Object.keys(datas);
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-11 19:40:37
* @Last Modified time: 2023-04-20 15:34:11
*/
</script>
<template>
......@@ -72,6 +72,8 @@
</el-popover>
</template>
</el-table-column>
<el-table-column prop="fraction" align="center" label="每题得分">
</el-table-column>
<el-table-column prop="quote" label="是否引用" align="center">
<template slot-scope="scope">
{{ scope.row.examination_question_detail_id ? '是' : '否' }}
......@@ -178,6 +180,7 @@ import {
get_image_path,
get_examination_questions_all,
create_answer_card,
get_examination_questions_select,
} from '@/api/student';
import { exportText } from '@/utils/tool';
const standard_template = {
......@@ -201,6 +204,11 @@ export default {
is_search_show: false,
search_placeholder: '学员姓名/手机号',
right_buttons: [
{
text: '每题得分',
icon: 'el-icon-magic-stick',
event: 'select_score',
},
{
text: '模板下载',
icon: 'el-icon-download',
......@@ -212,7 +220,7 @@ export default {
event: 'examination_questions_upload',
},
{
text: '试题下载',
text: '答案下载',
icon: 'el-icon-download',
event: 'examination_download',
},
......@@ -295,13 +303,14 @@ export default {
this.getExaminationQuestionsDetail();
},
btnClick(val) {
console.log('右侧按钮');
console.log(val);
// console.log('右侧按钮');
// console.log(val);
if (val == 'add') this.addInformation();
if (val == 'template_download') this.templateDownload();
if (val.val == 'template_download') this.templateDownload(val.data);
/* pictureBatchUpload */
if (val == 'batch_upload') this.pictureBatchUpload();
if (val == 'examination_download') this.createAnswerCard();
if (val.val == 'select_score') this.selectScoreData(val.data);
},
init() {
......@@ -381,9 +390,14 @@ export default {
this.student_brief_introduction.begin_date = res.begin_date;
this.student_brief_introduction.test_number =
res.examination_question_detail.length;
this.student_brief_introduction.full_marks =
res.examination_question_detail.length *
res.examination_question_detail[0].fraction;
// console.log(this.student_brief_introduction.full_marks);
this.is_loading = false;
});
},
//获取方位
getTobaccoProvince() {
get_tobacco_province().then((res) => {
......@@ -532,16 +546,17 @@ export default {
});
},
//试题模版下载
templateDownload() {
let url = `${this.IP}/php_sours/tmpDoc/setThemeCard.docx`;
templateDownload(path) {
// let url = `${this.IP}/php_sours/tmpDoc/setThemeCard.docx`;
let url = `${this.IP}/php_sours/tmpDoc/${path}`;
exportText(url, '模板.docx');
},
//试题下载
createAnswerCard() {
let id = this.examination_questions_id;
create_answer_card(id).then((res) => {
console.log('下载答题卡回调');
console.log(res);
// console.log('下载答题卡回调');
// console.log(res);
if (res.code == 200) {
let s = res.message.split('=');
let name = s[s.length - 1];
......@@ -550,19 +565,32 @@ export default {
}
});
},
//得分选择
selectScoreData(val) {
let amendData = this.$handleParams({ fraction: val });
let id = this.examination_questions_id;
console.log(amendData);
console.log(id);
get_examination_questions_select(id, amendData).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.getExaminationQuestionsDetail();
}
});
},
//试题上传
uploadTestQuestions(val) {
this.is_loading = true;
console.log('试题上传');
console.log(val);
// console.log('试题上传');
// console.log(val);
const formData = new FormData();
formData.append('file', val.file);
let id = this.examination_questions_id;
examination_question_detail_upload(id, formData)
.then((res) => {
console.log('试题上传');
console.log(res);
// console.log('试题上传');
// console.log(res);
if (res.code == 200) {
this.is_loading = false;
this.$message.success(res.message);
......@@ -584,8 +612,8 @@ export default {
},
//图片提交
subMitPictureList() {
console.log('当前文件列表');
console.log(this.picture_file_list);
// console.log('当前文件列表');
// console.log(this.picture_file_list);
let formData = new FormData();
this.picture_file_list.forEach((element) => {
formData.append('image[]', element.raw);
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-04-10 18:06:52
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-18 11:45:11
* @Last Modified time: 2023-04-19 15:24:58
*/
</script>
<template>
......@@ -49,7 +49,7 @@
<el-table-column prop="id" label="编号" width="50">
</el-table-column>
<el-table-column prop="title" label="考试标题">
<el-table-column prop="title" label="考试标题" width="220">
<template slot-scope="scope">
<el-popover trigger="hover" placement="top">
<p>{{ scope.row.title }}</p>
......@@ -128,7 +128,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="260">
<el-table-column label="操作" width="210">
<template slot-scope="scope">
<el-button
size="mini"
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-03-29 17:06:03
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-17 10:39:36
* @Last Modified time: 2023-04-19 10:34:19
*/
</script>
<template>
......@@ -24,7 +24,7 @@
</el-card>
<el-card class="box-card">
<el-row>
<!-- 错误方位/区域 -->
<!-- 南北方正确/错误率 -->
<el-col :span="8" style="margin-bottom: 15px" v-if="area_score_list">
<div class="centenr_container">
<AnalyseModule :module_data="area_score_list"> </AnalyseModule>
......@@ -42,7 +42,7 @@
<AnalyseModule :module_data="wrong_group_list"> </AnalyseModule>
</div>
</el-col>
<!-- 错误等组 -->
<!-- 错误正副组 -->
<el-col
:span="8"
style="margin-bottom: 15px"
......@@ -147,7 +147,7 @@ export default {
test_text:
'针对你在本次烟草知识考试中的表现,我认为你已经做得非常出色。你的答案准确地回答了考试中的问题,而且展现出了对烟草知识的全面了解。',
//区域区域数据
//南北方正确/错误率
area_score_list: null,
//错误部位
wrong_position_list: null,
......@@ -157,7 +157,7 @@ export default {
error_level_list: null,
//错误组别
wrong_group_list: null,
//错误等组
//错误正副组
wrong_iso_groups_list: null,
///眼光稳定性
eye_stability_list: null,
......@@ -214,7 +214,7 @@ export default {
//表格列表
this.questions_list = new_arr;
//烟草区域
//南北方正确/错误率
this.area_score_list = this.changeAreaScore(
res.statistical_results.AreaScore
);
......@@ -234,7 +234,7 @@ export default {
this.wrong_group_list = this.changeWrongGroup(
res.statistical_results.WrongGroup
);
//错误等组
//错误正副组
this.wrong_iso_groups_list = this.changeWrongIsoGroup(
res.statistical_results.WrongIsogroup
);
......@@ -247,7 +247,7 @@ export default {
console.log(this.eye_stability_list);
});
},
//区域得分
//南北方正确/错误率
changeAreaScore(datas) {
if (!datas) return false;
let keys = Object.keys(datas);
......@@ -260,7 +260,7 @@ export default {
type: 'bar',
chart_id: 'bar_chart1',
color: '#E6A23C',
title: '突出区域的烟草识别',
title: '南北方正确/错误率',
labers,
keys,
raw_data: datas,
......@@ -380,7 +380,7 @@ export default {
list,
};
},
//错误等组
//错误正副组
changeWrongIsoGroup(datas) {
if (!datas) return false;
let keys = Object.keys(datas);
......@@ -403,7 +403,7 @@ export default {
type: 'table',
chart_id: 'wrong_group',
color: '#529B2E',
title: '错误等组',
title: '错误正副组',
labers,
list,
};
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论