@focus-teach/ui 1.1.2 → 1.1.4

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.
package/api/index.js CHANGED
@@ -1511,6 +1511,48 @@ export function checkScoreRuleApi(options) {
1511
1511
  })
1512
1512
  }
1513
1513
 
1514
+ export function setHtml2Ocr(options,param) {
1515
+ const apiAxios = axios.create({
1516
+ // baseURL: '/ocr',
1517
+ timeout: 30000,
1518
+ crossDomain: true,
1519
+ withCredentials: true
1520
+ });
1521
+ let params = qs.stringify(param)
1522
+ return new Promise((resolve) => {
1523
+ apiAxios.post("http:///10.110.6.72:8000/ocr_image?"+params, options).then(
1524
+ (res) => {
1525
+ let arr = [],strList = []
1526
+ if(res?.data?.message && typeof res?.data?.message == 'string') arr = JSON.parse(res?.data?.message ?? '[]')
1527
+ if(arr?.length){
1528
+ let flatList = arr.flat(Infinity)
1529
+ flatList?.map(item=>{
1530
+ if(typeof item == 'string') strList.push(item)
1531
+ })
1532
+ }
1533
+ console.log('strList',strList)
1534
+ resolve([null,strList?.join()]);
1535
+ },
1536
+ (err) => {
1537
+ resolve([err,null]);
1538
+ }
1539
+ );
1540
+ })
1541
+ }
1542
+
1543
+ /* 调百度ocr接口将图片转文字 */
1544
+ export function getOcrToText(options) {
1545
+ return new Promise((resolve) => {
1546
+ axios.post("/ybk/baidu-ocr", options).then(
1547
+ (res) => {
1548
+ resolve([null,res?.value ?? '']);
1549
+ },
1550
+ (err) => {
1551
+ resolve([err,null]);
1552
+ }
1553
+ );
1554
+ });
1555
+ }
1514
1556
  //获取教材列表
1515
1557
  export function getMaterialData(options, success, error) {
1516
1558
  return new Promise(resolve => {
@@ -1525,5 +1567,4 @@ export function getMaterialData(options, success, error) {
1525
1567
  }
1526
1568
  );
1527
1569
  })
1528
-
1529
1570
  }