askbot-dragon 1.1.12 → 1.1.14

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,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -4,7 +4,7 @@
4
4
  @click="lookAttach(msg.content.list[0].url, msg.content.list[0])" class="aci-view">查看原文 ></span></div>
5
5
  <div v-if="msg.content.type == 1" class="answer-text">{{ msg.content.text }}</div>
6
6
  <div class="ad-list">
7
- <div v-for="(item, itemIndex) in msg.content.list" :key="itemIndex" class="ad-list-cell">
7
+ <div v-for="(item, itemIndex) in msg.content.list" :style="{paddingBottom: itemIndex === msg.content.list.length - 1?0:'10px'}" :key="itemIndex" class="ad-list-cell">
8
8
  <div class="alc-title">
9
9
  <div class="alc-box">
10
10
  <div class="alc-source-left">
@@ -70,8 +70,8 @@ export default {
70
70
  TXT: 'txt1',
71
71
  txt: 'txt1',
72
72
  selfadd: 'selfadd1',
73
- md: "selfadd1",
74
- html: 'selfadd1',
73
+ md: "md2",
74
+ html: 'html2',
75
75
  mode: "mode",
76
76
  general: 'general',
77
77
  word: "word1",
@@ -139,9 +139,13 @@ export default {
139
139
  if (index !== -1) {
140
140
  url = url.substring(0, index)
141
141
  type = this.fileType(url)
142
+ } else {
143
+ type = this.fileType(url)
142
144
  }
143
145
  if (type === '' || type === 'OTHER') {
144
146
  httpUrl = httpUrl += '?needEncrypt=true'
147
+ } else {
148
+ httpUrl = httpUrl += '?needEncrypt=false'
145
149
  }
146
150
  this.$http.post(httpUrl, {
147
151
  "fileInOssPath":url
@@ -150,8 +154,14 @@ export default {
150
154
  this.previewHref = res.data.data
151
155
  this.$refs.previewPdf.previewShowPopup = true;
152
156
  this.$refs.previewPdf.fileType = type
157
+
153
158
  this.$nextTick(() =>{
154
- this.$refs.previewPdf.loadIframe(item)
159
+ if(item.srcContent == 'CREATED_BY_ONESELF') {
160
+ this.$refs.previewPdf.getBolb(item)
161
+ } else {
162
+ this.$refs.previewPdf.loadIframe(item)
163
+
164
+ }
155
165
  })
156
166
  }
157
167
  })
@@ -160,7 +170,7 @@ export default {
160
170
  const fileType = url.substring(url.lastIndexOf('.'));
161
171
  if (fileType === '.mp4' || fileType === '.MP4') {
162
172
  return 'VIDEO'
163
- } else if (fileType === '.html' || fileType === '.md') {
173
+ } else if (fileType === '.html') {
164
174
  return 'HTML'
165
175
  } else {
166
176
  return 'OTHER'
@@ -2,13 +2,16 @@
2
2
  <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}">
3
3
  <div class="footer">
4
4
  <span>查看详情</span>
5
- <section @click="close">
6
- <i class="iconfont guoran-shanchu"></i>
7
- </section>
8
- </div>
5
+ <section @click="close">
6
+ <i class="iconfont guoran-shanchu"></i>
7
+ </section>
8
+ </div>
9
9
  <div v-if="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 70px)">
10
10
  <video :src="url" controls width="100%;" height="98%"></video>
11
11
  </div>
12
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;height: calc(100% - 70px)">
13
+ <div class="preview_iframe" style="text-algin:left" v-html="fileText"></div>
14
+ </div>
12
15
  <template v-else-if="url.includes('https://www') || url.includes('http://www')">
13
16
  <iframe class="preview_iframe"
14
17
  :src="url"
@@ -28,7 +31,8 @@
28
31
  export default {
29
32
  data () {
30
33
  return {
31
- previewShowPopup: false
34
+ previewShowPopup: false,
35
+ fileText:''
32
36
  }
33
37
  },
34
38
  props:{
@@ -91,7 +95,61 @@ export default {
91
95
  // data: ``
92
96
  // }, '*')
93
97
  // }
94
- }
98
+ },
99
+ getBolb() {
100
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false',{
101
+ fileInOssPath: this.url,
102
+ templateId: ''
103
+ }).then(res =>{
104
+ if (res.data.code == 0) {
105
+ this.fileText = res.data.data
106
+ } else {
107
+
108
+ }
109
+ })
110
+ },
111
+ replaceFileUrl(data,type){
112
+ let dom = document.createElement('div');
113
+ dom.innerHTML = data;
114
+ console.log(dom,'dom');
115
+ let imgList = Array.from(dom.querySelectorAll('img'));
116
+ imgList.forEach((item,index) => {
117
+ let itemUrl = item.getAttribute('src')
118
+ console.log(itemUrl,'老的');
119
+ this.$http.post(requestUrl.knowledge.getTemporaryCertificate+"?needEncrypt=false",{fileInOssPath:itemUrl}).then((urlRes) => {
120
+ item.setAttribute('src',urlRes.data.data)
121
+ console.log(urlRes.data.data,'新的');
122
+ // let ele = item.parentNode;
123
+ // let className = ele.getAttribute('class')
124
+ // if(className && className.indexOf('ask-component-img-box') !== -1){
125
+ // let img = document.createElement('img');
126
+ // img.setAttribute('src',urlRes.data.data)
127
+ // ele.parentNode.replaceChild(img, ele);
128
+ // }
129
+ });
130
+
131
+ })
132
+ let iframeList = Array.from(dom.querySelectorAll('iframe'));
133
+ iframeList.forEach((item,index) => {
134
+ let itemUrl = item.getAttribute('src')
135
+ console.log(itemUrl,'老的---');
136
+ this.$http.post(requestUrl.knowledge.getTemporaryCertificate+"?needEncrypt=false",{fileInOssPath:itemUrl}).then((urlRes) => {
137
+ item.setAttribute('src',urlRes.data.data)
138
+ console.log(urlRes.data.data,'新的---');
139
+ });
140
+ })
141
+ setTimeout(() => {
142
+ let ckeditorValue = dom.innerHTML
143
+ if(type === 'insert'){
144
+ this.$refs.contentCkeditor.currentEditor.setData(this.ckeditorValue + ckeditorValue);
145
+ this.ckeditorValueCopy = this.ckeditorValue + ckeditorValue;
146
+ } else {
147
+ console.log(ckeditorValue,'ckeditorValue');
148
+ this.$refs.contentCkeditor.currentEditor.setData(ckeditorValue);
149
+ this.ckeditorValueCopy = ckeditorValue;
150
+ }
151
+ },1000)
152
+ },
95
153
  }
96
154
  }
97
155
  </script>