Files
hospital-rescue-app-v2/uni_modules/x-ocr-s/utssdk/app-harmony/index.uts
T
2026-09-24 16:25:22 +08:00

36 lines
1.1 KiB
Plaintext

import { x_ocrDecode } from "x_ocr_s"
export function chooseImageBuilder(callback : (str : string[], source : string[]) => void, langs : string | null) {
uni.chooseImage({
count: 1,
success(evt : ChooseImageSuccess) {
uni.showLoading({ title: '', mask: true })
if (evt.tempFilePaths.length > 0) {
const imgs = UTSHarmony.convert2AbsFullPath(evt.tempFilePaths[0] as string);
x_ocrDecode(imgs, (arg1 : string[], arg2 : string[]) => {
callback(arg1, arg2)
uni.hideLoading()
})
}
},
fail() {
callback([] as string[], [] as string[])
}
})
}
export function downloadUrlImageBuilder(url : string,callback:(str:string[],source:string[])=>void,langs:string|null) {
uni.downloadFile({
url,
success(evt) {
x_ocrDecode(UTSHarmony.convert2AbsFullPath(evt.tempFilePath), callback)
},
fail() {
callback([] as string[],[] as string[])
}
})
}
export function localFilePathImageBuilder(pathfile : string,callback:(str:string[],source:string[])=>void,langs:string|null){
x_ocrDecode(UTSHarmony.convert2AbsFullPath(pathfile), callback)
}