diff --git a/manager/package.json b/manager/package.json index 916b0900..66c45f0b 100644 --- a/manager/package.json +++ b/manager/package.json @@ -12,6 +12,7 @@ "dependencies": { "@amap/amap-jsapi-loader": "0.0.7", "@antv/g2": "^4.1.12", + "@tinymce/tinymce-vue": "^3.2.0", "axios": "^0.21.1", "core-js": "^3.6.5", "dplayer": "^1.26.0", @@ -31,7 +32,6 @@ "vue-router": "^3.1.3", "vuedraggable": "^2.23.2", "vuex": "^3.4.0", - "wangeditor": "^4.7.5", "xss": "^1.0.7" }, "devDependencies": { diff --git a/manager/src/App.vue b/manager/src/App.vue index 8181bd5c..2be269f4 100644 --- a/manager/src/App.vue +++ b/manager/src/App.vue @@ -49,4 +49,7 @@ body { .ivu-tag { cursor: pointer; } +.tox-notifications-container{ + display: none !important; +} diff --git a/manager/src/api/common.js b/manager/src/api/common.js index b025595e..1fbe6886 100644 --- a/manager/src/api/common.js +++ b/manager/src/api/common.js @@ -1,4 +1,4 @@ -import {commonUrl, getRequest, getRequestWithNoToken, postRequestWithNoToken} from '@/libs/axios'; +import {commonUrl, getRequest, getRequestWithNoToken, postRequestWithNoToken,uploadFileRequest,uploadFile} from '@/libs/axios'; // 通过id获取子地区 export const getChildRegion = (id) => { @@ -25,3 +25,8 @@ export const postVerifyImg = (params) => { export const getBaseSite = () => { return getRequest(`${commonUrl}/common/common/site`); }; + +// 上传文件 +export const upLoadFile = (bold) =>{ + return uploadFileRequest(uploadFile,bold); +} diff --git a/manager/src/libs/axios.js b/manager/src/libs/axios.js index 550bbeba..d4a9c02b 100644 --- a/manager/src/libs/axios.js +++ b/manager/src/libs/axios.js @@ -15,6 +15,9 @@ export const managerUrl = (process.env.NODE_ENV === "development" ? BASE.API_DEV.manager : BASE.API_PROD.manager) + BASE.PREFIX; +// 文件上传接口 +export const uploadFile = commonUrl + "/common/common/upload/file"; + const service = axios.create({ timeout: 8000, @@ -311,9 +314,10 @@ export const uploadFileRequest = (url, params) => { return service({ method: "post", url: `${url}`, - params: params, + data: params, headers: { - accessToken: accessToken + accessToken: accessToken, + 'Content-Type': 'multipart/form-data' } }); }; @@ -346,7 +350,7 @@ export const postRequestWithNoToken = (url, params) => { /** * 无需token验证的请求 避免旧token过期导致请求失败 - * @param {*} url + * @param {*} url * @param {*} params */ export const postRequestWithNoTokenData = (url, params) => { diff --git a/manager/src/views/lili-components/editor/config.js b/manager/src/views/lili-components/editor/config.js new file mode 100644 index 00000000..249c017b --- /dev/null +++ b/manager/src/views/lili-components/editor/config.js @@ -0,0 +1,61 @@ +import plugins from "./plugins"; +import toobar from "./toolbar"; +import { upLoadFile } from "@/api/common"; + +export const initEditor = { + height: "400px", + language: "zh_CN", + menubar: "file edit insert view format table", // 菜单:指定应该出现哪些菜单 + toolbar: toobar, // 分组工具栏控件 + plugins: plugins, // 插件(比如: advlist | link | image | preview等) + object_resizing: false, // 是否禁用表格图片大小调整 + end_container_on_empty_block: true, // enter键 分块 + powerpaste_word_import: "merge", // 是否保留word粘贴样式 clean | merge + code_dialog_height: 450, // 代码框高度 、宽度 + code_dialog_width: 1000, + advlist_bullet_styles: "square", // 无序列表 有序列表 + maxSize: "2097152", // 设置图片大小 + accept: "image/jpeg, image/png", // 设置图片上传规则 + images_upload_handler: async function (blobInfo, success, failure) { + console.log("请求") + const formData = new FormData(); + formData.append("file", blobInfo.blob()); + try { + const res = await upLoadFile(formData); + if (res.result) { + + success(res.result) + } else { + failure("上传文件有误请稍后重试"); + } + } catch (e) { + failure('上传出错') + } + }, + // init_instance_callback: function (editor) { + // var freeTiny = document.querySelector(".tox .tox-notification--in"); + // freeTiny.style.display = "none"; + // }, + content_style: ` + * { padding:0; margin:0; } + + html, body height:100%; } + + img { max-width:100%; display:block;height:auto; } + + a { text-decoration: none; } + + iframe{ width: 100%; } + + p { line-height:1.6; margin: 0px; } + + table{ word-wrap:break-word; word-break:break-all; max-width:100%; border:none; border-color:#999; } + + .mce-object-iframe{ width:100%; box-sizing:border-box; margin:0; padding:0; } + + ul,ol{ list-style-position:inside; } + `, // 设置样式 + statusbar: false, // 隐藏编辑器底部的状态栏 + elementpath: false, // 禁用编辑器底部的状态栏 + paste_data_images: true, // 允许粘贴图像 +}; diff --git a/manager/src/views/lili-components/editor/plugins.js b/manager/src/views/lili-components/editor/plugins.js new file mode 100644 index 00000000..c78e47ea --- /dev/null +++ b/manager/src/views/lili-components/editor/plugins.js @@ -0,0 +1,4 @@ +const plugins = [ + 'advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount' +] +export default plugins diff --git a/manager/src/views/lili-components/editor/toolbar.js b/manager/src/views/lili-components/editor/toolbar.js new file mode 100644 index 00000000..f3c483d4 --- /dev/null +++ b/manager/src/views/lili-components/editor/toolbar.js @@ -0,0 +1,2 @@ +const toolbar = ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor '] +export default toolbar diff --git a/manager/src/views/my-components/lili/editor.vue b/manager/src/views/my-components/lili/editor.vue deleted file mode 100644 index a628ef89..00000000 --- a/manager/src/views/my-components/lili/editor.vue +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - diff --git a/manager/src/views/page/article-manage/articleList.vue b/manager/src/views/page/article-manage/articleList.vue index a932ceed..1058d973 100644 --- a/manager/src/views/page/article-manage/articleList.vue +++ b/manager/src/views/page/article-manage/articleList.vue @@ -1,70 +1,125 @@