Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
3602241b
提交
3602241b
authored
5月 08, 2020
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
作业支持多道简答题
上级
506bd6c8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
216 行增加
和
0 行删除
+216
-0
editor.vue
client/src/components/editor.vue
+135
-0
upload.vue
client/src/components/upload.vue
+81
-0
chapterWork.vue
client/src/pages/player/chapterWork/chapterWork.vue
+0
-0
没有找到文件。
client/src/components/editor.vue
0 → 100644
浏览文件 @
3602241b
<
template
>
<div
class=
"editor"
>
<textarea
name=
"editor"
:id=
"textareaElementId"
:disabled=
"disabled"
></textarea>
</div>
</
template
>
<
script
>
import
{
uniqueId
}
from
'lodash'
export
default
{
name
:
'VEditor'
,
props
:
{
value
:
{
type
:
String
},
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
textareaElementId
:
uniqueId
(
'editor_'
),
ckEditor
:
null
}
},
methods
:
{
createEditor
()
{
const
editor
=
(
this
.
ckEditor
=
CKEDITOR
.
replace
(
this
.
textareaElementId
,
{
height
:
400
,
uiColor
:
'#eeeeee'
,
filebrowserImageUploadUrl
:
'/api/ckeditor/img/upload'
,
// resize_enabled: typeof this.props.resizable === 'boolean' ? this.props.resizable : true,
toolbar
:
[
// { name: 'document', items: ['Source', '-', 'Save', 'NewPage', 'Preview'] },
{
name
:
'styles'
,
items
:
[
'Styles'
,
'Format'
,
'Font'
,
'FontSize'
]
},
{
name
:
'colors'
,
items
:
[
'TextColor'
,
'BGColor'
]
},
{
name
:
'tools'
,
items
:
[
'Maximize'
,
'ShowBlocks'
]
},
// { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
{
name
:
'editing'
,
items
:
[
'Find'
,
'Replace'
]
},
// { name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'] },
'/'
,
{
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'
]
},
{
name
:
'insert'
,
items
:
[
'Image'
,
'Table'
,
'HorizontalRule'
]
}
]
}))
editor
.
on
(
'instanceReady'
,
()
=>
{
const
data
=
this
.
value
editor
.
fire
(
'lockSnapshot'
)
editor
.
setData
(
data
,
{
callback
:
()
=>
{
this
.
bindEvent
()
const
newData
=
editor
.
getData
()
// Locking the snapshot prevents the 'change' event.
// Trigger it manually to update the bound data.
if
(
data
!==
newData
)
{
this
.
$once
(
'input'
,
()
=>
{
this
.
$emit
(
'ready'
,
editor
)
})
this
.
$emit
(
'input'
,
newData
)
}
else
{
this
.
$emit
(
'ready'
,
editor
)
}
editor
.
fire
(
'unlockSnapshot'
)
}
})
})
},
bindEvent
()
{
const
editor
=
this
.
ckEditor
editor
.
on
(
'change'
,
evt
=>
{
const
data
=
editor
.
getData
()
if
(
this
.
value
!==
data
)
{
this
.
$emit
(
'input'
,
data
,
evt
,
editor
)
}
})
editor
.
on
(
'focus'
,
evt
=>
{
this
.
$emit
(
'focus'
,
evt
,
editor
)
})
editor
.
on
(
'blur'
,
evt
=>
{
this
.
$emit
(
'blur'
,
evt
,
editor
)
})
}
},
mounted
()
{
this
.
createEditor
()
},
beforeDestroy
()
{
this
.
ckEditor
&&
this
.
ckEditor
.
destroy
()
this
.
ckEditor
=
null
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
*
{
margin
:
0
;
padding
:
0
;
}
</
style
>
client/src/components/upload.vue
0 → 100644
浏览文件 @
3602241b
<
template
>
<div
class=
"upload"
>
<el-upload
action
:show-file-list=
"false"
:http-request=
"httpRequest"
>
<slot></slot>
<el-button
type=
"text"
size=
"small"
icon=
"el-icon-upload"
>
点击上传
</el-button>
<template
v-slot:tip
>
<div
class=
"el-upload__tips"
>
<slot
name=
"tip"
></slot>
</div>
</
template
>
</el-upload>
<div
class=
"file-list"
v-if=
"value"
>
<div
class=
"file-list-item"
>
<a
:href=
"value"
target=
"_blank"
>
<i
class=
"el-icon-document"
></i>
{{ fileName }}
</a>
<a
:href=
"value"
:download=
"fileName"
target=
"_blank"
>
<el-tooltip
effect=
"dark"
content=
"下载"
>
<i
class=
"el-icon-download"
></i>
</el-tooltip>
</a>
</div>
</div>
</div>
</template>
<
script
>
import
cAction
from
'@action'
export
default
{
name
:
'VUpload'
,
props
:
{
value
:
{
type
:
String
}
},
data
()
{
return
{}
},
computed
:
{
fileName
()
{
return
this
.
value
?
this
.
value
.
split
(
'/'
).
pop
()
:
''
}
},
methods
:
{
httpRequest
(
xhr
)
{
cAction
.
Player
.
uploadFile
({
file
:
xhr
.
file
})
.
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$emit
(
'input'
,
response
.
url
)
}
})
.
catch
(
error
=>
{
console
.
log
(
error
)
})
},
handleRemove
()
{
this
.
$emit
(
'input'
,
''
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.file-list-item
{
display
:
flex
;
margin-bottom
:
10px
;
padding
:
0
10px
;
justify-content
:
space-between
;
line-height
:
30px
;
background-color
:
#fff
;
border-radius
:
4px
;
a
{
text-decoration
:
none
;
color
:
#333
;
&
:hover
{
color
:
#b49441
;
}
}
}
</
style
>
client/src/pages/player/chapterWork/chapterWork.vue
浏览文件 @
3602241b
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论