diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 7a69f3a..908ef50 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,3 +1,5 @@
+import { getUploadBaseUrl, getSopFileBaseUrl } from '@/utils/runtimeSiteConfig.js'
+
export default {
namespaced: true,
state: {
@@ -6,8 +8,8 @@ export default {
site: 0,
languageDefault: '',
userDisplay: '',
- padSopUrl:process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? 'http://192.168.1.83:81/upload/' :'http://192.168.2.172/upload/',
- tvSopUrl:process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? 'http://192.168.1.83:81/sopFile/' :'http://192.168.2.172/sopFile/',
+ padSopUrl: process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? 'http://192.168.1.83:81/upload/' : getUploadBaseUrl(),
+ tvSopUrl: process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? 'http://192.168.1.83:81/sopFile/' : getSopFileBaseUrl(),
},
mutations: {
updateId (state, id) {
diff --git a/src/utils/runtimeSiteConfig.js b/src/utils/runtimeSiteConfig.js
new file mode 100644
index 0000000..9f82561
--- /dev/null
+++ b/src/utils/runtimeSiteConfig.js
@@ -0,0 +1,53 @@
+/**
+ * 运行时站点配置(由 static/config 合并后的 config/index.js 注入)- rqrq
+ * 未配置时使用与原硬编码一致的默认值,便于生产在 dist 中补全 SITE_CONFIG 项
+ */
+
+const DEFAULT_PRINT_ASSET_BASE = 'http://192.168.2.172:80/print'
+const DEFAULT_UPLOAD_BASE = 'http://192.168.2.172/upload/'
+const DEFAULT_SOP_FILE_BASE = 'http://192.168.2.172/sopFile/'
+
+function getSiteConfig () {
+ return typeof window !== 'undefined' && window.SITE_CONFIG ? window.SITE_CONFIG : {}
+}
+
+/**
+ * LODOP 打印图片根路径(不含末尾 /)- rqrq
+ * @returns {string}
+ */
+export function getPrintAssetBaseUrl () {
+ const v = getSiteConfig().printAssetBaseUrl
+ if (v) {
+ return String(v).replace(/\/+$/, '')
+ }
+ return DEFAULT_PRINT_ASSET_BASE
+}
+
+/**
+ * 拼接打印资源完整 URL - rqrq
+ * @param {string} pathSegment 文件名或相对路径片段
+ * @returns {string}
+ */
+export function buildPrintImageUrl (pathSegment) {
+ const base = getPrintAssetBaseUrl()
+ const seg = pathSegment == null ? '' : String(pathSegment)
+ return base + '/' + seg.replace(/^\//, '')
+}
+
+/**
+ * 上传根路径(建议带末尾 /)- rqrq
+ * @returns {string}
+ */
+export function getUploadBaseUrl () {
+ const v = getSiteConfig().uploadBaseUrl
+ return v || DEFAULT_UPLOAD_BASE
+}
+
+/**
+ * SOP 文件根路径(建议带末尾 /)- rqrq
+ * @returns {string}
+ */
+export function getSopFileBaseUrl () {
+ const v = getSiteConfig().sopFileBaseUrl
+ return v || DEFAULT_SOP_FILE_BASE
+}
diff --git a/src/views/modules/board/sopBoard.vue b/src/views/modules/board/sopBoard.vue
index 83705f7..33e64b9 100644
--- a/src/views/modules/board/sopBoard.vue
+++ b/src/views/modules/board/sopBoard.vue
@@ -64,9 +64,8 @@
badList:[],
pageLoaded: false,
timeOut:30000,
- // packageUrl:'http://192.168.1.130/upload/',
- // packageUrl:'http://192.168.2.172/sopFile/',
- packageUrl:this.$store.state.user.tvSopUrl,
+ // packageUrl 与 store user.tvSopUrl 一致(均来自 SITE_CONFIG.sopFileBaseUrl)- rqrq
+ packageUrl: this.$store.state.user.tvSopUrl,
}
},
mounted () {
diff --git a/src/views/modules/board/sopBoard_old.vue b/src/views/modules/board/sopBoard_old.vue
index 0236f89..4ad9d06 100644
--- a/src/views/modules/board/sopBoard_old.vue
+++ b/src/views/modules/board/sopBoard_old.vue
@@ -37,6 +37,7 @@
import {
getSopAddress,
} from '@/api/board.js'
+ import { getSopFileBaseUrl } from '@/utils/runtimeSiteConfig.js'
import pdf from 'vue-pdf'
export default {
name: 'sopBoard',
@@ -63,9 +64,8 @@
badUrl: '',
pageLoaded: false,
timeOut:30000,
- // packageUrl:'http://192.168.1.130/upload/',
- packageUrl:'http://192.168.2.172/sopFile/',
- // packageUrl:'http://192.168.1.83:81/upload/',
+ // packageUrl 来自运行时配置 static/config(打包后为 config/index.js)- rqrq
+ packageUrl: getSopFileBaseUrl(),
}
},
mounted () {
diff --git a/src/views/modules/print/printPackageLabelNoPreview2.js b/src/views/modules/print/printPackageLabelNoPreview2.js
index a0512d2..4527958 100644
--- a/src/views/modules/print/printPackageLabelNoPreview2.js
+++ b/src/views/modules/print/printPackageLabelNoPreview2.js
@@ -1,5 +1,6 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
+import { buildPrintImageUrl } from '@/utils/runtimeSiteConfig.js'
/*打印材料卷标签*/
export function printPackageLabelNoPreview2(printList) {
const LODOP = getLodop()
@@ -110,7 +111,7 @@ export function printPackageLabelNoPreview2(printList) {
}
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,"
");
- LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
+ LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
}
diff --git a/src/views/modules/print/print_outBox_label.js b/src/views/modules/print/print_outBox_label.js
index 717a3ec..54e7c62 100644
--- a/src/views/modules/print/print_outBox_label.js
+++ b/src/views/modules/print/print_outBox_label.js
@@ -1,5 +1,6 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
+import { buildPrintImageUrl } from '@/utils/runtimeSiteConfig.js'
/*打印材料卷标签*/
export function printOutBoxLabel(printList) {
const LODOP = getLodop()
@@ -143,7 +144,7 @@ export function printOutBoxLabel(printList) {
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
if(printData.iconInfo!=''&&printData.iconInfo!=null) {
// LODOP.ADD_PRINT_IMAGE(185,425,99,50, "
");
- LODOP.ADD_PRINT_IMAGE(188,9,77,46, "
");
+ LODOP.ADD_PRINT_IMAGE(188,9,77,46, "
");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2);
}
if(printData.code=='CODE128') {
diff --git a/src/views/modules/print/print_outBox_label0327.js b/src/views/modules/print/print_outBox_label0327.js
index edecf1c..2273cde 100644
--- a/src/views/modules/print/print_outBox_label0327.js
+++ b/src/views/modules/print/print_outBox_label0327.js
@@ -1,5 +1,6 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
+import { buildPrintImageUrl } from '@/utils/runtimeSiteConfig.js'
/*打印材料卷标签*/
export function printOutBoxLabel(printList) {
const LODOP = getLodop()
@@ -141,7 +142,7 @@ export function printOutBoxLabel(printList) {
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
if(printData.iconInfo!=''&&printData.iconInfo!=null) {
// LODOP.ADD_PRINT_IMAGE(185,425,99,50, "
");
- LODOP.ADD_PRINT_IMAGE(185,425,99,50, "
");
+ LODOP.ADD_PRINT_IMAGE(185,425,99,50, "
");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2);
}
if(printData.code=='CODE128') {
diff --git a/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js b/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js
index 01fd509..4793da7 100644
--- a/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js
+++ b/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js
@@ -1,5 +1,6 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
+import { buildPrintImageUrl } from '@/utils/runtimeSiteConfig.js'
/*打印材料卷标签*/
export function printTCPPackageLabelNoPreview(printList) {
const LODOP = getLodop()
@@ -114,7 +115,7 @@ export function printTCPPackageLabelNoPreview(printList) {
}
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,"
");
- LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
+ LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
}
diff --git a/src/views/modules/print/print_package_label-NOOREVIEW.js b/src/views/modules/print/print_package_label-NOOREVIEW.js
index c01b3b6..6e771a1 100644
--- a/src/views/modules/print/print_package_label-NOOREVIEW.js
+++ b/src/views/modules/print/print_package_label-NOOREVIEW.js
@@ -1,5 +1,6 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
+import { buildPrintImageUrl } from '@/utils/runtimeSiteConfig.js'
/*打印材料卷标签*/
export function printPackageLabelNoPreview(printList) {
const LODOP = getLodop()
@@ -123,7 +124,7 @@ export function printPackageLabelNoPreview(printList) {
}
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,"
");
- LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
+ LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
}
diff --git a/src/views/modules/print/print_package_label.js b/src/views/modules/print/print_package_label.js
index 8a4ca83..a7d0d62 100644
--- a/src/views/modules/print/print_package_label.js
+++ b/src/views/modules/print/print_package_label.js
@@ -1,5 +1,6 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
+import { buildPrintImageUrl } from '@/utils/runtimeSiteConfig.js'
/*打印材料卷标签*/
export function printPackageLabel(printList) {
const LODOP = getLodop()
@@ -105,7 +106,7 @@ export function printPackageLabel(printList) {
}
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,"
");
- LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
+ LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
// LODOP.ADD_PRINT_IMAGE(4,18,114,31,`
`);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
diff --git a/static/config/index-prod.js b/static/config/index-prod.js
index bf19066..7c880ed 100644
--- a/static/config/index-prod.js
+++ b/static/config/index-prod.js
@@ -7,6 +7,11 @@
// api接口请求地址
window.SITE_CONFIG['baseUrl'] = 'http://192.168.2.172:9090';
+ // LODOP 打印图片根路径(无末尾/)- rqrq
+ window.SITE_CONFIG['printAssetBaseUrl'] = 'http://192.168.2.172:80/print';
+ window.SITE_CONFIG['uploadBaseUrl'] = 'http://192.168.2.172/upload/';
+ window.SITE_CONFIG['sopFileBaseUrl'] = 'http://192.168.2.172/sopFile/';
+
// cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './'; // 域名
window.SITE_CONFIG['version'] = ''; // 版本号(年月日时分)
diff --git a/static/config/index-qa.js b/static/config/index-qa.js
index 8051d4c..26ac62b 100644
--- a/static/config/index-qa.js
+++ b/static/config/index-qa.js
@@ -11,4 +11,9 @@
window.SITE_CONFIG['domain'] = './'; // 域名
window.SITE_CONFIG['version'] = ''; // 版本号(年月日时分)
window.SITE_CONFIG['cdnUrl'] = window.SITE_CONFIG.domain + window.SITE_CONFIG.version;
+
+ // LODOP 打印图片根路径 - rqrq
+ window.SITE_CONFIG['printAssetBaseUrl'] = 'http://127.0.0.1:80/print';
+ window.SITE_CONFIG['uploadBaseUrl'] = 'http://127.0.0.1:9090/xujie-fast/upload/';
+ window.SITE_CONFIG['sopFileBaseUrl'] = 'http://127.0.0.1:9090/xujie-fast/sopFile/';
})();
diff --git a/static/config/index-uat.js b/static/config/index-uat.js
index cff83ca..c473790 100644
--- a/static/config/index-uat.js
+++ b/static/config/index-uat.js
@@ -11,4 +11,9 @@
window.SITE_CONFIG['domain'] = './'; // 域名
window.SITE_CONFIG['version'] = ''; // 版本号(年月日时分)
window.SITE_CONFIG['cdnUrl'] = window.SITE_CONFIG.domain + window.SITE_CONFIG.version;
+
+ // LODOP 打印图片根路径 - rqrq
+ window.SITE_CONFIG['printAssetBaseUrl'] = 'http://127.0.0.1:80/print';
+ window.SITE_CONFIG['uploadBaseUrl'] = 'http://127.0.0.1:9090/xujie-fast/upload/';
+ window.SITE_CONFIG['sopFileBaseUrl'] = 'http://127.0.0.1:9090/xujie-fast/sopFile/';
})();
diff --git a/static/config/index.js b/static/config/index.js
index 15f802a..9a82171 100644
--- a/static/config/index.js
+++ b/static/config/index.js
@@ -12,5 +12,9 @@
window.SITE_CONFIG['version'] = ''; // 版本号(年月日时分)
window.SITE_CONFIG['cdnUrl'] = window.SITE_CONFIG.domain + window.SITE_CONFIG.version;
-
+ // LODOP 打印图片根路径(无末尾/,与代码中拼接 /文件名 一致)- rqrq
+ window.SITE_CONFIG['printAssetBaseUrl'] = 'http://localhost:80/print';
+ // 上传、SOP 静态根路径(带末尾/)- rqrq
+ window.SITE_CONFIG['uploadBaseUrl'] = 'http://localhost:9090/upload/';
+ window.SITE_CONFIG['sopFileBaseUrl'] = 'http://localhost:9090/sopFile/';
})();