askbot-dragon 1.5.49 → 1.5.50

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 (82) 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 +56 -55
  5. package/public/index.html +73 -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 +75 -75
  13. package/src/assets/js/hammer.js +89 -89
  14. package/src/assets/js/obsBrowser.js +63 -0
  15. package/src/assets/js/script.js +36 -36
  16. package/src/assets/less/common.css +6773 -6773
  17. package/src/assets/less/converSationContainer/common.less +192 -192
  18. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  19. package/src/assets/less/iconfont.css +37 -37
  20. package/src/assets/less/ticketMessage.less +294 -294
  21. package/src/components/ActionAlertIframe.vue +154 -154
  22. package/src/components/AiGuide.vue +468 -468
  23. package/src/components/AnswerDocknowledge.vue +581 -556
  24. package/src/components/AnswerVoice.vue +285 -285
  25. package/src/components/AskIFrame.vue +15 -15
  26. package/src/components/ConversationContainer.vue +4969 -5038
  27. package/src/components/FileType.vue +86 -86
  28. package/src/components/Message.vue +27 -27
  29. package/src/components/MyEditor.vue +348 -346
  30. package/src/components/actionSatisfaction.vue +107 -107
  31. package/src/components/actionSendToBot.vue +62 -62
  32. package/src/components/answerDissatisfaction.vue +62 -62
  33. package/src/components/answerRadio.vue +132 -186
  34. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  35. package/src/components/ask-components/Msgloading.vue +37 -37
  36. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  37. package/src/components/askVideo.vue +142 -139
  38. package/src/components/assetDetails.vue +370 -370
  39. package/src/components/assetMessage.vue +228 -228
  40. package/src/components/associationIntention.vue +349 -349
  41. package/src/components/attachmentPreview.vue +90 -90
  42. package/src/components/botActionSatisfactor.vue +68 -68
  43. package/src/components/chatContent.vue +513 -513
  44. package/src/components/feedBack.vue +136 -136
  45. package/src/components/fielListView.vue +351 -351
  46. package/src/components/file/AliyunOssComponents.vue +108 -108
  47. package/src/components/formTemplate.vue +3577 -3572
  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/pdfPosition.vue +1328 -1322
  60. package/src/components/popup.vue +227 -227
  61. package/src/components/previewDoc.vue +242 -242
  62. package/src/components/previewPdf.vue +353 -306
  63. package/src/components/receiverMessagePlatform.vue +65 -65
  64. package/src/components/recommend.vue +80 -80
  65. package/src/components/selector/hOption.vue +20 -20
  66. package/src/components/selector/hSelector.vue +199 -199
  67. package/src/components/selector/hWrapper.vue +216 -216
  68. package/src/components/senderMessagePlatform.vue +50 -50
  69. package/src/components/source/BotMessage.vue +24 -24
  70. package/src/components/source/CustomMessage.vue +24 -24
  71. package/src/components/test.vue +260 -260
  72. package/src/components/tree.vue +294 -294
  73. package/src/components/utils/AliyunIssUtil.js +81 -81
  74. package/src/components/utils/ckeditor.js +177 -174
  75. package/src/components/utils/format_date.js +25 -25
  76. package/src/components/utils/index.js +6 -6
  77. package/src/components/utils/math_utils.js +29 -29
  78. package/src/components/voiceComponent.vue +119 -119
  79. package/src/components/welcomeKnowledgeFile.vue +307 -270
  80. package/src/components/welcomeLlmCard.vue +134 -134
  81. package/src/main.js +57 -57
  82. 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,177 @@
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
+ import { putObject } from "../../assets/js/obsBrowser";
5
+ // const ossConfig = {
6
+ // region: "oss-cn-zhangjiakou",
7
+ // //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
8
+ // accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
9
+ // accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
10
+ // // stsToken: '<Your securityToken(STS)>',
11
+ // bucket: "guoranopen-zjk",
12
+ // }
13
+ class MyUploadAdapter {
14
+ constructor( loader , editor ) {
15
+ // 要在上载期间使用的文件加载器实例
16
+ this.loader = loader;
17
+ this.editor = editor
18
+ }
19
+
20
+ // 启动上载过程
21
+ upload() {
22
+ return this.loader.file
23
+ .then( file => new Promise(() => {
24
+ /* this._initRequest();
25
+ this._initListeners( resolve, reject, file );
26
+ this._sendRequest( file );*/
27
+ let command = this.editor.commands.get("insertAskComponent");
28
+ let uid = uuidv4()
29
+ command.execute({
30
+ tag: "section",
31
+ options: {
32
+ className: 'self-p-section',
33
+ data: 'self-p-section'
34
+ },
35
+ });
36
+ command.execute({
37
+ tag: "span-editable",
38
+ options: {
39
+ name: file.name + '正在上传...',
40
+ data: uid,
41
+ editable:false,
42
+ type:'upload'
43
+ }
44
+ })
45
+ this.uploadFile(file)
46
+ }));
47
+ }
48
+
49
+ // 中止上载过程
50
+ abort() {
51
+ if ( this.xhr ) {
52
+ this.xhr.abort();
53
+ }
54
+ }
55
+ uploadFile(file){
56
+ let imgInfo = {
57
+ url:'',
58
+ }
59
+ // let res = multipartUpload(
60
+ // ossConfig,
61
+ // file,
62
+ // null,
63
+ // imgInfo
64
+ // );
65
+ let res = putObject(file);
66
+ res.then(resp=>{
67
+ // imgInfo.url = ossFileUrl(ossConfig, resp.name)
68
+ imgInfo.url = resp.url;
69
+ let root = this.editor.model.document.getRoot()
70
+ let children = root.getChildren()
71
+ for(let child of children){
72
+ for (let index = 0; index < child._children._nodes.length; index++) {
73
+ if(child._children._nodes[index].name == 'askComponentPlaceholderContainer'){
74
+ if(child._children._nodes[index]._children._nodes[0]) {
75
+ let attrs = child._children._nodes[index]._children._nodes[0]._attrs
76
+ if(attrs) {
77
+ let attrsList = [...attrs.keys()]
78
+ for (let j = 0; j < attrsList.length; j++) {
79
+ if(attrsList[j] == 'data') {
80
+ // this.editor.uploadImg = this.editor.uploadImg.filter(id =>{return id != attrs.get(attrsList[j])})
81
+ this.editor.model.change(writer => {
82
+ writer.remove(child._children._nodes[index]);
83
+ });
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ let command = this.editor.commands.get("insertAskComponent");
92
+ command.execute({
93
+ tag: "img",
94
+ options: {
95
+ width:'100%',
96
+ alt: resp.name + 0,
97
+ src: imgInfo.url
98
+ },
99
+ });
100
+ this.editor.execute('insertParagraph', {
101
+ position: this.editor.model.document.selection.focus
102
+ })
103
+ })
104
+ }
105
+ // 使用传递给构造函数的URL初始化XMLHttpRequest对象.
106
+ _initRequest() {
107
+ const xhr = this.xhr = new XMLHttpRequest();
108
+ console.log(xhr)
109
+ xhr.open( 'POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true );
110
+ xhr.responseType = '';
111
+ }
112
+
113
+ // 初始化 XMLHttpRequest 监听.
114
+ _initListeners( resolve, reject, file ) {
115
+ const xhr = this.xhr;
116
+ const loader = this.loader;
117
+ console.log(this.loader)
118
+ const genericErrorText = `无法上传文件: ${ file.name }.`;
119
+
120
+ xhr.addEventListener( 'error', () => reject( genericErrorText ) );
121
+ xhr.addEventListener( 'abort', () => reject() );
122
+ xhr.addEventListener( 'load', () => {
123
+ const response = xhr.response;
124
+ // 当code==200说明上传成功,可以增加弹框提示;
125
+ // 当上传失败时,必须调用reject()函数。
126
+
127
+ console.log('response', xhr)
128
+
129
+ if ( !response || response.error ) {
130
+ return reject( response && response.error ? response.error.message : genericErrorText );
131
+ }
132
+ //上传成功,从后台获取图片的url地址
133
+ resolve( {
134
+ default: response
135
+ } );
136
+ } );
137
+
138
+ // 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
139
+ if ( xhr.upload ) {
140
+ xhr.upload.addEventListener( 'progress', evt => {
141
+ if ( evt.lengthComputable ) {
142
+ loader.uploadTotal = evt.total;
143
+ loader.uploaded = evt.loaded;
144
+ }
145
+ } );
146
+ }
147
+ }
148
+
149
+ // 准备数据并发送请求
150
+ _sendRequest( file ) {
151
+ //通过FormData构造函数创建一个空对象
152
+ const data = new FormData();
153
+ //通过append()方法在末尾追加key为files值为file的数据
154
+
155
+ console.log('file',file)
156
+ data.append( 'file', file );//上传的参数data
157
+ // data.append( 'memberId', "666" );
158
+ /**
159
+ * 重要提示:这是实现诸如身份验证和CSRF保护等安全机制的正确位置。
160
+ * 例如,可以使用XMLHttpRequest.setRequestHeader()设置包含应用程序先前生成的CSRF令牌的请求头。
161
+ */
162
+ this.xhr.send( data );
163
+ }
164
+ }
165
+
166
+ function MyCustomUploadAdapterPlugin( editor ) {
167
+ editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
168
+ // 在这里将URL配置为后端上载脚本
169
+ console.log(loader,'loader');
170
+ return new MyUploadAdapter( loader,editor );
171
+ }
172
+ }
173
+
174
+ export {
175
+ MyUploadAdapter,
176
+ MyCustomUploadAdapterPlugin
177
+ }
@@ -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
+ }