diff --git a/hchyun-ui/src/api/system/download.js b/hchyun-ui/src/api/system/download.js new file mode 100644 index 0000000..c5a6040 --- /dev/null +++ b/hchyun-ui/src/api/system/download.js @@ -0,0 +1,14 @@ +import axios from "axios"; +import {getToken} from "@/utils/auth"; + +export function downloadFile(fileId){ + axios({ + method:'get', + url:process.env.VUE_APP_BASE_API+'/system/file/download/'+fileId, + headers:{ + token:'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + } + }).then(res=>{ + return res; + }) +} diff --git a/hchyun-ui/src/api/system/file.js b/hchyun-ui/src/api/system/file.js index 3551fc3..3e34978 100644 --- a/hchyun-ui/src/api/system/file.js +++ b/hchyun-ui/src/api/system/file.js @@ -62,5 +62,12 @@ export function getRoleAll(){ type:2 } }) - } + +export function downloadFile(fileId){ + return request({ + url:'/system/file/download/'+fileId, + method:'get' + }) +} + diff --git a/hchyun-ui/src/views/system/file/index.vue b/hchyun-ui/src/views/system/file/index.vue index 2b2e483..29d356f 100644 --- a/hchyun-ui/src/views/system/file/index.vue +++ b/hchyun-ui/src/views/system/file/index.vue @@ -152,6 +152,13 @@ v-hasPermi="['system:file:remove']" >删除 + 下载 + @@ -210,6 +217,7 @@