Commit 7345d09d by qinjianhui

fix: C-lodop 问题修改

parent 28c24885
import { onMounted } from 'vue'
export interface LODOPObject extends HTMLObjectElement {
VERSION: string;
CVERSION: string;
SET_LICENSES: (companyName: string, licenseA: string, licenseB: string, licenseC: string) => void;
GET_PRINTER_COUNT: () => number;
GET_PRINTER_NAME: (index: number) => string;
PRINT_INIT: (printName: string) => void;
SET_PRINTER_INDEX: (printerName: string) => void | string | number | boolean;
SET_PRINT_MODE: (mode: string, value: boolean) => void;
On_Return: (id: string, value: string) => void;
On_Return_Remain: boolean;
SEND_PRINT_RAWDATA: (data: string) => void;
ADD_PRINT_PDF: (x: number, y: number, width: string, height: string, url: string) => void;
ADD_PRINT_IMAGE: (x: number, y: number, width: string, height: string, url: string) => void;
GET_VALUE: (valueType: string, valueIndex: string | unknown) => string;
PRINT: () => string;
PRINTA: () => string;
VERSION: string
CVERSION: string
SET_LICENSES: (
companyName: string,
licenseA: string,
licenseB: string,
licenseC: string,
) => void
GET_PRINTER_COUNT: () => number
GET_PRINTER_NAME: (index: number) => string
PRINT_INIT: (printName: string) => void
SET_PRINTER_INDEX: (printerName: string) => void | string | number | boolean
SET_PRINT_MODE: (mode: string, value: boolean) => void
On_Return: (id: string, value: string) => void
On_Return_Remain: boolean
SEND_PRINT_RAWDATA: (data: string) => void
ADD_PRINT_PDF: (
x: number,
y: number,
width: string,
height: string,
url: string,
) => void
ADD_PRINT_IMAGE: (
x: number,
y: number,
width: string,
height: string,
url: string,
) => void
GET_VALUE: (valueType: string, valueIndex: string | unknown) => string
PRINT: () => string
PRINTA: () => string
}
export interface CLodopObject {
CVERSION: string;
GET_STATUS: () => number;
GET_VALUE: (valueType: string, valueIndex: string | unknown) => string;
CVERSION: string
GET_STATUS: () => number
GET_VALUE: (valueType: string, valueIndex: string | unknown) => string
}
declare global {
interface Window {
LODOP: new () => LODOPObject;
_lodop:LODOPObject | null;
_lodopCallback:{ [key: string]: Function };
CLODOP: CLodopObject;
getCLodop: () => LODOPObject;
LODOP: new () => LODOPObject
_lodop: LODOPObject | null
_lodopCallback: { [key: string]: Function }
CLODOP: CLodopObject
getCLodop: () => LODOPObject
}
}
......@@ -92,13 +109,13 @@ export default function useLodop() {
const JS1 = document.createElement('script')
const JS2 = document.createElement('script')
if (window.location.protocol == 'https:') {
JS1.src = 'https://localhost.lodop.net:8443/CLodopfuncs.js'
JS2.src = 'https://localhost.lodop.net:8444/CLodopfuncs.js'
} else {
JS1.src = 'http://localhost:8000/CLodopfuncs.js'
JS2.src = 'http://localhost:18000/CLodopfuncs.js'
}
// if (window.location.protocol == 'https:') {
// JS1.src = 'https://localhost.lodop.net:8443/CLodopfuncs.js'
// JS2.src = 'https://localhost.lodop.net:8444/CLodopfuncs.js'
// } else {
JS1.src = 'http://localhost:8000/CLodopfuncs.js'
JS2.src = 'http://localhost:18000/CLodopfuncs.js'
// }
JS1.onload = JS2.onload = function () {
CLodopJsState = 'complete'
}
......@@ -109,7 +126,10 @@ export default function useLodop() {
head.insertBefore(JS2, head.firstChild)
CLodopIsLocal = !!(JS1.src + JS2.src).match(/\/\/localho|\/\/127.0.0./i)
}
const getCLodop = (oOBJECT: LODOPObject | null, oEMBED: LODOPObject | null): LODOPObject | null => {
const getCLodop = (
oOBJECT: LODOPObject | null,
oEMBED: LODOPObject | null,
): LODOPObject | null => {
const strFontTag = '<font _#_>打印控件'
const strLodopInstall =
strFontTag +
......@@ -157,9 +177,11 @@ export default function useLodop() {
/Trident/i.test(navigator.userAgent)
const isWinIE64 = isWinIE && /x64/i.test(navigator.userAgent)
const isLinuxX86 =
/Linux/i.test(navigator.userAgent) && /x86_64/i.test(navigator.userAgent)
/Linux/i.test(navigator.userAgent) &&
/x86_64/i.test(navigator.userAgent)
const isLinuxARM =
/Linux/i.test(navigator.userAgent) && /aarch64/i.test(navigator.userAgent)
/Linux/i.test(navigator.userAgent) &&
/aarch64/i.test(navigator.userAgent)
if (needCLodop || isLinuxX86 || isLinuxARM) {
try {
......@@ -168,9 +190,9 @@ export default function useLodop() {
console.error(err)
}
if (!LODOP && CLodopJsState !== 'complete') {
if (CLodopJsState == 'loading'){
if (CLodopJsState == 'loading') {
console.log('网页还没下载完毕,请稍等一下再操作.')
}else{
} else {
console.log('未曾加载Lodop主JS文件,请先调用loadCLodop过程.')
}
return null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment