赛季内容编辑器调整

This commit is contained in:
joylink_fanyuhong 2024-03-11 09:57:48 +08:00
parent bb8678e486
commit f0cea7706c
2 changed files with 35 additions and 16 deletions

View File

@ -19,6 +19,8 @@
}, },
"dependencies": { "dependencies": {
"@stomp/stompjs": "^5.4.4", "@stomp/stompjs": "^5.4.4",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^1.0.2",
"axios": "^0.18.0", "axios": "^0.18.0",
"dayjs": "^1.11.5", "dayjs": "^1.11.5",
"echarts": "^4.7.0", "echarts": "^4.7.0",

View File

@ -1,15 +1,20 @@
<template> <template>
<el-dialog v-dialogDrag v-loading="loading" title="编辑赛季内容" :visible.sync="dialogVisible" width="80%" :before-close="handleClose" center :close-on-click-modal="false"> <el-dialog v-dialogDrag v-loading="loading" destroy-on-close title="编辑赛季内容" :visible.sync="dialogVisible" width="80%" :before-close="handleClose" center :close-on-click-modal="false">
<quill-editor <div style="border: 1px solid #ccc;">
:ref="'contentInput'" <Toolbar
v-model="seasonContent" style="border-bottom: 1px solid #ccc"
style="width: 80%;margin-left: 10%;margin-top: 10px;" :editor="editor"
:margin-bottom="20" :default-config="toolbarConfig"
editor-type="default" :mode="mode"
:no-handle-p="true" />
:height="450" <Editor
placeholder="请输入" v-model="seasonContent"
/> style="height: 500px; overflow-y: hidden;"
:default-config="editorConfig"
:mode="mode"
@onCreated="onCreated"
/>
</div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button> <el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
@ -18,21 +23,33 @@
</template> </template>
<script> <script>
import { editSeasonContent, getSeasonContent } from '@/api/contest'; import { editSeasonContent, getSeasonContent } from '@/api/contest';
import QuillEditor from '@/components/QuillEditor/index'; // import QuillEditor from '@/components/QuillEditor/index';
import '@wangeditor/editor/dist/css/style.css';
import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
export default { export default {
name: 'EditContent', name: 'EditContent',
components: { components: { Editor, Toolbar },
QuillEditor
},
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
seasonContent:'', seasonContent:'',
id: '', id: '',
loading: false loading: false,
editor: null,
toolbarConfig: { },
editorConfig: { placeholder: '请输入内容...' },
mode: 'default' // or 'simple'
}; };
}, },
beforeDestroy() {
const editor = this.editor;
if (editor == null) return;
editor.destroy(); //
},
methods:{ methods:{
onCreated(editor) {
this.editor = Object.seal(editor); // Object.seal()
},
doShow(row) { doShow(row) {
this.dialogVisible = true; this.dialogVisible = true;
if (row) { if (row) {