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
534f7a8c
Commit
534f7a8c
authored
Apr 06, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/luochao/confucius
parents
3afe7d84
01753870
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
355 additions
and
420 deletions
+355
-420
v-single.vue
src/components/questiontype/v-single.vue
+150
-0
questionInfo.vue
src/pages/course/questionInfo.vue
+205
-420
No files found.
src/components/questiontype/v-single.vue
0 → 100644
View file @
534f7a8c
<
style
>
.singleQuestion
{
width
:
100%
;
}
</
style
>
<!--单选题-->
<
template
>
<div
class=
"singleQuestion"
>
<table
v-if=
"data&&data.length>0"
class=
"common_TiTable"
>
<tr
v-for=
"(item,index) in data"
>
<td
style=
"width:40px;text-align:center;"
>
<div
class=
"Answer_List"
:class=
"
{'Is_Answer':item.IsAnswer}">
{{
item
.
Name
}}
</div>
</td>
<td>
<div
class=
"InpDIV"
style=
"border:0;"
v-html=
"item.Content"
></div>
</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
:
90
,
},
optionTitleList
:
[],
commonIndex
:
-
1
,
};
},
created
()
{
this
.
initConfig
();
},
mounted
()
{},
methods
:
{
initConfig
()
{
this
.
optionTitleList
=
getOptionList
();
},
//删除选项
deleteOpion
(
index
)
{
this
.
$q
.
dialog
({
title
:
'提示信息'
,
message
:
'是否确定删除?'
,
cancel
:
true
,
persistent
:
true
,
ok
:
"确定"
,
cancel
:
"取消"
,
}).
onOk
(()
=>
{
this
.
data
.
splice
(
index
,
1
);
this
.
commonIndex
=
-
1
;
this
.
calcOptionTitle
();
}).
onCancel
(()
=>
{
});
},
//新增选项
addOption
()
{
if
(
this
.
data
.
length
<
7
)
{
this
.
data
.
push
({
Name
:
""
,
Content
:
""
,
IsAnswer
:
false
});
this
.
calcOptionTitle
()
}
else
{
this
.
$q
.
notify
({
type
:
'warning'
,
position
:
'center'
,
timeout
:
1500
,
message
:
`最多只能添加7个选项`
})
return
}
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle
()
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
data
.
forEach
((
item
,
index
)
=>
{
if
(
this
.
setOption
.
QuestionTypeKey
==
"single-number"
)
{
item
.
Name
=
index
+
1
;
}
else
{
item
.
Name
=
this
.
optionTitleList
[
index
];
}
})
}
},
//返回数据到父组件
returnDataToParent
()
{
this
.
getAnswer
();
this
.
$emit
(
'getChild'
,
this
.
data
);
},
ChangeItem
(
item
)
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
data
.
forEach
(
item
=>
{
item
.
IsAnswer
=
false
;
})
}
item
.
IsAnswer
=
true
;
},
//获取正确答案
getAnswer
()
{
this
.
setOption
.
Answer
=
""
;
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
data
.
forEach
(
item
=>
{
if
(
item
.
IsAnswer
)
{
this
.
setOption
.
Answer
=
item
.
Name
;
}
})
}
},
//点击切换输入
changeEdit
(
index
)
{
this
.
commonIndex
=
index
;
}
},
mounted
()
{
},
watch
:
{
data
:
{
handler
(
newValue
)
{
this
.
returnDataToParent
();
},
deep
:
true
},
}
};
</
script
>
src/pages/course/questionInfo.vue
View file @
534f7a8c
...
...
@@ -102,80 +102,134 @@
</
style
>
<
template
>
<div>
<q-card
style=
"width: 1400px;max-width:900px;"
>
<q-card-section>
<div
class=
"text-h6"
>
{{
objOption
.
QuestionId
==
0
?
'新增问题信息'
:
'修改问题信息'
}}
</div>
</q-card-section>
<q-card-section
class=
"q-pt-none scroll"
style=
"max-height: 70vh"
>
<div
class=
"row wrap"
>
<div
class=
"col-12"
v-html=
"objOption.Title"
></div>
<div
class=
"edit_stem"
>
{{
questionName
}}
</div>
<div
class=
"col-12"
>
<template
v-if=
"questionObj.Key=='cloze'"
>
<span
class=
"question_number"
>
选项处用##题号##替换,如##1##
</span>
</
template
>
<UeEditor
v-if=
"questionObj.Key!='sharing-choose'"
v-model=
"objOption.Title"
:config=
"config"
ref=
"UE_Title"
></UeEditor>
</div>
<br
/>
<div
class=
"col-12"
>
<div
style=
"margin:20px 0;"
>
答案解析
</div>
<UeEditor
v-model=
"objOption.AnswerParse"
:config=
"config"
ref=
"AnswerParse"
></UeEditor>
</div>
<br
/>
<div
class=
"col-12"
>
<br
/>
<span
class=
"difficulty_Degree"
>
难度
</span>
<select
v-model=
"objOption.DifficultyType"
class=
"selectBox blue-border"
>
<
template
v-for=
"(cItem,cIndex) in questionDifficultyTypeList"
>
<option
:key=
"cIndex"
:label=
"cItem.Name"
:value=
"cItem.Id"
>
</option>
<div>
<q-card
style=
"width: 1400px;max-width:900px;"
>
<q-card-section
class=
"q-pt-none scroll"
style=
"max-height: 70vh"
>
<div
class=
"row wrap"
>
<div
class=
"col-12"
v-if=
"objOption.QuestionId==0"
style=
"margin-bottom:20px"
>
题型
<template
v-for=
"(fItem,fIndex) in firstTypeList"
>
<q-btn
:key=
"fIndex"
color=
"accent"
:label=
"fItem.Name"
style=
"margin-left:5px;"
@
click=
"onItemClick(fItem)"
/>
</
template
>
</select>
</div>
<div
class=
"col-12"
>
<br
/>
<span
class=
"difficulty_Degree"
>
所属大类
</span>
<select
v-model=
"objOption.Category"
class=
"selectBox blue-border"
>
<
template
v-for=
"(cItem,cIndex) in questionCategoryList"
>
<option
:key=
"cIndex"
:label=
"cItem.Name"
:value=
"cItem.Id"
>
</option>
<q-btn-dropdown
color=
"accent"
label=
"更多"
style=
"margin-left:5px;"
>
<q-list>
<q-item
v-for=
"(fItem,fIndex) in secondTypeList"
@
click=
"onItemClick(fItem)"
clickable
v-close-popup
:key=
"fIndex"
>
<q-item-section>
<q-item-label>
{{fItem.Name}}
</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
<div
class=
"edit_stem"
>
{{questionName}}
</div>
<div
class=
"col-12"
>
<
template
v-if=
"questionObj.Key=='cloze'"
>
<span
class=
"question_number"
>
选项处用##题号##替换,如##1##
</span>
</
template
>
</select>
</div>
<div
class=
"col-12"
>
<div
v-html=
"objOption.Title"
@
click=
"clickQuestion($event)"
></div>
<!-- <UeEditor v-if="questionObj.Key!='sharing-choose'" v-model="objOption.Title" :config="config"
ref="UE_Title"></UeEditor> -->
</div>
<br
/>
<span
class=
"difficulty_Degree"
>
考级程度
</span>
<select
v-model=
"objOption.LevelType"
class=
"selectBox blue-border"
>
<
template
v-for=
"(cItem,cIndex) in questionLevalTypeList"
>
<option
:key=
"cIndex"
:label=
"cItem.Name"
:value=
"cItem.Id"
>
</option>
</
template
>
</select>
</div>
<div
class=
"col-12"
style=
"margin-top:16px;"
>
<span
class=
"difficulty_Degree"
>
知识点:
</span>
<a
class=
"addKnowledge"
@
click=
"isShowPoint=true"
>
<i
class=
"iconfont icon-add"
style=
"position:relative;top:1px;"
></i>
选择知识点
</a>
<span
class=
"knowledge_List"
v-for=
"(x, i) in choosePointArray"
:key=
"i"
>
{{x.PointName}}
<i
class=
"iconfont icon-shanchu1"
@
click=
"removePointTag(i)"
></i>
</span>
<!--单选题-->
<v-single
v-if=
"questionObj.Key=='single'||questionObj.Key=='single-number'"
:questionData=
"AnswerList"
@
getChild=
"getChildData"
:setOption=
"objOption"
></v-single>
<!--多选题-->
<multiple
v-if=
"questionObj.Key=='multiple'"
:questionData=
"AnswerList"
@
getChild=
"getChildData"
:setOption=
"objOption"
></multiple>
<!--填空题-->
<fill-in
v-if=
"questionObj.Key=='fill-in'"
:questionData=
"AnswerList"
@
getChild=
"getChildData"
:setOption=
"objOption"
></fill-in>
<!--判断题-->
<judge
v-if=
"questionObj.Key=='judge'"
:questionData=
"AnswerList"
@
getChild=
"getChildData"
:setOption=
"objOption"
></judge>
<!--简答题、名词解释、论述题、计算题、口语题、其它-->
<short-answer
v-if=
"questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'
||questionObj.Key=='calculation' || questionObj.Key=='spoken'|| questionObj.Key=='other'
"
:setOption=
"objOption"
>
</short-answer>
<!--分录题、资料题-->
<entry-problem
v-if=
"questionObj.Key=='entry-problem'|| questionObj.Key=='data-question'"
:questionData=
"AnswerList"
:setOption=
"objOption"
@
getChild=
"getChildData"
>
</entry-problem>
<!--连线题-->
<matching
v-if=
"questionObj.Key=='matching'"
:questionData=
"AnswerList"
:setOption=
"objOption"
@
getChild=
"getChildData"
></matching>
<!--排序题-->
<sorting-problem
v-if=
"questionObj.Key=='sorting-problem'"
:questionData=
"AnswerList"
:setOption=
"objOption"
@
getChild=
"getChildData"
></sorting-problem>
<!--完型填空-->
<cloze
v-if=
"questionObj.Key=='cloze'"
:questionData=
"AnswerList"
:setOption=
"objOption"
@
getChild=
"getChildData"
></cloze>
<!--阅读理解、听力题-->
<reading-comprehensio
v-if=
"questionObj.Key=='reading-comprehensio'||questionObj.Key=='listening'"
:questionData=
"AnswerList"
:setOption=
"objOption"
@
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"
>
<div
style=
"margin:20px 0;"
>
答案解析
</div>
<div
v-html=
"objOption.AnswerParse"
></div>
</div>
<br
/>
<div
class=
"col-12"
>
<br
/>
<span
class=
"difficulty_Degree"
>
难度
</span>
<span>
{{objOption.DifficultyTypeStr}}
</span>
<!-- <select v-model="objOption.DifficultyType" class="selectBox blue-border">
<template v-for="(cItem,cIndex) in questionDifficultyTypeList">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Id">
</option>
</template>
</select> -->
</div>
<div
class=
"col-12"
>
<br
/>
<span
class=
"difficulty_Degree"
>
所属大类
</span>
<select
v-model=
"objOption.Category"
class=
"selectBox blue-border"
>
<
template
v-for=
"(cItem,cIndex) in questionCategoryList"
>
<option
:key=
"cIndex"
:label=
"cItem.Name"
:value=
"cItem.Id"
>
</option>
</
template
>
</select>
</div>
<div
class=
"col-12"
>
<br
/>
<span
class=
"difficulty_Degree"
>
考级程度
</span>
<select
v-model=
"objOption.LevelType"
class=
"selectBox blue-border"
>
<
template
v-for=
"(cItem,cIndex) in questionLevalTypeList"
>
<option
:key=
"cIndex"
:label=
"cItem.Name"
:value=
"cItem.Id"
>
</option>
</
template
>
</select>
</div>
<div
class=
"col-12"
style=
"margin-top:16px;"
>
<span
class=
"difficulty_Degree"
>
知识点:
</span>
<a
class=
"addKnowledge"
@
click=
"isShowPoint=true"
>
<i
class=
"iconfont icon-add"
style=
"position:relative;top:1px;"
></i>
选择知识点
</a>
<span
class=
"knowledge_List"
v-for=
"(x, i) in choosePointArray"
:key=
"i"
>
{{x.PointName}}
<i
class=
"iconfont icon-shanchu1"
@
click=
"removePointTag(i)"
></i>
</span>
</div>
</div>
</div>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
style=
"font-weight:400 !important"
@
click=
"closeCourseForm"
/>
<q-btn
label=
"立即提交"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
:loading=
"saveCourseLoading"
@
click=
"setQuestion"
/>
</q-card-actions>
</q-card>
</div>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
style=
"font-weight:400 !important"
/>
</q-card-actions>
</q-card>
<!--选择知识点-->
<questionpoint
v-if=
"isShowPoint"
:CourseId=
"CourseId"
:openDialog=
"isShowPoint"
@
closed=
"closeQuestionPoint"
:multiple=
"true"
@
selected=
"getPointList"
>
</questionpoint>
</div>
</template>
<
script
>
...
...
@@ -192,9 +246,35 @@
}
from
'../../api/question/questionconfig'
import
UeEditor
from
'../../components/editor/UeEditor'
//知识点列表
import
questionpoint
from
'../../components/question/questionpoint'
import
vSingle
from
'../../components/questiontype/v-single'
import
multiple
from
'../../components/questiontype/multiple'
import
fillIn
from
'../../components/questiontype/fill-in'
import
judge
from
'../../components/questiontype/judge'
import
shortAnswer
from
'../../components/questiontype/short-answer'
import
entryProblem
from
'../../components/questiontype/entry-problem'
import
matching
from
'../../components/questiontype/matching'
import
sortingProblem
from
'../../components/questiontype/sorting-problem'
import
cloze
from
'../../components/questiontype/cloze'
import
readingComprehensio
from
'../../components/questiontype/reading-comprehensio'
import
sharingChoose
from
'../../components/questiontype/sharing-choose'
export
default
{
components
:
{},
components
:
{
UeEditor
,
questionpoint
,
//知识点
vSingle
,
//单选题
multiple
,
//多选题
fillIn
,
//填空题
judge
,
//判断题
shortAnswer
,
//简答题
entryProblem
,
//分录题
matching
,
//连线题
sortingProblem
,
//排序题
cloze
,
//完型填空
readingComprehensio
,
//阅读理解
sharingChoose
,
//共用选择题
},
props
:
{
setingObj
:
{
type
:
Object
,
...
...
@@ -239,7 +319,6 @@
firstTypeList
:
[],
//前5个数组
secondTypeList
:
[],
//后面的题型
questionDifficultyTypeList
:
[],
//问题难易程度列表
saveCourseLoading
:
false
,
isShowPoint
:
false
,
//是否显示知识点弹窗
choosePointArray
:
[],
//知识点列表
questionCategoryList
:
[],
//问题大类
...
...
@@ -270,10 +349,7 @@
this
.
getQuestionLevelType
();
},
mounted
()
{
if
(
this
.
$route
.
query
.
QuestionId
)
{
let
QuestionId
=
this
.
$route
.
query
.
QuestionId
;
this
.
initObj
(
QuestionId
);
}
this
.
initObj
()
},
methods
:
{
//获取问题大类
...
...
@@ -345,11 +421,13 @@
});
},
//初始化表单
initObj
(
id
)
{
this
.
objOption
.
CourseId
=
this
.
CourseId
;
this
.
objOption
.
BankId
=
this
.
BankId
;
initObj
()
{
var
qId
=
0
;
if
(
this
.
$route
.
query
.
QuestionId
)
{
qId
=
this
.
$route
.
query
.
QuestionId
;
}
queryQuestionInfo
({
QuestionId
:
i
d
QuestionId
:
qI
d
}).
then
(
res
=>
{
this
.
objOption
.
QuestionId
=
res
.
Data
.
QuestionId
;
this
.
objOption
.
Title
=
res
.
Data
.
Title
;
...
...
@@ -366,7 +444,6 @@
this
.
questionObj
.
QId
=
res
.
Data
.
QuestionTypeId
;
this
.
objOption
.
Category
=
res
.
Data
.
Category
;
this
.
objOption
.
LevelType
=
res
.
Data
.
LevelType
;
this
.
objOption
.
Title
=
res
.
Data
.
Title
;
if
(
res
.
Data
.
QuestionContentObj
)
{
this
.
AnswerList
=
res
.
Data
.
QuestionContentObj
;
this
.
objOption
.
QuestionContent
=
JSON
.
stringify
(
res
.
Data
.
QuestionContentObj
);
...
...
@@ -377,353 +454,61 @@
this
.
choosePointArray
=
res
.
Data
.
QuestionPointList
;
}
})
},
//关闭弹窗
closeCourseForm
()
{
this
.
$emit
(
'close'
)
this
.
persistent
=
false
},
//保存问题
setQuestion
()
{
//验证方法
if
(
this
.
validateType
())
{
var
pointIds
=
""
;
if
(
this
.
choosePointArray
&&
this
.
choosePointArray
.
length
>
0
)
{
this
.
choosePointArray
.
forEach
(
item
=>
{
pointIds
+=
','
+
item
.
PointId
});
}
if
(
pointIds
!=
''
)
{
pointIds
=
pointIds
.
substring
(
1
);
}
this
.
objOption
.
Knowledge
=
pointIds
;
this
.
saveCourseLoading
=
true
;
saveQuestion
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveCourseLoading
=
false
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'数据保存成功!'
,
position
:
'top'
})
this
.
$emit
(
"success"
)
this
.
closeSaveForm
()
}).
catch
(()
=>
{
this
.
saveCourseLoading
=
false
})
}
},
this
.
optionTitle
=
"修改问题信息"
}
},
//关闭弹窗
closeCourseForm
()
{
//验证
validateType
()
{
//连线题
var
result
=
true
;
if
(
this
.
objOption
.
QuestionTypeKey
==
'matching'
)
{
if
(
this
.
objOption
.
QuestionContent
)
{
var
myArr
=
JSON
.
parse
(
this
.
objOption
.
QuestionContent
);
for
(
var
i
=
0
;
i
<
myArr
[
0
].
length
;
i
++
)
{
if
(
myArr
[
0
][
i
].
Content
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`第一组第
${
i
+
1
}
行数据内容为空!`
})
result
=
false
;
return
;
}
}
if
(
this
.
isRepeat
(
myArr
[
0
],
1
))
{
result
=
this
.
isRepeat
(
myArr
[
0
],
1
);
}
else
{
return
;
}
for
(
var
i
=
0
;
i
<
myArr
[
1
].
length
;
i
++
)
{
if
(
myArr
[
1
][
i
].
Content
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`第二组第
${
i
+
1
}
行数据内容为空!`
})
result
=
false
;
return
;
}
}
if
(
this
.
isRepeat
(
myArr
[
1
],
2
))
{
result
=
this
.
isRepeat
(
myArr
[
1
],
2
);
}
else
{
return
;
}
}
}
//公用选择题
if
(
this
.
objOption
.
QuestionTypeKey
==
'sharing-choose'
)
{
if
(
this
.
objOption
.
QuestionContent
)
{
var
myArr
=
JSON
.
parse
(
this
.
objOption
.
QuestionContent
);
for
(
var
i
=
0
;
i
<
myArr
[
0
].
length
;
i
++
)
{
if
(
myArr
[
0
][
i
].
Content
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`选项内容不能为空!`
})
result
=
false
;
return
;
}
}
if
(
this
.
isRepeat
(
myArr
[
0
],
3
))
{
result
=
this
.
isRepeat
(
myArr
[
0
],
3
);
}
else
{
return
;
}
for
(
var
i
=
0
;
i
<
myArr
[
1
].
length
;
i
++
)
{
if
(
myArr
[
1
][
i
].
Content
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`题干内容不能为空!`
})
result
=
false
;
return
;
}
}
if
(
this
.
isRepeat
(
myArr
[
1
],
4
))
{
result
=
this
.
isRepeat
(
myArr
[
1
],
4
);
}
else
{
return
;
}
}
}
//其他何口语题
if
(
this
.
objOption
.
QuestionTypeKey
==
'other'
||
this
.
objOption
.
QuestionTypeKey
==
'spoken'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入试题的题干`
})
result
=
false
;
return
;
}
}
//听力题 阅读理解
if
(
this
.
objOption
.
QuestionTypeKey
==
'listening'
||
this
.
objOption
.
QuestionTypeKey
==
'reading-comprehensio'
)
{
if
(
this
.
objOption
.
QuestionContent
)
{
var
myArr
=
JSON
.
parse
(
this
.
objOption
.
QuestionContent
);
for
(
var
i
=
0
;
i
<
myArr
.
length
;
i
++
)
{
if
(
myArr
[
i
].
SubTitle
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入第
${
i
+
1
}
小题题干!`
})
result
=
false
;
return
;
}
for
(
var
j
=
0
;
j
<
myArr
[
i
].
SubAnwser
.
length
;
j
++
)
{
if
(
myArr
[
i
].
SubAnwser
[
j
].
Content
===
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入第
${
i
+
1
}
小题选项`
})
result
=
false
;
return
;
}
}
if
(
this
.
isRepeat
(
myArr
[
i
].
SubAnwser
,
3
))
{
result
=
this
.
isRepeat
(
myArr
[
i
].
SubAnwser
,
3
);
}
else
{
return
;
}
}
}
}
//口语题
if
(
this
.
objOption
.
QuestionTypeKey
==
'spoken'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入试题的题干`
})
result
=
false
;
return
;
}
}
//阅读理解
if
(
this
.
objOption
.
QuestionTypeKey
==
'cloze'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入试题的题干`
})
result
=
false
;
return
;
}
if
(
this
.
objOption
.
QuestionContent
)
{
var
myArr
=
JSON
.
parse
(
this
.
objOption
.
QuestionContent
);
for
(
var
i
=
0
;
i
<
myArr
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
myArr
[
i
].
length
;
j
++
)
if
(
myArr
[
i
][
j
].
Content
===
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入第
${
i
+
1
}
小题选项`
})
result
=
false
;
return
;
}
if
(
this
.
isRepeat
(
myArr
[
i
],
3
))
{
result
=
this
.
isRepeat
(
myArr
[
i
],
3
);
}
else
{
return
;
}
}
}
}
//排序题
if
(
this
.
objOption
.
QuestionTypeKey
==
'sorting-problem'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入试题的题干`
})
result
=
false
;
return
;
}
if
(
this
.
objOption
.
QuestionContent
)
{
var
myArr
=
JSON
.
parse
(
this
.
objOption
.
QuestionContent
);
for
(
var
i
=
0
;
i
<
myArr
[
0
].
length
;
i
++
)
{
if
(
myArr
[
0
].
Content
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入试题选项`
})
result
=
false
;
return
;
}
if
(
this
.
isRepeat
(
myArr
[
0
],
3
))
{
result
=
this
.
isRepeat
(
myArr
[
0
],
3
);
}
else
{
return
;
}
}
}
}
//资料提 分录题 多选题
if
(
this
.
objOption
.
QuestionTypeKey
==
'data-question'
||
this
.
objOption
.
QuestionTypeKey
==
'entry-problem'
||
this
.
objOption
.
QuestionTypeKey
==
'multiple'
||
this
.
objOption
.
QuestionTypeKey
==
'single'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入题干!`
})
result
=
false
;
return
;
}
if
(
this
.
objOption
.
QuestionContent
)
{
var
myArr
=
JSON
.
parse
(
this
.
objOption
.
QuestionContent
);
for
(
var
i
=
0
;
i
<
myArr
.
length
;
i
++
)
{
if
(
myArr
[
i
].
Content
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入第
${
i
+
1
}
的选项!`
})
result
=
false
;
return
;
}
if
(
this
.
isRepeat
(
myArr
,
3
))
{
result
=
this
.
isRepeat
(
myArr
,
3
);
}
else
{
return
;
}
}
}
}
//计算题
if
(
this
.
objOption
.
QuestionTypeKey
==
'calculation'
||
this
.
objOption
.
QuestionTypeKey
==
'essay-question'
||
this
.
objOption
.
QuestionTypeKey
==
'noun-explanation'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入题干!`
})
result
=
false
;
return
;
}
if
(
this
.
objOption
.
Answer
==
''
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入回答!`
})
result
=
false
;
return
;
}
}
//判断题
if
(
this
.
objOption
.
QuestionTypeKey
==
'judge'
)
{
if
(
this
.
objOption
.
Title
==
''
)
{
},
clickQuestion
(
e
)
{
if
((
e
.
target
.
nodeName
==
'SPAN'
||
e
.
target
.
nodeName
==
'P'
||
e
.
target
.
nodeName
==
'IMG'
)
&&
event
.
target
.
className
==
'attachNew'
)
{
var
url
=
e
.
target
.
getAttribute
(
"accesskey"
);
if
(
url
&&
url
!=
''
)
{
window
.
open
(
url
)
}
}
},
//js 判断重复
isRepeat
(
Arr
,
type
)
{
var
result
=
true
;
var
msg
=
''
;
switch
(
type
)
{
case
1
:
msg
=
'第1组数据选项不能相同'
break
;
case
2
:
msg
=
'第2组数据选项不能相同'
break
;
case
3
:
msg
=
'选项内容不能相同'
break
;
case
4
:
msg
=
'题干内容不能相同!'
;
break
;
default
:
}
let
num
=
0
;
for
(
var
i
=
0
;
i
<
Arr
.
length
-
1
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
Arr
.
length
;
j
++
)
{
if
(
Arr
[
i
].
Content
===
Arr
[
j
].
Content
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
`请输入题干!`
message
:
msg
})
result
=
false
;
return
;
num
++
;
}
}
return
result
;
},
//js 判断重复
isRepeat
(
Arr
,
type
)
{
var
result
=
true
;
var
msg
=
''
;
switch
(
type
)
{
case
1
:
msg
=
'第1组数据选项不能相同'
break
;
case
2
:
msg
=
'第2组数据选项不能相同'
break
;
case
3
:
msg
=
'选项内容不能相同'
break
;
case
4
:
msg
=
'题干内容不能相同!'
;
break
;
default
:
}
let
num
=
0
;
for
(
var
i
=
0
;
i
<
Arr
.
length
-
1
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
Arr
.
length
;
j
++
)
{
if
(
Arr
[
i
].
Content
===
Arr
[
j
].
Content
)
{
this
.
$q
.
notify
({
type
:
'negative'
,
position
:
"top"
,
message
:
msg
})
num
++
;
}
}
}
if
(
num
>
0
)
{
result
=
false
;
}
else
{
result
=
true
;
}
return
result
;
}
},
if
(
num
>
0
)
{
result
=
false
;
}
else
{
result
=
true
;
}
return
result
;
}
}
</
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