askbot-dragon 0.7.57 → 0.7.60
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/package.json +2 -1
- package/src/components/ConversationContainer.vue +0 -3
- package/src/components/formTemplate.vue +17 -6
- package/src/components/utils/ckeditor.js +3 -4
- package/src/components/utils/command.js +69 -0
- package/src/components/utils/editing.js +12 -0
- package/src/components/utils/plugin-image.js +12 -0
- package/src/components/utils/toolbar-ui.js +42 -0
- package/src/main.js +2 -1
- package/vue.config.js +2 -2
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askbot-dragon",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.60",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
7
7
|
"lint": "vue-cli-service lint"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
+
"@ckeditor/ckeditor5-ui": "^10.1.0",
|
|
10
11
|
"@ckeditor/ckeditor5-vue": "^1.0.3",
|
|
11
12
|
"ali-oss": "^6.2.1",
|
|
12
13
|
"ckeditor": "^4.12.1",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<!-- 消息记录容器 -->
|
|
2
2
|
<template>
|
|
3
3
|
<div id="conversation">
|
|
4
|
-
<asset-message></asset-message>
|
|
5
4
|
<!-- <asser-deatils></asser-deatils> -->
|
|
6
5
|
<msg-loading v-if="inLoading"></msg-loading>
|
|
7
6
|
<div style="position: relative" class="img_div">
|
|
@@ -64,7 +63,6 @@ import AnswerDissatisfaction from "./answerDissatisfaction";
|
|
|
64
63
|
import ActionSendToBot from "./actionSendToBot";
|
|
65
64
|
import VoiceCompontent from './voiceComponent'
|
|
66
65
|
// import AsserDeatils from './assetDetails.vue'
|
|
67
|
-
import AssetMessage from './assetMessage.vue'
|
|
68
66
|
/* import TicketMessage from "@/components/message/TicketMessage";
|
|
69
67
|
import TicketMessage from "@/components/message/TicketMessage";
|
|
70
68
|
import TextMessage from "@/components/message/TextMessage";
|
|
@@ -87,7 +85,6 @@ export default {
|
|
|
87
85
|
/* VoiceComponent,*/
|
|
88
86
|
TicketMessage,
|
|
89
87
|
// AsserDeatils,
|
|
90
|
-
AssetMessage,
|
|
91
88
|
AnswerRadio,
|
|
92
89
|
FormTemplate,
|
|
93
90
|
TextMessage,
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
accept="image/*"
|
|
166
166
|
name="file"
|
|
167
167
|
action="/open/media/file/upload"
|
|
168
|
-
:multiple="false"
|
|
168
|
+
:multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
|
|
169
169
|
:file-list="fileListList[item.fieldId]"
|
|
170
170
|
:limit=item.formField.extInfo.limitNum?Number(item.formField.extInfo.limitNum):1
|
|
171
171
|
:before-upload="beforeAvatarUpload"
|
|
@@ -227,6 +227,7 @@
|
|
|
227
227
|
<ckeditor
|
|
228
228
|
:editor="ckeditor.editor"
|
|
229
229
|
v-model="item.value"
|
|
230
|
+
@onReady="onReady"
|
|
230
231
|
:config="ckeditor.editorConfig"
|
|
231
232
|
></ckeditor>
|
|
232
233
|
</div>
|
|
@@ -407,10 +408,10 @@
|
|
|
407
408
|
<van-uploader
|
|
408
409
|
v-model="fileListList[item.fieldId]"
|
|
409
410
|
:before-read="beforeRead"
|
|
410
|
-
:max-count='item.formField.extInfo.limitNum
|
|
411
|
+
:max-count='item.formField.extInfo&&item.formField.extInfo.limitNum?item.formField.extInfo.limitNum:1'
|
|
411
412
|
:after-read="afterRead"
|
|
412
413
|
accept="image/*"
|
|
413
|
-
:multiple=false
|
|
414
|
+
:multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
|
|
414
415
|
>
|
|
415
416
|
<div class="vant-upload--picture-card">
|
|
416
417
|
<i class="el-icon-plus"></i>
|
|
@@ -448,10 +449,13 @@
|
|
|
448
449
|
</template>
|
|
449
450
|
|
|
450
451
|
<script>
|
|
452
|
+
/* eslint-disable */
|
|
451
453
|
let that
|
|
452
454
|
import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
|
|
453
455
|
import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
|
|
456
|
+
import MyimageUpload from './utils/plugin-image'
|
|
454
457
|
import CKEDITOR from 'ckeditor'
|
|
458
|
+
|
|
455
459
|
export default {
|
|
456
460
|
name: "formTemplate",
|
|
457
461
|
data() {
|
|
@@ -537,9 +541,9 @@ export default {
|
|
|
537
541
|
ckeditor: {
|
|
538
542
|
editor: CKEDITOR.ClassicEditor,
|
|
539
543
|
editorConfig: {
|
|
540
|
-
extraPlugins: [MyCustomUploadAdapterPlugin],
|
|
544
|
+
extraPlugins: [MyimageUpload,MyCustomUploadAdapterPlugin],
|
|
541
545
|
toolbar: [
|
|
542
|
-
'
|
|
546
|
+
'MyimageUpload'
|
|
543
547
|
]
|
|
544
548
|
},
|
|
545
549
|
},
|
|
@@ -607,7 +611,6 @@ export default {
|
|
|
607
611
|
})
|
|
608
612
|
},
|
|
609
613
|
created() {
|
|
610
|
-
|
|
611
614
|
if(this.disable===true)
|
|
612
615
|
{
|
|
613
616
|
this.disableds=true
|
|
@@ -623,6 +626,10 @@ export default {
|
|
|
623
626
|
that.defaultClick()
|
|
624
627
|
},
|
|
625
628
|
methods: {
|
|
629
|
+
onReady(){
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
},
|
|
626
633
|
beforeRead(file){
|
|
627
634
|
console.debug('file',file)
|
|
628
635
|
console.debug('fileType',!Array.isArray(file))
|
|
@@ -1954,6 +1961,10 @@ export default {
|
|
|
1954
1961
|
background-color: #366aff!important;
|
|
1955
1962
|
border-color: #366aff!important;
|
|
1956
1963
|
}
|
|
1964
|
+
/deep/.ck .ck-icon {
|
|
1965
|
+
width: 14px !important;
|
|
1966
|
+
height: 14px !important;
|
|
1967
|
+
}
|
|
1957
1968
|
}
|
|
1958
1969
|
|
|
1959
1970
|
</style>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
|
|
2
|
+
|
|
2
3
|
const ossConfig={
|
|
3
4
|
region: "oss-cn-zhangjiakou",
|
|
4
5
|
//云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
|
|
@@ -78,7 +79,7 @@ class MyUploadAdapter {
|
|
|
78
79
|
//上传成功,从后台获取图片的url地址
|
|
79
80
|
resolve( {
|
|
80
81
|
default: response
|
|
81
|
-
} );
|
|
82
|
+
} );
|
|
82
83
|
} );
|
|
83
84
|
|
|
84
85
|
// 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
|
|
@@ -111,11 +112,9 @@ class MyUploadAdapter {
|
|
|
111
112
|
|
|
112
113
|
function MyCustomUploadAdapterPlugin( editor ) {
|
|
113
114
|
editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
|
|
114
|
-
console.log('loader',loader)
|
|
115
|
-
|
|
116
115
|
// 在这里将URL配置为后端上载脚本
|
|
117
116
|
return new MyUploadAdapter( loader );
|
|
118
|
-
}
|
|
117
|
+
}
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
export {
|
|
@@ -0,0 +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
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import Plugin from "@ckeditor/ckeditor5-core/src/plugin";
|
|
3
|
+
import ButtonView from "@ckeditor/ckeditor5-ui/src/button/buttonview";
|
|
4
|
+
// import aoteman from "@ckeditor/ckeditor5-basic-styles/theme/icons/bold.svg";
|
|
5
|
+
import aoteman from '../../assets/image/2.jpg'
|
|
6
|
+
|
|
7
|
+
// console.log(aoteman.replace('/',''));
|
|
8
|
+
export default class BoldToolbarUI extends Plugin {
|
|
9
|
+
init() {
|
|
10
|
+
this._createToolbarButton();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
_createToolbarButton() {
|
|
14
|
+
const editor = this.editor;
|
|
15
|
+
const command = editor.commands.get('imageUpload');
|
|
16
|
+
editor.ui.componentFactory.add('MyimageUpload', (locale) => {
|
|
17
|
+
const view = new ButtonView(locale);
|
|
18
|
+
view.set({
|
|
19
|
+
label: '上传图片',
|
|
20
|
+
tooltip: true,
|
|
21
|
+
withText: true, // 在按钮上展示 label
|
|
22
|
+
icon:`<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
23
|
+
viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
|
|
24
|
+
<path d="M182,4.2H18c-9.9,0-18,8-18,18l0,0v156c0.2,9.7,8.3,17.5,18,17.5h164c9.7,0,17.8-7.8,18-17.5v-156C200,12.3,192,4.2,182,4.2
|
|
25
|
+
z M152.5,101.2c-3.1-2.3-7.5-2.3-10.6,0l-31.1,26.1L67.9,58.5c-3.4-3.7-8.9-3.9-12.6-0.6c-0.2,0.2-0.3,0.3-0.6,0.6L18,99.3V22.2h164
|
|
26
|
+
v91.3L152.5,101.2z" fill="#333333"/>
|
|
27
|
+
<path d="M145.8,38.3c-14,0-25.3,11.3-25.3,25.3s11.3,25.3,25.3,25.3s25.3-11.3,25.3-25.3l0,0C171.1,49.6,159.7,38.3,145.8,38.3z
|
|
28
|
+
M145.8,70.3c-4,0-7.3-3.2-7.3-7.3s3.2-7.3,7.3-7.3s7.3,3.2,7.3,7.3c0.2,4-2.8,7.4-6.8,7.6c-0.1,0-0.3,0-0.4,0V70.3z" fill="#333333"/>
|
|
29
|
+
</svg>`,
|
|
30
|
+
class:'icon'
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// console.log(Template);
|
|
34
|
+
// 将按钮的状态关联到命令对应值上
|
|
35
|
+
view.bind("isOn", "isEnabled").to(command, "value", "isEnabled");
|
|
36
|
+
// 点击按钮时触发相应命令
|
|
37
|
+
this.listenTo(view, "execute", () => editor.execute('imageUpload'));
|
|
38
|
+
return view;
|
|
39
|
+
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
2
|
import App from './App.vue'
|
|
3
|
-
import VueResource from
|
|
3
|
+
import VueResource from 'vue-resource'
|
|
4
4
|
import ElementUI from 'element-ui';
|
|
5
5
|
import { requestUrl } from './api/index';
|
|
6
6
|
import { utils } from '../src/components/utils/index';
|
|
@@ -11,6 +11,7 @@ import Vant from 'vant';
|
|
|
11
11
|
import 'vant/lib/index.css';
|
|
12
12
|
|
|
13
13
|
import CKEditor from '@ckeditor/ckeditor5-vue';
|
|
14
|
+
|
|
14
15
|
Vue.use(CKEditor);
|
|
15
16
|
/*import VConsole from 'vconsole'
|
|
16
17
|
const vConsole = new VConsole();
|