askbot-dragon 1.7.28-beta → 1.7.31-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.
- package/package.json +2 -4
- package/src/assets/js/AliyunlssUtil.js +9 -32
- package/src/components/AnswerDocknowledge.vue +93 -101
- package/src/components/ConversationContainer.vue +17 -6
- package/src/components/MyEditor.vue +10 -1
- package/src/components/QwFeedback.vue +302 -0
- package/src/components/askVideo.vue +2 -2
- package/src/components/formTemplate.vue +14 -4
- package/src/components/intelligentSummary.vue +12 -14
- package/src/components/pdfPosition.vue +58 -66
- package/src/components/previewPdf.vue +21 -16
- package/src/components/utils/AliyunIssUtil.js +12 -33
- package/src/components/utils/ckeditor.js +48 -59
- package/src/main.js +0 -16
- package/src/components/imgView.vue +0 -32
- package/src/components/markDownText.vue +0 -164
- package/src/locales/cn.json +0 -26
- package/src/locales/en.json +0 -26
|
@@ -5,33 +5,34 @@
|
|
|
5
5
|
另外增加了在知识项目中预览当前文件的一些功能
|
|
6
6
|
-->
|
|
7
7
|
<template>
|
|
8
|
-
<el-drawer title="" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
|
|
8
|
+
<el-drawer title="我是标题" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
|
|
9
9
|
:modal="false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
|
|
10
10
|
custom-class="pdf-preview-drawer" v-if="drawer">
|
|
11
|
+
<!-- v-else-if="drawer" -->
|
|
11
12
|
<div class="drawer-header" :class="isLiBang ? 'libang_head' : ''" v-if="!isPc">
|
|
12
13
|
<div class="header-btn btn_position">
|
|
13
14
|
<div class="onload_btn" v-if="isDownload" @click="downLoad">
|
|
14
|
-
|
|
15
|
+
下载
|
|
15
16
|
</div>
|
|
16
17
|
<div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
|
|
17
18
|
<i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
|
|
18
|
-
<span
|
|
19
|
+
<span>智能摘要</span>
|
|
19
20
|
</div>
|
|
20
21
|
<template v-if="isHasChat">
|
|
21
22
|
<div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
|
|
22
23
|
<i class="iconfont guoran-wendapingjia"></i>
|
|
23
|
-
|
|
24
|
+
聊一聊
|
|
24
25
|
</div>
|
|
25
26
|
<div class="chat chat_active" @click="previewToDialog(false)" v-else>
|
|
26
27
|
<i class="iconfont guoran-wendapingjia"></i>
|
|
27
|
-
|
|
28
|
+
聊一聊
|
|
28
29
|
</div>
|
|
29
30
|
</template>
|
|
30
31
|
</div>
|
|
31
32
|
<div class="header_title">
|
|
32
33
|
<div class="header_close">
|
|
33
34
|
<span class="title_left">
|
|
34
|
-
{{ title ? title :
|
|
35
|
+
{{ title ? title : "查看详情" }}
|
|
35
36
|
</span>
|
|
36
37
|
<section @click="close">
|
|
37
38
|
<i class="iconfont guoran-shanchu"></i>
|
|
@@ -48,25 +49,25 @@
|
|
|
48
49
|
<div class="header_title">
|
|
49
50
|
<div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
|
|
50
51
|
<span class="title_left">
|
|
51
|
-
{{ title ? title :
|
|
52
|
+
{{ title ? title : "查看详情" }}
|
|
52
53
|
</span>
|
|
53
54
|
<div class="header-btn">
|
|
54
|
-
<div class="onload_btn" v-if="isDownload" @click="downLoad">
|
|
55
|
-
|
|
55
|
+
<div class="onload_btn" v-if="isDownload || true" @click="downLoad">
|
|
56
|
+
下载
|
|
56
57
|
</div>
|
|
57
58
|
<div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
|
|
58
|
-
v-if="isHasChat">
|
|
59
|
+
v-if="isHasChat || true">
|
|
59
60
|
<i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
|
|
60
|
-
<span
|
|
61
|
+
<span>智能摘要</span>
|
|
61
62
|
</div>
|
|
62
|
-
<template v-if="isHasChat">
|
|
63
|
+
<template v-if="isHasChat || true">
|
|
63
64
|
<div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
|
|
64
65
|
<i class="iconfont guoran-wendapingjia"></i>
|
|
65
|
-
|
|
66
|
+
聊一聊
|
|
66
67
|
</div>
|
|
67
68
|
<div class="chat chat_active" @click="previewToDialog(false)" v-else>
|
|
68
69
|
<i class="iconfont guoran-wendapingjia"></i>
|
|
69
|
-
|
|
70
|
+
聊一聊
|
|
70
71
|
</div>
|
|
71
72
|
</template>
|
|
72
73
|
<section @click="close">
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
</div>
|
|
83
84
|
</div>
|
|
84
85
|
<div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
|
|
86
|
+
<!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
|
|
85
87
|
<intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
|
|
86
88
|
@closeSummary="closeSummary" @recommendQues="recommendQues"
|
|
87
89
|
@getSummarySuccess="getSummarySuccess"></intelligent-summary>
|
|
@@ -94,7 +96,7 @@
|
|
|
94
96
|
<video :src="url" controls width="100%;" height="98%"></video>
|
|
95
97
|
</div>
|
|
96
98
|
<div v-else-if="fileType == 'HTML'" style="width: 100%;">
|
|
97
|
-
<div class="preview_iframe_html" style="text-
|
|
99
|
+
<div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
|
|
98
100
|
</div>
|
|
99
101
|
<template v-else-if="url.includes('https://www') || url.includes('http://www')">
|
|
100
102
|
<iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
|
|
@@ -105,6 +107,9 @@
|
|
|
105
107
|
:style="{ height: iframeHeight }"></iframe>
|
|
106
108
|
</template>
|
|
107
109
|
</template>
|
|
110
|
+
<!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
|
|
111
|
+
下载
|
|
112
|
+
</div> -->
|
|
108
113
|
</div>
|
|
109
114
|
<div class="loading_img" v-show="loading">
|
|
110
115
|
<img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
|
|
@@ -392,7 +397,7 @@ export default {
|
|
|
392
397
|
selection.addRange(range);
|
|
393
398
|
document.execCommand('copy');
|
|
394
399
|
selection.removeAllRanges()
|
|
395
|
-
Toast(
|
|
400
|
+
Toast('下载地址已复制,请前往Safari浏览器访问下载');
|
|
396
401
|
this.close()
|
|
397
402
|
},100)
|
|
398
403
|
} else {
|
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
// const OSS = require('ali-oss');
|
|
2
2
|
const OSS = window.OSS
|
|
3
3
|
|
|
4
|
-
const getPrivateOssConfig = () => {
|
|
5
|
-
let mainSource = sessionStorage.getItem('_mainSource') ? sessionStorage.getItem('_mainSource') : "askbot";
|
|
6
|
-
switch (mainSource) {
|
|
7
|
-
case "askbot":
|
|
8
|
-
return {
|
|
9
|
-
region: "oss-cn-zhangjiakou",
|
|
10
|
-
accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
|
|
11
|
-
accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
|
|
12
|
-
bucket: "guoranopen-zjk",
|
|
13
|
-
}
|
|
14
|
-
case "lishi":
|
|
15
|
-
return {
|
|
16
|
-
region: "oss-ap-southeast-1",
|
|
17
|
-
accessKeyId: "LTAI5tAusPLDNJJwkvUbqi2T",
|
|
18
|
-
accessKeySecret: "xqPVaunOIbvTe3g9qsXal2IZO6RftK",
|
|
19
|
-
bucket: "askbotopen-ls",
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
4
|
let IDX = 256, HEX = [], SIZE = 256, BUFFER;
|
|
25
5
|
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
|
|
26
6
|
let mainId = sessionStorage.getItem('_mainId') ? sessionStorage.getItem('_mainId') : "";
|
|
@@ -56,12 +36,12 @@ function pathGenerate(filename) {
|
|
|
56
36
|
}
|
|
57
37
|
|
|
58
38
|
|
|
59
|
-
function upload(data) {
|
|
60
|
-
let ossClient = new OSS(
|
|
39
|
+
function upload(ossConfig, data) {
|
|
40
|
+
let ossClient = new OSS(ossConfig);
|
|
61
41
|
// object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
|
|
62
42
|
let objectKey = pathGenerate(data.name);
|
|
63
|
-
let result =
|
|
64
|
-
headers:
|
|
43
|
+
let result = ossClient.put(objectKey, data, {
|
|
44
|
+
headers:{
|
|
65
45
|
// 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
|
|
66
46
|
'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
|
|
67
47
|
},
|
|
@@ -70,13 +50,13 @@ function upload(data) {
|
|
|
70
50
|
return result;
|
|
71
51
|
}
|
|
72
52
|
|
|
73
|
-
function multipartUpload(data, callback,
|
|
74
|
-
let ossClient = new OSS(
|
|
53
|
+
function multipartUpload(ossConfig, data, callback,extCallback) {
|
|
54
|
+
let ossClient = new OSS(ossConfig);
|
|
75
55
|
// object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
|
|
76
56
|
let objectKey = pathGenerate(data.name);
|
|
77
57
|
|
|
78
|
-
let res =
|
|
79
|
-
headers:
|
|
58
|
+
let res = ossClient.multipartUpload(objectKey, data, {
|
|
59
|
+
headers:{
|
|
80
60
|
// 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
|
|
81
61
|
'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
|
|
82
62
|
},
|
|
@@ -84,15 +64,14 @@ function multipartUpload(data, callback, extCallback) {
|
|
|
84
64
|
console.debug('progress callback', p, checkpoint);
|
|
85
65
|
// 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
|
|
86
66
|
if (callback && callback instanceof Function) {
|
|
87
|
-
callback(p, checkpoint,
|
|
67
|
+
callback(p, checkpoint,data,extCallback);
|
|
88
68
|
}
|
|
89
69
|
}
|
|
90
70
|
})
|
|
91
|
-
|
|
71
|
+
return res;
|
|
92
72
|
}
|
|
93
73
|
|
|
94
|
-
function ossFileUrl(path, cname) {
|
|
95
|
-
let ossConfig = getPrivateOssConfig();
|
|
74
|
+
function ossFileUrl(ossConfig, path, cname) {
|
|
96
75
|
if (cname == null) {
|
|
97
76
|
return 'https://' + ossConfig.bucket + '.' + ossConfig.region + '.aliyuncs.com/' + path;
|
|
98
77
|
} else {
|
|
@@ -100,4 +79,4 @@ function ossFileUrl(path, cname) {
|
|
|
100
79
|
}
|
|
101
80
|
}
|
|
102
81
|
|
|
103
|
-
export {
|
|
82
|
+
export {upload, multipartUpload, ossFileUrl}
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import {
|
|
2
|
+
import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
|
|
12
|
-
accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
|
|
13
|
-
bucket: "guoranopen-zjk",
|
|
14
|
-
}
|
|
15
|
-
case "lishi":
|
|
16
|
-
return {
|
|
17
|
-
region: "oss-ap-southeast-1",
|
|
18
|
-
accessKeyId: "LTAI5tAusPLDNJJwkvUbqi2T",
|
|
19
|
-
accessKeySecret: "xqPVaunOIbvTe3g9qsXal2IZO6RftK",
|
|
20
|
-
bucket: "askbotopen-ls",
|
|
21
|
-
};
|
|
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",
|
|
22
11
|
}
|
|
23
|
-
}
|
|
24
12
|
class MyUploadAdapter {
|
|
25
|
-
constructor(loader, editor) {
|
|
13
|
+
constructor( loader , editor ) {
|
|
26
14
|
// 要在上载期间使用的文件加载器实例
|
|
27
15
|
this.loader = loader;
|
|
28
16
|
this.editor = editor
|
|
@@ -31,7 +19,7 @@ class MyUploadAdapter {
|
|
|
31
19
|
// 启动上载过程
|
|
32
20
|
upload() {
|
|
33
21
|
return this.loader.file
|
|
34
|
-
.then(file => new Promise(() => {
|
|
22
|
+
.then( file => new Promise(() => {
|
|
35
23
|
/* this._initRequest();
|
|
36
24
|
this._initListeners( resolve, reject, file );
|
|
37
25
|
this._sendRequest( file );*/
|
|
@@ -49,8 +37,8 @@ class MyUploadAdapter {
|
|
|
49
37
|
options: {
|
|
50
38
|
name: file.name + '正在上传...',
|
|
51
39
|
data: uid,
|
|
52
|
-
editable:
|
|
53
|
-
type:
|
|
40
|
+
editable:false,
|
|
41
|
+
type:'upload'
|
|
54
42
|
}
|
|
55
43
|
})
|
|
56
44
|
this.uploadFile(file)
|
|
@@ -59,32 +47,33 @@ class MyUploadAdapter {
|
|
|
59
47
|
|
|
60
48
|
// 中止上载过程
|
|
61
49
|
abort() {
|
|
62
|
-
if (this.xhr) {
|
|
50
|
+
if ( this.xhr ) {
|
|
63
51
|
this.xhr.abort();
|
|
64
52
|
}
|
|
65
53
|
}
|
|
66
|
-
uploadFile(file)
|
|
54
|
+
uploadFile(file){
|
|
67
55
|
let imgInfo = {
|
|
68
|
-
url:
|
|
56
|
+
url:'',
|
|
69
57
|
}
|
|
70
58
|
let res = multipartUpload(
|
|
59
|
+
ossConfig,
|
|
71
60
|
file,
|
|
72
61
|
null,
|
|
73
62
|
imgInfo
|
|
74
63
|
);
|
|
75
|
-
res.then(resp
|
|
76
|
-
imgInfo.url = ossFileUrl(resp.name)
|
|
77
|
-
let root =
|
|
64
|
+
res.then(resp=>{
|
|
65
|
+
imgInfo.url = ossFileUrl(ossConfig, resp.name)
|
|
66
|
+
let root = this.editor.model.document.getRoot()
|
|
78
67
|
let children = root.getChildren()
|
|
79
|
-
for
|
|
68
|
+
for(let child of children){
|
|
80
69
|
for (let index = 0; index < child._children._nodes.length; index++) {
|
|
81
|
-
if
|
|
82
|
-
if
|
|
70
|
+
if(child._children._nodes[index].name == 'askComponentPlaceholderContainer'){
|
|
71
|
+
if(child._children._nodes[index]._children._nodes[0]) {
|
|
83
72
|
let attrs = child._children._nodes[index]._children._nodes[0]._attrs
|
|
84
|
-
if
|
|
73
|
+
if(attrs) {
|
|
85
74
|
let attrsList = [...attrs.keys()]
|
|
86
75
|
for (let j = 0; j < attrsList.length; j++) {
|
|
87
|
-
if
|
|
76
|
+
if(attrsList[j] == 'data') {
|
|
88
77
|
// this.editor.uploadImg = this.editor.uploadImg.filter(id =>{return id != attrs.get(attrsList[j])})
|
|
89
78
|
this.editor.model.change(writer => {
|
|
90
79
|
writer.remove(child._children._nodes[index]);
|
|
@@ -100,7 +89,7 @@ class MyUploadAdapter {
|
|
|
100
89
|
command.execute({
|
|
101
90
|
tag: "img",
|
|
102
91
|
options: {
|
|
103
|
-
width:
|
|
92
|
+
width:'100%',
|
|
104
93
|
alt: resp.name + 0,
|
|
105
94
|
src: imgInfo.url
|
|
106
95
|
},
|
|
@@ -114,68 +103,68 @@ class MyUploadAdapter {
|
|
|
114
103
|
_initRequest() {
|
|
115
104
|
const xhr = this.xhr = new XMLHttpRequest();
|
|
116
105
|
console.log(xhr)
|
|
117
|
-
xhr.open('POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true);
|
|
106
|
+
xhr.open( 'POST', '/open-api/oss/public?token=8c98087dfd2d48f856d8c95c09115def', true );
|
|
118
107
|
xhr.responseType = '';
|
|
119
108
|
}
|
|
120
109
|
|
|
121
110
|
// 初始化 XMLHttpRequest 监听.
|
|
122
|
-
_initListeners(resolve, reject, file) {
|
|
111
|
+
_initListeners( resolve, reject, file ) {
|
|
123
112
|
const xhr = this.xhr;
|
|
124
113
|
const loader = this.loader;
|
|
125
114
|
console.log(this.loader)
|
|
126
|
-
const genericErrorText = `无法上传文件: ${file.name}.`;
|
|
115
|
+
const genericErrorText = `无法上传文件: ${ file.name }.`;
|
|
127
116
|
|
|
128
|
-
xhr.addEventListener('error', () => reject(genericErrorText));
|
|
129
|
-
xhr.addEventListener('abort', () => reject());
|
|
130
|
-
xhr.addEventListener('load', () => {
|
|
117
|
+
xhr.addEventListener( 'error', () => reject( genericErrorText ) );
|
|
118
|
+
xhr.addEventListener( 'abort', () => reject() );
|
|
119
|
+
xhr.addEventListener( 'load', () => {
|
|
131
120
|
const response = xhr.response;
|
|
132
121
|
// 当code==200说明上传成功,可以增加弹框提示;
|
|
133
122
|
// 当上传失败时,必须调用reject()函数。
|
|
134
123
|
|
|
135
124
|
console.log('response', xhr)
|
|
136
125
|
|
|
137
|
-
if (!response || response.error) {
|
|
138
|
-
return reject(response && response.error ? response.error.message : genericErrorText);
|
|
126
|
+
if ( !response || response.error ) {
|
|
127
|
+
return reject( response && response.error ? response.error.message : genericErrorText );
|
|
139
128
|
}
|
|
140
129
|
//上传成功,从后台获取图片的url地址
|
|
141
|
-
resolve({
|
|
130
|
+
resolve( {
|
|
142
131
|
default: response
|
|
143
|
-
});
|
|
144
|
-
});
|
|
132
|
+
} );
|
|
133
|
+
} );
|
|
145
134
|
|
|
146
135
|
// 支持时上传进度。文件加载器有#uploadTotal和#upload属性,用于在编辑器用户界面中显示上载进度栏。
|
|
147
|
-
if (xhr.upload) {
|
|
148
|
-
xhr.upload.addEventListener('progress', evt => {
|
|
149
|
-
if (evt.lengthComputable) {
|
|
136
|
+
if ( xhr.upload ) {
|
|
137
|
+
xhr.upload.addEventListener( 'progress', evt => {
|
|
138
|
+
if ( evt.lengthComputable ) {
|
|
150
139
|
loader.uploadTotal = evt.total;
|
|
151
140
|
loader.uploaded = evt.loaded;
|
|
152
141
|
}
|
|
153
|
-
});
|
|
142
|
+
} );
|
|
154
143
|
}
|
|
155
144
|
}
|
|
156
145
|
|
|
157
146
|
// 准备数据并发送请求
|
|
158
|
-
_sendRequest(file) {
|
|
147
|
+
_sendRequest( file ) {
|
|
159
148
|
//通过FormData构造函数创建一个空对象
|
|
160
149
|
const data = new FormData();
|
|
161
150
|
//通过append()方法在末尾追加key为files值为file的数据
|
|
162
151
|
|
|
163
|
-
console.log('file',
|
|
164
|
-
data.append('file', file);//上传的参数data
|
|
152
|
+
console.log('file',file)
|
|
153
|
+
data.append( 'file', file );//上传的参数data
|
|
165
154
|
// data.append( 'memberId', "666" );
|
|
166
155
|
/**
|
|
167
156
|
* 重要提示:这是实现诸如身份验证和CSRF保护等安全机制的正确位置。
|
|
168
157
|
* 例如,可以使用XMLHttpRequest.setRequestHeader()设置包含应用程序先前生成的CSRF令牌的请求头。
|
|
169
158
|
*/
|
|
170
|
-
this.xhr.send(data);
|
|
159
|
+
this.xhr.send( data );
|
|
171
160
|
}
|
|
172
161
|
}
|
|
173
162
|
|
|
174
|
-
function MyCustomUploadAdapterPlugin(editor) {
|
|
175
|
-
editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
|
|
163
|
+
function MyCustomUploadAdapterPlugin( editor ) {
|
|
164
|
+
editor.plugins.get( 'FileRepository' ).createUploadAdapter = ( loader ) => {
|
|
176
165
|
// 在这里将URL配置为后端上载脚本
|
|
177
|
-
console.log(loader,
|
|
178
|
-
return new MyUploadAdapter(loader,
|
|
166
|
+
console.log(loader,'loader');
|
|
167
|
+
return new MyUploadAdapter( loader,editor );
|
|
179
168
|
}
|
|
180
169
|
}
|
|
181
170
|
|
package/src/main.js
CHANGED
|
@@ -47,27 +47,11 @@ Viewer.setDefaults({
|
|
|
47
47
|
Options: { "inline": true, "button": true, "navbar": true, "title": true, "toolbar": true, "tooltip": true, "movable": true, "zoomable": true, "rotatable": true, "scalable": true, "transition": true, "fullscreen": true, "keyboard": true, "url": "data-source" }
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
import VueI18n from 'vue-i18n'; //多语言
|
|
51
50
|
|
|
52
|
-
// 导入多语言的 JSON 文件
|
|
53
|
-
import enLocale from './locales/en.json';
|
|
54
|
-
import cnLocale from './locales/cn.json';
|
|
55
|
-
|
|
56
|
-
Vue.use(VueI18n);
|
|
57
|
-
// 创建 VueI18n 实例,并设置默认语言和多语言内容
|
|
58
|
-
const i18n = new VueI18n({
|
|
59
|
-
locale: 'en', // 默认语言
|
|
60
|
-
messages: {
|
|
61
|
-
en: enLocale, // 英文
|
|
62
|
-
cn: cnLocale, // 中文
|
|
63
|
-
// 其他语言...
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
51
|
|
|
67
52
|
Vue.prototype.requestUrl = requestUrl;
|
|
68
53
|
Vue.prototype.utils = utils;
|
|
69
54
|
|
|
70
55
|
new Vue({
|
|
71
56
|
render: h => h(App),
|
|
72
|
-
i18n,
|
|
73
57
|
}).$mount('#app')
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-image-viewer :zIndex="999999" :on-close="closeViewer" :url-list="urlList" />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import ElementUI from 'element-ui';
|
|
9
|
-
// import ElImageViewer from ElementUI.Image.components.ImageViewer;
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
name: "imgView",
|
|
13
|
-
components: {
|
|
14
|
-
ElImageViewer: ElementUI.Image.components.ImageViewer
|
|
15
|
-
},
|
|
16
|
-
data () {
|
|
17
|
-
return {};
|
|
18
|
-
},
|
|
19
|
-
props: ["urlList"],
|
|
20
|
-
methods: {
|
|
21
|
-
closeViewer () {
|
|
22
|
-
// 关闭组件后从父级dom销毁这个挂载
|
|
23
|
-
if (this.$el.parentNode) {
|
|
24
|
-
this.$el.parentNode.removeChild(this.$el);
|
|
25
|
-
}
|
|
26
|
-
this.$emit("closeViewer");
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<style scoped></style>
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div @click="lookImage">
|
|
3
|
-
<vue-markdown class="mark_down" :source="typedContent" :ref="'markdown' + msgId">
|
|
4
|
-
</vue-markdown>
|
|
5
|
-
<div v-if="showPreview">
|
|
6
|
-
<img-view :url-list="imgList" @closeViewer="closeViewer"></img-view>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
import VueMarkdown from "vue-markdown";
|
|
13
|
-
import ImgView from "./imgView.vue";
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
name: "markDownText",
|
|
17
|
-
data() {
|
|
18
|
-
return {
|
|
19
|
-
typedContent: "",
|
|
20
|
-
typingSpeed: 15,
|
|
21
|
-
showPreview: false,
|
|
22
|
-
imgList: [],
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
chainValues: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "",
|
|
29
|
-
},
|
|
30
|
-
msgId: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "",
|
|
33
|
-
},
|
|
34
|
-
isHistory: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
components: {
|
|
40
|
-
ImgView,
|
|
41
|
-
VueMarkdown,
|
|
42
|
-
},
|
|
43
|
-
mounted() {
|
|
44
|
-
this.$nextTick(() => {
|
|
45
|
-
// let ref = 'markdown' + this.msgId
|
|
46
|
-
// const el = this.$refs[ref].$el;
|
|
47
|
-
// if (this.isHistory){
|
|
48
|
-
// el.innerHTML = this.chainValues;
|
|
49
|
-
// } else {
|
|
50
|
-
// new Typed(el, {
|
|
51
|
-
// strings: [this.chainValues],
|
|
52
|
-
// typeSpeed: 30,
|
|
53
|
-
// showCursor: false
|
|
54
|
-
// })
|
|
55
|
-
// }
|
|
56
|
-
this.typedContent = this.chainValues;
|
|
57
|
-
// if (this.isHistory) {
|
|
58
|
-
// this.typedContent = this.chainValues;
|
|
59
|
-
// } else {
|
|
60
|
-
// this.startTypingEffect();
|
|
61
|
-
// }
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
methods: {
|
|
65
|
-
startTypingEffect() {
|
|
66
|
-
let i = 0;
|
|
67
|
-
const interval = setInterval(() => {
|
|
68
|
-
if (i < this.chainValues.length) {
|
|
69
|
-
this.typedContent += this.chainValues.charAt(i);
|
|
70
|
-
i++;
|
|
71
|
-
} else {
|
|
72
|
-
clearInterval(interval);
|
|
73
|
-
}
|
|
74
|
-
}, this.typingSpeed);
|
|
75
|
-
},
|
|
76
|
-
lookImage(e) {
|
|
77
|
-
let previewImageUrl = "";
|
|
78
|
-
console.log("e.target", e.target);
|
|
79
|
-
if (e.target.localName == "img") {
|
|
80
|
-
previewImageUrl = e.target.currentSrc;
|
|
81
|
-
this.showPreview = true;
|
|
82
|
-
}
|
|
83
|
-
let richtext = JSON.parse(JSON.stringify(this.typedContent));
|
|
84
|
-
this.imgList = [];
|
|
85
|
-
richtext.replace(
|
|
86
|
-
/<img [^>]*src=['"]([^'"]+)[^>]*>/g,
|
|
87
|
-
(match, capture) => {
|
|
88
|
-
this.imgList.push(capture);
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
/*当前点击的图片作为第一个图片*/
|
|
92
|
-
let index = this.imgList.indexOf(previewImageUrl);
|
|
93
|
-
this.imgList.splice(index, 1);
|
|
94
|
-
this.imgList.unshift(previewImageUrl);
|
|
95
|
-
},
|
|
96
|
-
closeViewer() {
|
|
97
|
-
this.showPreview = false;
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<style scoped lang="less">
|
|
104
|
-
.mark_down {
|
|
105
|
-
line-height: 24px;
|
|
106
|
-
|
|
107
|
-
/deep/p {
|
|
108
|
-
margin-bottom: 14px;
|
|
109
|
-
font-size: 16px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/deep/p:only-child {
|
|
113
|
-
margin: 0 !important;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/deep/p:last-child {
|
|
117
|
-
margin-bottom: 0 !important;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/deep/ul {
|
|
121
|
-
margin-bottom: 16px ;
|
|
122
|
-
li {
|
|
123
|
-
margin: 7px 0 !important;
|
|
124
|
-
font-size: 16px;
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/deep/ ol {
|
|
130
|
-
li {
|
|
131
|
-
margin: 7px 0 !important;
|
|
132
|
-
font-size: 16px;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/deep/img {
|
|
137
|
-
max-width: 400px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/deep/h3,
|
|
141
|
-
/deep/h2,
|
|
142
|
-
/deep/h1,
|
|
143
|
-
/deep/h4,
|
|
144
|
-
/deep/h5,
|
|
145
|
-
/deep/h6 {
|
|
146
|
-
color: #000000;
|
|
147
|
-
font-weight: 500;
|
|
148
|
-
line-height: 26px;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/deep/h3 {
|
|
152
|
-
font-size: 20px;
|
|
153
|
-
}
|
|
154
|
-
/deep/h2 {
|
|
155
|
-
font-size: 22px;
|
|
156
|
-
}
|
|
157
|
-
/deep/h1 {
|
|
158
|
-
font-size: 24px;
|
|
159
|
-
}
|
|
160
|
-
/deep/h3 {
|
|
161
|
-
font-size: 20px;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
</style>
|
package/src/locales/cn.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"dragonCommon": {
|
|
3
|
-
"download": "下载",
|
|
4
|
-
"smartSummary": "智能摘要",
|
|
5
|
-
"chat": "聊一聊",
|
|
6
|
-
"viewDetails": "查看详情",
|
|
7
|
-
"folderName": "文件夹名称",
|
|
8
|
-
"loading": "加载中...",
|
|
9
|
-
"Safaridownload": "下载地址已复制,请前往Safari浏览器访问下载",
|
|
10
|
-
"reduce": "缩小",
|
|
11
|
-
"zoom": "放大",
|
|
12
|
-
"selectScale": "请选择",
|
|
13
|
-
"previous": "上一段",
|
|
14
|
-
"next": "下一段",
|
|
15
|
-
"answersGeneratedByPre": "答案由",
|
|
16
|
-
"answersGeneratedByAfter": "段内容生成",
|
|
17
|
-
"scaleAuto": "自动缩放",
|
|
18
|
-
"scaleReality": "实际比例",
|
|
19
|
-
"firstParagraph": "当前已经是第一段了",
|
|
20
|
-
"lastParagraph": "当前已经是最后一段了",
|
|
21
|
-
"fileloadException": "文件加载异常",
|
|
22
|
-
"regenerate": "重新生成",
|
|
23
|
-
"generating": "生成中",
|
|
24
|
-
"close": "关闭"
|
|
25
|
-
}
|
|
26
|
-
}
|