|
|
@@ -2,8 +2,16 @@ import { getToken } from './token-util';
|
|
|
import { TOKEN_HEADER_NAME } from '@/config/setting';
|
|
|
|
|
|
// 获取图片反显url
|
|
|
-export function getImageUrl (path) {
|
|
|
- return `${sessionStorage.filePath}${path}`;
|
|
|
+export function getImageUrl(path) {
|
|
|
+ let fileNames = path.split('/');
|
|
|
+ let url =
|
|
|
+ window.location.origin +
|
|
|
+ '/api/main/file/getFile?objectName=' +
|
|
|
+ path +
|
|
|
+ '&fullfilename=' +
|
|
|
+ fileNames[fileNames.length - 1];
|
|
|
+ return url;
|
|
|
+ // return `${sessionStorage.filePath}${path}`;
|
|
|
// if (process.env.NODE_ENV === 'development') {
|
|
|
// return `http://192.168.3.51:18086/main/file/getFile?${TOKEN_HEADER_NAME}=${getToken()}&objectName=${path}`;
|
|
|
// } else {
|
|
|
@@ -13,7 +21,7 @@ export function getImageUrl (path) {
|
|
|
// }
|
|
|
}
|
|
|
// 从反显url上获取接口需要path
|
|
|
-export function getImagePath (url) {
|
|
|
+export function getImagePath(url) {
|
|
|
if (!url) {
|
|
|
return '';
|
|
|
}
|
|
|
@@ -24,7 +32,7 @@ export function getImagePath (url) {
|
|
|
}
|
|
|
|
|
|
// 下载方法
|
|
|
-export function download (data, name) {
|
|
|
+export function download(data, name) {
|
|
|
const a = document.createElement('a');
|
|
|
const url = window.URL.createObjectURL(data);
|
|
|
const filename = name;
|