Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
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
罗超
confucius
Commits
4589db6f
Commit
4589db6f
authored
Jan 07, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
fc15b75f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
194 additions
and
3 deletions
+194
-3
questionconfig.js
src/api/question/questionconfig.js
+22
-1
question-form.vue
src/components/question/question-form.vue
+6
-2
sharing-choose.vue
src/components/questiontype/sharing-choose.vue
+166
-0
No files found.
src/api/question/questionconfig.js
View file @
4589db6f
...
...
@@ -150,7 +150,28 @@ export function CreateQuestion(questionKey) {
break
;
//共用选择题
case
"sharing-choose"
:
var
tempArray
=
[{
Name
:
"A"
,
Content
:
""
},
{
Name
:
"B"
,
Content
:
""
},
{
Name
:
"C"
,
Content
:
""
},
{
Name
:
"D"
,
Content
:
""
}];
var
array2
=
[{
Name
:
""
,
Content
:
""
,
},
{
Name
:
""
,
Content
:
""
,
}];
AnswerList
.
push
(
tempArray
);
AnswerList
.
push
(
array2
);
break
;
}
return
AnswerList
;
...
...
src/components/question/question-form.vue
View file @
4589db6f
...
...
@@ -32,7 +32,7 @@
<
template
v-if=
"questionObj.Key=='cloze'"
>
选项处用##题号##替换,如##1##
</
template
>
<UeEditor
v-model=
"objOption.Title"
:config=
"config"
ref=
"UE_Title"
></UeEditor>
<UeEditor
v-if=
"questionObj.Key!='sharing-choose'"
v-model=
"objOption.Title"
:config=
"config"
ref=
"UE_Title"
></UeEditor>
</div>
<br
/>
<!--单选题-->
...
...
@@ -62,6 +62,9 @@
<!--阅读理解、听力题-->
<reading-comprehensio
v-if=
"questionObj.Key=='reading-comprehensio'||questionObj.Key=='listening'"
:questionData=
"AnswerList"
@
getChild=
"getChildData"
></reading-comprehensio>
<!--共用选择题-->
<sharing-choose
v-if=
"questionObj.Key=='sharing-choose'"
:questionData=
"AnswerList"
@
getChild=
"getChildData"
:setOption=
"objOption"
>
</sharing-choose>
<br
/>
<div
class=
"col-12"
>
答案解析
<UeEditor
v-model=
"objOption.AnswerParse"
:config=
"config"
ref=
"AnswerParse"
></UeEditor>
...
...
@@ -121,6 +124,7 @@
import
sortingProblem
from
'../questiontype/sorting-problem'
import
cloze
from
'../questiontype/cloze'
import
readingComprehensio
from
'../questiontype/reading-comprehensio'
import
sharingChoose
from
'../questiontype/sharing-choose'
export
default
{
components
:
{
UeEditor
,
...
...
@@ -135,6 +139,7 @@
sortingProblem
,
//排序题
cloze
,
//完型填空
readingComprehensio
,
//阅读理解
sharingChoose
,
//共用选择题
},
props
:
{
setingObj
:
{
...
...
@@ -235,7 +240,6 @@
this
.
objOption
.
QuestionTypeKey
=
item
.
Key
;
var
obj
=
CreateQuestion
(
item
.
Key
);
this
.
AnswerList
=
obj
;
console
.
log
(
"this.AnswerList "
,
this
.
AnswerList
);
},
//获取题型列表
getQuestionType
()
{
...
...
src/components/questiontype/sharing-choose.vue
0 → 100644
View file @
4589db6f
<!--共用选择题-->
<
style
>
</
style
>
<
template
>
<div
class=
"sharingChooseQuestion"
>
<table
v-if=
"data&&data.length>0"
>
<tr
v-for=
"(item,index) in data[0]"
>
<td>
{{
item
.
Name
}}
</td>
<td>
<UeEditor
v-model=
"item.Content"
:config=
"config"
></UeEditor>
</td>
<td>
<a
style=
"cursor:pointer;"
@
click=
"deleteOpion(index)"
>
删除
</a>
</td>
</tr>
<tfoot>
<tr>
<td
colspan=
"3"
>
<a
style=
"cursor:pointer;"
@
click=
"addOption()"
>
添加选项
</a>
</td>
</tr>
</tfoot>
</table>
<br
/>
<table
v-if=
"data&&data.length>0"
>
<tr
v-for=
"(item,index) in data[1]"
>
<td>
{{
index
+
1
}}
</td>
<td>
<UeEditor
v-model=
"item.Content"
:config=
"config"
></UeEditor>
</td>
<td>
<a
style=
"cursor:pointer;"
@
click=
"deleteQuestion(index)"
>
删除题干
</a>
</td>
</tr>
<tfoot>
<tr>
<td
colspan=
"3"
>
<a
style=
"cursor:pointer;"
@
click=
"addQuestion()"
>
添加题干
</a>
</td>
</tr>
</tfoot>
</table>
<br
/>
答案:
<br
/>
<table
v-if=
"data&&data.length>0"
>
<tr
v-for=
"(item,index) in data[1]"
>
<td>
{{
index
+
1
}}
</td>
<td>
<select
v-model=
"item.Name"
>
<template
v-for=
"(cItem,cIndex) in data[0]"
>
<option
:key=
"cIndex"
:label=
"cItem.Name"
:value=
"cItem.Name"
>
</option>
</
template
>
</select>
</td>
</tr>
</table>
</div>
</template>
<
script
>
import
{
getOptionList
,
//获取选择标签【A,B,C,D....】
}
from
'../../api/question/questionconfig'
import
UeEditor
from
'../editor/UeEditor'
export
default
{
props
:
{
questionData
:
{
type
:
Array
,
},
setOption
:
{
type
:
Object
}
},
components
:
{
UeEditor
},
data
()
{
return
{
data
:
this
.
questionData
,
config
:
{
initialFrameWidth
:
null
,
initialFrameHeight
:
80
,
},
optionTitleList
:
[],
};
},
created
()
{
this
.
initConfig
();
},
methods
:
{
initConfig
()
{
this
.
optionTitleList
=
getOptionList
();
},
//删除选项
deleteOpion
(
index
)
{
this
.
data
[
0
].
splice
(
index
,
1
);
this
.
calcOptionTitle
();
},
//新增选项
addOption
()
{
if
(
this
.
data
.
length
<
26
)
{
this
.
data
[
0
].
push
({
Name
:
""
,
Content
:
""
,
});
this
.
calcOptionTitle
();
}
else
{
this
.
$q
.
notify
({
type
:
'warning'
,
position
:
'center'
,
timeout
:
1500
,
message
:
`最多只能添加26个选项`
})
return
}
},
//删除题干
deleteQuestion
(
index
)
{
this
.
data
[
1
].
splice
(
index
,
1
);
this
.
calcOptionTitle
();
},
//添加题干
addQuestion
()
{
this
.
data
[
1
].
push
({
Name
:
""
,
Content
:
""
,
});
this
.
calcOptionTitle
();
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle
()
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
data
[
0
].
forEach
((
item
,
index
)
=>
{
item
.
Name
=
this
.
optionTitleList
[
index
];
})
}
},
//返回数据到父组件
returnDataToParent
()
{
this
.
$emit
(
'getChild'
,
this
.
data
);
},
},
mounted
()
{
},
watch
:
{
data
:
{
handler
(
newValue
)
{
this
.
setOption
.
Title
=
this
.
data
[
1
][
0
].
Content
;
this
.
returnDataToParent
();
},
deep
:
true
},
}
};
</
script
>
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