bhd-components 0.9.12 → 0.9.14

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.
@@ -160,7 +160,8 @@ const urlToBase64 = (url)=>{
160
160
  return new Promise((resolve)=>{
161
161
  const image = new Image();
162
162
  // 先设置图片跨域属性
163
- image.crossOrigin = 'Anonymous';
163
+ // image.crossOrigin = 'Anonymous'
164
+ image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
164
165
  // 再给image赋值src属性,先后顺序不能颠倒
165
166
  image.src = url;
166
167
  image.onload = function() {
@@ -5,12 +5,13 @@ import React, { useEffect, useState, useRef } from "react";
5
5
  import styles from "./index.module.less";
6
6
  //import "highlight.js/styles/default.css";
7
7
  import "highlight.js/styles/github.css";
8
- import { Input } from "antd";
8
+ import { Input, Spin } from "antd";
9
9
  import { CustomClose, CustomExpand, CustomAiIcon } from "../icons";
10
10
  import { SearchOutlined } from "@ant-design/icons";
11
11
  import { formatDate } from "./function"; //录音使用文件
12
12
  const HistoryFun = (props)=>{
13
13
  let { type, roomId, userData, http, urllocation, onClose, loadSpecifiedData } = props;
14
+ const [loading, setLoading] = useState(false);
14
15
  const [keyWordProblem, setKeyWordProblem] = useState(""); //搜索内容
15
16
  const [showLoadingState, setShowLoadingState] = useState(1); //1,初始状态,2、无数据 ,3、不显示图片
16
17
  const [pageNum, setPageNum] = useState(1);
@@ -49,6 +50,7 @@ const HistoryFun = (props)=>{
49
50
  pageNum
50
51
  ]);
51
52
  const getList = (val, pageNum)=>{
53
+ setLoading(true);
52
54
  return http.get(`${urllocation}/chat-service/public/v1.0/history-messages-total`, {
53
55
  params: {
54
56
  message: val,
@@ -56,6 +58,7 @@ const HistoryFun = (props)=>{
56
58
  maxPageSize: maxPageSize
57
59
  }
58
60
  }).then((res)=>{
61
+ setLoading(false);
59
62
  let data = res.data;
60
63
  if (data.total > 0) {
61
64
  setShowLoadingState(3);
@@ -70,7 +73,9 @@ const HistoryFun = (props)=>{
70
73
  } else {
71
74
  setShowLoadingState(2);
72
75
  }
73
- }).catch((res)=>{});
76
+ }).catch((res)=>{
77
+ setLoading(false);
78
+ });
74
79
  };
75
80
  //获取全部数据
76
81
  const allData = (roomId)=>{
@@ -317,181 +322,185 @@ const HistoryFun = (props)=>{
317
322
  })
318
323
  ]
319
324
  }),
320
- /*#__PURE__*/ _jsxs("div", {
325
+ /*#__PURE__*/ _jsx("div", {
321
326
  className: styles.main_list,
322
327
  id: "history_list",
323
- children: [
324
- showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
325
- className: styles.no_data,
326
- children: [
327
- /*#__PURE__*/ _jsx("img", {
328
- src: "/new_yun/images/aiService/search_for_icon.png"
329
- }),
330
- /*#__PURE__*/ _jsx("p", {
331
- children: "输入关键词,搜索聊天记录"
332
- })
333
- ]
334
- }),
335
- showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
336
- className: styles.no_data,
337
- children: [
338
- /*#__PURE__*/ _jsx("img", {
339
- src: "/new_yun/images/aiService/no_data.png"
340
- }),
341
- /*#__PURE__*/ _jsx("p", {
342
- children: "暂无记录"
343
- })
344
- ]
345
- }),
346
- /*#__PURE__*/ _jsx("div", {
347
- className: styles.list_item,
348
- children: totalData.map((item)=>{
349
- let span = "";
350
- let time = "";
351
- if (item.count == 1) {
352
- let message = item.message;
353
- let position_i = message.indexOf(keyWordProblem);
354
- if (position_i > 30) {
355
- message = message.substring(position_i - 15);
356
- }
357
- let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
358
- //搜索内容是否有特殊字符
359
- if (reg.test(keyWordProblem)) {
360
- span = message.replaceAll(keyWordProblem, (e)=>{
361
- return `<span class=${styles.sign}>${e}</span>`;
362
- });
363
- } else {
364
- span = message.replaceAll(new RegExp(keyWordProblem, "ig"), (i)=>{
365
- return `<span class=${styles.sign}>${i}</span>`;
366
- });
328
+ children: /*#__PURE__*/ _jsxs(Spin, {
329
+ spinning: loading,
330
+ tip: "加载中...",
331
+ children: [
332
+ showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
333
+ className: styles.no_data,
334
+ children: [
335
+ /*#__PURE__*/ _jsx("img", {
336
+ src: "/new_yun/images/aiService/search_for_icon.png"
337
+ }),
338
+ /*#__PURE__*/ _jsx("p", {
339
+ children: "输入关键词,搜索聊天记录"
340
+ })
341
+ ]
342
+ }),
343
+ showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
344
+ className: styles.no_data,
345
+ children: [
346
+ /*#__PURE__*/ _jsx("img", {
347
+ src: "/new_yun/images/aiService/no_data.png"
348
+ }),
349
+ /*#__PURE__*/ _jsx("p", {
350
+ children: "暂无记录"
351
+ })
352
+ ]
353
+ }),
354
+ /*#__PURE__*/ _jsx("div", {
355
+ className: styles.list_item,
356
+ children: totalData.map((item)=>{
357
+ let span = "";
358
+ let time = "";
359
+ if (item.count == 1) {
360
+ let message = item.message;
361
+ let position_i = message.indexOf(keyWordProblem);
362
+ if (position_i > 30) {
363
+ message = message.substring(position_i - 15);
364
+ }
365
+ let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
366
+ //搜索内容是否有特殊字符
367
+ if (reg.test(keyWordProblem)) {
368
+ span = message.replaceAll(keyWordProblem, (e)=>{
369
+ return `<span class=${styles.sign}>${e}</span>`;
370
+ });
371
+ } else {
372
+ span = message.replaceAll(new RegExp(keyWordProblem, "ig"), (i)=>{
373
+ return `<span class=${styles.sign}>${i}</span>`;
374
+ });
375
+ }
376
+ time = formatDate(item.createdAt);
367
377
  }
368
- time = formatDate(item.createdAt);
369
- }
370
- return /*#__PURE__*/ _jsxs(_Fragment, {
371
- children: [
372
- /*#__PURE__*/ _jsxs("div", {
373
- className: `${styles.list_summary} ${item.show ? styles.list_summary_active : ""}`,
374
- id: item.roomId,
375
- onClick: ()=>{
376
- if (item.count == 1) {
377
- calculationData(item.roomId, item.id, item.member);
378
- } else {
379
- showDetails(item.roomId, item.show);
380
- }
381
- },
382
- children: [
383
- /*#__PURE__*/ _jsx("div", {
384
- className: styles.head_img,
385
- children: item.member == "AI" ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
386
- src: item.headImg
387
- })
388
- }),
389
- /*#__PURE__*/ _jsxs("div", {
390
- className: styles.list_desc,
391
- children: [
392
- /*#__PURE__*/ _jsxs("p", {
393
- className: styles.name,
394
- children: [
395
- item.member == "AI" ? "AI助手" : item.name,
396
- item.count == 1 ? /*#__PURE__*/ _jsx("span", {
397
- className: styles.time,
398
- children: time
399
- }) : ""
400
- ]
401
- }),
402
- item.count == 1 ? /*#__PURE__*/ _jsx("p", {
403
- className: styles.decs,
404
- style: {
405
- width: "calc(100% - 36px)"
406
- },
407
- dangerouslySetInnerHTML: {
408
- __html: span
409
- }
410
- }) : /*#__PURE__*/ _jsx("p", {
411
- className: styles.decs,
412
- children: `${item.count}条相关聊天记录`
413
- })
414
- ]
415
- }),
416
- item.count != 1 ? /*#__PURE__*/ _jsx("div", {
417
- className: `${styles.open} ${item.show ? styles.active : ''}`,
418
- children: /*#__PURE__*/ _jsx(CustomExpand, {})
419
- }) : ""
420
- ]
421
- }),
422
- /*#__PURE__*/ _jsxs("div", {
423
- className: styles.list_detail,
424
- children: [
425
- item.show && item.detailsList && item.detailsList.map((list)=>{
426
- // console.log(list,item,'dklfvmdflkvmdfklv')
427
- let name = "";
428
- if (list.sender == 'AI') {
429
- name = 'AI助手';
430
- } else if (list.sender == item.member) {
431
- name = item.name;
378
+ return /*#__PURE__*/ _jsxs(_Fragment, {
379
+ children: [
380
+ /*#__PURE__*/ _jsxs("div", {
381
+ className: `${styles.list_summary} ${item.show ? styles.list_summary_active : ""}`,
382
+ id: item.roomId,
383
+ onClick: ()=>{
384
+ if (item.count == 1) {
385
+ calculationData(item.roomId, item.id, item.member);
432
386
  } else {
433
- name = userData.real_name;
434
- }
435
- let time = formatDate(list.updatedAt);
436
- let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
437
- let span = '';
438
- let message = list.message;
439
- let position_i = message.indexOf(keyWordProblem);
440
- if (position_i > 30) {
441
- message = message.substring(position_i - 15);
387
+ showDetails(item.roomId, item.show);
442
388
  }
443
- //搜索内容是否有特殊字符
444
- if (reg.test(keyWordProblem)) {
445
- span = message.replaceAll(keyWordProblem, (e)=>{
446
- return `<span class=${styles.sign}>${e}</span>`;
447
- });
448
- } else {
449
- span = message.replaceAll(new RegExp(keyWordProblem, "ig"), (i)=>{
450
- // console.log(i,'skdcnsdjk')
451
- return `<span class=${styles.sign}>${i}</span>`;
452
- });
453
- }
454
- return /*#__PURE__*/ _jsxs("div", {
455
- className: styles.list,
456
- onClick: ()=>{
457
- calculationData(item.roomId, list.id, list.receiver);
458
- },
389
+ },
390
+ children: [
391
+ /*#__PURE__*/ _jsx("div", {
392
+ className: styles.head_img,
393
+ children: item.member == "AI" ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
394
+ src: item.headImg
395
+ })
396
+ }),
397
+ /*#__PURE__*/ _jsxs("div", {
398
+ className: styles.list_desc,
459
399
  children: [
460
- /*#__PURE__*/ _jsxs("div", {
400
+ /*#__PURE__*/ _jsxs("p", {
461
401
  className: styles.name,
462
402
  children: [
463
- /*#__PURE__*/ _jsx("p", {
464
- children: name
465
- }),
466
- /*#__PURE__*/ _jsx("span", {
403
+ item.member == "AI" ? "AI助手" : item.name,
404
+ item.count == 1 ? /*#__PURE__*/ _jsx("span", {
467
405
  className: styles.time,
468
406
  children: time
469
- })
407
+ }) : ""
470
408
  ]
471
409
  }),
472
- /*#__PURE__*/ _jsx("div", {
473
- className: styles.con,
410
+ item.count == 1 ? /*#__PURE__*/ _jsx("p", {
411
+ className: styles.decs,
412
+ style: {
413
+ width: "calc(100% - 36px)"
414
+ },
474
415
  dangerouslySetInnerHTML: {
475
416
  __html: span
476
417
  }
418
+ }) : /*#__PURE__*/ _jsx("p", {
419
+ className: styles.decs,
420
+ children: `${item.count}条相关聊天记录`
477
421
  })
478
422
  ]
479
- }, list.id);
480
- }),
481
- item.show && item.pageCount > 1 && item.pageCount > item.pageNum && /*#__PURE__*/ _jsx("div", {
482
- className: `${styles.list} ${styles.list_more}`,
483
- onClick: ()=>{
484
- loadMore(item.pageNum + 1, item.roomId);
485
- },
486
- children: "点击加载更多"
487
- })
488
- ]
489
- })
490
- ]
491
- });
423
+ }),
424
+ item.count != 1 ? /*#__PURE__*/ _jsx("div", {
425
+ className: `${styles.open} ${item.show ? styles.active : ''}`,
426
+ children: /*#__PURE__*/ _jsx(CustomExpand, {})
427
+ }) : ""
428
+ ]
429
+ }),
430
+ /*#__PURE__*/ _jsxs("div", {
431
+ className: styles.list_detail,
432
+ children: [
433
+ item.show && item.detailsList && item.detailsList.map((list)=>{
434
+ // console.log(list,item,'dklfvmdflkvmdfklv')
435
+ let name = "";
436
+ if (list.sender == 'AI') {
437
+ name = 'AI助手';
438
+ } else if (list.sender == item.member) {
439
+ name = item.name;
440
+ } else {
441
+ name = userData.real_name;
442
+ }
443
+ let time = formatDate(list.updatedAt);
444
+ let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
445
+ let span = '';
446
+ let message = list.message;
447
+ let position_i = message.indexOf(keyWordProblem);
448
+ if (position_i > 30) {
449
+ message = message.substring(position_i - 15);
450
+ }
451
+ //搜索内容是否有特殊字符
452
+ if (reg.test(keyWordProblem)) {
453
+ span = message.replaceAll(keyWordProblem, (e)=>{
454
+ return `<span class=${styles.sign}>${e}</span>`;
455
+ });
456
+ } else {
457
+ span = message.replaceAll(new RegExp(keyWordProblem, "ig"), (i)=>{
458
+ // console.log(i,'skdcnsdjk')
459
+ return `<span class=${styles.sign}>${i}</span>`;
460
+ });
461
+ }
462
+ return /*#__PURE__*/ _jsxs("div", {
463
+ className: styles.list,
464
+ onClick: ()=>{
465
+ calculationData(item.roomId, list.id, list.receiver);
466
+ },
467
+ children: [
468
+ /*#__PURE__*/ _jsxs("div", {
469
+ className: styles.name,
470
+ children: [
471
+ /*#__PURE__*/ _jsx("p", {
472
+ children: name
473
+ }),
474
+ /*#__PURE__*/ _jsx("span", {
475
+ className: styles.time,
476
+ children: time
477
+ })
478
+ ]
479
+ }),
480
+ /*#__PURE__*/ _jsx("div", {
481
+ className: styles.con,
482
+ dangerouslySetInnerHTML: {
483
+ __html: span
484
+ }
485
+ })
486
+ ]
487
+ }, list.id);
488
+ }),
489
+ item.show && item.pageCount > 1 && item.pageCount > item.pageNum && /*#__PURE__*/ _jsx("div", {
490
+ className: `${styles.list} ${styles.list_more}`,
491
+ onClick: ()=>{
492
+ loadMore(item.pageNum + 1, item.roomId);
493
+ },
494
+ children: "点击加载更多"
495
+ })
496
+ ]
497
+ })
498
+ ]
499
+ });
500
+ })
492
501
  })
493
- })
494
- ]
502
+ ]
503
+ })
495
504
  })
