1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
handleImageUploadClick() { const selft = this; wx.chooseMedia({ count: 1, mediaType: ["image"], sourceType: ["album", "camera"], maxDuration: 30, camera: "back", async success(res) { let ocr_type = 1;
let img_url = new wx.serviceMarket.CDN({ type: "filePath", filePath: res.tempFiles[0].tempFilePath, }); wx.serviceMarket .invokeService({ service: "wx79ac3de8be320b71", api: "OcrAllInOne", data: { data_type: 3, img_url, ocr_type, }, }) .then((res) => { console.log("invokeService success", res); wx.showModal({ title: "cost", content: res + "", }); }) .catch((err) => { console.error("invokeService fail", err); wx.showModal({ title: "fail", content: err + "", }); }); }, }); },
|