|
@@ -1,46 +1,47 @@
|
|
|
import OSS from 'ali-oss'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import request from '@/utils/httpRequest'
|
|
|
+import { PUBLIC_MODULES_PATH as prefix } from "../AppPath";
|
|
|
|
|
|
export default class OSSSerive {
|
|
|
saveMsg (param) {
|
|
|
return request({
|
|
|
- url: '/oss/file/saveMsg',
|
|
|
+ url: prefix + '/oss/file/saveMsg',
|
|
|
method: 'post',
|
|
|
data: param
|
|
|
})
|
|
|
}
|
|
|
findFileList (attachmentId) {
|
|
|
return request({
|
|
|
- url: '/oss/file/findFileList',
|
|
|
+ url: prefix + '/oss/file/findFileList',
|
|
|
method: 'get',
|
|
|
params: {attachmentId: attachmentId}
|
|
|
})
|
|
|
}
|
|
|
getTemporaryUrl (url) {
|
|
|
return request({
|
|
|
- url: '/oss/file/getTemporaryUrl',
|
|
|
+ url: prefix + '/oss/file/getTemporaryUrl',
|
|
|
method: 'get',
|
|
|
params: {url: url}
|
|
|
})
|
|
|
}
|
|
|
getFileSizeByUrl (url) {
|
|
|
return request({
|
|
|
- url: '/oss/file/getFileSizeByUrl',
|
|
|
+ url: prefix + '/oss/file/getFileSizeByUrl',
|
|
|
method: 'get',
|
|
|
params: {url: url}
|
|
|
})
|
|
|
}
|
|
|
deleteMsgById (id) {
|
|
|
return request({
|
|
|
- url: '/oss/file/deleteMsgById',
|
|
|
+ url: prefix + '/oss/file/deleteMsgById',
|
|
|
method: 'get',
|
|
|
params: {id: id}
|
|
|
})
|
|
|
}
|
|
|
downLoadAttach (url) {
|
|
|
return request({
|
|
|
- url: '/oss/file/downLoadAttach',
|
|
|
+ url: prefix + '/oss/file/downLoadAttach',
|
|
|
method: 'get',
|
|
|
responseType: 'blob',
|
|
|
params: {file: url}
|
|
@@ -182,7 +183,7 @@ export async function httpRequest (file, name, type, maxValue) { // 阿里云OSS
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
function getTemporaryByUrl (url) {
|
|
|
return request({
|
|
|
- url: '/oss/file/getTemporaryUrl',
|
|
|
+ url: prefix + '/oss/file/getTemporaryUrl',
|
|
|
method: 'get',
|
|
|
params: {url: url}
|
|
|
})
|
|
@@ -221,7 +222,7 @@ export async function toHref (row) {
|
|
|
}
|
|
|
const link = document.createElement('a')
|
|
|
await getTemporaryByUrl(row.url).then((data) => {
|
|
|
- const url = data.data // 完整的url则直接使用
|
|
|
+ const url = data // 完整的url则直接使用
|
|
|
// 这里是将url转成blob地址,
|
|
|
fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
|
|
|
link.href = URL.createObjectURL(blob)
|