Commit fe9f1074 authored by 罗超's avatar 罗超

完善文件下载部分缺漏

parent e5d1132b
......@@ -21,7 +21,7 @@ const fetchWithTimeout = (url:string, timeout:number)=>{
}
class FileService {
static downloadLinePdfAsync = async (id: any) => {
let url = `https://fileservice.oytour.com/api/pdf/${id}`
let url = `${process.env.VUE_APP_PDF_URL}/api/pdf/${id}`
try {
const response = await fetchWithTimeout(url, 60*1000);
// 处理响应
......@@ -103,7 +103,7 @@ class FileService {
}
static notifyFontUpdateAsync = async (fileName:string)=>{
await fetch('https://fileservice.oytour.com/api/file/downfont/'+fileName)
await fetch(`${process.env.VUE_APP_PDF_URL}/api/file/downfont/`+fileName)
}
static uploadToFontServerAsync = async (file:File)=>{
......@@ -111,7 +111,7 @@ class FileService {
const formData = new FormData();
formData.append('file', file);
const response = await fetch('https://fileservice.oytour.com/api/file/uploadfont', {
const response = await fetch(`${process.env.VUE_APP_PDF_URL}/api/file/uploadfont`, {
method: 'POST',
body: formData,
});
......
......@@ -82,7 +82,8 @@
<template #dropdown>
<el-dropdown-menu class="q-pa-md">
<el-dropdown-item v-if="scope.row.IsEdit && scope.row.FileType!=0" icon="EditPen" @click="editorFileHandler(scope.row)">编辑</el-dropdown-item>
<el-dropdown-item v-if="scope.row.IsDownload && scope.row.FileType!=0" icon="Download" @click="exportDocument(scope.row)">导出</el-dropdown-item>
<el-dropdown-item v-if="scope.row.IsDownload && scope.row.FileType!=0" icon="Download" @click="exportDocument(scope.row,0)">导出PDF</el-dropdown-item>
<el-dropdown-item v-if="scope.row.IsDownload && scope.row.FileType!=0" icon="Download" @click="exportDocument(scope.row,2)">导出图片</el-dropdown-item>
<el-dropdown-item icon="CopyDocument" v-if="scope.row.IsView" @click="openCopyHandler(scope.row)">复制到</el-dropdown-item>
</el-dropdown-menu>
</template>
......@@ -103,7 +104,7 @@ import { ApiResult } from "@/configs/axios";
import ConfigService from "@/services/ConfigService";
import { ElMessage } from "element-plus";
import { PropType, inject, reactive, ref, watch } from "vue";
import {createPlayLink, createSaleEditorLink, formatDateTimeToRead, query} from '@/utils/common'
import {createPlayLink, createSaleEditorLink, downLoadFile, formatDateTimeToRead, query} from '@/utils/common'
import breadPeeling from './components/breadPeeling.vue'
import CopyFile from './components/CopyFile.vue'
import { injectKeyTemplate } from "@/types/injectKey";
......@@ -203,10 +204,14 @@ const openFileDocument = (item:any) => {
const url = createPlayLink(item.FileId,0,2)//`${location.origin}/?uid=${param.uid}&sellId=${item.FileId}&ViewSlideshow=2`
window.open(url);
}
const exportDocument = (item:any) => {
let url = `https://fileservice.oytour.com/api/img/${item.FileId}/1/png/1/${item.HashInfo}`
if(item.FileType==1) url = `https://fileservice.oytour.com/api/pdf/${item.FileId}/${item.HashInfo}`
window.open(url);
const exportDocument = (item:any,type:0|1|2) => {
downLoadFile({
Id:item.FileId,
Hash:item.HashInfo,
Range:'0',
Quality:1,
DownloadType:type
})
}
const changeFolderHandler = async (item:any) =>{
if(item.FileType==0){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment