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
Expand all
Show 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
This diff is collapsed.
Click to expand it.
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