askbot-dragon 1.1.29 → 1.2.0

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.29",
3
+ "version": "1.2.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -0,0 +1,12 @@
1
+ export function isMobile() {
2
+ let bool = false
3
+ let flag = navigator.userAgent.match(
4
+ /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
5
+ );
6
+ if (flag) {
7
+ bool = true
8
+ } else {
9
+ bool = false
10
+ }
11
+ return bool
12
+ }
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  <div v-html="item.introduction" class="alc-box-introduction">
17
17
  </div>
18
- <div class="alc-updateTime" v-if="isAskLightning == 1">
18
+ <div class="alc-updateTime">
19
19
  <div v-show="docSource[item.source]" class="upload-source">
20
20
  {{docSource[item.source]}}
21
21
  </div>
@@ -50,6 +50,7 @@
50
50
 
51
51
  <script>
52
52
  import previewPdf from "./previewPdf";
53
+ import { isMobile } from "../assets/js/common";
53
54
  export default {
54
55
  name: "answerDocknowledge",
55
56
  components: { previewPdf },
@@ -58,10 +59,11 @@ export default {
58
59
  isPC: true,
59
60
  previewHref: "",
60
61
  docSource: {
61
- LOCAL_FILE: "上传于本地文件",
62
- CREATED_BY_ONESELF: "来源于自建",
62
+ LOCAL_FILE: "来源于本地文件",
63
+ CREATED_BY_ONESELF: "来源于自建知识",
63
64
  WECHAT: "来源于微信",
64
- AUTO_SYN_FROM_LOCAL_FILE: "自动同步与本地",
65
+ AUTO_SYN_FROM_LOCAL_FILE: "自动同步于本地",
66
+ YUQUE: "来源于语雀"
65
67
  },
66
68
  imageObj: {
67
69
  PDF: 'pdf1',
@@ -106,6 +108,7 @@ export default {
106
108
  rmvb: "video",
107
109
  wav: "audio",
108
110
  mp3: "audio",
111
+ yqhtml: "yqhtml",
109
112
  }
110
113
  }
111
114
  },
@@ -137,42 +140,50 @@ export default {
137
140
  //预览图片
138
141
  lookAttach(url, item, event) {
139
142
  event.preventDefault();
140
- console.log('111111111');
141
- window.parent.postMessage({
142
- data: "bot_preview",
143
- item: JSON.stringify(item),
144
- url: url
145
- },"*");
146
- // let index = url.lastIndexOf('?')
147
- // let type = ''
148
- // let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
149
- // if (index !== -1) {
150
- // url = url.substring(0, index)
151
- // type = this.fileType(url)
152
- // } else {
153
- // type = this.fileType(url)
154
- // }
155
- // if (type === '' || type === 'OTHER') {
156
- // httpUrl = httpUrl += '?needEncrypt=true'
157
- // } else {
158
- // httpUrl = httpUrl += '?needEncrypt=false'
159
- // }
160
- // this.$http.post(httpUrl, {
161
- // "fileInOssPath":url
162
- // }).then(res =>{
163
- // if(res.data.code == '0') {
164
- // this.previewHref = res.data.data
165
- // this.$refs.previewPdf.previewShowPopup = true;
166
- // this.$refs.previewPdf.fileType = type
167
- // this.$nextTick(() =>{
168
- // if(item.source == 'CREATED_BY_ONESELF') {
169
- // this.$refs.previewPdf.getBolb(item)
170
- // } else {
171
- // this.$refs.previewPdf.loadIframe(item)
172
- // }
173
- // })
174
- // }
175
- // })
143
+ console.log('111111111',url,item,this.isAskLightning);
144
+ if (this.isAskLightning == 1){
145
+ window.parent.postMessage({
146
+ data: "bot_preview",
147
+ item: JSON.stringify(item),
148
+ url: url
149
+ },"*");
150
+ } else {
151
+ let index = url.lastIndexOf('?')
152
+ let type = ''
153
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
154
+ if (index !== -1) {
155
+ url = url.substring(0, index)
156
+ type = this.fileType(url)
157
+ } else {
158
+ type = this.fileType(url)
159
+ }
160
+ if (type === '' || type === 'OTHER') {
161
+ httpUrl = httpUrl += '?needEncrypt=true'
162
+ } else {
163
+ httpUrl = httpUrl += '?needEncrypt=false'
164
+ }
165
+ this.$http.post(httpUrl, {
166
+ "fileInOssPath":url
167
+ }).then(res =>{
168
+ if(res.data.code == '0') {
169
+ this.previewHref = res.data.data;
170
+ if (isMobile()){
171
+ this.$refs.previewPdf.previewShowPopup = true;
172
+ } else {
173
+ this.$refs.previewPdf.drawer = true;
174
+ }
175
+ this.$refs.previewPdf.fileType = type
176
+ this.$nextTick(() =>{
177
+ if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
178
+ this.$refs.previewPdf.getBolb(item)
179
+ } else {
180
+ this.$refs.previewPdf.loadIframe(item)
181
+ }
182
+ })
183
+ }
184
+ })
185
+ }
186
+
176
187
  },
177
188
  fileType (url) {
178
189
  const fileType = url.substring(url.lastIndexOf('.'));
@@ -14,10 +14,10 @@
14
14
  </div> -->
15
15
 
16
16
  <form-template
17
- :formList="formList"
17
+ :formList="formList2"
18
18
  @submitClick="submitClick"
19
19
  ></form-template>
20
- <answer-docknowledge :isAskLightning="1" :msg="answerDocknowledge"></answer-docknowledge>
20
+ <answer-docknowledge :isAskLightning="0" :msg="answerDocknowledge"></answer-docknowledge>
21
21
  <!-- <voice-component @closeVoice="closeVoice">
22
22
  <div slot="voiceTip">
23
23
  松开发送
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}">
2
+ <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}" v-if="previewShowPopup">
3
3
  <div class="footer">
