diff --git a/src/components/XyTinymce/index.vue b/src/components/XyTinymce/index.vue index eb2dda5..1d4c894 100644 --- a/src/components/XyTinymce/index.vue +++ b/src/components/XyTinymce/index.vue @@ -49,12 +49,14 @@ default: false, }, plugins: { - type: [String, Array], - default: "code image axupimgs paste preview searchreplace autolink directionality visualblocks visualchars fullscreen template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave ", + type: [String, Array], + // axupimgs 多图上传 + default: "code image paste preview searchreplace autolink directionality visualblocks visualchars fullscreen template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave ", }, toolbar: { - type: [String, Array], - default: ` undo redo restoredraft | code | image | axupimgs | imagetools | assignment | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough anchor | alignleft aligncenter alignright alignjustify outdent indent | + type: [String, Array], + // axupimgs 多图上传 + default: ` undo redo restoredraft | code | image | imagetools | assignment | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough anchor | alignleft aligncenter alignright alignjustify outdent indent | styleselect formatselect fontselect fontsizeselect | table charmap emoticons hr pagebreak | bullist numlist | blockquote subscript superscript removeformat | insertdatetime print preview | fullscreen | bdmap indent2em lineheight formatpainter`, }, @@ -69,8 +71,8 @@ showImg: false, imgUploadUrl: `${process.env.VUE_APP_UPLOAD_API}`, init: { - language_url: "/public/tinymce/langs/zh_CN.js", // 这里需要单独处理 - language: "zh_CN", + // language_url: "/public/tinymce/langs/zh_CN.js", // 这里需要单独处理 + // language: "zh_CN", height: this.height, plugins: this.plugins, fontsize_formats: "8px 10px 12px 14px 16px 18px 24px 28px 36px", @@ -92,7 +94,7 @@ let file = blobInfo.blob(); const isLt2M = file.size / 1024 < 2048; if (!isLt2M) { - failure("上传失败,图片不可超过2M!"); + failure("Upload failed, the image cannot exceed 2M"); return false; } let formdate = new FormData(); diff --git a/src/components/wangEditor/index.vue b/src/components/wangEditor/index.vue index 30d80f4..bed889a 100644 --- a/src/components/wangEditor/index.vue +++ b/src/components/wangEditor/index.vue @@ -108,17 +108,27 @@ methods: { // 源码模式点击事件 clickSource(active, editor) { - let value = editor.getHtml(); + let value = this.editor.getHtml(); + console.log("getHtml",value) // 先将编辑器内容清空 this.editor.clear(); if (active) { - // 将html代码转换为html代码块 dangerouslyInsertHtml是插入html不是重置html - this.editor.dangerouslyInsertHtml(parseEditorCode(value)); + // 将html代码转换为html代码块 dangerouslyInsertHtml是插入html不是重置html + + value = parseEditorCode(value) + console.log("active",value) + this.editor.dangerouslyInsertHtml(value); + this.html = value + } else { - // 将html代码块转换为editor的html - this.editor.dangerouslyInsertHtml(parseCodeEditor(value)); - // console.log("parseCodeEditor(value)", parseCodeEditor(value)) - value = parseCodeEditor(value); + // 将html代码块转换为editor的html + + value = parseCodeEditor(value) + console.log("else", value) + this.editor.dangerouslyInsertHtml(value); + // value = parseCodeEditor(value); + console.log("nowHtml",parseCodeEditor(this.editor.getHtml())) + this.html = value } }, onCreated(editor) { @@ -133,8 +143,10 @@ onChange() { const text = this.editor.getText(); // 计算当前输入了多少文字 - this.useLen = (text || '').length; - // 每次富文本内容改变,触发change事件 + this.useLen = (text || '').length; + let value = this.editor.getHtml(); + // 每次富文本内容改变,触发change事件 + console.log("this.html",value) this.$emit('change', this.html); }, diff --git a/src/components/wangEditor/register.js b/src/components/wangEditor/register.js index 87ffa9c..1035533 100644 --- a/src/components/wangEditor/register.js +++ b/src/components/wangEditor/register.js @@ -1,65 +1,72 @@ -import SourceMenu from "./sourceMenu.js"; -import prettier from 'prettier/standalone'; -import parserHtml from 'prettier/parser-html'; - -/** - * 在编辑器中得到的html源码是没有格式的html字符串 - * 所以需要格式化展示代码 - * 格式化html代码 - */ -export const parserHtmlCode = (code) => { - try { - return prettier.format(code, { - parser: 'html', - plugins: [parserHtml], - // 格式化的标签不换行 例如span标签等>格式化后会换行 - htmlWhitespaceSensitivity: 'ignore' - }); - } catch (e) { - console.error('格式化代码错误', e); - return code; - } -} - -/** - * 将编辑器html转换为代码块内容 - */ -export const parseEditorCode = (html) => { - const code = html - .replace(/ /g, '') - .replace(new RegExp('


', 'g'), ''); - const data = parserHtmlCode(code).trim(); - const textCode = data - .replace(//g, ">") +import SourceMenu from "./sourceMenu.js"; +import prettier from 'prettier/standalone'; +import parserHtml from 'prettier/parser-html'; + +/** + * 在编辑器中得到的html源码是没有格式的html字符串 + * 所以需要格式化展示代码 + * 格式化html代码 + */ +export const parserHtmlCode = (code) => { + try { + return prettier.format(code, { + parser: 'html', + plugins: [parserHtml], + // 格式化的标签不换行 例如span标签等>格式化后会换行 + htmlWhitespaceSensitivity: 'ignore' + }); + } catch (e) { + console.error('格式化代码错误', e); + return code; + } +} + +/** + * 将编辑器html转换为代码块内容 + */ +export const parseEditorCode = (html) => { + const code = html + .replace(/ /g, '') + .replace(new RegExp('


', 'g'), ''); + const data = parserHtmlCode(code).trim(); + const textCode = data + .replace(//g, ">") .replace(/ /g, " "); - return `
${textCode}
`; -} -/** - * 将代码块转换为编辑器html - */ -export const parseCodeEditor = (preCode) => { - // 转码 - let data = encodeURI(preCode); - // 将 转换为空格 - data = data.replace(/%C2%A0/g, '%20'); - // 解码 - data = decodeURI(data); - const htmlStr = data - .replace('
', '')
-    .replace('
', '') - .replace(/</ig, "<") + console.log("textcode",textCode) + return `
${textCode}
`; + // return `${textCode}`; +} + +/** + * 将代码块转换为编辑器html + */ +export const parseCodeEditor = (preCode) => { + // 转码 + let data = encodeURI(preCode); + // 将 转换为空格 + data = data.replace(/%C2%A0/g, '%20'); + // 解码 + data = decodeURI(data); + const htmlStr = data + .replace('
', '')
+    .replace('
', '') + .replace(/</ig, "<") .replace(/>/ig, ">"); - return htmlStr - .replace(new RegExp('\\n', 'g'), '') - .replace(new RegExp('


', 'g'), '') - .trim(); -} - -export const sourceConf = { - // 工具栏中的唯一key - key: 'source', - // 组件 - factory: () => new SourceMenu() + console.log("htmlStr",htmlStr + .replace(new RegExp('\\n', 'g'), '') + .replace(new RegExp('


', 'g'), '') + .trim()) + return htmlStr + .replace(new RegExp('\\n', 'g'), '') + .replace(new RegExp('


', 'g'), '') + .trim(); +} + +export const sourceConf = { + // 工具栏中的唯一key + key: 'source', + // 组件 + factory: () => new SourceMenu() }; diff --git a/src/mixin/product.js b/src/mixin/product.js index 4027135..6819208 100644 --- a/src/mixin/product.js +++ b/src/mixin/product.js @@ -9,11 +9,11 @@ export default { } }, created() { - this.getProductList() + this.getProductParaList() }, methods: { // 获取产品参数 有detail的下拉,没有的填写 - async getProductList(){ + async getProductParaList(){ const res = await listparameter({ page: 1, page_size: 999, diff --git a/src/styles/iconfont.css b/src/styles/iconfont.css index 9f6fdb2..a82e8b4 100644 --- a/src/styles/iconfont.css +++ b/src/styles/iconfont.css @@ -1,8 +1,8 @@ @font-face { - font-family: "iconfont"; /* Project id 4052909 */ - src: url('iconfont.woff2?t=1683361610626') format('woff2'), - url('iconfont.woff?t=1683361610626') format('woff'), - url('iconfont.ttf?t=1683361610626') format('truetype'); + font-family: "iconfont"; /* Project id 4764550 */ + src: url('iconfont.woff2?t=1732857913289') format('woff2'), + url('iconfont.woff?t=1732857913289') format('woff'), + url('iconfont.ttf?t=1732857913289') format('truetype'); } .iconfont { @@ -13,107 +13,119 @@ -moz-osx-font-smoothing: grayscale; } -.icon-jurassic_process-list:before { - content: "\e6c4"; +.icon-product:before { + content: "\e611"; } -.icon-biaodan:before { - content: "\e663"; +.icon-icon_note:before { + content: "\e64c"; } -.icon-biaozhunhuaguizeguanli:before { - content: "\e60a"; +.icon-zixunguanli:before { + content: "\e610"; } -.icon-a-zhidu6:before { - content: "\eb07"; +.icon-application-parameters:before { + content: "\e642"; } -.icon-dat:before { - content: "\e691"; +.icon-chanpinxuanze:before { + content: "\e6ca"; } -.icon-audio:before { - content: "\e692"; +.icon-chanpincanshu:before { + content: "\e600"; } -.icon-video:before { - content: "\e693"; +.icon-fangwenjilu:before { + content: "\e602"; } -.icon-zip:before { - content: "\e694"; +.icon-liuyan:before { + content: "\e627"; } -.icon-image:before { - content: "\e695"; +.icon-xuanze:before { + content: "\e68b"; } -.icon-pdf:before { - content: "\e696"; +.icon-phase:before { + content: "\e620"; } -.icon-ppt:before { - content: "\e697"; +.icon-yonghuzhongxin:before { + content: "\e68c"; } -.icon-21excel:before { - content: "\e698"; +.icon-dingdan:before { + content: "\e897"; } -.icon-21word:before { - content: "\e699"; +.icon-dingdanjihe:before { + content: "\e898"; } -.icon-21move:before { - content: "\e69a"; +.icon-Usermanuals:before { + content: "\e607"; } -.icon-21setting:before { - content: "\e69b"; +.icon-interact:before { + content: "\e86a"; } -.icon-21upload:before { - content: "\e69c"; +.icon-application:before { + content: "\e88a"; } -.icon-21download:before { - content: "\e69d"; +.icon-gonggongshiye:before { + content: "\e613"; } -.icon-21cancel:before { - content: "\e69e"; +.icon-ziyuanguanli:before { + content: "\e770"; } -.icon-21ok:before { - content: "\e69f"; +.icon--Faq:before { + content: "\e60e"; } -.icon-21copy:before { - content: "\e6a0"; +.icon-mulu:before { + content: "\e60f"; } -.icon-21delete:before { - content: "\e6a1"; +.icon-yonghuliebiao:before { + content: "\e7f1"; } -.icon-21edit:before { - content: "\e6a2"; +.icon-webinar:before { + content: "\ec3c"; } -.icon-21new:before { - content: "\e6a3"; +.icon-longzishuxing:before { + content: "\e601"; } -.icon-21folder:before { - content: "\e6a4"; +.icon-chanpinfenlei:before { + content: "\e656"; } -.icon-21mutil:before { - content: "\e6a5"; +.icon-canshuguanli:before { + content: "\e640"; } -.icon-21file:before { - content: "\e6a6"; +.icon-chanpinzhongxin:before { + content: "\e603"; +} + +.icon-ic_flyer:before { + content: "\e60b"; +} + +.icon-market-poster:before { + content: "\e7a7"; +} + +.icon-yingyongfenlei:before { + content: "\e6fb"; } diff --git a/src/styles/iconfont.ttf b/src/styles/iconfont.ttf index 4e2970e..1463f41 100644 Binary files a/src/styles/iconfont.ttf and b/src/styles/iconfont.ttf differ diff --git a/src/styles/iconfont.woff b/src/styles/iconfont.woff index b7c5531..94db1d9 100644 Binary files a/src/styles/iconfont.woff and b/src/styles/iconfont.woff differ diff --git a/src/styles/iconfont.woff2 b/src/styles/iconfont.woff2 index 0c051c5..885ba6a 100644 Binary files a/src/styles/iconfont.woff2 and b/src/styles/iconfont.woff2 differ diff --git a/src/utils/common.js b/src/utils/common.js index 5a0712d..6cce6c8 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -25,6 +25,19 @@ let base = { isUrl (url) { return this.checkUrl(url) }, + // 判断数组中 是否有相同的 项 + findDuplicateKeys(arr, key) { + const seen = new Set(); + const duplicates = new Set(); + for (const item of arr) { + if (seen.has(item[key])) { + duplicates.add(item[key]); // 添加重复的key值 + } else { + seen.add(item[key]); + } + } + return Array.from(duplicates); // 将Set转换为数组并返回 + }, checkUrl (url) { // url= 协议://(ftp的登录信息)[IP|域名](:端口号)(/或?请求参数) var strRegex = diff --git a/src/views/application/components/addNotes.vue b/src/views/application/components/addNotes.vue index 62e83c2..cdb4fb6 100644 --- a/src/views/application/components/addNotes.vue +++ b/src/views/application/components/addNotes.vue @@ -181,7 +181,6 @@ filesList: [], appCategoryList: [], productCategoryList:[], - showWang: false, detail_item: [{ type: 'index', width: 50 @@ -236,9 +235,6 @@ } this.filesList = fileList }, - changeEditor(e) { - this.form.content = e - }, addRow() { var len = this.form.application_details.length; this.form.application_details.push({ @@ -300,9 +296,7 @@ show_relation: ['applicationDetails'] }).then(res => { this.form = this.base.requestToForm(res, this.form) - this.form.content = res.content ? res.content : '' - this.form.application_details = res.application_details ? res.application_details : [], - this.showWang = true + this.form.application_details = res.application_details ? res.application_details : [] if (res.files && res.files.length > 0) { this.filesList = [] res.files.map(item => { @@ -322,11 +316,9 @@ if (this.type === 'editor') { this.getDetail() } - this.showWang = true } else { this.id = '' this.filesList = [] - this.showWang = false this.form = { application_type_id: '', category_id:[], @@ -349,7 +341,6 @@