祖安之光
3 天以前 959d8b7b00590bfd1e6196a2d34ade2132a8bcbb
src/views/build/conpanyFunctionConsult/digitalFileDep/otherIntellFile/index.vue
@@ -107,14 +107,16 @@
      console.log('取消预览')
    });
    return
  }
  try {
    // 1. 获取文件
    const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
    const arrayBuffer = await response.arrayBuffer()
    // 2. 创建新窗口
    const win = window.open('', '_blank')
    win.document.write(`
  }else if(ext == 'pdf' || ext == 'jpg' ){
    window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank');
  }else{
    try {
      // 1. 获取文件
      const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
      const arrayBuffer = await response.arrayBuffer()
      // 2. 创建新窗口
      const win = window.open('', '_blank')
      win.document.write(`
      <!DOCTYPE html>
      <html>
        <head>
@@ -129,12 +131,12 @@
        </body>
      </html>
    `);
    // 3. 渲染 DOCX
    await renderAsync(arrayBuffer, win.document.getElementById('container'));
      // 3. 渲染 DOCX
      await renderAsync(arrayBuffer, win.document.getElementById('container'));
  } catch (error) {
    console.error('预览失败:', error);
    alert(`预览失败: ${error.message}`);
    } catch (error) {
      alert(`预览失败: ${error.message}`);
    }
  }
}
const getList = async () => {