diff --git a/ruoyi-ui/src/utils/zipdownload.js b/ruoyi-ui/src/utils/zipdownload.js
index 06198090b..666d2af77 100644
--- a/ruoyi-ui/src/utils/zipdownload.js
+++ b/ruoyi-ui/src/utils/zipdownload.js
@@ -2,60 +2,59 @@ import axios from 'axios'
import { getToken } from '@/utils/auth'
const mimeMap = {
- xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- zip: 'application/zip'
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ zip: 'application/zip'
}
const baseUrl = process.env.VUE_APP_BASE_API
export function downLoadZip(str, filename) {
- var url = baseUrl + str
- axios({
- method: 'get',
- url: url,
- responseType: 'blob',
- headers: { 'Authorization': 'Bearer ' + getToken() }
- }).then(res => {
- resolveBlob(res, mimeMap.zip)
- })
+ var url = baseUrl + str
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(res => {
+ resolveBlob(res, mimeMap.zip)
+ })
}
export function downLoadVideoUrl(str) {
var url = baseUrl + str
axios({
- method: 'get',
- url: url,
- responseType: 'arraybuffer',
- headers: { 'Authorization': 'Bearer ' + getToken() },
+ method: 'get',
+ url: url,
+ responseType: 'arraybuffer',
+ headers: { 'Authorization': 'Bearer ' + getToken() },
}).then(res => {
- // console.log(res);
- res.send();
+ // console.log(res);
+ return res.data
})
}
export function downLoadUrl(str, item) {
- var url = baseUrl + str
- axios({
- method: 'get',
- url: url,
- responseType: 'blob',
- headers: { 'Authorization': 'Bearer ' + getToken() },
- }).then(res => {
- // console.log(res);
- // downloadFileFun(res.data, item)
- res.send();
- })
+ var url = baseUrl + str
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() },
+ }).then(res => {
+ // console.log(res);
+ downloadFileFun(res.data, item)
+ })
}
export function downloadFileFun(data, item) {
- if (!data) {
- return
- }
- let url = window.URL.createObjectURL(new Blob([data]))
- let link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- link.setAttribute('download', item.name)
- document.body.appendChild(link)
- link.click()
+ if (!data) {
+ return
+ }
+ let url = window.URL.createObjectURL(new Blob([data]))
+ let link = document.createElement('a')
+ link.style.display = 'none'
+ link.href = url
+ link.setAttribute('download', item.name)
+ document.body.appendChild(link)
+ link.click()
}
/**
@@ -64,17 +63,17 @@ export function downloadFileFun(data, item) {
* @param {String} mimeType MIME类型
*/
export function resolveBlob(res, mimeType) {
- const aLink = document.createElement('a')
- var blob = new Blob([res.data], { type: mimeType })
- // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
- var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
- var contentDisposition = decodeURI(res.headers['content-disposition'])
- var result = patt.exec(contentDisposition)
- var fileName = result[1]
- fileName = fileName.replace(/\"/g, '')
- aLink.href = URL.createObjectURL(blob)
- aLink.setAttribute('download', fileName) // 设置下载文件名称
- document.body.appendChild(aLink)
- aLink.click()
- document.body.appendChild(aLink)
+ const aLink = document.createElement('a')
+ var blob = new Blob([res.data], { type: mimeType })
+ // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
+ var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
+ var contentDisposition = decodeURI(res.headers['content-disposition'])
+ var result = patt.exec(contentDisposition)
+ var fileName = result[1]
+ fileName = fileName.replace(/\"/g, '')
+ aLink.href = URL.createObjectURL(blob)
+ aLink.setAttribute('download', fileName) // 设置下载文件名称
+ document.body.appendChild(aLink)
+ aLink.click()
+ document.body.appendChild(aLink)
}
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/benyi/child_files/index.vue b/ruoyi-ui/src/views/benyi/child_files/index.vue
index a4924e670..e2abd1951 100644
--- a/ruoyi-ui/src/views/benyi/child_files/index.vue
+++ b/ruoyi-ui/src/views/benyi/child_files/index.vue
@@ -22,8 +22,8 @@
{{ i + 1 }}.
{{ ele.name }}
-
- 下载
+ 下载
+
diff --git a/ruoyi-ui/src/views/benyi_train/video_study/index.vue b/ruoyi-ui/src/views/benyi_train/video_study/index.vue
index caecf08e9..d9fa49eb9 100644
--- a/ruoyi-ui/src/views/benyi_train/video_study/index.vue
+++ b/ruoyi-ui/src/views/benyi_train/video_study/index.vue
@@ -176,7 +176,6 @@ export default {
listVideo(this.queryParams).then((response) => {
this.videoList = response.rows;
this.playerOptions = response.rows.map((ele) => {
- console.log(ele.videourl);
return {
autoplay: false,
muted: true,
@@ -187,8 +186,8 @@ export default {
{
type: ele.filetype,
// mp4
- // src: ele.videourl
- src: downLoadVideoUrl(ele.videourl),
+ src: ele.videourl
+ // src: downLoadVideoUrl(ele.videourl),
},
],
notSupportedMessage: "此视频暂无法播放,请稍后再试",
diff --git a/ruoyi/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index ef3add97c..a05c525ac 100644
--- a/ruoyi/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -94,9 +94,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css",
"/**/*.js"
).permitAll()
-// .antMatchers("/profile/**").anonymous()
-// .antMatchers("/common/download**").anonymous()
-// .antMatchers("/common/download/resource**").anonymous()
+ .antMatchers("/profile/**").anonymous()
+ .antMatchers("/common/download**").anonymous()
+ .antMatchers("/common/download/resource**").anonymous()
.antMatchers("/swagger-ui.html").anonymous()
.antMatchers("/swagger-resources/**").anonymous()
.antMatchers("/webjars/**").anonymous()
diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java
index 517ba8b94..6449b641a 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java
@@ -62,8 +62,8 @@ public class ByTrainVideoController extends BaseController {
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
-// list.get(i).setVideourl(commonController.privateDownloadUrl(list.get(i).getVideourl()));
- list.get(i).setVideourl("profile/video/"+list.get(i).getVideourl()+".mp4");
+ list.get(i).setVideourl(commonController.privateDownloadUrl(list.get(i).getVideourl()));
+// list.get(i).setVideourl("/profile/video/"+list.get(i).getVideourl()+".mp4");
}
}
@@ -104,6 +104,7 @@ public class ByTrainVideoController extends BaseController {
public AjaxResult getInfo(@PathVariable("id") Long id) {
ByTrainVideo byTrainVideo = byTrainVideoService.selectByTrainVideoById(id);
byTrainVideo.setVideourl(commonController.privateDownloadUrl(byTrainVideo.getVideourl()));
+ // byTrainVideo.setVideourl("/profile/video/"+list.get(i).getVideourl()+".mp4");
// System.out.println("url:"+byTrainVideo.getVideourl());
byTrainVideo.setType(byTrainVideo.getType().substring(0, byTrainVideo.getType().length() - 1));//去掉后缀的,号
return AjaxResult.success(byTrainVideo);