Commit 36b794e4 authored by 罗超's avatar 罗超

修改文件上传接口调用

parent 52027cf3
...@@ -203,6 +203,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin ...@@ -203,6 +203,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
} }
const url = await FileService.uploadToFontServerAsync(uploadFile?.raw) const url = await FileService.uploadToFontServerAsync(uploadFile?.raw)
if(url && url!=''){ if(url && url!=''){
if(url.indexOf('"')!=-1) url = url.replaceAll('"','')
let label=uploadFile.name.split('.')[0],reduceName='',reduceUrl='' let label=uploadFile.name.split('.')[0],reduceName='',reduceUrl=''
try { try {
if(info.file){ if(info.file){
...@@ -231,6 +232,11 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin ...@@ -231,6 +232,11 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
type:'error' type:'error'
}) })
} }
}else{
ElMessage({
message:'上传失败,请重试',
type:'error'
})
} }
} catch (error) { } catch (error) {
console.log("上传异常",error) console.log("上传异常",error)
......
...@@ -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 = `http://fileservice.oytour.com/api/pdf/${id}` let url = `https://fileservice.oytour.com/api/pdf/${id}`
try { try {
const response = await fetchWithTimeout(url, 60*1000); const response = await fetchWithTimeout(url, 60*1000);
// 处理响应 // 处理响应
...@@ -104,7 +104,7 @@ class FileService { ...@@ -104,7 +104,7 @@ class FileService {
} }
static notifyFontUpdateAsync = async (fileName:string)=>{ static notifyFontUpdateAsync = async (fileName:string)=>{
await fetch('http://fileservice.oytour.com/api/file/downfont/'+fileName) await fetch('https://fileservice.oytour.com/api/file/downfont/'+fileName)
} }
static uploadToFontServerAsync = async (file:File)=>{ static uploadToFontServerAsync = async (file:File)=>{
...@@ -112,13 +112,14 @@ class FileService { ...@@ -112,13 +112,14 @@ class FileService {
const formData = new FormData(); const formData = new FormData();
formData.append('file', file); formData.append('file', file);
const response = await fetch('http://localhost:5164/api/file/uploadfont', { const response = await fetch('https://fileservice.oytour.com/api/file/uploadfont', {
method: 'POST', method: 'POST',
body: formData, body: formData,
}); });
if(response.ok){ if(response.ok){
let r = await response.text() let r = await response.text()
return r if(r.indexOf('https://im.oytour.com')!=-1) return r
return ''
} }
return '' return ''
} catch (error) { } catch (error) {
......
...@@ -143,7 +143,7 @@ const beginDownload = async ()=>{ ...@@ -143,7 +143,7 @@ const beginDownload = async ()=>{
} }
} }
fileUrl.value = `http://fileservice.oytour.com/api/img/${searchData.value.sellId}/${rangeArray.join(',')}/${format.value=='png'?'png':'jpg'}/${quality.value}/${useSellTemplateStore().SaleHashCode}` //http://fileservice.oytour.com fileUrl.value = `https://fileservice.oytour.com/api/img/${searchData.value.sellId}/${rangeArray.join(',')}/${format.value=='png'?'png':'jpg'}/${quality.value}/${useSellTemplateStore().SaleHashCode}` //https://fileservice.oytour.com
console.log(fileUrl.value) console.log(fileUrl.value)
nextTick(()=>{ nextTick(()=>{
downloadLink.value.click() downloadLink.value.click()
......
...@@ -127,7 +127,7 @@ const exportOnlinePdf=()=>{ ...@@ -127,7 +127,7 @@ const exportOnlinePdf=()=>{
autoSave.value=1 autoSave.value=1
} }
const beginDownload = async ()=>{ const beginDownload = async ()=>{
fileUrl.value = `http://fileservice.oytour.com/api/pdf/${searchData.value.sellId}/${useSellTemplateStore().SaleHashCode}` fileUrl.value = `https://fileservice.oytour.com/api/pdf/${searchData.value.sellId}/${useSellTemplateStore().SaleHashCode}`
nextTick(()=>{ nextTick(()=>{
downloadLink.value.click() downloadLink.value.click()
}) })
......
...@@ -216,8 +216,8 @@ const openFileDocument = (item:any) => { ...@@ -216,8 +216,8 @@ const openFileDocument = (item:any) => {
window.open(url); window.open(url);
} }
const exportDocument = (item:any) => { const exportDocument = (item:any) => {
let url = `http://fileservice.oytour.com/api/img/${item.FileId}/1/png/1/${item.HashInfo}` let url = `https://fileservice.oytour.com/api/img/${item.FileId}/1/png/1/${item.HashInfo}`
if(item.FileType==1) url = `http://fileservice.oytour.com/api/pdf/${item.FileId}/${item.HashInfo}` if(item.FileType==1) url = `https://fileservice.oytour.com/api/pdf/${item.FileId}/${item.HashInfo}`
window.open(url); window.open(url);
} }
const changeFolderHandler = async (item:any) =>{ const changeFolderHandler = async (item:any) =>{
......
...@@ -340,8 +340,8 @@ import CopyFile from "./CopyFile.vue"; ...@@ -340,8 +340,8 @@ import CopyFile from "./CopyFile.vue";
} }
const exportDocument = (item:any) => { const exportDocument = (item:any) => {
let url = `http://fileservice.oytour.com/api/img/${item.FileId}/1/png/1/${item.HashInfo}` let url = `https://fileservice.oytour.com/api/img/${item.FileId}/1/png/1/${item.HashInfo}`
if(item.FileType==1) url = `http://fileservice.oytour.com/api/pdf/${item.FileId}/${item.HashInfo}` if(item.FileType==1) url = `https://fileservice.oytour.com/api/pdf/${item.FileId}/${item.HashInfo}`
window.open(url); window.open(url);
} }
const viewTemplate = (row:any) => { const viewTemplate = (row:any) => {
......
...@@ -34,9 +34,6 @@ module.exports = { ...@@ -34,9 +34,6 @@ module.exports = {
}) })
], ],
}, },
devServer:{
https:true
},
pwa: { pwa: {
name: 'PPTist', name: 'PPTist',
themeColor: '#d14424', themeColor: '#d14424',
......
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