496
505
  ]
497
506
  })
@@ -27,11 +27,11 @@ const { TextArea } = Input;
27
27
  // import './html2canvas.test.js';
28
28
  import knowledge_icon from "./images/knowledge_icon.png";
29
29
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
30
- import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
30
+ import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, urlToBase64 } from "./function"; //一些方法
31
31
  // import html2canvas from "html2canvas";
32
- // const screenShot = require('./screenShotPlugin.esm')
32
+ // const screenShot = require('./screenShotPlugin.esm')
33
33
  import ScreenShot from "./js-screen-shot/main";
34
- /*
34
+ /*
35
35
  自定义remarkable的text解析规则
36
36
  */ const HTML_ESCAPE_TEST_RE = /[&<>"]/;
37
37
  const HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
@@ -69,6 +69,7 @@ const CustomerService = (props)=>{
69
69
  const [loading, setLoading] = useState(false); //上拉显示加载图标
70
70
  const [bottomLoading, setBottomLoading] = useState(false); //下拉显示加载图标
71
71
  const [finished, setFinished] = useState(true); //是否结束生成
72
+ const finishedRef = useRef(true); //是否结束生成
72
73
  const [lastId, setLastId] = useState(""); //最后一条数据的id,可用于定位当前位置
73
74
  const [chatWith, setChatWith] = useState({}); //聊天的老师id或ai
74
75
  const [firstLoad, setFirstLoad] = useState(false); //第一次切换全屏时滚动到页面底部
@@ -327,12 +328,13 @@ const CustomerService = (props)=>{
327
328
  }, 1000);
328
329
  }
