Commit 8576cd47 authored by zhengke's avatar zhengke

上传图

parent 15ca1172
......@@ -158,6 +158,13 @@ const routes: RouteRecordRaw[] = [
title:'行程生成预览'
}
},
{
path: '/PreviewCover/:tempId(\\d+)',
component: () => import('@/views/Preview/PreviewCover.vue'),
meta:{
title:'预览封面'
}
},
{
path: '/play/:id(\\d+)/:logId(\\d+)/:status(\\d+)',
component: () => import('@/views/Editor/PlayView.vue'),
......
import { domainManager } from '@/utils/domainManager'
class AliyunUpload {
static readonly REGION = 'oss-cn-chengdu'
static readonly ACCESS_KEY_ID = 'LTAI5tFgqt1pwnoA35cigYTr'
static readonly ACCESS_KEY_SECRET = 'wXPoEqJ7qLdvX9iBluIebhCPSzoemy'
static readonly BUCKET = 'vt-im-bucket'
static GetOSS = () => {
const OSS = require('ali-oss');
//return new OSS
return new OSS({
region:this.REGION,
accessKeyId:this.ACCESS_KEY_ID,
accessKeySecret:this.ACCESS_KEY_SECRET,
bucket:this.BUCKET
})
}
static UploadAsync = async (file:any,name:string)=>{
try {
let path = "/Sale/Uploadvideo/"
const formData = new FormData();
formData.append('file', file);
const response = await fetch(`${domainManager().UploadUrl}/Upload/UploadToALiOSS?filePath=${path}`, {
const response = await fetch(`${domainManager().UploadUrl}/Upload/UploadToALiOSS?filePath=${encodeURIComponent(name)}`, {
method: 'POST',
body: formData,
});
if(response.ok){
let result = await response.text()
let datas = JSON.parse(result)
return datas.FilePath
return 'https://im.oytour.com'+datas.FilePath
}
return ''
} catch (error) {
......
......@@ -118,7 +118,8 @@ searchData.value = inject(injectKeyTemplate)
const acquiesceLogo = ref([
'https://im.oytour.com/pptist/static/logo1.png',
'https://im.oytour.com/pptist/static/logo2.png',
'https://im.oytour.com/pptist/static/logo3.png'
'https://im.oytour.com/pptist/static/logo3.png',
'https://im.oytour.com/pptist/static/logo4.png'
])
watch(() => slideIndex.value, () => {
......@@ -462,11 +463,13 @@ const GetTripTemplate = async () =>{
let x = newSlides[i]
let index =null
x.elements.forEach((y,indexs)=>{
// console.log(y.layerName=='logo','----logo'+i)
if(y.layerName && y.layerName=='logo') index = indexs
})
let eles = x.elements.filter(y=>y.layerName && y.layerName=='logo')
let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1)
let newElements = await ResolveTripLogoHandler(eles,i)
x.elements = x.elements.concat(newElements?.elements)
console.log(eles.length,'---')
if(index>=0) x.elements.splice(index,1)
}
}
......@@ -528,9 +531,8 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number) =>{
let y = templateObj[i]
let tempSize = await FileService.getImageSizeWithoutDownloading(templateObj[i].src)
let scale = tempSize.width/tempSize.height
if(scale==1) templateObj[i].src = acquiesceLogo.value[0]
if(scale>1) templateObj[i].src = acquiesceLogo.value[2]
if(scale>1) templateObj[i].src = acquiesceLogo.value[3]
if(scale<1) templateObj[i].src = acquiesceLogo.value[1]
if(tempNewSlide){
tempNewSlide.elements.push(...templateObj)
......
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