system-clients 3.2.100 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/LodopFuncs.js +103 -71
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-clients",
3
- "version": "3.2.100",
3
+ "version": "3.3.2",
4
4
  "description": "系统基础框架",
5
5
  "main": "src/index.js",
6
6
  "directories": {
package/src/LodopFuncs.js CHANGED
@@ -1,57 +1,69 @@
1
1
  var CreatedOKLodop7766 = null
2
2
 
3
+ function loadScriptAsync(src) {
4
+ return new Promise((resolve, reject) => {
5
+ var script = document.createElement('script')
6
+ script.src = src
7
+ script.async = true
8
+ script.onload = resolve
9
+ script.onerror = reject
10
+ document.head.appendChild(script)
11
+ })
12
+ }
13
+
3
14
  // ====判断是否需要安装CLodop云打印服务器:====
4
- function needCLodop () {
15
+ function needCLodop() {
5
16
  // return false;
6
17
  try {
7
- var ua = navigator.userAgent
8
- if (ua.match(/Windows\sPhone/i) != null) return true
9
- if (ua.match(/iPhone|iPod/i) != null) return true
10
- if (ua.match(/Android/i) != null) return true
11
- if (ua.match(/Edge\D?\d+/i) != null) return true
12
- if (ua.match(/QQBrowser/i) != null) return false
13
- var verTrident = ua.match(/Trident\D?\d+/i)
14
- var verIE = ua.match(/MSIE\D?\d+/i)
15
- var verOPR = ua.match(/OPR\D?\d+/i)
16
- var verFF = ua.match(/Firefox\D?\d+/i)
17
- var x64 = ua.match(/x64/i)
18
- if ((verTrident == null) && (verIE == null) && (x64 !== null))
19
- return true; else
20
- if (verFF !== null) {
21
- verFF = verFF[0].match(/\d+/)
22
- if (verFF[0] >= 42) return true
23
- } else
24
- if (verOPR !== null) {
25
- verOPR = verOPR[0].match(/\d+/)
26
- if (verOPR[0] >= 32) return true
27
- } else
28
- if ((verTrident == null) && (verIE == null)) {
29
- var verChrome = ua.match(/Chrome\D?\d+/i)
30
- if (verChrome !== null) {
31
- verChrome = verChrome[0].match(/\d+/)
32
- if (verChrome[0] >= 42) return true
33
- };
34
- };
18
+ var ua = navigator.userAgent
19
+ if (ua.match(/Windows\sPhone/i) != null) return true
20
+ if (ua.match(/iPhone|iPod/i) != null) return true
21
+ if (ua.match(/Android/i) != null) return true
22
+ if (ua.match(/Edge\D?\d+/i) != null) return true
23
+ if (ua.match(/QQBrowser/i) != null) return false
24
+ var verTrident = ua.match(/Trident\D?\d+/i)
25
+ var verIE = ua.match(/MSIE\D?\d+/i)
26
+ var verOPR = ua.match(/OPR\D?\d+/i)
27
+ var verFF = ua.match(/Firefox\D?\d+/i)
28
+ var x64 = ua.match(/x64/i)
29
+ if ((verTrident == null) && (verIE == null) && (x64 !== null)) {
30
+ return true
31
+ } else if (verFF !== null) {
32
+ verFF = verFF[0].match(/\d+/)
33
+ if (verFF[0] >= 42) return true
34
+ } else if (verOPR !== null) {
35
+ verOPR = verOPR[0].match(/\d+/)
36
+ if (verOPR[0] >= 32) return true
37
+ } else if ((verTrident == null) && (verIE == null)) {
38
+ var verChrome = ua.match(/Chrome\D?\d+/i)
39
+ if (verChrome !== null) {
40
+ verChrome = verChrome[0].match(/\d+/)
41
+ if (verChrome[0] >= 42) return true
42
+ }
43
+ ;
44
+ }
45
+ ;
35
46
  return false
36
- } catch (err) { return true };
47
+ } catch (err) {
48
+ return true
49
+ }
50
+ ;
37
51
  };
38
52
 
39
53
  // ====页面引用CLodop云打印必须的JS文件:====
40
54
  if (needCLodop()) {
41
- var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement
42
- var oscript = document.createElement('script')
43
- // 让本机浏览器打印(更优先)
44
- oscript = document.createElement('script')
45
- oscript.src = 'http://localhost:8000/CLodopfuncs.js?priority=1'
46
- head.insertBefore(oscript, head.firstChild)
47
- // 本机浏览器的后补端口8001:
48
- // oscript = document.createElement("script");
49
- // oscript.src ="http://localhost:8001/CLodopfuncs.js?priority=2";
50
- // head.insertBefore( oscript,head.firstChild );
51
- };
55
+ loadScriptAsync('http://localhost:18000/CLodopfuncs.js?priority=1')
56
+ .then(() => {
57
+ console.log('CLodop script loaded successfully.')
58
+ // 这里可以继续执行其他需要在脚本加载完后执行的逻辑
59
+ })
60
+ .catch((error) => {
61
+ console.error('Failed to load CLodop script:', error)
62
+ })
63
+ }
52
64
 
53
65
  // ====获取LODOP对象的主过程:====
