askbot-dragon 0.7.87 → 0.7.91

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 (67) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +5 -5
  3. package/dragon.iml +7 -7
  4. package/package.json +55 -55
  5. package/public/index.html +30 -30
  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/script.js +36 -36
  13. package/src/assets/less/common.css +6773 -6773
  14. package/src/assets/less/converSationContainer/common.less +191 -191
  15. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  16. package/src/assets/less/iconfont.css +37 -37
  17. package/src/assets/less/ticketMessage.less +211 -211
  18. package/src/components/ActionAlertIframe.vue +112 -112
  19. package/src/components/AiGuide.vue +467 -467
  20. package/src/components/AskIFrame.vue +15 -15
  21. package/src/components/ConversationContainer.vue +1318 -1318
  22. package/src/components/FileType.vue +86 -86
  23. package/src/components/Message.vue +27 -27
  24. package/src/components/actionSatisfaction.vue +107 -107
  25. package/src/components/actionSendToBot.vue +62 -62
  26. package/src/components/answerDissatisfaction.vue +62 -62
  27. package/src/components/answerRadio.vue +76 -76
  28. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  29. package/src/components/ask-components/Msgloading.vue +37 -37
  30. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  31. package/src/components/askVideo.vue +138 -138
  32. package/src/components/assetDetails.vue +370 -370
  33. package/src/components/assetMessage.vue +228 -228
  34. package/src/components/associationIntention.vue +229 -121
  35. package/src/components/botActionSatisfactor.vue +68 -68
  36. package/src/components/chatContent.vue +513 -513
  37. package/src/components/feedBack.vue +136 -136
  38. package/src/components/file/AliyunOssComponents.vue +108 -108
  39. package/src/components/formTemplate.vue +1974 -1969
  40. package/src/components/loadingProcess.vue +164 -164
  41. package/src/components/message/ActionAlertIframe.vue +112 -112
  42. package/src/components/message/ShopMessage.vue +164 -164
  43. package/src/components/message/TextMessage.vue +924 -924
  44. package/src/components/message/TicketMessage.vue +177 -177
  45. package/src/components/message/swiper/index.js +4 -4
  46. package/src/components/message/swiper/ticketSwiper.vue +502 -502
  47. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  48. package/src/components/msgLoading.vue +231 -231
  49. package/src/components/recommend.vue +89 -89
  50. package/src/components/selector/hOption.vue +20 -20
  51. package/src/components/selector/hSelector.vue +199 -199
  52. package/src/components/selector/hWrapper.vue +216 -216
  53. package/src/components/source/BotMessage.vue +24 -24
  54. package/src/components/source/CustomMessage.vue +24 -24
  55. package/src/components/test.vue +260 -260
  56. package/src/components/utils/AliyunIssUtil.js +72 -72
  57. package/src/components/utils/ckeditor.js +123 -123
  58. package/src/components/utils/command.js +68 -68
  59. package/src/components/utils/editing.js +11 -11
  60. package/src/components/utils/format_date.js +18 -18
  61. package/src/components/utils/index.js +6 -6
  62. package/src/components/utils/math_utils.js +15 -15
  63. package/src/components/utils/plugin-image.js +11 -11
  64. package/src/components/utils/toolbar-ui.js +41 -41
  65. package/src/components/voiceComponent.vue +119 -119
  66. package/src/main.js +45 -45
  67. package/vue.config.js +34 -34
