askbot-dragon 1.3.27 → 1.3.30

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.27",
3
+ "version": "1.3.30",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -84,6 +84,7 @@ export default {
84
84
  let url = typeof item == 'object' ? item.url : item
85
85
  this.previewHref = url
86
86
  this.$refs.previewDoc.previewShowPopup = true
87
+ this.$refs.previewDoc.title = typeof item == 'object' ? item.name : item
87
88
  },
88
89
  deleteAttch (index) {
89
90
  this.$emit('attachDeleteAttch', index)
@@ -290,7 +290,6 @@
290
290
  </div>
291
291
  <div v-else-if="item.formField.type==='EXPLANATION'||item.formField.type==='EXPLAIN'" class="explan-ation">
292
292
  <div class="explanation">
293
- 123123123
294
293
  <p class="explanation-p" v-if="item.formField.type==='EXPLANATION'">
295
294
  <span class="el-icon-info"></span>
296
295
  {{item.formField.extInfo.descriptionText}}
@@ -21,76 +21,113 @@
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">
25
+ 下载
26
+ </div>
24
27
  </div>
25
28
  </template>
26
29
 
27
30
  <script>
28
31
  export default {
29
- data () {
30
- return {
31
- previewShowPopup: false
32
- }
32
+ data () {
33
+ return {
34
+ previewShowPopup: false,
35
+ title:'工单附件'
36
+ }
37
+ },
38
+ props: {
39
+ url: {
40
+ type: String,
41
+ required: true,
33
42
  },
34
- props:{
35
- url:{
36
- type: String,
37
- required: true,
38
- },
39
- officePreviewType:{
40
- type: String,
41
- default: ''
43
+ officePreviewType: {
44
+ type: String,
45
+ default: ''
46
+ }
47
+ },
48
+ computed: {
49
+ previewUrl () {
50
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
51
+ if (this.url != '') {
52
+ if (/[\u4E00-\u9FA5]+/g.test(this.url)) {
53
+ url += btoa(encodeURIComponent(this.url))
54
+ } else {
55
+ url += btoa(this.url)
42
56
  }
57
+ url += '&encodeURIComponent=true'
58
+ }
59
+ return url
43
60
  },
44
- computed:{
45
- previewUrl() {
46
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
47
- if(this.url != '') {
48
- if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
49
- url += btoa(encodeURIComponent(this.url))
50
- } else {
51
- url += btoa(this.url)
52
- }
53
- url += '&encodeURIComponent=true'
54
- }
55
- return url
56
- },
57
- fileType() {
58
- const fileType = this.url.substring(this.url.lastIndexOf('.'));
59
- if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
60
- return 'VIDEO'
61
- } else {
62
- return 'OTHER'
63
- }
64
-
65
- }
61
+ fileType () {
62
+ const fileType = this.url.substring(this.url.lastIndexOf('.'));
63
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
64
+ return 'VIDEO'
65
+ } else {
66
+ return 'OTHER'
67
+ }
68
+
69
+ }
70
+ },
71
+ methods: {
72
+ close () {
73
+ this.$emit('close')
66
74
  },
67
- methods :{
68
- close() {
69
- this.$emit('close')
70
- },
71
- loadIframe(item) {
72
- let iframe = document.getElementsByClassName('preview_iframe')[0]
73
- iframe.onload(() =>{
74
- iframe.contentWindow.postMessage({
75
- type: "positionText",
76
- data: item.text,
77
- page: item.page
78
- }, '*')
79
- })
80
- // if(preview) {
81
- // preview.postMessage({
82
- // type: "positionText",
83
- // data: ``
84
- // }, '*')
85
- // }
86
- }
75
+ loadIframe (item) {
76
+ let iframe = document.getElementsByClassName('preview_iframe')[0]
77
+ iframe.onload(() => {
78
+ iframe.contentWindow.postMessage({
79
+ type: "positionText",
80
+ data: item.text,
81
+ page: item.page
82
+ }, '*')
83
+ })
84
+ // if(preview) {
85
+ // preview.postMessage({
86
+ // type: "positionText",
87
+ // data: ``
88
+ // }, '*')
89
+ // }
90
+ },
91
+ 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 }))
121
+ }
87
122
  }
123
+ }
88
124
  }
89
125
  </script>
90
126
 
91
127
  <style lang="less" scoped>
92
128
  .previewDoc{
93
129
  height: 100%;
130
+ position: relative;
94
131
  }
95
132
  .preview_iframe {
96
133
  width: 100%;
@@ -110,4 +147,22 @@ export default {
110
147
  /deep/.el-drawer__body{
111
148
  height: 100%;
112
149
  }
150
+ .onload_btn {
151
+ position: absolute;
152
+ left: 50%;
153
+ transform: translateX(-50%);
154
+ bottom: 40px;
155
+ width: 200px;
156
+ background-color: #366AFF;
157
+ color: white;
158
+ height: 48px;
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ border-radius: 28px;
163
+ cursor: pointer;
164
+ i{
165
+ margin-right: 8px;
166
+ }
167
+ }
113
168
  </style>