4
4
  <span>查看详情</span>
5
5
  <section @click="close">
@@ -10,7 +10,7 @@
10
10
  <video :src="url" controls width="100%;" height="98%"></video>
11
11
  </div>
12
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>
13
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
14
14
  </div>
15
15
  <template v-else-if="url.includes('https://www') || url.includes('http://www')">
16
16
  <iframe class="preview_iframe"
@@ -25,6 +25,38 @@
25
25
  <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
26
26
  </template>
27
27
  </van-popup>
28
+ <el-drawer
29
+ title="我是标题"
30
+ :visible.sync="drawer"
31
+ v-else
32
+ :with-header="false"
33
+ size="60%"
34
+ >
35
+ <div class="drawer-footer">
36
+ <span>查看详情</span>
37
+ <section @click="close">
38
+ <i class="iconfont guoran-shanchu"></i>
39
+ </section>
40
+ </div>
41
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
42
+ <video :src="url" controls width="100%;" height="98%"></video>
43
+ </div>
44
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;height: 100%">
45
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
46
+ </div>
47
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
48
+ <iframe class="preview_iframe"
49
+ :src="url"
50
+ width="100%"
51
+ height="100%"
52
+ scrolling="100%"
53
+ frameborder="no"
54
+ border="0"></iframe>
55
+ </template>
56
+ <template v-else>
57
+ <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
58
+ </template>
59
+ </el-drawer>
28
60
  </template>
29
61
 
30
62
  <script>
@@ -32,7 +64,10 @@ export default {
32
64
  data () {
33
65
  return {
34
66
  previewShowPopup: false,
35
- fileText:''
67
+ fileText:'',
68
+ fileType:"",
69
+ isPc:true,
70
+ drawer:false
36
71
  }
37
72
  },
38
73
  props:{
@@ -43,10 +78,6 @@ export default {
43
78
  officePreviewType:{
44
79
  type: String,
45
80
  default: ''
46
- },
47
- fileType :{
48
- type: String,
49
- default: ''
50
81
  }
51
82
  },
52
83
  computed:{
@@ -73,12 +104,13 @@ export default {
73
104
  // } else {
74
105
  // return 'OTHER'
75
106
  // }
76
-
107
+
77
108
  // }
78
109
  },
79
110
  methods :{
80
111
  close() {
81
- this.previewShowPopup = false
112
+ this.previewShowPopup = false;
113
+ this.drawer = false;
82
114
  },
83
115
  loadIframe(item) {
84
116
  let iframe = document.getElementsByClassName('preview_iframe')[0]
@@ -115,6 +147,29 @@ export default {
115
147
  width: 100%;
116
148
  height: calc(100% - 52px);
117
149
  }
150
+ .preview_iframe_html{
151
+ width: 100%;
152
+ height: calc(100% - 52px);
153
+ overflow-y: scroll;
154
+ text-align: left;
155
+ box-sizing: border-box;
156
+ padding: 16px;
157
+ /deep/.lake-content{
158
+ margin-left: 10px;
159
+ }
160
+ /deep/a:active, a:hover, a:link, a:visited{
161
+ color: #366aff;
162
+ }
163
+ /deep/li:not(.rich-text-li), ol:not(.list-paddingleft-2), ul:not(.list-paddingleft-2){
164
+ list-style-type: auto;
165
+ }
166
+ /deep/img{
167
+ width: 100%;
168
+ }
169
+ /deep/.ne-table{
170
+ width: 100% !important;
171
+ }
172
+ }
118
173
  .footer {
119
174
  width: calc(100% - 40px);
120
175
  height: 50px;
@@ -125,4 +180,17 @@ export default {
125
180
  padding: 0 20px;
126
181
  border-bottom: 1px solid #cccccc;
127
182
  }
183
+ .drawer-footer{
184
+ width:100%;
185
+ height: 50px;
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: space-between;
189
+ cursor: pointer;
190
+ padding: 0 20px;
191
+ border-bottom: 1px solid #cccccc;
192
+ }
193
+ /deep/.el-drawer__body{
194
+ height: 100%;
195
+ }
128
196
  </style>