Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzksxt
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
xzksxt
Commits
0169dfed
Commit
0169dfed
authored
Dec 29, 2023
by
宋珺琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多选题、修改不用cookie、
parent
23171b4a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
384 additions
and
190 deletions
+384
-190
src/components/common/jumpLogin.vue
+8
-6
src/components/student/answer.vue
+22
-129
src/components/student/index.vue
+44
-20
src/components/student/scoreTable.vue
+2
-1
src/components/student/scoreTjTable.vue
+1
-1
src/components/teacher/addAnswerChildren.vue
+153
-22
src/components/teacher/selectAnswer.vue
+154
-11
No files found.
src/components/common/jumpLogin.vue
View file @
0169dfed
...
...
@@ -29,10 +29,13 @@ export default {
}).
then
(
res
=>
{
let
resData
=
res
.
data
.
data
if
(
resData
!=
null
)
{
this
.
$cookies
.
set
(
"cname"
,
resData
.
studentName
)
this
.
$cookies
.
set
(
"cid"
,
resData
.
studentId
)
this
.
$cookies
.
set
(
"role"
,
resData
.
role
)
this
.
$router
.
push
({
path
:
'/answer?examCode=20190001'
})
this
.
$router
.
push
({
path
:
'/answer?examCode=20190001'
,
query
:{
cname
:
resData
.
studentName
,
cid
:
resData
.
studentId
,
role
:
resData
.
role
}})
}
if
(
resData
==
null
)
{
//错误提示
this
.
$message
({
...
...
@@ -49,4 +52,4 @@ export default {
},
computed
:
mapState
([
"userInfo"
]),
}
</
script
>
\ No newline at end of file
</
script
>
src/components/student/answer.vue
View file @
0169dfed
...
...
@@ -9,7 +9,17 @@
<li><i
class=
"iconfont icon-menufold icon20"
ref=
"toggle"
@
click=
"slider_flag = !slider_flag"
></i></li>
<li>
{{
examData
.
type
}}
-
{{
examData
.
source
}}
</li>
<li>
(
{{
userInfo
.
name
}}
)
</li>
<li><router-link
to=
"/scoreTable"
class =
"router1"
>
个人统计
</router-link></li>
<li>
<router-link
:to=
"
{
path: '/scoreTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}" class="router1">个人统计
</router-link>
</li>
<li><i
class=
"iconfont icon-arrLeft icon20"
></i></li>
</ul>
</div>
...
...
@@ -217,7 +227,7 @@ export default {
}
},
created
()
{
this
.
get
Cookie
s
()
this
.
get
UrlParam
s
()
this
.
getExamData
()
this
.
showTime
()
},
...
...
@@ -242,10 +252,13 @@ export default {
// 拼接
return
year
+
"-"
+
month
+
"-"
+
day
+
" "
+
hours
+
":"
+
minutes
+
":"
+
seconds
;
},
getCookies
()
{
//获取cookie
this
.
userInfo
.
name
=
this
.
$cookies
.
get
(
"cname"
)
this
.
userInfo
.
id
=
this
.
$cookies
.
get
(
"cid"
)
let
role
=
this
.
$cookies
.
get
(
"role"
)
getUrlParams
()
{
//从路由上获取参数
this
.
userInfo
.
name
=
this
.
$route
.
query
.
cname
this
.
userInfo
.
id
=
this
.
$route
.
query
.
cid
let
role
=
this
.
$route
.
query
.
role
console
.
log
(
this
.
userInfo
.
name
)
console
.
log
(
this
.
userInfo
.
id
)
console
.
log
(
role
)
if
(
role
==
"0"
){
this
.
roleflag
=
true
;
}
...
...
@@ -580,7 +593,7 @@ export default {
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
console
.
log
(
"关闭当前页面"
)
window
.
open
(
"http://www.xz.cq/#/home"
,
"_self"
)
//
window.open("http://www.xz.cq/#/home","_self")
// http://localhost:8088/#/jumplogin
// this.$router.push("/answer")
// 模拟用户按下 Alt+F4 快捷键,并调用 window.close() 方法来关闭当前窗口
...
...
@@ -601,9 +614,6 @@ export default {
})
}
},
/* closeCurrentWindow(){
window.close();
},*/
showTime
()
{
//倒计时
setInterval
(()
=>
{
this
.
time
-=
1
...
...
@@ -619,123 +629,6 @@ export default {
}
},
1000
*
60
)
},
/* MoreTrueOrFalse(boo){
if (boo){
//定位目标元素,并获取它的样式对象:
var myElement = document.querySelector(".is-checked");
var inputElement = myElement.querySelector('.el-checkbox__input');
var innerElement = inputElement.querySelector('.el-checkbox__inner');
console.log(innerElement)
// 创建一个<style>标签
var styleTag = document.createElement('style');
document.head.appendChild(styleTag);
// 动态生成的内联样式规则
styleTag.innerHTML = `
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::before {
content: "";
position: absolute;
top: -10px;
left: 3px;
width: 12px;
height: 25px;
border: 2px solid transparent;
border-bottom: 5px solid #f50808;
border-right: 5px solid #fa0909;
transform: rotate(45deg);
}`;
// 将样式规则应用到页面上的元素
innerElement.classList.add('styleTag');
}else {
}
},
//动态添加是否对错
OnetrueOrFalse(boo){
if (boo){
/!* var myElements = document.querySelectorAll(".el-radio__input");
var uncheckedElements = Array.from(myElements).filter(function(element) {
return !element.classList.contains('is-checked');
});
console.log(uncheckedElements)
var styleTag2 = document.createElement('style2');
document.head.appendChild(styleTag2);
// 动态生成的内联样式规则
styleTag2.innerHTML = `
.el-radio__input.is-disabled .el-radio__inner::before {
content: "×";
position: absolute;
top: -8px;
left: -5px;
color: #f50808;
font-size: 30px;
text-shadow:
-1px -1px 0 #f50808,
1px -1px 0 #f50808,
-1px 1px 0 #f50808,
1px 1px 0 #f50808;
}`;
uncheckedElements.forEach(e=>{
var innerElements = e.querySelectorAll(".el-radio__inner");
Array.from(innerElements).forEach(function(element) {
console.log(element)
element.classList.add("style2");
});
})*!/
//定位目标元素,并获取它的样式对象:
var myElement = document.querySelector(".is-checked");
var inputElement = myElement.querySelector('.el-radio__input');
var innerElement = inputElement.querySelector('.el-radio__inner');
// console.log(innerElement)
// 创建一个<style>标签
var styleTag = document.createElement('style');
document.head.appendChild(styleTag);
// 动态生成的内联样式规则
styleTag.innerHTML = `
.el-radio__input.is-disabled.is-checked .el-radio__inner::before {
content: "";
position: absolute;
top: -20px;
left: 3px;
width: 10px;
height: 25px;
border: 2px solid transparent;
border-bottom: 5px solid #f50808;
border-right: 5px solid #fa0909;
transform: rotate(45deg);
}`;
// 将样式规则应用到页面上的元素
console.log(innerElement)
innerElement.classList.add('style');
}else {
var myElement = document.querySelector(".is-checked");
var inputElement = myElement.querySelector('.el-radio__input');
var innerElement = inputElement.querySelector('.el-radio__inner');
console.log(innerElement)
// 创建一个<style>标签
var styleTag = document.createElement('style');
document.head.appendChild(styleTag);
// 动态生成的内联样式规则
styleTag.innerHTML = `
.el-radio__input.is-disabled.is-checked .el-radio__inner::before {
content: "×";
position: absolute;
top: -8px;
left: -5px;
color: #f50808;
font-size: 30px;
text-shadow:
-1px -1px 0 #f50808,
1px -1px 0 #f50808,
-1px 1px 0 #f50808,
1px 1px 0 #f50808;
}`;
// 将样式规则应用到页面上的元素
innerElement.classList.add('styleTag');
}
}*/
},
computed
:
mapState
([
"isPractice"
])
}
...
...
@@ -1196,10 +1089,10 @@ export default {
}
.el-checkbox__label
{
/*color: red;*/
font-size
:
25px
;
font-size
:
25px
!important
;
font-family
:
'SimSun'
,
sans-serif
;
white-space
:
normal
;
line-height
:
25px
;
line-height
:
25px
!important
;
}
.content
.el-checkbox-group
{
display
:
flex
;
...
...
src/components/student/index.vue
View file @
0169dfed
...
...
@@ -5,14 +5,44 @@
<el-row
class=
"padding-50"
>
<el-col
:span=
"24"
>
<ul
class=
"list"
>
<!--
<li><a
href=
"javascript:;"
@
click=
"exam()"
>
我的试卷
</a></li>
-->
<!--
<li><a
href=
"javascript:;"
@
click=
"practice()"
>
我的练习
</a></li>
-->
<li><router-link
to=
"/scoreTable"
>
我的分数
</router-link></li>
<li><router-link
to=
"/scoreTjTable"
>
我的分数统计
</router-link></li>
<li
v-if=
"roleflag"
><router-link
to=
"/scoreDwTjTable"
>
单位分数统计
</router-link></li>
<li>
<router-link
:to=
"
{
path: '/scoreTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}"
>我的分数
</router-link>
</li>
<li>
<router-link
:to=
"
{
path: '/scoreTjTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}"
>我的分数统计
</router-link>
</li>
<li
v-if=
"roleflag"
>
<router-link
:to=
"
{
path: '/scoreDwTjTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}"
>单位分数统计
</router-link>
</li>
<li
class=
"right"
>
{{
user
.
userName
}}
<!--
<div
class=
"final"
@
click=
"over()"
>
结束考试
</div>
-->
{{
this
.
$route
.
query
.
cname
}}
</li>
</ul>
</el-col>
...
...
@@ -37,33 +67,27 @@ export default {
return
{
flag
:
false
,
user
:
{},
roleflag
:
false
roleflag
:
false
,
}
},
crea
ted
()
{
moun
ted
()
{
this
.
userInfo
()
},
methods
:
{
exit
()
{
//退出登录
this
.
$router
.
push
({
path
:
"/"
})
//跳转到登录页面
this
.
$cookies
.
remove
(
"cname"
)
//清除cookie
this
.
$cookies
.
remove
(
"cid"
)
},
manage
()
{
//跳转到修改密码页面
this
.
$router
.
push
({
path
:
'/manager'
})
},
userInfo
()
{
let
role
=
this
.
$cookies
.
get
(
"role"
)
debugger
if
(
role
==
"0"
){
this
.
roleflag
=
true
;
if
(
this
.
$route
.
query
.
role
==
"0"
){
this
.
roleflag
=
true
;
}
let
studentName
=
this
.
$cookies
.
get
(
"cname"
)
let
studentId
=
this
.
$cookies
.
get
(
"cid"
)
console
.
log
(
`studentId
${
studentId
}
`
)
console
.
log
(
`studentName
${
studentName
}
`
)
this
.
user
.
userName
=
studentName
this
.
user
.
studentId
=
studentId
let
self
=
this
;
self
.
user
.
userName
=
this
.
$route
.
query
.
cname
self
.
user
.
studentId
=
this
.
$route
.
query
.
cid
},
practice
()
{
//跳转练习模式
let
isPractice
=
true
...
...
src/components/student/scoreTable.vue
View file @
0169dfed
...
...
@@ -59,12 +59,13 @@ export default {
}
},
created
()
{
this
.
getScore
()
this
.
loading
=
true
//数据加载则遮罩表格
},
methods
:
{
getScore
()
{
let
studentId
=
this
.
$
cookies
.
get
(
"cid"
)
let
studentId
=
this
.
$
route
.
query
.
cid
;
this
.
$axios
(
`/api/score/
${
this
.
pagination
.
current
}
/
${
this
.
pagination
.
size
}
/
${
studentId
}
`
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
loading
=
false
//数据加载完成去掉遮罩
...
...
src/components/student/scoreTjTable.vue
View file @
0169dfed
...
...
@@ -48,7 +48,7 @@ export default {
},
methods
:
{
getScoreTj
()
{
let
studentId
=
this
.
$
cookies
.
get
(
"cid"
)
let
studentId
=
this
.
$
route
.
query
.
cid
this
.
$axios
(
`/api/scoreTj/
${
studentId
}
`
).
then
(
res
=>
{
debugger
if
(
res
.
data
.
code
==
200
)
{
...
...
src/components/teacher/addAnswerChildren.vue
View file @
0169dfed
...
...
@@ -3,12 +3,13 @@
<div
class=
"add"
>
<el-tabs
v-model=
"activeName"
>
<el-tab-pane
name=
"first"
>
<span
slot=
"label"
><i
class=
"el-icon-circle-plus"
></i>
添加试题
</span>
<span
slot=
"label"
v-if=
"isAddOrEdit"
><i
class=
"el-icon-circle-plus"
></i>
添加试题
</span>
<span
slot=
"label"
v-else
><i
class=
"el-icon-circle-plus"
></i>
修改试题
</span>
<section
class=
"append"
>
<ul>
<li>
<span>
题目类型:
</span>
<el-select
v-model=
"optionValue"
placeholder=
"请选择题型"
class=
"w150"
>
<el-select
v-model=
"optionValue"
placeholder=
"请选择题型"
class=
"w150"
:disabled =
!isAddOrEdit
>
<el-option
v-for=
"item in options"
:key=
"item.value"
...
...
@@ -17,7 +18,7 @@
</el-option>
</el-select>
</li>
<li
v-if=
"optionValue == '
选择
题' || optionValue=='多选题'"
>
<li
v-if=
"optionValue == '
单选
题' || optionValue=='多选题'"
>
<span>
所属章节:
</span>
<el-input
placeholder=
"请输入对应章节"
...
...
@@ -44,7 +45,7 @@
clearable
>
</el-input>
</li>
<li
v-if=
"optionValue == '
选择
题' || optionValue=='多选题'"
>
<li
v-if=
"optionValue == '
单选
题' || optionValue=='多选题'"
>
<span>
难度等级:
</span>
<el-select
v-model=
"postChange.level"
placeholder=
"选择难度等级"
class=
"w150"
>
<el-option
...
...
@@ -77,9 +78,9 @@
</el-option>
</el-select>
</li>
<li
v-show=
"optionValue == '
选择
题'"
>
<li
v-show=
"optionValue == '
单选
题'"
>
<span>
正确选项:
</span>
<el-select
v-model=
"
postChange.rightAnswer
"
placeholder=
"选择正确答案"
class=
"w150"
>
<el-select
v-model=
"
oneSelect
"
placeholder=
"选择正确答案"
class=
"w150"
>
<el-option
v-for=
"item in rights"
:key=
"item.value"
...
...
@@ -90,7 +91,7 @@
</li>
<li
v-show=
"optionValue=='多选题'"
>
<span>
正确选项:
</span>
<el-select
v-model=
"
postChange.rightAnswer
"
multiple
placeholder=
"选择正确答案"
class=
"w150"
>
<el-select
v-model=
"
moreSelect
"
multiple
placeholder=
"选择正确答案"
class=
"w150"
>
<el-option
v-for=
"item in rights"
:key=
"item.value"
...
...
@@ -101,7 +102,7 @@
</li>
</ul>
<!-- 选择题部分 -->
<div
class=
"change"
v-if=
"optionValue == '
选择
题' || optionValue=='多选题'"
>
<div
class=
"change"
v-if=
"optionValue == '
单选
题' || optionValue=='多选题'"
>
<div
class=
"title"
>
<el-tag>
题目:
</el-tag><span>
在下面的输入框中输入题目,形如--DNS 服务器和DHCP服务器的作用是()
</span>
<el-input
...
...
@@ -112,6 +113,22 @@
resize=
"none"
class=
"answer"
>
</el-input>
<!--
<el-upload
class=
"upload-demo"
action=
"#"
accept=
"image/jpg,image/jpeg,image/png"
:auto-upload=
"false"
:on-change=
"
(file, fileList) =>
{
handlePhotoChange(file, fileList);
}
"
:on-remove="handleRemove"
:file-list="photoList"
list-type="picture">
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<
!
–
<div
slot=
"tip"
class=
"el-upload__tip"
>
只能上传jpg/png文件,且不超过500kb
</div>
–>
</el-upload>
-->
</div>
<div
class=
"options"
>
<ul>
...
...
@@ -161,7 +178,8 @@
</el-input>
</div>
<div
class=
"submit"
>
<el-button
type=
"primary"
@
click=
"changeSubmit()"
>
立即添加
</el-button>
<el-button
v-if=
"isAddOrEdit"
type=
"primary"
@
click=
"changeSubmit()"
>
立即添加
</el-button>
<el-button
v-else
type=
"primary"
@
click=
"editSubmit()"
>
确认修改
</el-button>
</div>
</div>
<!-- 填空题部分 -->
...
...
@@ -225,7 +243,9 @@
</el-input>
</div>
<div
class=
"submit"
>
<el-button
type=
"primary"
@
click=
"judgeSubmit()"
>
立即添加
</el-button>
<el-button
v-if=
"isAddOrEdit"
type=
"primary"
@
click=
"judgeSubmit()"
>
立即添加
</el-button>
<el-button
v-else
type=
"primary"
@
click=
"editSubmit2()"
>
确认修改
</el-button>
</div>
</div>
</section>
...
...
@@ -239,14 +259,19 @@
export
default
{
data
()
{
return
{
oneSelect
:
''
,
moreSelect
:
""
,
row
:{},
//路由上的参数
isAddOrEdit
:
true
,
photoList
:
[],
changeNumber
:
null
,
//选择题出题数量
fillNumber
:
null
,
//填空题出题数量
judgeNumber
:
null
,
//判断题出题数量
activeName
:
'first'
,
//活动选项卡
options
:
[
//题库类型
{
value
:
'
选择
题'
,
label
:
'
选择
题'
value
:
'
单选
题'
,
label
:
'
单选
题'
},
{
value
:
'判断题'
,
...
...
@@ -313,10 +338,10 @@ export default {
},
],
paperId
:
null
,
optionValue
:
'
选择
题'
,
//题型选中值 选择题就是单选题
optionValue
:
'
单选
题'
,
//题型选中值 选择题就是单选题
subject
:
''
,
//试卷名称用来接收路由参数
postChange
:
{
//选择题提交内容
oneOrMore
:
this
.
optionValue
==
'
选择
题'
?
'1'
:
'2'
,
oneOrMore
:
this
.
optionValue
==
'
单选
题'
?
'1'
:
'2'
,
subject
:
''
,
//试卷名称
level
:
''
,
//难度等级选中值
rightAnswer
:
''
,
//正确答案选中值
...
...
@@ -354,18 +379,63 @@ export default {
//监听optionValue题目类型的变化 去重置正确选项的值
watch
:
{
optionValue
(
newValue
)
{
console
.
log
(
'optionValue 的值发生了变化:'
,
newValue
);
// 在这里执行你想要的操作
this
.
postChange
.
rightAnswer
=
''
}
},
created
()
{
//编辑的时候从路由上获取参数
if
(
this
.
$route
.
query
.
row
){
const
row
=
JSON
.
parse
(
this
.
$route
.
query
.
row
);
this
.
row
=
row
console
.
log
(
this
.
row
)
this
.
isAddOrEdit
=
false
if
(
row
.
oneOrMore
==
'1'
){
//单选题
this
.
postChange
.
answerA
=
row
.
answerA
this
.
postChange
.
answerB
=
row
.
answerB
this
.
postChange
.
answerC
=
row
.
answerC
this
.
postChange
.
answerD
=
row
.
answerD
this
.
postChange
.
section
=
row
.
section
//所属章节
this
.
postChange
.
level
=
row
.
level
//难度等级
this
.
oneSelect
=
row
.
rightAnswer
//正确选项
this
.
postChange
.
question
=
row
.
question
//题干
this
.
postChange
.
analysis
=
row
.
analysis
//解析
this
.
optionValue
=
"单选题"
//题目类型
}
else
if
(
row
.
oneOrMore
==
'2'
){
//多选
this
.
postChange
.
answerA
=
row
.
answerA
this
.
postChange
.
answerB
=
row
.
answerB
this
.
postChange
.
answerC
=
row
.
answerC
this
.
postChange
.
answerD
=
row
.
answerD
this
.
postChange
.
section
=
row
.
section
//所属章节
this
.
postChange
.
level
=
row
.
level
//难度等级
this
.
postChange
.
question
=
row
.
question
//题干
this
.
postChange
.
analysis
=
row
.
analysis
//解析
this
.
optionValue
=
"多选题"
//题目类型
this
.
moreSelect
=
row
.
rightAnswer
.
split
(
","
).
map
(
item
=>
item
.
trim
());
//正确选项
console
.
log
(
this
.
moreSelect
)
}
else
{
//判断
this
.
optionValue
=
"判断题"
//题目类型
this
.
postJudge
.
section
=
row
.
section
//所属章节
this
.
postJudge
.
level
=
row
.
level
//难度等级
this
.
postJudge
.
question
=
row
.
question
//题干
this
.
postJudge
.
answer
=
row
.
rightAnswer
this
.
postJudge
.
analysis
=
row
.
analysis
//解析
}
}
this
.
getParams
()
},
methods
:
{
// handleClick(tab, event) {
// console.log(tab, event);
// },
//添加照片
handlePhotoChange
(
file
,
fileList
)
{
let
self
=
this
;
self
.
photoList
=
fileList
},
//移除照片
handleRemove
(
file
,
fileList
)
{
this
.
photoList
=
fileList
},
create
()
{
this
.
$axios
({
url
:
'/api/item'
,
...
...
@@ -378,7 +448,6 @@ export default {
subject
:
'试题1'
//题目数量太少,指定为计算机网络出题
}
}).
then
(
res
=>
{
console
.
log
(
res
)
let
data
=
res
.
data
if
(
data
.
code
==
200
){
setTimeout
(()
=>
{
...
...
@@ -405,9 +474,13 @@ export default {
this
.
postPaper
.
paperId
=
paperId
},
changeSubmit
()
{
//选择题题库提交
// console.log(this.textcccc)
this
.
postChange
.
oneOrMore
=
'1'
this
.
postChange
.
rightAnswer
=
this
.
oneSelect
this
.
postChange
.
subject
=
this
.
subject
if
(
this
.
optionValue
==
'多选题'
&&
this
.
postChange
.
rightAnswer
){
this
.
postChange
.
rightAnswer
=
this
.
postChange
.
rightAnswer
.
join
(
', '
);
if
(
this
.
optionValue
==
'多选题'
&&
this
.
moreSelect
){
this
.
postChange
.
rightAnswer
=
this
.
moreSelect
.
join
(
', '
);
this
.
postChange
.
oneOrMore
=
'2'
}
this
.
$axios
({
//提交数据到选择题题库表
url
:
'/api/MultiQuestion'
,
...
...
@@ -423,6 +496,8 @@ export default {
type
:
'success'
})
this
.
postChange
=
{}
this
.
oneSelect
=
''
this
.
moreSelect
=
""
}
}).
then
(()
=>
{
this
.
$axios
(
`/api/multiQuestionId`
).
then
(
res
=>
{
//获取当前题目的questionId
...
...
@@ -439,6 +514,62 @@ export default {
})
})
},
//单选多选修改
editSubmit
(){
this
.
postChange
.
oneOrMore
=
'1'
this
.
postChange
.
rightAnswer
=
this
.
oneSelect
//如果是多选拼接答案转为字符串
if
(
this
.
optionValue
==
'多选题'
&&
this
.
moreSelect
){
this
.
postChange
.
rightAnswer
=
this
.
moreSelect
.
join
(
', '
);
this
.
postChange
.
oneOrMore
=
'2'
}
this
.
postChange
.
subject
=
this
.
row
.
subject
this
.
postChange
.
questionid
=
this
.
row
.
questionid
this
.
postChange
.
tablename
=
this
.
row
.
tablename
this
.
$axios
({
//提交数据到选择题题库表
url
:
'/api/updateAnswers'
,
method
:
'post'
,
data
:
{
...
this
.
postChange
}
}).
then
(
res
=>
{
//添加成功显示提示
let
status
=
res
.
data
.
code
if
(
status
==
200
)
{
this
.
$message
({
message
:
'已修改当前题库'
,
type
:
'success'
})
}
})
},
//判断修改
editSubmit2
(){
this
.
$axios
({
//提交数据到选择题题库表
url
:
'/api/updateAnswers'
,
method
:
'post'
,
data
:
{
analysis
:
this
.
postJudge
.
analysis
,
level
:
this
.
postJudge
.
level
,
question
:
this
.
postJudge
.
question
,
rightAnswer
:
this
.
postJudge
.
answer
,
section
:
this
.
postJudge
.
section
,
//所属章节
subject
:
this
.
row
.
subject
,
tablename
:
this
.
row
.
tablename
,
questionid
:
this
.
row
.
questionid
,
type
:
"判断题"
}
}).
then
(
res
=>
{
//添加成功显示提示
let
status
=
res
.
data
.
code
if
(
status
==
200
)
{
this
.
$message
({
message
:
'已修改当前题库'
,
type
:
'success'
})
}
})
},
fillSubmit
()
{
//填空题提交
this
.
postFill
.
subject
=
this
.
subject
this
.
$axios
({
...
...
src/components/teacher/selectAnswer.vue
View file @
0169dfed
//查询所有题库
<!--查询所有题库-->
<
template
>
<div
class=
"exam"
>
<div
class=
"tabs"
>
<el-form
ref=
"searchForm"
:model=
"searchForm"
>
<el-row
>
<el-col
:span=
"6"
>
<el-form-item
label=
"题目信息 :"
style=
"display: flex"
>
<el-input
v-model=
"searchForm.question"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"6"
>
<el-button
class=
"toEmptyButton"
@
click=
"toEmpty"
>
<span
class=
"skyp icon-sousuo"
></span>
清空
</el-button>
<el-button
class=
"searchListButton"
@
click=
"searchList()"
>
<span
class=
"skyp icon-sousuo"
></span>
查询
</el-button>
<el-button
class=
"addTableButton"
@
click=
"addTable"
>
<span
class=
"skyp icon-tianjia"
></span>
新增
</el-button>
</el-col>
</el-row>
</el-form>
</div>
<el-table
:data=
"pagination.records"
border
:row-class-name=
"tableRowClassName"
>
<el-table-column
fixed=
"left"
prop=
"subject"
label=
"试卷名称"
width=
"180"
></el-table-column>
<el-table-column
prop=
"question"
label=
"题目信息"
width=
"490"
></el-table-column>
<el-table-column
prop=
"section"
label=
"所属章节"
width=
"200"
></el-table-column>
<el-table-column
prop=
"type"
label=
"题目类型"
width=
"200"
></el-table-column>
<el-table-column
prop=
"type"
label=
"题目类型"
width=
"200"
>
<template
slot-scope=
"scope"
>
<template
v-if=
"scope.row.oneOrMore === '1'"
>
单选题
</
template
>
<
template
v-else-if=
"scope.row.oneOrMore === '2'"
>
多选题
</
template
>
<
template
v-else
>
判断题
</
template
>
</template>
</el-table-column>
<el-table-column
prop=
"score"
label=
"试题分数"
width=
"150"
></el-table-column>
<el-table-column
prop=
"level"
label=
"难度等级"
width=
"133"
></el-table-column>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"200"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"text"
size=
"small"
@
click=
"edit(scope.row)"
>
编辑
</el-button
>
<el-button
type=
"text"
size=
"small"
@
click=
"del(scope.row)"
>
删除
</el-button
>
</
template
>
</el-table-column>
</el-table>
<el-pagination
@
size-change=
"handleSizeChange"
...
...
@@ -26,6 +83,9 @@
export
default
{
data
()
{
return
{
searchForm
:{
question
:
''
,
},
pagination
:
{
//分页后的考试信息
current
:
1
,
//当前页
...
...
@@ -38,11 +98,27 @@ export default {
this
.
getAnswerInfo
();
},
methods
:
{
getAnswerInfo
()
{
//分页查询所有试卷信息
this
.
$axios
(
`/api/answers/
${
this
.
pagination
.
current
}
/
${
this
.
pagination
.
size
}
`
)
//查询按钮
searchList
(){
this
.
getAnswerInfo
(
this
.
searchForm
.
question
)
},
//清空按钮
toEmpty
()
{
let
self
=
this
;
self
.
searchForm
.
question
=
""
;
self
.
getAnswerInfo
();
},
//新增按钮
addTable
(){
this
.
$router
.
push
(
'/addAnswer'
)
},
//分页查询所有试卷信息
getAnswerInfo
(
likeSelect
)
{
let
url
=
`/api/answers/
${
this
.
pagination
.
current
}
/
${
this
.
pagination
.
size
}
/null`
if
(
likeSelect
){
url
=
`/api/answers/
${
this
.
pagination
.
current
}
/
${
this
.
pagination
.
size
}
/
${
likeSelect
}
`
}
this
.
$axios
(
url
)
.
then
(
res
=>
{
this
.
pagination
=
res
.
data
.
data
;
console
.
log
(
res
);
...
...
@@ -52,12 +128,12 @@ export default {
//改变当前记录条数
handleSizeChange
(
val
)
{
this
.
pagination
.
size
=
val
;
this
.
getAnswerInfo
();
this
.
getAnswerInfo
(
this
.
searchForm
.
question
);
},
//改变当前页码,重新发送请求
handleCurrentChange
(
val
)
{
this
.
pagination
.
current
=
val
;
this
.
getAnswerInfo
();
this
.
getAnswerInfo
(
this
.
searchForm
.
question
);
},
tableRowClassName
({
row
,
rowIndex
})
{
if
(
rowIndex
%
2
==
0
)
{
...
...
@@ -65,11 +141,78 @@ export default {
}
else
{
return
"success-row"
;
}
}
},
//编辑 跳转到新增页面
edit
(
row
){
this
.
$router
.
push
({
path
:
"/addAnswerChildren"
,
query
:{
paperId
:
row
.
paperId
,
subject
:
row
.
subject
,
row
:
JSON
.
stringify
(
row
),
}
});
},
//删除
del
(
row
)
{
console
.
log
(
row
)
let
self
=
this
;
this
.
$confirm
(
"此操作将永久删除该文件, 是否继续?"
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
})
.
then
(()
=>
{
self
.
removeData
(
row
);
})
.
catch
(()
=>
{
this
.
$message
({
type
:
"info"
,
message
:
"已取消删除"
,
});
});
},
//点击二次确认删除后执行的操作
removeData
(
row
)
{
let
self
=
this
;
console
.
log
(
row
)
//删除的时候传主键和类型
this
.
$axios
(
`/api/deleteAnswers/
${
row
.
questionid
}
/
${
row
.
tablename
}
/
${
row
.
subject
}
`
).
then
((
res
)
=>
{
if
(
res
.
status
==
200
)
{
self
.
$message
.
success
(
"删除成功"
);
self
.
getAnswerInfo
();
}
else
{
this
.
$message
.
error
(
"删除失败"
);
}
});
},
}
};
</
script
>
<
style
lang=
"less"
scoped
>
/
deep
/
.el-input__suffix
{
display
:
none
;
}
/*添加按钮*/
.addTableButton
{
margin-top
:
0
;
background-color
:
#266fe8
;
color
:
#fff
;
/*color: #266fe8;*/
/*border: 1px solid #266fe8;*/
}
/*查询按钮*/
.searchListButton
{
margin-top
:
0
;
background-color
:
#266fe8
;
color
:
#fff
;
}
/*清空按钮*/
.toEmptyButton
{
margin-top
:
0
;
background-color
:
#266fe8
;
color
:
#fff
;
}
.exam
{
padding
:
0px
40px
;
.page
{
...
...
@@ -87,7 +230,7 @@ export default {
}
.el-table
.warning-row
{
background
:
#000
!important
;
}
.el-table
.success-row
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment