askbot-dragon 1.3.33 → 1.3.34

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.3.33",
3
+ "version": "1.3.34",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -21,13 +21,16 @@
21
21
  <template v-else>
22
22
  <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
23
23
  </template>
24
- <!-- <div class="onload_btn" @click="downLoad">
24
+ <div class="onload_btn" @click="downLoad">
25
25
  下载
26
- </div> -->
26
+ </div>
27
27
  </div>
28
28
  </template>
29
29
 
30
30
  <script>
31
+ import { Toast } from 'vant';
32
+ import { isMobile } from "../assets/js/common";
33
+
31
34
  export default {
32
35
  data () {
33
36
  return {
@@ -49,12 +52,19 @@ export default {
49
52
  previewUrl () {
50
53
  let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
51
54
  if (this.url != '') {
52
- if (/[\u4E00-\u9FA5]+/g.test(this.url)) {
55
+ // if (/[\u4E00-\u9FA5]+/g.test(this.url)) {
56
+ // url += btoa(encodeURIComponent(this.url))
57
+ // } else {
58
+ // url += btoa(this.url)
59
+ // }
60
+ // url += '&encodeURIComponent=true'
61
+ if(decodeURIComponent(this.url) == this.url) {
53
62
  url += btoa(encodeURIComponent(this.url))
63
+ url += '&encodeURIComponent=true'
54
64
  } else {
55
- url += btoa(this.url)
65
+ url += btoa(encodeURIComponent(decodeURIComponent(this.url)))
66
+ url += '&encodeURIComponent=true'
56
67
  }
57
- url += '&encodeURIComponent=true'
58
68
  }
59
69
  return url
60
70
  },
@@ -89,36 +99,33 @@ export default {
89
99
  // }
90
100
  },
91
101
  downLoad () {
92
- const fileType = this.url.substring(this.url.lastIndexOf('.'));
93
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
94
- navigator.clipboard.writeText(this.url)
95
- this.$message({
96
- title: '下载地址已复制,请前往Safari浏览器访问下载'
97
- })
98
- return
99
- } else if (/(Android)/i.test(navigator.userAgent)) {
100
- console.log('isAndroid')
101
- } else {
102
- console.log('isPC')
103
- }
104
- if (fileType == '.txt') {
105
- this.$http.get(this.url).then(res =>{
106
- let elink = document.createElement("a");// 设置下载文件名
107
- elink.download = this.title + '.txt';
108
- elink.style.display = "none";
109
- let blob = new Blob([res.data]);
110
- elink.href = URL.createObjectURL(blob);
111
- document.body.appendChild(elink);
112
- elink.click();
113
- document.body.removeChild(elink);
114
- URL.revokeObjectURL(blob); //释放对象
115
- })
116
- } else {
117
- let a = document.createElement('a')
118
- a.href = this.url
119
- a.download = (this.title) + fileType
120
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
102
+ let url = this.url
103
+ if (decodeURIComponent(url) != url) {
104
+ url = decodeURIComponent(url)
121
105
  }
106
+ const fileType = url.substring(url.lastIndexOf('.'));
107
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
108
+ "Content-Type": "application/json",
109
+ }).then(res => {
110
+ if (res.data) {
111
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
112
+ if(isMobile()) {
113
+ Toast('下载地址已复制,请前往Safari浏览器访问下载');
114
+ } else {
115
+ navigator.clipboard.writeText(res.data)
116
+ this.$message.success({
117
+ message:'下载地址已复制,请前往Safari浏览器访问下载',
118
+ })
119
+ }
120
+ return
121
+ } else {
122
+ let a = document.createElement('a')
123
+ a.href = res.data
124
+ a.download = (this.title) + fileType
125
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
126
+ }
127
+ }
128
+ })
122
129
  }
123
130
  }
124
131
  }
@@ -161,6 +168,7 @@ export default {
161
168
  justify-content: center;
162
169
  border-radius: 28px;
163
170
  cursor: pointer;
171
+ z-index: 9999;
164
172
  i{
165
173
  margin-right: 8px;
166
174
  }