Commit fe9f1074 authored by 罗超's avatar 罗超

完善文件下载部分缺漏

parent e5d1132b
...@@ -21,7 +21,7 @@ const fetchWithTimeout = (url:string, timeout:number)=>{ ...@@ -21,7 +21,7 @@ const fetchWithTimeout = (url:string, timeout:number)=>{
} }
class FileService { class FileService {
static downloadLinePdfAsync = async (id: any) => { 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 { try {
const response = await fetchWithTimeout(url, 60*1000); const response = await fetchWithTimeout(url, 60*1000);
// 处理响应 // 处理响应
...@@ -103,7 +103,7 @@ class FileService { ...@@ -103,7 +103,7 @@ class FileService {
} }
static notifyFontUpdateAsync = async (fileName:string)=>{ 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)=>{ static uploadToFontServerAsync = async (file:File)=>{
...@@ -111,7 +111,7 @@ class FileService { ...@@ -111,7 +111,7 @@ class FileService {
const formData = new FormData(); const formData = new FormData();
formData.append('file', file); 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', method: 'POST',
body: formData, body: formData,
}); });
......
...@@ -82,7 +82,8 @@ ...@@ -82,7 +82,8 @@
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="q-pa-md"> <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.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-item icon="CopyDocument" v-if="scope.row.IsView" @click="openCopyHandler(scope.row)">复制到</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
...@@ -103,7 +104,7 @@ import { ApiResult } from "@/configs/axios"; ...@@ -103,7 +104,7 @@ import { ApiResult } from "@/configs/axios";
import ConfigService from "@/services/ConfigService"; import ConfigService from "@/services/ConfigService";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { PropType, inject, reactive, ref, watch } from "vue"; 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 breadPeeling from './components/breadPeeling.vue'
import CopyFile from './components/CopyFile.vue' import CopyFile from './components/CopyFile.vue'
import { injectKeyTemplate } from "@/types/injectKey"; import { injectKeyTemplate } from "@/types/injectKey";
...@@ -203,10 +204,14 @@ const openFileDocument = (item:any) => { ...@@ -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` const url = createPlayLink(item.FileId,0,2)//`${location.origin}/?uid=${param.uid}&sellId=${item.FileId}&ViewSlideshow=2`
window.open(url); window.open(url);
} }
const exportDocument = (item:any) => { const exportDocument = (item:any,type:0|1|2) => {
let url = `https://fileservice.oytour.com/api/img/${item.FileId}/1/png/1/${item.HashInfo}` downLoadFile({
if(item.FileType==1) url = `https://fileservice.oytour.com/api/pdf/${item.FileId}/${item.HashInfo}` Id:item.FileId,
window.open(url); Hash:item.HashInfo,
Range:'0',
Quality:1,
DownloadType:type
})
} }
const changeFolderHandler = async (item:any) =>{ const changeFolderHandler = async (item:any) =>{
if(item.FileType==0){ 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