askbot-dragon 1.7.23-beta → 1.7.25-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 CHANGED
@@ -1,38 +1,39 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.7.23-beta",
3
+ "version": "1.7.25-beta",
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
+ "vue-markdown": "^2.2.4"
10
11
  },
11
12
  "devDependencies": {
13
+ "@vue/cli-plugin-babel": "~4.5.0",
14
+ "@vue/cli-plugin-eslint": "~4.5.0",
15
+ "@vue/cli-service": "~4.5.0",
12
16
  "audio-loader": "^1.0.3",
17
+ "babel-eslint": "^10.1.0",
13
18
  "core-js": "^3.6.5",
19
+ "element-ui": "^2.15.10",
20
+ "eslint": "^6.7.2",
21
+ "eslint-plugin-vue": "^6.2.2",
14
22
  "install": "^0.13.0",
15
23
  "jquery": "^3.5.1",
24
+ "less": "^3.12.2",
25
+ "less-loader": "^7.0.2",
16
26
  "lodash": "^4.17.21",
17
27
  "uuid": "^8.3.2",
18
28
  "v-viewer": "^1.6.4",
19
29
  "vant": "^2.12.51",
20
30
  "vconsole": "^3.9.1",
21
31
  "vue": "^2.6.11",
32
+ "vue-i18n": "^8.26.4",
22
33
  "vue-resource": "^1.5.1",
34
+ "vue-template-compiler": "^2.6.11",
23
35
  "vue-video-player": "^5.0.2",
24
- "vue-i18n": "^8.26.4",
25
- "weixin-js-sdk": "^1.6.0",
26
- "@vue/cli-plugin-babel": "~4.5.0",
27
- "@vue/cli-plugin-eslint": "~4.5.0",
28
- "@vue/cli-service": "~4.5.0",
29
- "babel-eslint": "^10.1.0",
30
- "element-ui": "^2.15.10",
31
- "eslint": "^6.7.2",
32
- "eslint-plugin-vue": "^6.2.2",
33
- "less": "^3.12.2",
34
- "less-loader": "^7.0.2",
35
- "vue-template-compiler": "^2.6.11"
36
+ "weixin-js-sdk": "^1.6.0"
36
37
  },
37
38
  "eslintConfig": {
38
39
  "root": true,
@@ -17,7 +17,7 @@
17
17
  <p v-html="msg.content.text"></p>
18
18
  </template>
19
19
  <template v-if="msg.content.renderType == 2">
20
- <markDownText :chainValues="msg.content.text" :isHistory="true"></markDownText>
20
+ <markDownText :chainValues="msg.content.text" :isHistory="isHistory"></markDownText>
21
21
  </template>
22
22
  <template v-else>{{ msg.content.text }}</template>
23
23
  </div>
@@ -275,7 +275,7 @@ export default {
275
275
  previewOssPath: ""
276
276
  }
277
277
  },
278
- props: ['msg', 'isAskLightning', 'isMessageRecord', "isApp", "isHasChat", "activeKnowledgeId", "isLiBang","language"],
278
+ props: ['msg', 'isAskLightning', 'isMessageRecord', "isApp", "isHasChat", "activeKnowledgeId", "isLiBang","language","isHistory"],
279
279
  beforeMounted () {
280
280
  },
281
281
  watch: {
@@ -0,0 +1,32 @@
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>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div @click="lookImage">
3
+ <vue-markdown
4
+ class="mark_down"
5
+ :source="typedContent"
6
+ :ref="'markdown' + msgId"
7
+ >
8
+ </vue-markdown>
9
+ <div v-if="showPreview">
10
+ <img-view :url-list="imgList" @closeViewer="closeViewer"></img-view>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import VueMarkdown from "vue-markdown";
17
+ import ImgView from "./imgView.vue";
18
+
19
+ export default {
20
+ name: "markDownText",
21
+ data() {
22
+ return {
23
+ typedContent: "",
24
+ typingSpeed: 15,
25
+ showPreview: false,
26
+ imgList: [],
27
+ };
28
+ },
29
+ props: {
30
+ chainValues: {
31
+ type: String,
32
+ default: "",
33
+ },
34
+ msgId: {
35
+ type: String,
36
+ default: "",
37
+ },
38
+ isHistory: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ },
43
+ components: {
44
+ ImgView,
45
+ VueMarkdown,
46
+ },
47
+ mounted() {
48
+ this.$nextTick(() => {
49
+ // let ref = 'markdown' + this.msgId
50
+ // const el = this.$refs[ref].$el;
51
+ // if (this.isHistory){
52
+ // el.innerHTML = this.chainValues;
53
+ // } else {
54
+ // new Typed(el, {
55
+ // strings: [this.chainValues],
56
+ // typeSpeed: 30,
57
+ // showCursor: false
58
+ // })
59
+ // }
60
+ if (this.isHistory) {
61
+ this.typedContent = this.chainValues;
62
+ } else {
63
+ this.startTypingEffect();
64
+ }
65
+ });
66
+ },
67
+ methods: {
68
+ startTypingEffect() {
69
+ let i = 0;
70
+ const interval = setInterval(() => {
71
+ if (i < this.chainValues.length) {
72
+ this.typedContent += this.chainValues.charAt(i);
73
+ i++;
74
+ } else {
75
+ clearInterval(interval);
76
+ }
77
+ }, this.typingSpeed);
78
+ },
79
+ lookImage(e) {
80
+ let previewImageUrl = "";
81
+ console.log("e.target", e.target);
82
+ if (e.target.localName == "img") {
83
+ previewImageUrl = e.target.currentSrc;
84
+ this.showPreview = true;
85
+ }
86
+ let richtext = JSON.parse(JSON.stringify(this.typedContent));
87
+ this.imgList = [];
88
+ richtext.replace(
89
+ /<img [^>]*src=['"]([^'"]+)[^>]*>/g,
90
+ (match, capture) => {
91
+ this.imgList.push(capture);
92
+ }
93
+ );
94
+ /*当前点击的图片作为第一个图片*/
95
+ let index = this.imgList.indexOf(previewImageUrl);
96
+ this.imgList.splice(index, 1);
97
+ this.imgList.unshift(previewImageUrl);
98
+ },
99
+ closeViewer() {
100
+ this.showPreview = false;
101
+ },
102
+ },
103
+ };
104
+ </script>
105
+
106
+ <style scoped lang="less">
107
+ .mark_down {
108
+ line-height: 25px;
109
+ /deep/p {
110
+ margin-bottom: 14px;
111
+ }
112
+ /deep/p:only-child {
113
+ margin: 0 !important;
114
+ }
115
+ /deep/p:last-child {
116
+ margin-bottom: 0 !important;
117
+ }
118
+ /deep/ol,
119
+ ul {
120
+ li {
121
+ margin: 14px 0 !important;
122
+ }
123
+ }
124
+ /deep/img {
125
+ max-width: 400px;
126
+ }
127
+ }
128
+ </style>