Browse Source

Merge branch 'master' of ssh://101.201.226.163:50022/binbin0314/datang-admin

master
aBin 3 years ago
parent
commit
0c1ce4c33a
  1. 115
      src/components/Detail/editor.vue
  2. 53
      src/components/Detail/editoritem.vue
  3. 2
      src/components/News/addOrEdit.vue
  4. 2
      src/components/News/search.vue
  5. 2
      src/router/menus/information.js
  6. 8
      src/views/richText/index.vue

115
src/components/Detail/editor.vue

@ -1,75 +1,66 @@
<template>
<!-- <div id="editorSection"></div> -->
<div>
<editor-bar v-model="detail" :isClear="isClear" @change="change"></editor-bar>
</div>
<template lang="html">
<div id="editor" name="productcontent"></div>
</template>
<script>
import Editor from "tui-editor"; /* ES6 */
import "tui-editor/dist/tui-editor.css"; // editor's ui
import "tui-editor/dist/tui-editor-contents.css"; // editor's content
import "codemirror/lib/codemirror.css"; // codemirror
import "highlight.js/styles/github.css"; // code block highlight
import { init } from "echarts/lib/echarts";
import EditorBar from './editoritem'
export default {
components: { EditorBar },
props:{
content:{
type: String,
default: ''
}
},
data() {
return {
isClear: false,
detail:""
}
},
watch: {
content(val){
if(val){
this.setValue(val)
import {BASE_API} from '../../config';
import E from 'wangeditor'
export default {
name: 'editoritem',
props:{
content:{
type: String,
default: ''
}
}
},
mounted() {
// this.initialize();
// this.$nextTick(() => {
// this.setValue(this.content)
// })
},
beforeDestroy() {
this.tuieditor = null;
delete this.tuieditor;
},
methods: {
change(val) {
console.log(val)
},
initialize() {
if (this.$el) {
this.tuieditor = new Editor({
el: document.querySelector("#editorSection"),
initialEditType: "wysiwyg",
previewStyle: "vertical",
height: "800px",
});
this.tuieditor.getHtml();
data() {
return {
// uploadPath,
editor: null,
}
},
getValue() {
return this.tuieditor.getHtml()
watch: {
content(val){
if(val){
this.editor.txt.html(val)
}
}
},
setValue(val) {
this.tuieditor.setHtml(val);
mounted() {
this.seteditor()
this.editor.txt.html(this.content)
},
methods: {
seteditor() {
this.editor = new E( document.getElementById('editor') )
this.editor.config.height = 800
this.editor.config.uploadImgShowBase64 = false // base 64
this.editor.config.uploadImgServer = `${BASE_API}/file/uploadImg`//
this.editor.config.uploadVideoServer = `${BASE_API}/file/uploadAudio`
this.editor.config.uploadVideoName = 'file'
this.editor.config.uploadFileName = 'file' //
this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024 // 2M
this.editor.config.uploadImgMaxLength = 1 // 1
this.editor.config.uploadImgTimeout = 3 * 60 * 1000 //
this.editor.create()
}
}
}
};
</script>
<style>
<style lang="css">
.editor {
width: 100%;
margin: 0 auto;
position: relative;
z-index: 0;
}
.toolbar {
border: 1px solid #ccc;
}
.text {
border: 1px solid #ccc;
min-height: 500px;
}
</style>

53
src/components/Detail/editoritem.vue

@ -1,53 +0,0 @@
<template lang="html">
<div id="editor" name="productcontent">
</div>
</template>
<script>
import {BASE_API} from '../../config';
import E from 'wangeditor'
export default {
name: 'editoritem',
data() {
return {
// uploadPath,
editor: null,
}
},
mounted() {
this.seteditor()
this.editor.txt.html(this.value)
},
methods: {
seteditor() {
this.editor = new E( document.getElementById('editor') )
this.editor.config.uploadImgShowBase64 = false // base 64
this.editor.config.uploadImgServer = `${BASE_API}/file/upload`//
this.editor.config.uploadImgHeaders = {
'Content-Type': 'multipart/form-data'
}// header
this.editor.config.uploadFileName = 'file' //
this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024 // 2M
this.editor.config.uploadImgMaxLength = 6 // 3
this.editor.config.uploadImgTimeout = 3 * 60 * 1000 //
this.editor.create()
}
}
}
</script>
<style lang="css">
.editor {
width: 100%;
margin: 0 auto;
position: relative;
z-index: 0;
}
.toolbar {
border: 1px solid #ccc;
}
.text {
border: 1px solid #ccc;
min-height: 500px;
}
</style>

2
src/components/News/addOrEdit.vue

@ -170,7 +170,7 @@
}
const code = localStorage.getItem('code')
this.code = code
if(code === '0204' || code === '0210'){
if(code === '0204' || code === '0209' || code === '0210'){
this.formLabelAlign.showType = 1
}
if(code === '0207'){

2
src/components/News/search.vue

@ -1,5 +1,5 @@
<template>
<div class="flex flex-wrap mb-4">
<div class="flex flex-wrap my-4">
<div class="flex flex-row mr-5 mb-4 align-center">
标题
<el-input

2
src/router/menus/information.js

@ -8,7 +8,7 @@ const commodityManagement = {
children: [
{
path: '/information1',
// component: () => import('@/views/richText/index'),
component: () => import('@/views/richText/index'),
code: '0601',
// name: '基本信息',
meta: {title: '基本信息', noCache: true, affix: false},

8
src/views/richText/index.vue

@ -4,7 +4,7 @@
<el-tab-pane label="详情页管理" name="DETAIL">
<detail :showPage="showPage" ref="detail" />
</el-tab-pane>
<el-tab-pane label="轮播图管理" name="IMAGE">
<el-tab-pane label="轮播图管理" name="IMAGE" v-if="showBanner">
<banner :showPage="showPage" ref="banner" />
</el-tab-pane>
</el-tabs>
@ -24,11 +24,15 @@
data() {
return {
activeName: 'DETAIL',
showPage: ''
showPage: '',
showBanner: true
}
},
created() {
this.showPage = localStorage.getItem('code')
if(this.showPage.length == 6){
this.showBanner = false
}
},
mounted() {
this.$nextTick(() => {

Loading…
Cancel
Save