@focus-teach/ui 1.1.1 → 1.1.3

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
@@ -1510,3 +1510,61 @@ export function checkScoreRuleApi(options) {
1510
1510
  );
1511
1511
  })
1512
1512
  }
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
+ }
1556
+ //获取教材列表
1557
+ export function getMaterialData(options, success, error) {
1558
+ return new Promise(resolve => {
1559
+ axios.get("/ybk/editor/data", {
1560
+ params: options
1561
+ }).then(
1562
+ (res) => {
1563
+ resolve([null, res])
1564
+ },
1565
+ (err) => {
1566
+ resolve([err, null])
1567
+ }
1568
+ );
1569
+ })
1570
+ }