Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
f71d6411
提交
f71d6411
authored
1月 17, 2020
作者:
GOD_ZYX
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成全部 考试开发
上级
e32c2cad
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
70 行增加
和
34 行删除
+70
-34
exam.vue
client/client/components/player/exam/exam.vue
+56
-27
uploadForm.vue
client/client/components/upload-form/src/uploadForm.vue
+12
-5
config.js
server/server/config.js
+2
-2
没有找到文件。
client/client/components/player/exam/exam.vue
浏览文件 @
f71d6411
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
<div
class=
"edit_html"
v-html=
"item.content || ''"
></div>
<div
class=
"edit_html"
v-html=
"item.content || ''"
></div>
<textarea
:id=
"('editor-exam' + index)"
v-model=
"item.user_answer"
></textarea>
<textarea
:id=
"('editor-exam' + index)"
v-model=
"item.user_answer"
></textarea>
<div
style=
"height: 10px;"
></div>
<div
style=
"height: 10px;"
></div>
<component
:is=
"item.upload.type"
v-bind:key=
"item.upload.model"
:item=
"item.upload"
:formData=
"item"
></component>
<component
:is=
"item.upload.type"
v-bind:key=
"item.upload.model"
:item=
"item.upload"
:formData=
"item"
:isUpload=
"!exam.type"
></component>
</div>
</div>
</
template
>
</
template
>
</template>
</template>
...
@@ -117,6 +117,7 @@ export default {
...
@@ -117,6 +117,7 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
_time
:
null
,
// 定时器,自动化提交
exam
:
{
exam
:
{
// id: '1',
// id: '1',
// title: '标题',
// title: '标题',
...
@@ -246,6 +247,26 @@ export default {
...
@@ -246,6 +247,26 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
loadAjax
()
this
.
loadAjax
()
if
(
this
.
_time
)
{
clearInterval
(
this
.
_time
)
this
.
_time
=
null
}
this
.
_time
=
setInterval
(()
=>
{
if
(
!
this
.
exam
.
type
)
{
this
.
submitExam
({
submitType
:
true
})
// 暂存, submitType: true 暂存;其他或不填为提交
}
else
{
clearInterval
(
this
.
_time
)
this
.
_time
=
null
}
},
30000
)
},
destroyed
()
{
if
(
this
.
_time
)
{
console
.
log
(
11
)
clearInterval
(
this
.
_time
)
this
.
_time
=
null
}
},
},
methods
:
{
methods
:
{
isCheckboxRight
:
(
val
,
arr
)
=>
{
isCheckboxRight
:
(
val
,
arr
)
=>
{
...
@@ -274,27 +295,31 @@ export default {
...
@@ -274,27 +295,31 @@ export default {
initckeditor
()
{
initckeditor
()
{
if
(
!
this
.
exam
.
shortAnswerList
)
{
return
}
if
(
!
this
.
exam
.
shortAnswerList
)
{
return
}
for
(
let
i
=
0
;
i
<
this
.
exam
.
shortAnswerList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
exam
.
shortAnswerList
.
length
;
i
++
)
{
let
tmpEditor
=
CKEDITOR
.
replace
(
'editor-exam'
+
i
,
{
let
instances
=
CKEDITOR
.
instances
height
:
300
,
let
tmpEditor
=
null
uiColor
:
'#eeeeee'
,
if
(
!
instances
[
'editor-exam'
+
i
])
{
filebrowserImageUploadUrl
:
'/api/ckeditor/img/upload'
,
tmpEditor
=
CKEDITOR
.
replace
(
'editor-exam'
+
i
,
{
// resize_enabled: typeof this.props.resizable === 'boolean' ? this.props.resizable : true,
height
:
300
,
toolbar
:
[
uiColor
:
'#eeeeee'
,
// { name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'Preview' ] },
filebrowserImageUploadUrl
:
'/api/ckeditor/img/upload'
,
{
name
:
'styles'
,
items
:
[
'Styles'
,
'Format'
,
'Font'
,
'FontSize'
]
},
// resize_enabled: typeof this.props.resizable === 'boolean' ? this.props.resizable : true,
{
name
:
'colors'
,
items
:
[
'TextColor'
,
'BGColor'
]
},
toolbar
:
[
{
name
:
'tools'
,
items
:
[
'Maximize'
,
'ShowBlocks'
]
},
// { name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'Preview' ] },
// { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{
name
:
'styles'
,
items
:
[
'Styles'
,
'Format'
,
'Font'
,
'FontSize'
]
},
{
name
:
'editing'
,
items
:
[
'Find'
,
'Replace'
]
},
{
name
:
'colors'
,
items
:
[
'TextColor'
,
'BGColor'
]
},
// { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
{
name
:
'tools'
,
items
:
[
'Maximize'
,
'ShowBlocks'
]
},
'/'
,
// { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{
name
:
'basicstyles'
,
items
:
[
'Bold'
,
'Italic'
,
'Underline'
,
'Strike'
,
'Subscript'
,
'Superscript'
,
'-'
,
'RemoveFormat'
]
},
{
name
:
'editing'
,
items
:
[
'Find'
,
'Replace'
]
},
{
name
:
'paragraph'
,
items
:
[
'NumberedList'
,
'BulletedList'
,
'-'
,
'Outdent'
,
'Indent'
,
'-'
,
'Blockquote'
,
'CreateDiv'
,
'-'
,
'JustifyLeft'
,
'JustifyCenter'
,
'JustifyRight'
,
'JustifyBlock'
,
'-'
,
'BidiLtr'
,
'BidiRtl'
]
},
// { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
{
name
:
'links'
,
items
:
[
'Link'
,
'Unlink'
,
'Anchor'
]
},
'/'
,
{
name
:
'insert'
,
items
:
[
'Image'
,
'Table'
,
'HorizontalRule'
]
}
{
name
:
'basicstyles'
,
items
:
[
'Bold'
,
'Italic'
,
'Underline'
,
'Strike'
,
'Subscript'
,
'Superscript'
,
'-'
,
'RemoveFormat'
]
},
]
{
name
:
'paragraph'
,
items
:
[
'NumberedList'
,
'BulletedList'
,
'-'
,
'Outdent'
,
'Indent'
,
'-'
,
'Blockquote'
,
'CreateDiv'
,
'-'
,
'JustifyLeft'
,
'JustifyCenter'
,
'JustifyRight'
,
'JustifyBlock'
,
'-'
,
'BidiLtr'
,
'BidiRtl'
]
},
})
{
name
:
'links'
,
items
:
[
'Link'
,
'Unlink'
,
'Anchor'
]
},
this
.
exam
.
shortAnswerList
[
i
].
ckeditor
=
tmpEditor
{
name
:
'insert'
,
items
:
[
'Image'
,
'Table'
,
'HorizontalRule'
]
}
]
})
}
this
.
exam
.
shortAnswerList
[
i
].
ckeditor
=
tmpEditor
||
instances
[
'editor-exam'
+
i
]
}
}
},
},
/**
/**
...
@@ -340,15 +365,15 @@ export default {
...
@@ -340,15 +365,15 @@ export default {
* 提交试题
* 提交试题
*/
*/
submitExam
(
e
)
{
submitExam
(
e
)
{
if
(
e
.
currentTarget
.
dataset
.
submit
)
{
if
(
!
e
.
submitType
&&
e
.
currentTarget
.
dataset
.
submit
)
{
this
.
$message
.
error
(
'已做过,不能再提交'
)
this
.
$message
.
error
(
'已做过,不能再提交'
)
return
return
}
}
let
body
=
{
answers
:
{},
type
:
0
}
// type: 0 缓存;type: 1 提交
let
body
=
{
answers
:
{},
type
:
!
e
.
submitType
?
1
:
0
}
// type: 0 缓存;type: 1 提交
body
.
answers
.
radioList
=
[]
body
.
answers
.
radioList
=
[]
for
(
let
i
=
0
;
i
<
this
.
exam
.
radioList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
exam
.
radioList
.
length
;
i
++
)
{
let
tmp
=
this
.
exam
.
radioList
[
i
]
let
tmp
=
this
.
exam
.
radioList
[
i
]
if
(
!
tmp
.
user_answer
)
{
if
(
!
tmp
.
user_answer
&&
!
e
.
submitType
)
{
this
.
$message
.
error
(
'还有单选题未做,不能提交'
)
this
.
$message
.
error
(
'还有单选题未做,不能提交'
)
return
return
}
}
...
@@ -360,7 +385,7 @@ export default {
...
@@ -360,7 +385,7 @@ export default {
body
.
answers
.
checkboxList
=
[]
body
.
answers
.
checkboxList
=
[]
for
(
let
i
=
0
;
i
<
this
.
exam
.
checkboxList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
exam
.
checkboxList
.
length
;
i
++
)
{
let
tmp
=
this
.
exam
.
checkboxList
[
i
]
let
tmp
=
this
.
exam
.
checkboxList
[
i
]
if
(
!
tmp
.
user_answer
.
length
)
{
if
(
!
tmp
.
user_answer
.
length
&&
!
e
.
submitType
)
{
this
.
$message
.
error
(
'还有多选题未做,不能提交'
)
this
.
$message
.
error
(
'还有多选题未做,不能提交'
)
return
return
}
}
...
@@ -373,7 +398,7 @@ export default {
...
@@ -373,7 +398,7 @@ export default {
for
(
let
i
=
0
;
i
<
this
.
exam
.
shortAnswerList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
exam
.
shortAnswerList
.
length
;
i
++
)
{
let
tmp
=
this
.
exam
.
shortAnswerList
[
i
]
let
tmp
=
this
.
exam
.
shortAnswerList
[
i
]
tmp
.
user_answer
=
tmp
.
ckeditor
.
getData
()
tmp
.
user_answer
=
tmp
.
ckeditor
.
getData
()
if
(
!
tmp
.
user_answer
)
{
if
(
!
tmp
.
user_answer
&&
!
e
.
submitType
)
{
this
.
$message
.
error
(
'还有简答题未做,不能提交'
)
this
.
$message
.
error
(
'还有简答题未做,不能提交'
)
return
return
}
}
...
@@ -386,6 +411,10 @@ export default {
...
@@ -386,6 +411,10 @@ export default {
body
.
answers
=
JSON
.
stringify
(
body
.
answers
)
body
.
answers
=
JSON
.
stringify
(
body
.
answers
)
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
cAction
.
examAction
.
submitExam
(
this
.
cid
,
this
.
sid
,
this
.
exam
.
id
,
body
).
then
(
_res
=>
{
cAction
.
examAction
.
submitExam
(
this
.
cid
,
this
.
sid
,
this
.
exam
.
id
,
body
).
then
(
_res
=>
{
if
(
e
.
submitType
)
{
this
.
$message
.
success
(
'暂存成功'
)
return
}
if
(
_res
.
code
===
200
)
{
if
(
_res
.
code
===
200
)
{
this
.
loadAjax
()
this
.
loadAjax
()
}
else
{
}
else
{
...
...
client/client/components/upload-form/src/uploadForm.vue
浏览文件 @
f71d6411
...
@@ -8,9 +8,10 @@
...
@@ -8,9 +8,10 @@
:on-success=
"onSuccessFile"
:on-success=
"onSuccessFile"
:with-credentials=
"true"
:with-credentials=
"true"
:show-file-list=
"false"
:show-file-list=
"false"
:disabled=
"item.disabled || false"
:disabled=
"(item.disabled || false) || !isUpload"
v-bind=
"item.attrs ||
{}">
v-bind=
"item.attrs ||
{}"
<el-button
type=
"primary"
size=
"small"
>
点击上传
</el-button>
>
<el-button
type=
"primary"
size=
"small"
:disabled=
"!isUpload"
>
点击上传
</el-button>
<template
v-if=
"formData[item.model] !== null && formData[item.model] !== '' && formData[item.model] !== undefined"
>
<template
v-if=
"formData[item.model] !== null && formData[item.model] !== '' && formData[item.model] !== undefined"
>
<div
class=
"self-icon el-icon-circle-check"
style=
"color: #237f00;"
></div>
<div
class=
"self-icon el-icon-circle-check"
style=
"color: #237f00;"
></div>
</
template
>
</
template
>
...
@@ -22,7 +23,7 @@
...
@@ -22,7 +23,7 @@
<template
v-for=
"(item, index) in filesArr"
>
<template
v-for=
"(item, index) in filesArr"
>
<template
v-if=
"/(jpeg)|(jpg)|(png)|(gif)/gi.test(item.url)"
>
<template
v-if=
"/(jpeg)|(jpg)|(png)|(gif)/gi.test(item.url)"
>
<div
v-bind:key=
"item.id"
class=
"show-file"
>
<div
v-bind:key=
"item.id"
class=
"show-file"
>
<template
v-if=
"!(item.disabled || false)"
>
<template
v-if=
"!(item.disabled || false)
&& isUpload
"
>
<div
class=
"close"
@
click=
"deleteFiles(index)"
>
X
</div>
<div
class=
"close"
@
click=
"deleteFiles(index)"
>
X
</div>
</
template
>
</
template
>
<el-avatar
shape=
"square"
:size=
"100"
fit=
"contain"
:src=
"item.url"
></el-avatar>
<el-avatar
shape=
"square"
:size=
"100"
fit=
"contain"
:src=
"item.url"
></el-avatar>
...
@@ -34,7 +35,7 @@
...
@@ -34,7 +35,7 @@
</template>
</template>
<
template
v-else
>
<
template
v-else
>
<div
v-bind:key=
"item.id"
class=
"show-file"
>
<div
v-bind:key=
"item.id"
class=
"show-file"
>
<template
v-if=
"!(item.disabled || false)"
>
<template
v-if=
"!(item.disabled || false)
&& isUpload
"
>
<div
class=
"close"
@
click=
"deleteFiles(index)"
>
X
</div>
<div
class=
"close"
@
click=
"deleteFiles(index)"
>
X
</div>
</
template
>
</
template
>
<el-avatar
shape=
"square"
:size=
"100"
fit=
"contain"
:src=
"item.url"
></el-avatar>
<el-avatar
shape=
"square"
:size=
"100"
fit=
"contain"
:src=
"item.url"
></el-avatar>
...
@@ -69,6 +70,12 @@ export default {
...
@@ -69,6 +70,12 @@ export default {
default
()
{
default
()
{
return
{}
return
{}
}
}
},
isUpload
:
{
type
:
Boolean
,
default
()
{
return
true
}
}
}
},
},
data
()
{
data
()
{
...
...
server/server/config.js
浏览文件 @
f71d6411
...
@@ -6,8 +6,8 @@ if (state === 'test') {
...
@@ -6,8 +6,8 @@ if (state === 'test') {
// conf.agentApiUrl = 'http://10.1.1.5:8024/'
// conf.agentApiUrl = 'http://10.1.1.5:8024/'
// conf.agentApiUrl = 'http://192.168.3.254:8081'
// conf.agentApiUrl = 'http://192.168.3.254:8081'
}
else
if
(
state
===
'production'
)
{
}
else
if
(
state
===
'production'
)
{
conf
.
agentApiUrl
=
'https://zapi.ezijing.com/'
//
conf.agentApiUrl = 'https://zapi.ezijing.com/'
//
conf.agentApiUrl = 'https://api2.ezijing.com/'
conf
.
agentApiUrl
=
'https://api2.ezijing.com/'
}
}
global
.
app
=
null
global
.
app
=
null
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论