文件下载
This commit is contained in:
parent
a11be2e986
commit
aa4e56655c
2
.npmrc
Normal file
2
.npmrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
@trydo:registry=http://139.155.124.81:8081/nexus/repository/trydo-npm/
|
||||||
|
registry=https://registry.npmmirror.com
|
||||||
19
package-lock.json
generated
19
package-lock.json
generated
@ -1418,6 +1418,15 @@
|
|||||||
"integrity": "sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==",
|
"integrity": "sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@trydo/files-utils": {
|
||||||
|
"version": "0.1.19-alpha",
|
||||||
|
"resolved": "http://139.155.124.81:8081/nexus/repository/trydo-npm/@trydo/files-utils/-/files-utils-0.1.19-alpha.tgz",
|
||||||
|
"integrity": "sha512-E+yMt6C37g4WRGRdWNbFXYN2a5KgtfLVvLMf6mKXfoObtHWXbokoeudYoD4Q5Vq7gngxO1yqrgo4u/I6Fy7AOQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"spark-md5": "^3.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/glob": {
|
"@types/glob": {
|
||||||
"version": "7.2.0",
|
"version": "7.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
|
||||||
@ -15424,7 +15433,6 @@
|
|||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bindings": "^1.5.0",
|
"bindings": "^1.5.0",
|
||||||
"nan": "^2.12.1",
|
|
||||||
"node-pre-gyp": "*"
|
"node-pre-gyp": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -17026,8 +17034,7 @@
|
|||||||
"nan": {
|
"nan": {
|
||||||
"version": "2.5.1",
|
"version": "2.5.1",
|
||||||
"resolved": "https://registry.npmmirror.com/nan/-/nan-2.5.1.tgz",
|
"resolved": "https://registry.npmmirror.com/nan/-/nan-2.5.1.tgz",
|
||||||
"integrity": "sha512-Mvo2RwemW12NRql4qU21+Sdtu8CAfn2RaCp8+p6N+4oQQvAM1DfO9R/ZyJOJaLdsMLHw84WJEo2AKZar4KANXA==",
|
"integrity": "sha512-Mvo2RwemW12NRql4qU21+Sdtu8CAfn2RaCp8+p6N+4oQQvAM1DfO9R/ZyJOJaLdsMLHw84WJEo2AKZar4KANXA=="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"natural-compare": {
|
"natural-compare": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
@ -19285,6 +19292,12 @@
|
|||||||
"integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==",
|
"integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"spark-md5": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/spark-md5/-/spark-md5-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"spdx-correct": {
|
"spdx-correct": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
"vuex-persistedstate": "^4.0.0-beta.3"
|
"vuex-persistedstate": "^4.0.0-beta.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@trydo/files-utils": "^0.1.19-alpha",
|
||||||
"@vue/cli-plugin-babel": "~4.3.0",
|
"@vue/cli-plugin-babel": "~4.3.0",
|
||||||
"@vue/cli-plugin-eslint": "~4.3.0",
|
"@vue/cli-plugin-eslint": "~4.3.0",
|
||||||
"@vue/cli-service": "~4.3.0",
|
"@vue/cli-service": "~4.3.0",
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import ElementUI from 'element-ui';
|
|||||||
import './assets/style/element-ui-variable.scss'
|
import './assets/style/element-ui-variable.scss'
|
||||||
// import 'element-ui/lib/theme-chalk/index.css';
|
// import 'element-ui/lib/theme-chalk/index.css';
|
||||||
import 'element-ui/lib/theme-chalk/icon.css'
|
import 'element-ui/lib/theme-chalk/icon.css'
|
||||||
|
import {TrydoFiles} from "@trydo/files-utils"
|
||||||
|
|
||||||
|
|
||||||
Vue.use(ElementUI);
|
Vue.use(ElementUI);
|
||||||
@ -29,6 +30,7 @@ Vue.prototype.$util = util;
|
|||||||
Vue.prototype.$verify = verify;
|
Vue.prototype.$verify = verify;
|
||||||
Vue.prototype.$clickThrottle = clickThrottle;
|
Vue.prototype.$clickThrottle = clickThrottle;
|
||||||
Vue.prototype.$echarts = echarts;
|
Vue.prototype.$echarts = echarts;
|
||||||
|
Vue.prototype.$TrydoFiles = TrydoFiles;
|
||||||
|
|
||||||
// vue使用vue-meta-info来动态设置标题
|
// vue使用vue-meta-info来动态设置标题
|
||||||
Vue.use(MetaInfo)
|
Vue.use(MetaInfo)
|
||||||
|
|||||||
@ -126,9 +126,12 @@ export default {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
handleDownload(item) {
|
handleDownload(item) {
|
||||||
let url = item.fullUrl + `&response-content-disposition=attachment;filename="${item.name}"`
|
const downloadTask = this.$TrydoFiles.download(item.fullUrl, item.name)
|
||||||
console.log(url, '---url')
|
.build()
|
||||||
this.$util.downloadFileByUrl(url, item.name)
|
.start();
|
||||||
|
// let url = item.fullUrl + `&response-content-disposition=attachment;filename="${item.name}"`
|
||||||
|
// console.log(url, '---url')
|
||||||
|
// this.$util.downloadFileByUrl(url, item.name)
|
||||||
// fetchApi.downFile({
|
// fetchApi.downFile({
|
||||||
// path: item.url,
|
// path: item.url,
|
||||||
// fileName: item.name
|
// fileName: item.name
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<div class="case-detail-des flex-column mb-16" v-for="(item, index) in tableData" :key="index">
|
<div class="case-detail-des flex-column mb-16" v-for="(item, index) in tableData" :key="index">
|
||||||
<div class="background-color-F5F5F5 p-16 flex-row border-radius-8">
|
<div class="background-color-F5F5F5 p-16 flex-row border-radius-8">
|
||||||
<a class="case-img"><img :src="reg_img(item.fullUrl)"/></a>
|
<a class="case-img"><img :src="reg_img(item)"/></a>
|
||||||
<div class="flex-column pl-8">
|
<div class="flex-column pl-8">
|
||||||
<a class="mt-8 f-weight500">{{item.materialType}}</a>
|
<a class="mt-8 f-weight500">{{item.materialType}}</a>
|
||||||
<a class="color-86909C">{{item.createBy + ' ' + item.createAt}}</a>
|
<a class="color-86909C">{{item.createBy + ' ' + item.createAt}}</a>
|
||||||
@ -72,27 +72,27 @@ export default {
|
|||||||
await this.getList();
|
await this.getList();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
reg_img(fileUrl) {
|
reg_img(item) {
|
||||||
if(fileUrl==null||fileUrl=='') {
|
if(item.url==null||item.url=='') {
|
||||||
return fileUrl
|
return item.fullUrl
|
||||||
}
|
}
|
||||||
// console.log(/.(xls|xlsx)$/.test(fileUrl.toLowerCase()),'111')
|
// console.log(/.(xls|xlsx)$/.test(fileUrl.toLowerCase()),'111')
|
||||||
if(/.(pdf)$/.test(fileUrl.toLowerCase())) {
|
if(/.(pdf)$/.test(item.url.toLowerCase())) {
|
||||||
return require('@/assets/image/util/pdf_img.jpg')
|
return require('@/assets/image/util/pdf_img.jpg')
|
||||||
}
|
}
|
||||||
else if(/.(xls|xlsx)$/.test(fileUrl.toLowerCase())) {
|
else if(/.(xls|xlsx)$/.test(item.url.toLowerCase())) {
|
||||||
return require('@/assets/image/util/excel_img.jpg')
|
return require('@/assets/image/util/excel_img.jpg')
|
||||||
}
|
}
|
||||||
else if(/.(doc|docx)$/.test(fileUrl.toLowerCase())) {
|
else if(/.(doc|docx)$/.test(item.url.toLowerCase())) {
|
||||||
return require('@/assets/image/util/word_img.jpg')
|
return require('@/assets/image/util/word_img.jpg')
|
||||||
}
|
}
|
||||||
else if(/.(zip|rar)$/.test(fileUrl.toLowerCase())) {
|
else if(/.(zip|rar)$/.test(item.url.toLowerCase())) {
|
||||||
return require('@/assets/image/util/yswj.jpg')
|
return require('@/assets/image/util/yswj.jpg')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// let previewUrl = `/mediate/minio/preview/${fileUrl}`
|
// let previewUrl = `/mediate/minio/preview/${fileUrl}`
|
||||||
// return service.service.serviceurl+fileUrl
|
// return service.service.serviceurl+fileUrl
|
||||||
return fileUrl
|
return item.fullUrl
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 列表数据
|
// 列表数据
|
||||||
@ -142,13 +142,16 @@ export default {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
handleDownload(item) {
|
handleDownload(item) {
|
||||||
fetchApi.downFile({
|
const downloadTask = this.$TrydoFiles.download(item.fullUrl, item.name)
|
||||||
path: item.url,
|
.build()
|
||||||
fileName: item.name
|
.start();
|
||||||
}).then(res => {
|
// fetchApi.downFile({
|
||||||
console.log(res)
|
// path: item.url,
|
||||||
this.$util.downloadFileByBlob(res, item.name)
|
// fileName: item.name
|
||||||
})
|
// }).then(res => {
|
||||||
|
// console.log(res)
|
||||||
|
// this.$util.downloadFileByBlob(res, item.name)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user