文档搜索功能修改

This commit is contained in:
cwchen 2025-11-10 14:49:32 +08:00
parent e686a21d18
commit 2fbe6901f5
2 changed files with 33 additions and 2 deletions

View File

@ -122,6 +122,13 @@ export default {
if ('GlobalStandardFontDataUrl' in pdfjsLib) { if ('GlobalStandardFontDataUrl' in pdfjsLib) {
pdfjsLib.GlobalStandardFontDataUrl = this.standardFontDataUrl pdfjsLib.GlobalStandardFontDataUrl = this.standardFontDataUrl
} }
if (pdfjsLib.GlobalOptions) {
pdfjsLib.GlobalOptions.disableFontFace = false
if ('useSystemFonts' in pdfjsLib.GlobalOptions) {
pdfjsLib.GlobalOptions.useSystemFonts = true
}
}
this.pdfUrl = this.$route.query.url || 'http://192.168.0.14:9090/smart-bid/technicalSolutionDatabase/2025/10/30/fe5b46ea37554516a71e7c0c486d3715.pdf' this.pdfUrl = this.$route.query.url || 'http://192.168.0.14:9090/smart-bid/technicalSolutionDatabase/2025/10/30/fe5b46ea37554516a71e7c0c486d3715.pdf'
if (this.pdfUrl) { if (this.pdfUrl) {
this.loadDocument() this.loadDocument()
@ -164,6 +171,9 @@ export default {
useWorkerFetch: !!resolvedWorkerSrc, useWorkerFetch: !!resolvedWorkerSrc,
cMapUrl: this.cMapUrl, cMapUrl: this.cMapUrl,
cMapPacked: true, cMapPacked: true,
standardFontDataUrl: this.standardFontDataUrl,
useSystemFonts: true,
fontExtraProperties: true,
}) })
this.pdfDoc = await loadingTask.promise this.pdfDoc = await loadingTask.promise
console.log('PDF 文档加载成功', this.pdfDoc) console.log('PDF 文档加载成功', this.pdfDoc)

View File

@ -6,11 +6,13 @@ function resolve(dir) {
} }
const CompressionPlugin = require('compression-webpack-plugin') const CompressionPlugin = require('compression-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '智能投标系统' // 网页标题 const name = process.env.VUE_APP_TITLE || '智能投标系统' // 网页标题
// const baseUrl = 'http://localhost:8080' // 后端接口 // const baseUrl = 'http://localhost:8080' // 后端接口
const baseUrl = 'http://192.168.0.39:8080' const baseUrl = 'http://192.168.0.39:8080'
// const baseUrl = 'http://192.168.31.170:8080'
const port = process.env.port || process.env.npm_config_port || 80 // 端口 const port = process.env.port || process.env.npm_config_port || 80 // 端口
@ -21,7 +23,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/smart-archiving/" : "/", publicPath: process.env.NODE_ENV === "production" ? "/smart-bid/" : "/",
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist // 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist', outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
@ -74,7 +76,26 @@ module.exports = {
algorithm: 'gzip', // 使用gzip压缩 algorithm: 'gzip', // 使用gzip压缩
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩 minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
deleteOriginalAssets: false // 压缩后删除原文件 deleteOriginalAssets: false // 压缩后删除原文件
}) }),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'node_modules/pdfjs-dist/legacy/build/pdf.worker.min.js'),
to: 'pdfjs/pdf.worker.min.js',
force: true
},
{
from: path.resolve(__dirname, 'node_modules/pdfjs-dist/cmaps'),
to: 'pdfjs/cmaps',
toType: 'dir',
noErrorOnMissing: true
},
{
from: path.resolve(__dirname, 'node_modules/pdfjs-dist/standard_fonts'),
to: 'pdfjs/standard_fonts',
toType: 'dir',
noErrorOnMissing: true
}
])
], ],
}, },
chainWebpack(config) { chainWebpack(config) {