329
330
  //生成答案过程中
330
- if (!finished && scrollTopHei.current > scrollTop) {
331
+ if (!finished && scrollHeight > scrollTop) {
332
+ console.log('生成答案过程中', scrollTopHei.current, scrollTop);
331
333
  // setIsPosition(false);
332
334
  isPosition.current = false;
333
335
  }
334
336
  if (!finished && clientHeight + scrollTop >= scrollHeight) {
335
- // console.log('到顶了111');
337
+ console.log('到顶了111', clientHeight, scrollTop, scrollHeight);
336
338
  isPosition.current = true;
337
339
  }
338
340
  scrollTopHei.current = scrollTop;
@@ -713,7 +715,7 @@ const CustomerService = (props)=>{
713
715
  });
714
716
  };
715
717
  //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
716
- const sendToTeacher = (type, message = '')=>{
718
+ const sendToTeacher = async (type, message = '')=>{
717
719
  console.log("消息发送给老师111");
718
720
  let obj = {};
719
721
  if (type == 1) {
@@ -866,10 +868,11 @@ const CustomerService = (props)=>{
866
868
  };
867
869
  let imageUrl = '';
868
870
  if (citationContent.imageUrl) {
869
- // let base64:string=await urlToBase64(citationContent.imageUrl) as string
871
+ let base64 = await urlToBase64(citationContent.imageUrl);
872
+ console.log('base64', base64);
870
873
  console.log('citationContent.imageUrl', citationContent.imageUrl);
871
- sendData.image = citationContent.imageUrl;
872
- imageUrl = citationContent.imageUrl;
874
+ sendData.image = base64;
875
+ imageUrl = base64;
873
876
  }
874
877
  if (screenshotBese64) {
875
878
  console.log('screenshotBese64', screenshotBese64);
@@ -1064,7 +1067,7 @@ const CustomerService = (props)=>{
1064
1067
  body: data,
1065
1068
  signal: ctrl.current.signal,
1066
1069
  openWhenHidden: true,
1067
- onopen (res) {
1070
+ async onopen (res) {
1068
1071
  console.info("eventSource open: ", res);
1069
1072
  clearTimeout(receiveMessageTimer.current);
1070
1073
  if (res.status >= 300) {
@@ -1144,31 +1147,39 @@ const CustomerService = (props)=>{
1144
1147
  //识别的内容
1145
1148
  // console.log("eventSource msg: ", event.data);
1146
1149
  let msg = JSON.parse(event.data);
1147
- if (msg.message) {
1148
- content = content + msg.message;
1149
- // isPosition.current = true;
1150
- renderAiAnswerTimer.current = setTimeout(()=>{
1150
+ if (msg.message) {}
1151
+ setFinished((prevData)=>{
1152
+ finishedRef.current = false;
1153
+ return finishedRef.current;
1154
+ });
1155
+ console.log('返回中', msg);
1156
+ content = content + msg.message;
1157
+ // isPosition.current = true;
1158
+ renderAiAnswerTimer.current = setTimeout(()=>{
1159
+ if (!finishedRef.current) {
1151
1160
  renderAiAnswer(msg, id, type);
1152
- }, 100);
1153
- }
1161
+ }
1162
+ }, 100);
1154
1163
  if (msg.finished) {
1155
- setFinished(true); //发送结束
1164
+ // console.log('返回完成',msg)
1165
+ // setFinished(true); //发送结束
1156
1166
  if (!flagKeyWord) {
1157
1167
  videoPageQuestiionsList(2);
1158
1168
  }
1159
1169
  // isPosition.current = true;
1160
- setTimeout(()=>{
1161
- isPosition.current = true;
1162
- }, 100);
1170
+ // setTimeout(()=>{
1171
+ // isPosition.current = true;
1172
+ // },100)
1163
1173
  testLabQuestion(JSON.parse(data).message, content, "");
1164
- }
1174
+ } else {}
1165
1175
  },
1166
1176
  onclose () {
1167
- setFinished(true); //发送结束
1168
- // isPosition.current = true;
1169
- setTimeout(()=>{
1170
- isPosition.current = true;
1171
- }, 100);
1177
+ console.log("eventSource close");
1178
+ // setFinished(true); //发送结束
1179
+ // // isPosition.current = true;
1180
+ // setTimeout(()=>{
1181
+ // isPosition.current = true;
1182
+ // },100)
1172
1183
  setHistoryMessageList((historyMessageList)=>{
1173
1184
  return historyMessageList.filter((item)=>item.id != "123456");
1174
1185
  });
@@ -1247,9 +1258,20 @@ const CustomerService = (props)=>{
1247
1258
  return newHistoryMessageList2;
1248
1259
  }
1249
1260
  });
1250
- const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
1251
- if (container) {
1252
- container.scrollTop = container.scrollHeight;
1261
+ console.log('isPosition', isPosition.current);
1262
+ if (isPosition.current) {
1263
+ const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
1264
+ if (container) {
1265
+ container.scrollTop = container.scrollHeight;
1266
+ }
1267
+ }
1268
+ if (msg.finished) {
1269
+ console.log('返回完成', msg);
1270
+ //发送结束
1271
+ setFinished((prevData)=>{
1272
+ finishedRef.current = true;
1273
+ return finishedRef.current;
1274
+ });
1253
1275
  }
1254
1276
  // console.log('historyMessageList',historyMessageList)
1255
1277
  // if(isPosition.current){
@@ -2640,7 +2662,11 @@ const CustomerService = (props)=>{
2640
2662
  setHistoryMessageList((historyMessageList)=>{
2641
2663
  return historyMessageList.filter((item)=>item.id != "123456");
2642
2664
  });
2643
- setFinished(true);
2665
+ // setFinished(true);
2666
+ setFinished((prevData)=>{
2667
+ finishedRef.current = true;
2668
+ return finishedRef.current;
2669
+ });
2644
2670
  onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
2645
2671
  }
2646
2672
  }),
@@ -2656,7 +2682,11 @@ const CustomerService = (props)=>{
2656
2682
  setHistoryMessageList((historyMessageList)=>{
2657
2683
  return historyMessageList.filter((item)=>item.id != "123456");
2658
2684
  });
2659
- setFinished(true);
2685
+ // setFinished(true);
2686
+ setFinished((prevData)=>{
2687
+ finishedRef.current = true;
2688
+ return finishedRef.current;
2689
+ });
2660
2690
  onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
2661
2691
  },
2662
2692
  children: "停止生成"
@@ -164,7 +164,8 @@ var urlToBase64 = function(url) {
164
164
  return new Promise(function(resolve) {
165
165
  var image = new Image();
166
166
  // 先设置图片跨域属性
167
- image.crossOrigin = "Anonymous";
167
+ // image.crossOrigin = 'Anonymous'
168
+ image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
168
169
  // 再给image赋值src属性,先后顺序不能颠倒
169
170
  image.src = url;
170
171
  image.onload = function() {