瀏覽代碼

修改导出

yangg 6 月之前
父節點
當前提交
b8cc28379c

+ 3 - 3
dist/ckeditor/config.js

@@ -47,11 +47,11 @@ config.contentsCss = '/public/ckeditor/custom-ckeditor.css';
 
 
 // 修改图片上传配置
-config.filebrowserImageUploadUrl = 'http://58.246.234.210:8084/upload/image';
-config.imageUploadUrl = 'http://58.246.234.210:8084/upload/image';
+config.filebrowserImageUploadUrl = 'http://192.168.66.163:8084/upload/imageNew';
+config.imageUploadUrl = 'http://192.168.66.163:8084/upload/imageNew';
 
 // 自定义上传处理
-config.uploadUrl = 'http://58.246.234.210:8084/upload/image';
+config.uploadUrl = 'http://192.168.66.163:8084/upload/imageNew';
 
 
 };

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-f77a8942.5297a847.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.600f4d0c.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-603868e3.bf81a673.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-f77a8942.9c0f396e.js


+ 3 - 3
public/ckeditor/config.js

@@ -47,11 +47,11 @@ config.contentsCss = '/public/ckeditor/custom-ckeditor.css';
 
 
 // 修改图片上传配置
-config.filebrowserImageUploadUrl = 'http://58.246.234.210:8084/upload/image';
-config.imageUploadUrl = 'http://58.246.234.210:8084/upload/image';
+config.filebrowserImageUploadUrl = 'http://192.168.66.163:8084/upload/imageNew';
+config.imageUploadUrl = 'http://192.168.66.163:8084/upload/imageNew';
 
 // 自定义上传处理
-config.uploadUrl = 'http://58.246.234.210:8084/upload/image';
+config.uploadUrl = 'http://192.168.66.163:8084/upload/imageNew';
 
 
 };

+ 40 - 29
src/views/project/components/dataList.vue

@@ -213,9 +213,9 @@
                   <el-dropdown-item command="word">Word格式</el-dropdown-item
                   ><!-- word -->
                   <el-dropdown-item command="pdf">PDF格式</el-dropdown-item>
-                  <el-dropdown-item command="pdf-to-word"
-                    >PDF转Word</el-dropdown-item
-                  >
+                  <!-- <el-dropdown-item command="pdf-to-word"
+                    >Word</el-dropdown-item
+                  > -->
                 </el-dropdown-menu>
               </template>
             </el-dropdown>
@@ -510,7 +510,7 @@ export default {
         </style>
       </head>
       <body>
-        ${contentContainer.innerHTML}
+        ${this.processImages(contentContainer.innerHTML)}
       </body>
     </html>`;
 
@@ -1838,7 +1838,7 @@ export default {
           this.$alert(res.errMsg);
           return;
         }
-        console.log(res)
+        console.log(res);
         // 处理文件下载
         const link = document.createElement("a");
         link.href = res.data.data.file_path;
@@ -1968,40 +1968,51 @@ export default {
     processImages(content) {
       const tempDiv = document.createElement("div");
       tempDiv.innerHTML = content;
-
       // 处理所有图片
       tempDiv.querySelectorAll("img").forEach((img) => {
-        // 保存原始宽高属性
-        const originalWidth = img.getAttribute("width");
-        const originalHeight = img.getAttribute("height");
-
         // 创建图片容器
         const container = document.createElement("div");
         container.className = "image-container";
-
-        // 设置图片样式
-        img.style.maxWidth = "100%";
-        img.style.height = "auto";
-
-        // 如果有原始尺寸,使用原始尺寸(但确保不超过页面宽度)
-        if (originalWidth && originalHeight) {
-          const aspectRatio = originalWidth / originalHeight;
-          const maxWidth = 595; // A4纸宽度(像素,减去边距)
-
-          if (originalWidth > maxWidth) {
-            img.style.width = maxWidth + "px";
-            img.style.height = maxWidth / aspectRatio + "px";
-          } else {
-            img.style.width = originalWidth + "px";
-            img.style.height = originalHeight + "px";
-          }
+        // 获取所有可能的尺寸来源
+        let width =
+          img.getAttribute("width") || img.style.width || img.width || null;
+        let height =
+          img.getAttribute("height") || img.style.height || img.height || null;
+        // 移除单位并转换为数字
+        if (typeof width === "string") {
+          width = parseInt(width.replace(/[^0-9]/g, ""));
         }
-
+        if (typeof height === "string") {
+          height = parseInt(height.replace(/[^0-9]/g, ""));
+        }
+        // 如果没有尺寸,创建一个临时图片来获取实际尺寸
+        if (!width || !height) {
+          const tempImg = new Image();
+          tempImg.src = img.src;
+          width = tempImg.width || 595; // 默认宽度
+          height = tempImg.height || Math.round(width * 0.75); // 默认高度比例
+        }
+        // 确保数值有效
+        width = Math.max(1, parseInt(width));
+        height = Math.max(1, parseInt(height));
+        // 处理尺寸
+        const maxWidth = 595; // A4纸宽度(像素,减去边距)
+        if (width > maxWidth) {
+          // 等比例缩放
+          const aspectRatio = width / height;
+          const newHeight = Math.round(maxWidth / aspectRatio);
+          width = maxWidth;
+          height = newHeight;
+        }
+        // 同时设置style和属性
+        img.style.width = `${width}px`;
+        img.style.height = `${height}px`;
+        img.setAttribute("width", width);
+        img.setAttribute("height", height);
         // 将图片包装在容器中
         img.parentNode.insertBefore(container, img);
         container.appendChild(img);
       });
-
       return tempDiv.innerHTML;
     },
   },

Some files were not shown because too many files changed in this diff