askbot-dragon 1.6.76-beta → 1.6.78-beta

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.
Files changed (84) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +6 -6
  3. package/dragon.iml +7 -7
  4. package/package.json +55 -55
  5. package/public/index.html +72 -72
  6. package/src/App.vue +31 -31
  7. package/src/api/index.js +1 -1
  8. package/src/api/mock.http +2 -2
  9. package/src/api/requestUrl.js +185 -185
  10. package/src/assets/js/AliyunlssUtil.js +92 -92
  11. package/src/assets/js/Base64Util.js +22 -22
  12. package/src/assets/js/common.js +252 -252
  13. package/src/assets/js/hammer.js +100 -100
  14. package/src/assets/js/script.js +36 -36
  15. package/src/assets/less/common.css +6773 -6773
  16. package/src/assets/less/converSationContainer/common.less +199 -199
  17. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  18. package/src/assets/less/iconfont.css +37 -37
  19. package/src/assets/less/ticketMessage.less +294 -294
  20. package/src/components/ActionAlertIframe.vue +177 -177
  21. package/src/components/AiGuide.vue +466 -466
  22. package/src/components/AnswerDocknowledge.vue +1059 -1059
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +4934 -4934
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +351 -351
  29. package/src/components/actionSatisfaction.vue +107 -107
  30. package/src/components/actionSendToBot.vue +62 -62
  31. package/src/components/answerDissatisfaction.vue +62 -62
  32. package/src/components/answerRadio.vue +186 -186
  33. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  34. package/src/components/ask-components/Msgloading.vue +37 -37
  35. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  36. package/src/components/askVideo.vue +162 -162
  37. package/src/components/assetDetails.vue +378 -378
  38. package/src/components/assetMessage.vue +228 -228
  39. package/src/components/associationIntention.vue +355 -355
  40. package/src/components/attachmentPreview.vue +90 -90
  41. package/src/components/botActionSatisfactor.vue +68 -68
  42. package/src/components/chatContent.vue +513 -513
  43. package/src/components/feedBack.vue +136 -136
  44. package/src/components/fielListView.vue +351 -351
  45. package/src/components/file/AliyunOssComponents.vue +108 -108
  46. package/src/components/formTemplate.vue +3572 -3572
  47. package/src/components/intelligentSummary.vue +227 -227
  48. package/src/components/kkview.vue +1138 -1138
  49. package/src/components/loadingProcess.vue +164 -164
  50. package/src/components/message/ActionAlertIframe.vue +112 -112
  51. package/src/components/message/ShopMessage.vue +164 -164
  52. package/src/components/message/TextMessage.vue +924 -924
  53. package/src/components/message/TicketMessage.vue +201 -201
  54. package/src/components/message/swiper/index.js +4 -4
  55. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  56. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  57. package/src/components/msgLoading.vue +231 -231
  58. package/src/components/myPopup.vue +70 -70
  59. package/src/components/newPdfPosition.vue +877 -877
  60. package/src/components/pdfPosition.vue +1508 -1506
  61. package/src/components/popup.vue +227 -227
  62. package/src/components/previewDoc.vue +247 -247
  63. package/src/components/previewPdf.vue +791 -757
  64. package/src/components/receiverMessagePlatform.vue +65 -65
  65. package/src/components/recommend.vue +80 -80
  66. package/src/components/selector/hOption.vue +20 -20
  67. package/src/components/selector/hSelector.vue +199 -199
  68. package/src/components/selector/hWrapper.vue +216 -216
  69. package/src/components/senderMessagePlatform.vue +50 -50
  70. package/src/components/source/BotMessage.vue +24 -24
  71. package/src/components/source/CustomMessage.vue +24 -24
  72. package/src/components/test.vue +260 -260
  73. package/src/components/tree.vue +294 -294
  74. package/src/components/utils/AliyunIssUtil.js +81 -81
  75. package/src/components/utils/ckeditor.js +174 -174
  76. package/src/components/utils/format_date.js +25 -25
  77. package/src/components/utils/index.js +6 -6
  78. package/src/components/utils/math_utils.js +29 -29
  79. package/src/components/voiceComponent.vue +119 -119
  80. package/src/components/welcomeKnowledgeFile.vue +340 -340
  81. package/src/components/welcomeLlmCard.vue +140 -140
  82. package/src/components/welcomeSuggest.vue +97 -97
  83. package/src/main.js +57 -57
  84. package/vue.config.js +54 -54