@@ -1,72 +1,72 @@
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
-
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/" + 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
- console.debug(result);
44
- return result;
45
- }
46
-
47
- function multipartUpload(ossConfig, data, callback,extCallback) {
48
- let ossClient = new OSS(ossConfig);
49
- // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
50
- let objectKey = pathGenerate(data.name);
51
-
52
- let res = ossClient.multipartUpload(objectKey, data, {
53
- progress: function (p, checkpoint) {
54
- console.debug('progress callback', p, checkpoint);
55
- // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
56
- if (callback && callback instanceof Function) {
57
- callback(p, checkpoint,data,extCallback);
58
- }
59
- }
60
- })
61
- return res;
62
- }
63
-
64
- function ossFileUrl(ossConfig, path, cname) {
65
- if (cname == null) {
66
- return 'https://' + ossConfig.bucket + '.' + ossConfig.region + '.aliyuncs.com/' + path;
67
- } else {
68
- return cname + '/' + path;
69
- }
70
- }
71
-
72
- 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
+
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/" + 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
+ console.debug(result);
44
+ return result;
45
+ }
46
+
47
+ function multipartUpload(ossConfig, data, callback,extCallback) {
48
+ let ossClient = new OSS(ossConfig);
49
+ // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
50
+ let objectKey = pathGenerate(data.name);
51
+
52
+ let res = ossClient.multipartUpload(objectKey, data, {
53
+ progress: function (p, checkpoint) {
54
+ console.debug('progress callback', p, checkpoint);
55
+ // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
56
+ if (callback && callback instanceof Function) {
57
+ callback(p, checkpoint,data,extCallback);
58
+ }
59
+ }
60
+ })
61
+ return res;
62
+ }
63
+
64
+ function ossFileUrl(ossConfig, path, cname) {
65
+ if (cname == null) {
66
+ return 'https://' + ossConfig.bucket + '.' + ossConfig.region + '.aliyuncs.com/' + path;
67
+ } else {
68
+ return cname + '/' + path;
69
+ }
70
+ }
71
+
72
+ export {upload, multipartUpload, ossFileUrl}
@@ -1,123 +1,123 @@
1
- import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
2
-
3
- const ossConfig={
4
- region: "oss-cn-zhangjiakou",
5
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
6
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
7
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
8
- // stsToken: '<Your securityToken(STS)>',
9
- bucket: "guoranopen-zjk",
10
- }
11
- class MyUploadAdapter {
12
- constructor( loader ) {
13
- // 要在上载期间使用的文件加载器实例
14
- this.loader = loader;
15
- }
16
-
17
- // 启动上载过程
18
- upload() {
19
- return this.loader.file
20
- .then( file => new Promise( ( resolve ) => {
21
- /* this._initRequest();
22
- this._initListeners( resolve, reject, file );
23
- this._sendRequest( file );*/
24
- this.uploadFile(file,resolve)
25
- } ) );
26
- }
27
-
28
- // 中止上载过程
29
- abort() {
30
- if ( this.xhr ) {
31
- this.xhr.abort();
32
- }
33
- }
34
- uploadFile(file,resolve){
35
- let imgInfo = {
36
- url:'',
37
- }
38
- let res = multipartUpload(
39
- ossConfig,
40
- file,
41
- null,
42
- imgInfo
43
- );
44
- res.then(resp=>{
45
- imgInfo.url = ossFileUrl(ossConfig, resp.name)
46
- console.log(imgInfo)
47
- resolve({
48
- default:imgInfo.url
49
- })
50
- })
51
- }
52
- // 使用传递给构造函数的URL初始化XMLHttpRequest对象.
53
- _initRequest() {
54
- const xhr = this.xhr = new XMLHttpRequest();
55
- console.log(xhr)
56
- xhr.open( 'POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true );
57
- xhr.responseType = '';
58
- }
59
-
60
- // 初始化 XMLHttpRequest 监听.
61
- _initListeners( resolve, reject, file ) {
62
- const xhr = this.xhr;
63
- const loader = this.loader;
64
- console.log(this.loader)
65
- const genericErrorText = `无法上传文件: ${ file.name }.`;
66
-
67
- xhr.addEventListener( 'error', () => reject( genericErrorText ) );
68
- xhr.addEventListener( 'abort', () => reject() );
69
- xhr.addEventListener( 'load', () => {
70
- const response = xhr.response;
71
- // 当code==200说明上传成功,可以增加弹框提示;
72
- // 当上传失败时,必须调用reject()函数。
73
-
74
- console.log('response', xhr)
75
-
76
- if ( !response || response.error ) {
77
- return reject( response && response.error ? response.error.message : genericErrorText );
78
- }
79
- //上传成功,从后台获取图片的url地址
80
- resolve( {
81
- default: response
82
- } );
83
- } );
84
-
85
- // 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
86
- if ( xhr.upload ) {
87
- xhr.upload.addEventListener( 'progress', evt => {
88
- if ( evt.lengthComputable ) {
89
- loader.uploadTotal = evt.total;
90
- loader.uploaded = evt.loaded;
91
- }
92
- } );
93
- }
94
- }
95
-
96
- // 准备数据并发送请求
97
- _sendRequest( file ) {
98
- //通过FormData构造函数创建一个空对象
99
- const data = new FormData();
100
- //通过append()方法在末尾追加key为files值为file的数据
101
-
102
- console.log('file',file)
103
- data.append( 'file', file );//上传的参数data
104
- // data.append( 'memberId', "666" );
105
- /**
106
- * 重要提示:这是实现诸如身份验证和CSRF保护等安全机制的正确位置。
107
- * 例如,可以使用XMLHttpRequest.setRequestHeader()设置包含应用程序先前生成的CSRF令牌的请求头。
108
- */
109
- this.xhr.send( data );
110
- }
111
- }
112
-
113
- function MyCustomUploadAdapterPlugin( editor ) {
114
- editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
115
- // 在这里将URL配置为后端上载脚本
116
- return new MyUploadAdapter( loader );
117
- }
118
- }
119
-
120
- export {
121
- MyUploadAdapter,
122
- MyCustomUploadAdapterPlugin
123
- }
1
+ import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
2
+
3
+ const ossConfig={
4
+ region: "oss-cn-zhangjiakou",
5
+ //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
6
+ accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
7
+ accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
8
+ // stsToken: '<Your securityToken(STS)>',
9
+ bucket: "guoranopen-zjk",
10
+ }
11
+ class MyUploadAdapter {
12
+ constructor( loader ) {
13
+ // 要在上载期间使用的文件加载器实例
14
+ this.loader = loader;
15
+ }
16
+
17
+ // 启动上载过程
18
+ upload() {
19
+ return this.loader.file
20
+ .then( file => new Promise( ( resolve ) => {
21
+ /* this._initRequest();
22
+ this._initListeners( resolve, reject, file );
23
+ this._sendRequest( file );*/
24
+ this.uploadFile(file,resolve)
25
+ } ) );
26
+ }
27
+
28
+ // 中止上载过程
29
+ abort() {
30
+ if ( this.xhr ) {
31
+ this.xhr.abort();
32
+ }
33
+ }
34
+ uploadFile(file,resolve){
35
+ let imgInfo = {
36
+ url:'',
37
+ }
38
+ let res = multipartUpload(
39
+ ossConfig,
40
+ file,
41
+ null,
42
+ imgInfo
43
+ );
44
+ res.then(resp=>{
45
+ imgInfo.url = ossFileUrl(ossConfig, resp.name)
46
+ console.log(imgInfo)
47
+ resolve({
48
+ default:imgInfo.url
49
+ })
50
+ })
51
+ }
52
+ // 使用传递给构造函数的URL初始化XMLHttpRequest对象.
53
+ _initRequest() {
54
+ const xhr = this.xhr = new XMLHttpRequest();
55
+ console.log(xhr)
56
+ xhr.open( 'POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true );
57
+ xhr.responseType = '';
58
+ }
59
+
60
+ // 初始化 XMLHttpRequest 监听.
61
+ _initListeners( resolve, reject, file ) {
62
+ const xhr = this.xhr;
63
+ const loader = this.loader;
64
+ console.log(this.loader)
65
+ const genericErrorText = `无法上传文件: ${ file.name }.`;
66
+
67
+ xhr.addEventListener( 'error', () => reject( genericErrorText ) );
68
+ xhr.addEventListener( 'abort', () => reject() );
69
+ xhr.addEventListener( 'load', () => {
70
+ const response = xhr.response;
71
+ // 当code==200说明上传成功,可以增加弹框提示;
72
+ // 当上传失败时,必须调用reject()函数。
73
+
74
+ console.log('response', xhr)
75
+
76
+ if ( !response || response.error ) {
77
+ return reject( response && response.error ? response.error.message : genericErrorText );
78
+ }
79
+ //上传成功,从后台获取图片的url地址
80
+ resolve( {
81
+ default: response
82
+ } );
83
+ } );
84
+
85
+ // 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
86
+ if ( xhr.upload ) {
87
+ xhr.upload.addEventListener( 'progress', evt => {
88
+ if ( evt.lengthComputable ) {
89
+ loader.uploadTotal = evt.total;
90
+ loader.uploaded = evt.loaded;
91
+ }
92
+ } );
93
+ }
94
+ }
95
+
96
+ // 准备数据并发送请求
97
+ _sendRequest( file ) {
98
+ //通过FormData构造函数创建一个空对象
99
+ const data = new FormData();
100
+ //通过append()方法在末尾追加key为files值为file的数据
101
+
102
+ console.log('file',file)
103
+ data.append( 'file', file );//上传的参数data
104
+ // data.append( 'memberId', "666" );
105
+ /**
106
+ * 重要提示:这是实现诸如身份验证和CSRF保护等安全机制的正确位置。
107
+ * 例如,可以使用XMLHttpRequest.setRequestHeader()设置包含应用程序先前生成的CSRF令牌的请求头。
108
+ */
109
+ this.xhr.send( data );
110
+ }
111
+ }
112
+
113
+ function MyCustomUploadAdapterPlugin( editor ) {
114
+ editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
115
+ // 在这里将URL配置为后端上载脚本
116
+ return new MyUploadAdapter( loader );
117
+ }
118
+ }
119
+
120
+ export {
121
+ MyUploadAdapter,
122
+ MyCustomUploadAdapterPlugin
123
+ }
@@ -1,69 +1,69 @@
1
- import Command from "@ckeditor/ckeditor5-core/src/command";
2
- import { multipartUpload, ossFileUrl } from "./AliyunIssUtil";
3
- const ossConfig = {
4
- region: "oss-cn-zhangjiakou",
5
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
6
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
7
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
8
- // stsToken: '<Your securityToken(STS)>',
9
- bucket: "guoranopen-zjk",
10
- }
11
- export default class ImageCommand extends Command {
12
- refresh() {
13
- this.isEnabled = true;
14
- }
15
- execute() {
16
- var inputObj = document.createElement('input')
17
- inputObj.setAttribute('id', '_ef');
18
- inputObj.setAttribute('type', 'file');
19
- inputObj.setAttribute('accept','image/jpeg,image/png,image/gif,image/bmp,image/webp,image/tiff')
20
- inputObj.setAttribute("style", 'visibility:hidden');
21
- document.body.appendChild(inputObj);
22
- inputObj.click();
23
- inputObj.onchange = () => {
24
- // 循环上传文件
25
- let files = inputObj.files;
26
- for (let index = 0; index < files.length; index++) {
27
- const filed = files[index];
28
- this.upload(filed).then(res =>{
29
- let command = this.editor.commands.get("insertAskComponent");
30
- command.execute({
31
- tag: "img",
32
- options: {
33
- width:'100%',
34
- name: res.default,
35
- src: res.default
36
- },
37
- });
38
- })
39
- }
40
- }
41
- }
42
-
43
- upload(file) {
44
- return new Promise((resolve) => {
45
- /* this._initRequest();
46
- this._initListeners( resolve, reject, file );
47
- this._sendRequest( file );*/
48
- this.uploadFile(file, resolve)
49
- })
50
- }
51
- uploadFile(file, resolve) {
52
- let imgInfo = {
53
- url: '',
54
- }
55
- let res = multipartUpload(
56
- ossConfig,
57
- file,
58
- null,
59
- imgInfo
60
- );
61
- res.then(resp => {
62
- imgInfo.url = ossFileUrl(ossConfig, resp.name)
63
- console.log(imgInfo)
64
- resolve({
65
- default: imgInfo.url
66
- })
67
- })
68
- }
1
+ import Command from "@ckeditor/ckeditor5-core/src/command";
2
+ import { multipartUpload, ossFileUrl } from "./AliyunIssUtil";
3
+ const ossConfig = {
4
+ region: "oss-cn-zhangjiakou",
5
+ //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
6
+ accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
7
+ accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
8
+ // stsToken: '<Your securityToken(STS)>',
9
+ bucket: "guoranopen-zjk",
10
+ }
11
+ export default class ImageCommand extends Command {
12
+ refresh() {
13
+ this.isEnabled = true;
14
+ }
15
+ execute() {
16
+ var inputObj = document.createElement('input')
17
+ inputObj.setAttribute('id', '_ef');
18
+ inputObj.setAttribute('type', 'file');
19
+ inputObj.setAttribute('accept','image/jpeg,image/png,image/gif,image/bmp,image/webp,image/tiff')
20
+ inputObj.setAttribute("style", 'visibility:hidden');
21
+ document.body.appendChild(inputObj);
22
+ inputObj.click();
23
+ inputObj.onchange = () => {
24
+ // 循环上传文件
25
+ let files = inputObj.files;
26
+ for (let index = 0; index < files.length; index++) {
27
+ const filed = files[index];
28
+ this.upload(filed).then(res =>{
29
+ let command = this.editor.commands.get("insertAskComponent");
30
+ command.execute({
31
+ tag: "img",
32
+ options: {
33
+ width:'100%',
34
+ name: res.default,
35
+ src: res.default
36
+ },
37
+ });
38
+ })
39
+ }
40
+ }
41
+ }
42
+
43
+ upload(file) {
44
+ return new Promise((resolve) => {
45
+ /* this._initRequest();
46
+ this._initListeners( resolve, reject, file );
47
+ this._sendRequest( file );*/
48
+ this.uploadFile(file, resolve)
49
+ })
50
+ }
51
+ uploadFile(file, resolve) {
52
+ let imgInfo = {
53
+ url: '',
54
+ }
55
+ let res = multipartUpload(
56
+ ossConfig,
57
+ file,
58
+ null,
59
+ imgInfo
60
+ );
61
+ res.then(resp => {
62
+ imgInfo.url = ossFileUrl(ossConfig, resp.name)
63
+ console.log(imgInfo)
64
+ resolve({
65
+ default: imgInfo.url
66
+ })
67
+ })
68
+ }
69
69
  }
@@ -1,12 +1,12 @@
1
- import Plugin from "@ckeditor/ckeditor5-core/src/plugin";
2
- import ImageCommand from "./command";
3
- export default class MyimageUpload extends Plugin {
4
- static get pluginName() {
5
- return "imageUpload";
6
- }
7
- init() {
8
- const editor = this.editor;
9
- // 注册一个 BoldCommand 命令
10
- editor.commands.add('imageUpload', new ImageCommand(editor));
11
- }
1
+ import Plugin from "@ckeditor/ckeditor5-core/src/plugin";
2
+ import ImageCommand from "./command";
3
+ export default class MyimageUpload extends Plugin {
4
+ static get pluginName() {
5
+ return "imageUpload";
6
+ }
7
+ init() {
8
+ const editor = this.editor;
9
+ // 注册一个 BoldCommand 命令
10
+ editor.commands.add('imageUpload', new ImageCommand(editor));
11
+ }
12
12
  }
@@ -1,19 +1,19 @@
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
-
17
- export { formatDate };
18
-
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
+
17
+ export { formatDate };
18
+
19
19
  // 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,15 +1,15 @@
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
-
13
- export {
14
- randomNum
15
- }
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
+
13
+ export {
14
+ randomNum
15
+ }
@@ -1,12 +1,12 @@
1
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
2
- import ToolbarUI from './toolbar-ui'
3
- import ImageUpload from './editing'
4
-
5
- export default class MyimageUpload extends Plugin {
6
- static get requires() {
7
- return [ImageUpload, ToolbarUI];
8
- }
9
- static get pluginName() {
10
- return 'MyimageUpload';
11
- }
1
+ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
2
+ import ToolbarUI from './toolbar-ui'
3
+ import ImageUpload from './editing'
4
+
5
+ export default class MyimageUpload extends Plugin {
6
+ static get requires() {
7
+ return [ImageUpload, ToolbarUI];
8
+ }
9
+ static get pluginName() {
10
+ return 'MyimageUpload';
11
+ }
12
12
  }