diff --git a/package.json b/package.json index 0ca77a4..cc87196 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "exif-js": "^2.3.0", "file-saver": "^2.0.5", "js-cookie": "2.2.0", + "markdown-it": "^14.1.0", + "markdown-it-katex": "^2.0.3", "mavon-editor": "^2.9.1", "node-gyp": "^8.0.0", "normalize.css": "7.0.0", diff --git a/src/api/generatedApi/index.js b/src/api/generatedApi/index.js index b63946c..6388bec 100644 --- a/src/api/generatedApi/index.js +++ b/src/api/generatedApi/index.js @@ -40,3 +40,21 @@ export function datasetDelete(data) { method: 'delete', }) } + + + +//minerU 获取bbox +export function minerUBbox(params) { + return request({ + url:'http://192.168.8.165:7196/document/mineru/bbox_json', + // url: getUrl('/document/mineru/bbox_json'), + method: 'get', + params:params + }) +} +//minerU 获取markdown +export function minerUMarkDown(params) { + return `http://192.168.8.165:7196/document/mineru/md?documentId=${params.documentId}` + // url: getUrl('/document/mineru/md'), + +} diff --git a/src/assets/sass/public.scss b/src/assets/sass/public.scss index 18923c8..c319698 100644 --- a/src/assets/sass/public.scss +++ b/src/assets/sass/public.scss @@ -142,6 +142,9 @@ .lineH35 { line-height: 35px; } +.lineH25 { + line-height: 25px; +} .lineH40 { line-height: 40px; } @@ -258,3 +261,90 @@ body .el-collapse-item__wrap { .cursor-pointer { cursor: pointer; } +.view-body { + text-align: left; + font-size: 14px; + div{ + outline: unset; + + } + + /* 添加一些基本的样式以美化 Markdown 内容 */ + + p { + font-size: 16px; + line-height: 1.6; + margin-bottom: 16px; + } + + h1, h2, h3, h4, h5, h6 { + margin-top: 24px; + margin-bottom: 12px; + border-bottom: 1px dashed #cecece; + padding:5px; + } + + ul, ol { + margin: 16px 0; + padding-left: 32px; + } + + li { + margin-bottom: 8px; + } + + a { + color: #007BFF; + text-decoration: none; + } + + a:hover { + text-decoration: underline; + } + + code { + background-color: #f1f1f1; + padding: 4px 8px; + border-radius: 4px; + font-family: 'Courier New', Courier, monospace; + } + + img { + max-width: 100%; + } + + pre { + background-color: #f1f1f1; + padding: 16px; + border-radius: 4px; + overflow-x: auto; + font-family: 'Courier New', Courier, monospace; + } + + pre code { + background-color: transparent; + padding: 0; + } + + table { + border: 1px solid #f9f9f9; + width: 100%; + border-collapse: collapse; + background: linear-gradient(to bottom, #ffffff, #f9f9f9); + } + + th, td { + border: 1px solid #ccc; + padding: 8px; + text-align: left; + } + + th { + background-color: #f2f2f2; + } + + // 添加斑马条纹效果 + tr:nth-child(even) { + background-color: #f9fafc; + } +} diff --git a/src/components/RenderMinerU/index.vue b/src/components/RenderMinerU/index.vue new file mode 100644 index 0000000..448eacd --- /dev/null +++ b/src/components/RenderMinerU/index.vue @@ -0,0 +1,173 @@ + + + diff --git a/src/components/RenderMinerU/pdf-color.js b/src/components/RenderMinerU/pdf-color.js new file mode 100644 index 0000000..d80ff0b --- /dev/null +++ b/src/components/RenderMinerU/pdf-color.js @@ -0,0 +1,37 @@ +export const PDF_COLOR_PICKER = { + title: { + line: 'rgba(121, 124, 255, 1)', + fill: 'rgba(121, 124, 255, 0.4)' + }, + text: { + line: 'rgba(230, 122, 171, 1)', + fill: 'rgba(230, 122, 171, 0.4)' + }, + interline_equation: { + line: 'rgba(240, 240, 124, 1)', + fill: 'rgba(240, 240, 124, 0.4)' + }, + discarded: { + line: 'rgba(164,164,164,1)', + fill: 'rgba(164,164,164,0.4)' + }, + image: { + line: 'rgba(149, 226, 115, 1)', + fill: 'rgba(149, 226, 115, 0.4)' + }, + table: { + line: 'rgba(230, 113, 230, 1)', + fill: 'rgba(230, 113, 230, 0.4)' + }, + inline_equation: { + line: 'rgba(150, 232, 172, 1)', + fill: 'rgba(150, 232, 172, 0.4)' + } +}; + +export const DEFAULT_COLOR_SECTION = { + line: 'rgba(166, 113, 230, 1)', + fill: 'rgba(166, 113, 230, 0.4)' +}; + +export const PDF_TEMPLATE_URL_KEY = 't'; diff --git a/src/main.js b/src/main.js index 50698bd..7819775 100644 --- a/src/main.js +++ b/src/main.js @@ -11,6 +11,7 @@ import RenderTable from './components/RenderTable' import RenderSwiper from './components/RenderSwiper' import VueEditor from './components/VueEditor' import MavonEditor from './components/MavonEditor' +import RenderMinerU from '@/components/RenderMinerU/index.vue' import utils from '@/assets/js/common' // 生成的数据交互api import generatedApi from '@/api/generatedApi' @@ -32,6 +33,7 @@ Vue.use(ElementUI, { locale }) //二次封装的el-table Vue.component('RTable', RenderTable) Vue.component('RSwiper', RenderSwiper) +Vue.component('RMinerU', RenderMinerU) // 富文本编辑器 Vue.component('VEditor', VueEditor) // 富文本编辑器 可视化代码 diff --git a/src/views/knowledge/detail/create.vue b/src/views/knowledge/detail/create.vue index 3941fab..2855996 100644 --- a/src/views/knowledge/detail/create.vue +++ b/src/views/knowledge/detail/create.vue @@ -1,83 +1,89 @@ - diff --git a/vue.config.js b/vue.config.js index 0a94662..b76f002 100644 --- a/vue.config.js +++ b/vue.config.js @@ -47,6 +47,15 @@ module.exports = { //在webpack的名称字段中提供应用程序的标题,以便 //可以在index.html中对其进行访问以注入正确的标题。 name: name, + module: { + rules: [ + { + test: /\.mjs$/, + include: /node_modules/, + type: 'javascript/auto', + }, + ], + }, resolve: { alias: { '@': resolve('src')