@@ -1,81 +1,81 @@
1
- const OSS = require('ali-oss');
2
-
3
- let IDX = 256, HEX = [], SIZE = 256, BUFFER;
4
- while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
5
- let mainId = sessionStorage.getItem('_mainId') ? sessionStorage.getItem('_mainId') : "";
6
- function uid(len) {
7
- let i = 0, tmp = (len || 11);
8
- if (!BUFFER || ((IDX + tmp) > SIZE * 2)) {
9
- for (BUFFER = '', IDX = 0; i < SIZE; i++) {
10
- BUFFER += HEX[Math.random() * 256 | 0];
11
- }
12
- }
13
-
14
- return BUFFER.substring(IDX, IDX++ + tmp);
15
- }
16
-
17
- function dataFormat(fmt, date = new Date()) {
18
- const o = {
19
- "M+": date.getMonth() + 1, //月份
20
- "d+": date.getDate(), //日
21
- "h+": date.getHours(), //小时
22
- "m+": date.getMinutes(), //分
23
- "s+": date.getSeconds(), //秒
24
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
25
- "S": date.getMilliseconds() //毫秒
26
- };
27
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
28
- for (const k in o)
29
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
30
- return fmt;
31
- }
32
-
33
- function pathGenerate(filename) {
34
- return "front-oss/" + mainId + '/' + dataFormat("yyyy/MM/dd/hh/mm/") + uid(32) + "/" + filename;
35
- }
36
-
37
-
38
- function upload(ossConfig, data) {
39
- let ossClient = new OSS(ossConfig);
40
- // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
41
- let objectKey = pathGenerate(data.name);
42
- let result = ossClient.put(objectKey, data, {
43
- headers:{
44
- // 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
45
- 'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
46
- },
47
- });
48
- console.debug(result);
49
- return result;
50
- }
51
-
52
- function multipartUpload(ossConfig, data, callback,extCallback) {
53
- let ossClient = new OSS(ossConfig);
54
- // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
55
- let objectKey = pathGenerate(data.name);
56
-
57
- let res = ossClient.multipartUpload(objectKey, data, {
58
- headers:{
59
- // 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
60
- 'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
61
- },
62
- progress: function (p, checkpoint) {
63
- console.debug('progress callback', p, checkpoint);
64
- // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
65
- if (callback && callback instanceof Function) {
66
- callback(p, checkpoint,data,extCallback);
67
- }
68
- }
69
- })
70
- return res;
71
- }
72
-
73
- function ossFileUrl(ossConfig, path, cname) {
74
- if (cname == null) {
75
- return 'https://' + ossConfig.bucket + '.' + ossConfig.region + '.aliyuncs.com/' + path;
76
- } else {
77
- return cname + '/' + path;
78
- }
79
- }
80
-
81
- export {upload, multipartUpload, ossFileUrl}
1
+ const OSS = require('ali-oss');
2
+
3
+ let IDX = 256, HEX = [], SIZE = 256, BUFFER;
4
+ while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
5
+ let mainId = sessionStorage.getItem('_mainId') ? sessionStorage.getItem('_mainId') : "";
6
+ function uid(len) {
7
+ let i = 0, tmp = (len || 11);
8
+ if (!BUFFER || ((IDX + tmp) > SIZE * 2)) {
9
+ for (BUFFER = '', IDX = 0; i < SIZE; i++) {
10
+ BUFFER += HEX[Math.random() * 256 | 0];
11
+ }
12
+ }
13
+
14
+ return BUFFER.substring(IDX, IDX++ + tmp);
15
+ }
16
+
17
+ function dataFormat(fmt, date = new Date()) {
18
+ const o = {
19
+ "M+": date.getMonth() + 1, //月份
20
+ "d+": date.getDate(), //日
21
+ "h+": date.getHours(), //小时
22
+ "m+": date.getMinutes(), //分
23
+ "s+": date.getSeconds(), //秒
24
+ "q+": Math.floor((date.getMonth() + 3) / 3), //季度
25
+ "S": date.getMilliseconds() //毫秒
26
+ };
27
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
28
+ for (const k in o)
29
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
30
+ return fmt;
31
+ }
32
+
33
+ function pathGenerate(filename) {
34
+ return "front-oss/" + mainId + '/' + dataFormat("yyyy/MM/dd/hh/mm/") + uid(32) + "/" + filename;
35
+ }
36
+
37
+
38
+ function upload(ossConfig, data) {
39
+ let ossClient = new OSS(ossConfig);
40
+ // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
41
+ let objectKey = pathGenerate(data.name);
42
+ let result = ossClient.put(objectKey, data, {
43
+ headers:{
44
+ // 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
45
+ 'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
46
+ },
47
+ });
48
+ console.debug(result);
49
+ return result;
50
+ }
51
+
52
+ function multipartUpload(ossConfig, data, callback,extCallback) {
53
+ let ossClient = new OSS(ossConfig);
54
+ // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
55
+ let objectKey = pathGenerate(data.name);
56
+
57
+ let res = ossClient.multipartUpload(objectKey, data, {
58
+ headers:{
59
+ // 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
60
+ 'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
61
+ },
62
+ progress: function (p, checkpoint) {
63
+ console.debug('progress callback', p, checkpoint);
64
+ // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
65
+ if (callback && callback instanceof Function) {
66
+ callback(p, checkpoint,data,extCallback);
67
+ }
68
+ }
69
+ })
70
+ return res;
71
+ }
72
+
73
+ function ossFileUrl(ossConfig, path, cname) {
74
+ if (cname == null) {
75
+ return 'https://' + ossConfig.bucket + '.' + ossConfig.region + '.aliyuncs.com/' + path;
76
+ } else {
77
+ return cname + '/' + path;
78
+ }
79
+ }
80
+
81
+ export {upload, multipartUpload, ossFileUrl}
@@ -1,174 +1,174 @@
1
- /* eslint-disable */
2
- import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
3
- import { v4 as uuidv4 } from "uuid";
4
- const ossConfig = {
5
- region: "oss-cn-zhangjiakou",
6
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
7
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
8
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
9
- // stsToken: '<Your securityToken(STS)>',
10
- bucket: "guoranopen-zjk",
11
- }
12
- class MyUploadAdapter {
13
- constructor( loader , editor ) {
14
- // 要在上载期间使用的文件加载器实例
15
- this.loader = loader;
16
- this.editor = editor
17
- }
18
-
19
- // 启动上载过程
20
- upload() {
21
- return this.loader.file
22
- .then( file => new Promise(() => {
23
- /* this._initRequest();
24
- this._initListeners( resolve, reject, file );
25
- this._sendRequest( file );*/
26
- let command = this.editor.commands.get("insertAskComponent");
27
- let uid = uuidv4()
28
- command.execute({
29
- tag: "section",
30
- options: {
31
- className: 'self-p-section',
32
- data: 'self-p-section'
33
- },
34
- });
35
- command.execute({
36
- tag: "span-editable",
37
- options: {
38
- name: file.name + '正在上传...',
39
- data: uid,
40
- editable:false,
41
- type:'upload'
42
- }
43
- })
44
- this.uploadFile(file)
45
- }));
46
- }
47
-
48
- // 中止上载过程
49
- abort() {
50
- if ( this.xhr ) {
51
- this.xhr.abort();
52
- }
53
- }
54
- uploadFile(file){
55
- let imgInfo = {
56
- url:'',
57
- }
58
- let res = multipartUpload(
59
- ossConfig,
60
- file,
61
- null,
62
- imgInfo
63
- );
64
- res.then(resp=>{
65
- imgInfo.url = ossFileUrl(ossConfig, resp.name)
66
- let root = this.editor.model.document.getRoot()
67
- let children = root.getChildren()
68
- for(let child of children){
69
- for (let index = 0; index < child._children._nodes.length; index++) {
70
- if(child._children._nodes[index].name == 'askComponentPlaceholderContainer'){
71
- if(child._children._nodes[index]._children._nodes[0]) {
72
- let attrs = child._children._nodes[index]._children._nodes[0]._attrs
73
- if(attrs) {
74
- let attrsList = [...attrs.keys()]
75
- for (let j = 0; j < attrsList.length; j++) {
76
- if(attrsList[j] == 'data') {
77
- // this.editor.uploadImg = this.editor.uploadImg.filter(id =>{return id != attrs.get(attrsList[j])})
78
- this.editor.model.change(writer => {
79
- writer.remove(child._children._nodes[index]);
80
- });
81
- }
82
- }
83
- }
84
- }
85
- }
86
- }
87
- }
88
- let command = this.editor.commands.get("insertAskComponent");
89
- command.execute({
90
- tag: "img",
91
- options: {
92
- width:'100%',
93
- alt: resp.name + 0,
94
- src: imgInfo.url
95
- },
96
- });
97
- this.editor.execute('insertParagraph', {
98
- position: this.editor.model.document.selection.focus
99
- })
100
- })
101
- }
102
- // 使用传递给构造函数的URL初始化XMLHttpRequest对象.
103
- _initRequest() {
104
- const xhr = this.xhr = new XMLHttpRequest();
105
- console.log(xhr)
106
- xhr.open( 'POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true );
107
- xhr.responseType = '';
108
- }
109
-
110
- // 初始化 XMLHttpRequest 监听.
111
- _initListeners( resolve, reject, file ) {
112
- const xhr = this.xhr;
113
- const loader = this.loader;
114
- console.log(this.loader)
115
- const genericErrorText = `无法上传文件: ${ file.name }.`;
116
-
117
- xhr.addEventListener( 'error', () => reject( genericErrorText ) );
118
- xhr.addEventListener( 'abort', () => reject() );
119
- xhr.addEventListener( 'load', () => {
120
- const response = xhr.response;
121
- // 当code==200说明上传成功,可以增加弹框提示;
122
- // 当上传失败时,必须调用reject()函数。
123
-
124
- console.log('response', xhr)
125
-
126
- if ( !response || response.error ) {
127
- return reject( response && response.error ? response.error.message : genericErrorText );
128
- }
129
- //上传成功,从后台获取图片的url地址
130
- resolve( {
131
- default: response
132
- } );
133
- } );
134
-
135
- // 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
136
- if ( xhr.upload ) {
137
- xhr.upload.addEventListener( 'progress', evt => {
138
- if ( evt.lengthComputable ) {
139
- loader.uploadTotal = evt.total;
140
- loader.uploaded = evt.loaded;
141
- }
142
- } );
143
- }
144
- }
145
-
146
- // 准备数据并发送请求
147
- _sendRequest( file ) {
148
- //通过FormData构造函数创建一个空对象
149
- const data = new FormData();
150
- //通过append()方法在末尾追加key为files值为file的数据
151
-
152
- console.log('file',file)
153
- data.append( 'file', file );//上传的参数data
154
- // data.append( 'memberId', "666" );
155
- /**
156
- * 重要提示:这是实现诸如身份验证和CSRF保护等安全机制的正确位置。
157
- * 例如,可以使用XMLHttpRequest.setRequestHeader()设置包含应用程序先前生成的CSRF令牌的请求头。
158
- */
159
- this.xhr.send( data );
160
- }
161
- }
162
-
163
- function MyCustomUploadAdapterPlugin( editor ) {
164
- editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
165
- // 在这里将URL配置为后端上载脚本
166
- console.log(loader,'loader');
167
- return new MyUploadAdapter( loader,editor );
168
- }
169
- }
170
-
171
- export {
172
- MyUploadAdapter,
173
- MyCustomUploadAdapterPlugin
174
- }
1
+ /* eslint-disable */
2
+ import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ const ossConfig = {
5
+ region: "oss-cn-zhangjiakou",
6
+ //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
7
+ accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
8
+ accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
9
+ // stsToken: '<Your securityToken(STS)>',
10
+ bucket: "guoranopen-zjk",
11
+ }
12
+ class MyUploadAdapter {
13
+ constructor( loader , editor ) {
14
+ // 要在上载期间使用的文件加载器实例
15
+ this.loader = loader;
16
+ this.editor = editor
17
+ }
18
+
19
+ // 启动上载过程
20
+ upload() {
21
+ return this.loader.file
22
+ .then( file => new Promise(() => {
23
+ /* this._initRequest();
24
+ this._initListeners( resolve, reject, file );
25
+ this._sendRequest( file );*/
26
+ let command = this.editor.commands.get("insertAskComponent");
27
+ let uid = uuidv4()
28
+ command.execute({
29
+ tag: "section",
30
+ options: {
31
+ className: 'self-p-section',
32
+ data: 'self-p-section'
33
+ },
34
+ });
35
+ command.execute({
36
+ tag: "span-editable",
37
+ options: {
38
+ name: file.name + '正在上传...',
39
+ data: uid,
40
+ editable:false,
41
+ type:'upload'
42
+ }
43
+ })
44
+ this.uploadFile(file)
45
+ }));
46
+ }
47
+
48
+ // 中止上载过程
49
+ abort() {
50
+ if ( this.xhr ) {
51
+ this.xhr.abort();
52
+ }
53
+ }
54
+ uploadFile(file){
55
+ let imgInfo = {
56
+ url:'',
57
+ }
58
+ let res = multipartUpload(
59
+ ossConfig,
60
+ file,
61
+ null,
62
+ imgInfo
63
+ );
64
+ res.then(resp=>{
65
+ imgInfo.url = ossFileUrl(ossConfig, resp.name)
66
+ let root = this.editor.model.document.getRoot()
67
+ let children = root.getChildren()
68
+ for(let child of children){
69
+ for (let index = 0; index < child._children._nodes.length; index++) {
70
+ if(child._children._nodes[index].name == 'askComponentPlaceholderContainer'){
71
+ if(child._children._nodes[index]._children._nodes[0]) {
72
+ let attrs = child._children._nodes[index]._children._nodes[0]._attrs
73
+ if(attrs) {
74
+ let attrsList = [...attrs.keys()]
75
+ for (let j = 0; j < attrsList.length; j++) {
76
+ if(attrsList[j] == 'data') {
77
+ // this.editor.uploadImg = this.editor.uploadImg.filter(id =>{return id != attrs.get(attrsList[j])})
78
+ this.editor.model.change(writer => {
79
+ writer.remove(child._children._nodes[index]);
80
+ });
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ let command = this.editor.commands.get("insertAskComponent");
89
+ command.execute({
90
+ tag: "img",
91
+ options: {
92
+ width:'100%',
93
+ alt: resp.name + 0,
94
+ src: imgInfo.url
95
+ },
96
+ });
97
+ this.editor.execute('insertParagraph', {
98
+ position: this.editor.model.document.selection.focus
99
+ })
100
+ })
101
+ }
102
+ // 使用传递给构造函数的URL初始化XMLHttpRequest对象.
103
+ _initRequest() {
104
+ const xhr = this.xhr = new XMLHttpRequest();
105
+ console.log(xhr)
106
+ xhr.open( 'POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true );
107
+ xhr.responseType = '';
108
+ }
109
+
110
+ // 初始化 XMLHttpRequest 监听.
111
+ _initListeners( resolve, reject, file ) {
112
+ const xhr = this.xhr;
113
+ const loader = this.loader;
114
+ console.log(this.loader)
115
+ const genericErrorText = `无法上传文件: ${ file.name }.`;
116
+
117
+ xhr.addEventListener( 'error', () => reject( genericErrorText ) );
118
+ xhr.addEventListener( 'abort', () => reject() );
119
+ xhr.addEventListener( 'load', () => {
120
+ const response = xhr.response;
121
+ // 当code==200说明上传成功,可以增加弹框提示;
122
+ // 当上传失败时,必须调用reject()函数。
123
+
124
+ console.log('response', xhr)
125
+
126
+ if ( !response || response.error ) {
127
+ return reject( response && response.error ? response.error.message : genericErrorText );
128
+ }
129
+ //上传成功,从后台获取图片的url地址
130
+ resolve( {
131
+ default: response
132
+ } );
133
+ } );
134
+
135
+ // 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
136
+ if ( xhr.upload ) {
137
+ xhr.upload.addEventListener( 'progress', evt => {
138
+ if ( evt.lengthComputable ) {
139
+ loader.uploadTotal = evt.total;
140
+ loader.uploaded = evt.loaded;
141
+ }
142
+ } );
143
+ }
144
+ }
145
+
146
+ // 准备数据并发送请求
147
+ _sendRequest( file ) {
148
+ //通过FormData构造函数创建一个空对象
149
+ const data = new FormData();
150
+ //通过append()方法在末尾追加key为files值为file的数据
151
+
152
+ console.log('file',file)
153
+ data.append( 'file', file );//上传的参数data
154
+ // data.append( 'memberId', "666" );
155
+ /**
156
+ * 重要提示:这是实现诸如身份验证和CSRF保护等安全机制的正确位置。
157
+ * 例如,可以使用XMLHttpRequest.setRequestHeader()设置包含应用程序先前生成的CSRF令牌的请求头。
158
+ */
159
+ this.xhr.send( data );
160
+ }
161
+ }
162
+
163
+ function MyCustomUploadAdapterPlugin( editor ) {
164
+ editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
165
+ // 在这里将URL配置为后端上载脚本
166
+ console.log(loader,'loader');
167
+ return new MyUploadAdapter( loader,editor );
168
+ }
169
+ }
170
+
171
+ export {
172
+ MyUploadAdapter,
173
+ MyCustomUploadAdapterPlugin
174
+ }
@@ -1,26 +1,26 @@
1
- const formatDate = (fmt) => { //author: meizz
2
- var o = {
3
- "M+": this.getMonth() + 1, //月份
4
- "d+": this.getDate(), //日
5
- "h+": this.getHours(), //小时
6
- "m+": this.getMinutes(), //分
7
- "s+": this.getSeconds(), //秒
8
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
9
- "S": this.getMilliseconds() //毫秒
10
- };
11
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
12
- for (var k in o)
13
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
14
- return fmt;
15
- }
16
- function forMatTime(value){
17
- let startTime = ''
18
- let currentTime = new Date(), year = currentTime.getFullYear(),
19
- month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1,
20
- day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate();
21
- startTime = year + "-" + month + "-" + day +' ' + value;
22
- return new Date(startTime)
23
- }
24
- export { formatDate,forMatTime };
25
-
1
+ const formatDate = (fmt) => { //author: meizz
2
+ var o = {
3
+ "M+": this.getMonth() + 1, //月份
4
+ "d+": this.getDate(), //日
5
+ "h+": this.getHours(), //小时
6
+ "m+": this.getMinutes(), //分
7
+ "s+": this.getSeconds(), //秒
8
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
9
+ "S": this.getMilliseconds() //毫秒
10
+ };
11
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
12
+ for (var k in o)
13
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
14
+ return fmt;
15
+ }
16
+ function forMatTime(value){
17
+ let startTime = ''
18
+ let currentTime = new Date(), year = currentTime.getFullYear(),
19
+ month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1,
20
+ day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate();
21
+ startTime = year + "-" + month + "-" + day +' ' + value;
22
+ return new Date(startTime)
23
+ }
24
+ export { formatDate,forMatTime };
25
+
26
26
  // new Date("2019-12-14T00:09:16.000+0000").Format("yyyy-MM-dd hh:mm:ss")
@@ -1,7 +1,7 @@
1
- import {formatDate} from './format_date';
2
-
3
- let utils = {
4
- formatDate
5
- }
6
-
1
+ import {formatDate} from './format_date';
2
+
3
+ let utils = {
4
+ formatDate
5
+ }
6
+
7
7
  export { utils }
@@ -1,29 +1,29 @@
1
- //生成从minNum到maxNum-1的随机数
2
- function randomNum(minNum,maxNum){
3
- switch(arguments.length){
4
- case 1:
5
- return parseInt(Math.random()*minNum+1,10)-1;
6
- case 2:
7
- return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10)-1;
8
- default:
9
- return 0;
10
- }
11
- }
12
- function uniqueData(tempArr) {
13
- let result = [];
14
- let obj = {};
15
- if (!tempArr){
16
- return []
17
- }
18
- for (let i = 0; i < tempArr.length; i++) {
19
- if (!obj[tempArr[i].value]) {
20
- result.push(tempArr[i]);
21
- obj[tempArr[i].value] = true;
22
- }
23
- }
24
- return result;
25
- }
26
- export {
27
- randomNum,
28
- uniqueData
29
- }
1
+ //生成从minNum到maxNum-1的随机数
2
+ function randomNum(minNum,maxNum){
3
+ switch(arguments.length){
4
+ case 1:
5
+ return parseInt(Math.random()*minNum+1,10)-1;
6
+ case 2:
7
+ return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10)-1;
8
+ default:
9
+ return 0;
10
+ }
11
+ }
12
+ function uniqueData(tempArr) {
13
+ let result = [];
14
+ let obj = {};
15
+ if (!tempArr){
16
+ return []
17
+ }
18
+ for (let i = 0; i < tempArr.length; i++) {
19
+ if (!obj[tempArr[i].value]) {
20
+ result.push(tempArr[i]);
21
+ obj[tempArr[i].value] = true;
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+ export {
27
+ randomNum,
28
+ uniqueData
29
+ }