askbot-dragon 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -27
- package/babel.config.js +6 -6
- package/dragon.iml +7 -7
- package/package.json +55 -55
- package/public/index.html +43 -43
- package/src/App.vue +31 -31
- package/src/api/index.js +1 -1
- package/src/api/mock.http +2 -2
- package/src/api/requestUrl.js +185 -185
- package/src/assets/js/AliyunlssUtil.js +92 -92
- package/src/assets/js/Base64Util.js +22 -22
- package/src/assets/js/script.js +36 -36
- package/src/assets/less/common.css +6773 -6773
- package/src/assets/less/converSationContainer/common.less +191 -191
- package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
- package/src/assets/less/iconfont.css +37 -37
- package/src/assets/less/ticketMessage.less +211 -211
- package/src/components/ActionAlertIframe.vue +112 -112
- package/src/components/AiGuide.vue +467 -467
- package/src/components/AskIFrame.vue +15 -15
- package/src/components/ConversationContainer.vue +3668 -1557
- package/src/components/FileType.vue +86 -86
- package/src/components/Message.vue +27 -27
- package/src/components/actionSatisfaction.vue +107 -107
- package/src/components/actionSendToBot.vue +62 -62
- package/src/components/answerDissatisfaction.vue +62 -62
- package/src/components/answerRadio.vue +76 -76
- package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
- package/src/components/ask-components/Msgloading.vue +37 -37
- package/src/components/ask-components/SatisfactionV2.vue +15 -15
- package/src/components/askVideo.vue +138 -138
- package/src/components/assetDetails.vue +370 -370
- package/src/components/assetMessage.vue +228 -228
- package/src/components/associationIntention.vue +229 -229
- package/src/components/botActionSatisfactor.vue +68 -68
- package/src/components/chatContent.vue +513 -513
- package/src/components/feedBack.vue +136 -136
- package/src/components/file/AliyunOssComponents.vue +108 -108
- package/src/components/formTemplate.vue +3101 -2888
- package/src/components/loadingProcess.vue +164 -164
- package/src/components/message/ActionAlertIframe.vue +112 -112
- package/src/components/message/ShopMessage.vue +164 -164
- package/src/components/message/TextMessage.vue +924 -924
- package/src/components/message/TicketMessage.vue +177 -177
- package/src/components/message/swiper/index.js +4 -4
- package/src/components/message/swiper/ticketSwiper.vue +502 -502
- package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
- package/src/components/msgLoading.vue +231 -231
- package/src/components/myPopup.vue +70 -70
- package/src/components/popup.vue +227 -227
- package/src/components/recommend.vue +89 -89
- package/src/components/selector/hOption.vue +20 -20
- package/src/components/selector/hSelector.vue +199 -199
- package/src/components/selector/hWrapper.vue +216 -216
- package/src/components/senderMessagePlatform.vue +50 -0
- package/src/components/source/BotMessage.vue +24 -24
- package/src/components/source/CustomMessage.vue +24 -24
- package/src/components/test.vue +260 -260
- package/src/components/tree.vue +247 -185
- package/src/components/utils/AliyunIssUtil.js +72 -72
- package/src/components/utils/ckeditor.js +123 -123
- package/src/components/utils/command.js +87 -87
- package/src/components/utils/editing.js +11 -11
- package/src/components/utils/format_date.js +25 -25
- package/src/components/utils/index.js +6 -6
- package/src/components/utils/math_utils.js +29 -15
- package/src/components/utils/plugin-image.js +11 -11
- package/src/components/utils/toolbar-ui.js +41 -41
- package/src/components/voiceComponent.vue +119 -119
- package/src/main.js +45 -45
- package/vue.config.js +47 -47
|
@@ -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,88 +1,88 @@
|
|
|
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(file) {
|
|
16
|
-
if (file){
|
|
17
|
-
this.forEachFiles(file.file)
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
var inputObj = document.createElement('input')
|
|
21
|
-
inputObj.setAttribute('id', '_ef');
|
|
22
|
-
inputObj.setAttribute('type', 'file');
|
|
23
|
-
inputObj.setAttribute('accept','image/jpeg,image/png,image/gif,image/bmp,image/webp,image/tiff')
|
|
24
|
-
inputObj.setAttribute("style", 'visibility:hidden');
|
|
25
|
-
document.body.appendChild(inputObj);
|
|
26
|
-
inputObj.click();
|
|
27
|
-
inputObj.onchange = () => {
|
|
28
|
-
// 循环上传文件
|
|
29
|
-
let files = inputObj.files;
|
|
30
|
-
for (let index = 0; index < files.length; index++) {
|
|
31
|
-
const filed = files[index];
|
|
32
|
-
this.upload(filed).then(res =>{
|
|
33
|
-
let command = this.editor.commands.get("insertAskComponent");
|
|
34
|
-
command.execute({
|
|
35
|
-
tag: "img",
|
|
36
|
-
options: {
|
|
37
|
-
width:'100%',
|
|
38
|
-
name: res.default,
|
|
39
|
-
src: res.default
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
forEachFiles(files){
|
|
47
|
-
for (let index = 0; index < files.length; index++) {
|
|
48
|
-
const filed = files[index];
|
|
49
|
-
this.upload(filed).then(res =>{
|
|
50
|
-
let command = this.editor.commands.get("insertAskComponent");
|
|
51
|
-
command.execute({
|
|
52
|
-
tag: "img",
|
|
53
|
-
options: {
|
|
54
|
-
width:'100%',
|
|
55
|
-
name: res.default,
|
|
56
|
-
src: res.default
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
upload(file) {
|
|
63
|
-
return new Promise((resolve) => {
|
|
64
|
-
/* this._initRequest();
|
|
65
|
-
this._initListeners( resolve, reject, file );
|
|
66
|
-
this._sendRequest( file );*/
|
|
67
|
-
this.uploadFile(file, resolve)
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
uploadFile(file, resolve) {
|
|
71
|
-
let imgInfo = {
|
|
72
|
-
url: '',
|
|
73
|
-
}
|
|
74
|
-
let res = multipartUpload(
|
|
75
|
-
ossConfig,
|
|
76
|
-
file,
|
|
77
|
-
null,
|
|
78
|
-
imgInfo
|
|
79
|
-
);
|
|
80
|
-
res.then(resp => {
|
|
81
|
-
imgInfo.url = ossFileUrl(ossConfig, resp.name)
|
|
82
|
-
console.log(imgInfo)
|
|
83
|
-
resolve({
|
|
84
|
-
default: imgInfo.url
|
|
85
|
-
})
|
|
86
|
-
})
|
|
87
|
-
}
|
|
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(file) {
|
|
16
|
+
if (file){
|
|
17
|
+
this.forEachFiles(file.file)
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
var inputObj = document.createElement('input')
|
|
21
|
+
inputObj.setAttribute('id', '_ef');
|
|
22
|
+
inputObj.setAttribute('type', 'file');
|
|
23
|
+
inputObj.setAttribute('accept','image/jpeg,image/png,image/gif,image/bmp,image/webp,image/tiff')
|
|
24
|
+
inputObj.setAttribute("style", 'visibility:hidden');
|
|
25
|
+
document.body.appendChild(inputObj);
|
|
26
|
+
inputObj.click();
|
|
27
|
+
inputObj.onchange = () => {
|
|
28
|
+
// 循环上传文件
|
|
29
|
+
let files = inputObj.files;
|
|
30
|
+
for (let index = 0; index < files.length; index++) {
|
|
31
|
+
const filed = files[index];
|
|
32
|
+
this.upload(filed).then(res =>{
|
|
33
|
+
let command = this.editor.commands.get("insertAskComponent");
|
|
34
|
+
command.execute({
|
|
35
|
+
tag: "img",
|
|
36
|
+
options: {
|
|
37
|
+
width:'100%',
|
|
38
|
+
name: res.default,
|
|
39
|
+
src: res.default
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
forEachFiles(files){
|
|
47
|
+
for (let index = 0; index < files.length; index++) {
|
|
48
|
+
const filed = files[index];
|
|
49
|
+
this.upload(filed).then(res =>{
|
|
50
|
+
let command = this.editor.commands.get("insertAskComponent");
|
|
51
|
+
command.execute({
|
|
52
|
+
tag: "img",
|
|
53
|
+
options: {
|
|
54
|
+
width:'100%',
|
|
55
|
+
name: res.default,
|
|
56
|
+
src: res.default
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
upload(file) {
|
|
63
|
+
return new Promise((resolve) => {
|
|
64
|
+
/* this._initRequest();
|
|
65
|
+
this._initListeners( resolve, reject, file );
|
|
66
|
+
this._sendRequest( file );*/
|
|
67
|
+
this.uploadFile(file, resolve)
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
uploadFile(file, resolve) {
|
|
71
|
+
let imgInfo = {
|
|
72
|
+
url: '',
|
|
73
|
+
}
|
|
74
|
+
let res = multipartUpload(
|
|
75
|
+
ossConfig,
|
|
76
|
+
file,
|
|
77
|
+
null,
|
|
78
|
+
imgInfo
|
|
79
|
+
);
|
|
80
|
+
res.then(resp => {
|
|
81
|
+
imgInfo.url = ossFileUrl(ossConfig, resp.name)
|
|
82
|
+
console.log(imgInfo)
|
|
83
|
+
resolve({
|
|
84
|
+
default: imgInfo.url
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
88
|
}
|
|
@@ -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,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,15 +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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
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,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
|
}
|