54
- function getLodop (oOBJECT, oEMBED) {
66
+ function getLodop(oOBJECT, oEMBED) {
55
67
  var strHtmInstall = "<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='http://113.10.155.131/install_lodop32.zip' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>"
56
68
  var strHtmUpdate = "<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='http://113.10.155.131/install_lodop32.zip' target='_self'>执行升级</a>,升级后请重新进入。</font>"
57
69
  var strHtm64_Install = "<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='http://113.10.155.131/install_lodop64.zip' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>"
@@ -64,23 +76,35 @@ function getLodop (oOBJECT, oEMBED) {
64
76
  try {
65
77
  var isIE = (navigator.userAgent.indexOf('MSIE') >= 0) || (navigator.userAgent.indexOf('Trident') >= 0)
66
78
  if (needCLodop()) {
67
- try { LODOP = getCLodop() } catch (err) {};
68
- if (!LODOP && document.readyState !== 'complete') { alert('C-Lodop没准备好,请稍后再试!'); return };
79
+ try {
80
+ LODOP = getCLodop()
81
+ } catch (err) {
82
+ }
83
+ ;
84
+ if (!LODOP && document.readyState !== 'complete') {
85
+ alert('C-Lodop没准备好,请稍后再试!');
86
+ return
87
+ }
88
+ ;
69
89
  if (!LODOP) {
70
- if (isIE) document.write(strCLodopInstall); else
71
- document.documentElement.innerHTML = strCLodopInstall + document.documentElement.innerHTML
90
+ if (isIE) document.write(strCLodopInstall); else {
91
+ document.documentElement.innerHTML = strCLodopInstall + document.documentElement.innerHTML
92
+ }
72
93
  return
73
94
  } else {
74
- if (CLODOP.CVERSION < '2.0.6.2') {
75
- if (isIE) document.write(strCLodopUpdate); else
76
- document.documentElement.innerHTML = strCLodopUpdate + document.documentElement.innerHTML
77
- };
78
- if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED)
79
- if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT)
80
- };
95
+ if (CLODOP.CVERSION < '2.0.6.2') {
96
+ if (isIE) document.write(strCLodopUpdate); else {
97
+ document.documentElement.innerHTML = strCLodopUpdate + document.documentElement.innerHTML
98
+ }
99
+ }
100
+ ;
101
+ if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED)
102
+ if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT)
103
+ }
104
+ ;
81
105
  } else {
82
106
  var is64IE = isIE && (navigator.userAgent.indexOf('x64') >= 0)
83
- // =====如果页面有Lodop就直接使用,没有则新建:==========
107
+ // =====如果页面有Lodop就直接使用,没有则新建:==========
84
108
  if (oOBJECT != undefined || oEMBED != undefined) {
85
109
  if (isIE) LODOP = oOBJECT; else LODOP = oEMBED
86
110
  } else if (CreatedOKLodop7766 == null) {
@@ -93,31 +117,39 @@ function getLodop (oOBJECT, oEMBED) {
93
117
  document.documentElement.appendChild(LODOP)
94
118
  CreatedOKLodop7766 = LODOP
95
119
  } else LODOP = CreatedOKLodop7766
96
- // =====Lodop插件未安装时提示下载地址:==========
120
+ // =====Lodop插件未安装时提示下载地址:==========
97
121
  if ((LODOP == null) || (typeof (LODOP.VERSION) == 'undefined')) {
98
- if (navigator.userAgent.indexOf('Chrome') >= 0)
122
+ if (navigator.userAgent.indexOf('Chrome') >= 0) {
99
123
  document.documentElement.innerHTML = strHtmChrome + document.documentElement.innerHTML
100
- if (navigator.userAgent.indexOf('Firefox') >= 0)
124
+ }
125
+ if (navigator.userAgent.indexOf('Firefox') >= 0) {
101
126
  document.documentElement.innerHTML = strHtmFireFox + document.documentElement.innerHTML
102
- if (is64IE) document.write(strHtm64_Install); else
103
- if (isIE) document.write(strHtmInstall); else
104
- document.documentElement.innerHTML = strHtmInstall + document.documentElement.innerHTML
127
+ }
128
+ if (is64IE) document.write(strHtm64_Install); else if (isIE) document.write(strHtmInstall); else {
129
+ document.documentElement.innerHTML = strHtmInstall + document.documentElement.innerHTML
130
+ }
105
131
  return LODOP
106
- };
107
- };
132
+ }
133
+ ;
134
+ }
135
+ ;
108
136
  if (LODOP.VERSION < '6.2.0.3') {
109
- if (needCLodop())
110
- document.documentElement.innerHTML = strCLodopUpdate + document.documentElement.innerHTML; else
111
- if (is64IE) document.write(strHtm64_Update); else
112
- if (isIE) document.write(strHtmUpdate); else
113
- document.documentElement.innerHTML = strHtmUpdate + document.documentElement.innerHTML
137
+ if (needCLodop()) {
138
+ document.documentElement.innerHTML = strCLodopUpdate + document.documentElement.innerHTML
139
+ } else if (is64IE) document.write(strHtm64_Update); else if (isIE) document.write(strHtmUpdate); else {
140
+ document.documentElement.innerHTML = strHtmUpdate + document.documentElement.innerHTML
141
+ }
114
142
  return LODOP
115
- };
116
- // ===如下空白位置适合调用统一功能(如注册语句、语言选择等):===
143
+ }
144
+ ;
145
+ // ===如下空白位置适合调用统一功能(如注册语句、语言选择等):===
117
146
  LODOP.SET_LICENSES('西安奥枫软件有限公司', '552C41D5AB0D146FCF77D05CD8AA15A1', '', '')
118
- // ===========================================================
147
+ // ===========================================================
119
148
  return LODOP
120
- } catch (err) { alert('getLodop出错:' + err) };
149
+ } catch (err) {
150
+ alert('getLodop出错:' + err)
151
+ }
152
+ ;
121
153
  };
122
154
 
123
155
  export default getLodop