parent
515fadb15d
commit
ac62a2270b
8 changed files with 1349 additions and 118 deletions
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,76 @@ |
||||
<template> |
||||
<div> |
||||
<script :id="randomId" type="text/plain" style="height: 200px;"></script> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from '@/setting' |
||||
export default { |
||||
name: 'UE', |
||||
props: { |
||||
value: { |
||||
default: function () { |
||||
return '' |
||||
} |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
randomId: 'editor_' + Math.random() * 100000000000000000, |
||||
// 编辑器实例 |
||||
instance: null, |
||||
ready: false |
||||
} |
||||
}, |
||||
watch: { |
||||
value: function (val, oldVal) { |
||||
if (val != null && this.ready) { |
||||
// eslint-disable-next-line no-undef |
||||
this.instance = UE.getEditor(this.randomId) |
||||
this.instance.setContent(val) |
||||
} |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.initEditor() |
||||
}, |
||||
|
||||
beforeDestroy () { |
||||
if (this.instance !== null && this.instance.destroy) { |
||||
this.instance.destroy() |
||||
} |
||||
}, |
||||
methods: { |
||||
initEditor () { |
||||
this.$nextTick(() => { |
||||
const host = Setting.isPro || Setting.isZxy ? location.origin : `http://121.37.12.51` |
||||
// eslint-disable-next-line no-undef |
||||
this.instance = UE.getEditor(this.randomId, { |
||||
UEDITOR_HOME_URL: Setting.isTest ? '/examination/static/ueditorPlus/' : '/static/ueditorPlus/', |
||||
serverUrl: host + `/exam/exam/upload/configAndUpload`, |
||||
plugins: 'gapfilling' |
||||
}) |
||||
|
||||
this.instance.addListener('ready', () => { |
||||
this.ready = true |
||||
this.$emit('ready', this.instance) |
||||
}) |
||||
}) |
||||
}, |
||||
getUEContent () { |
||||
return this.instance.getContent() |
||||
}, |
||||
setText (con) { |
||||
// eslint-disable-next-line no-undef |
||||
this.instance = UE.getEditor(this.randomId) |
||||
this.instance.setContent(con) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style lang="scss"> |
||||
.edui-default { |
||||
line-height: normal; |
||||
} |
||||
</style> |
@ -0,0 +1,34 @@ |
||||
export default { |
||||
difficults: [ |
||||
{ |
||||
id: 1, |
||||
name: '简单' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '普通' |
||||
}, |
||||
{ |
||||
id: 3, |
||||
name: '较难' |
||||
}, |
||||
{ |
||||
id: 4, |
||||
name: '难' |
||||
}, |
||||
], |
||||
paperTypes: [ |
||||
{ |
||||
id: 0, |
||||
name: '练习' |
||||
}, |
||||
{ |
||||
id: 1, |
||||
name: '考核' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '竞赛' |
||||
}, |
||||
], |
||||
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue