Commit 03e0570a authored by zhengke's avatar zhengke

优化替换logo

parent 1d2d7a34
......@@ -45,14 +45,14 @@
<div class="page-number">幻灯片 {{slideIndex + 1}} / {{slides.length}}</div>
</div>
<!-- <div style="position: fixed;left: 200px;top: -100px;opacity: 0;">
<div style="position: fixed;left: 200px;top: -100px;opacity: 0;">
<canvas style="display: none" id="canvas"></canvas>
<div
id="extract-color-id"
class="extract-color"
style="display: flex;padding: 0 20px; justify-content:end;">
</div>
</div> -->
</div>
</template>
<script lang="ts" setup>
......@@ -424,17 +424,17 @@ const GetTripTemplate = async () =>{
else if(TempId.value) queryMsg.TempId = TempId.value
let dataRes = await ConfigService.GetTripTemplateSlide(queryMsg);
if (dataRes.data.resultCode == 1) {
// colorList.value = []
colorList.value = []
tempDatas.value = dataRes.data.data
// for(let i=0;i<tempDatas.value.PageImageList.length;i++){
// const img = new Image();
// img.src = `${tempDatas.value.PageImageList[i]}`;
// img.crossOrigin = 'anonymous';
// img.onload = () => {
// themeColor(1, img, 20, SetColor);
// };
// }
for(let i=0;i<tempDatas.value.PageImageList.length;i++){
const img = new Image();
img.src = `${tempDatas.value.PageImageList[i]}`;
img.crossOrigin = 'anonymous';
img.onload = () => {
themeColor(1, img, 20, SetColor);
};
}
if(SalesBack.value==0||(SalesBack.value==1&&searchData.value.TempId)){
let viewportRatios = 0
if(dataRes.data.data.TemplateType!=2) {
......@@ -481,7 +481,9 @@ const GetTripTemplate = async () =>{
newSlides = newSlides.filter((x:Slide)=>!x.isTripItems)
}
getColorShade(newSlides)
setTimeout(()=>{
getColorShade(newSlides)
},500)
}
queryObj.value.TempId = dataRes.data.data.TempId
......@@ -526,27 +528,27 @@ const generateUniqueId = () => {
const getColorShade = async (newSlides:any) => {
let dark = false
// 根据集团渲染logo
// if(tempDatas.value.AuthType<=1){
// for(let j=0;j<colorList.value.length;j++){
// if (getRgbLevel(colorList.value[j].Color) > 50) dark = true
// }
// for(let i=0;i<newSlides.length;i++){
// if(i>colorList.value.length-2) dark = false
// let x = newSlides[i]
// let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1)
// let newElementsImg = await ResolveTripLogoHandler(eles,i,dark)
// let newElements = []
// x.elements.forEach(y=>{
// if(newElementsImg?.elements){
// newElementsImg?.elements.forEach(z=>{
// if(y.id==z.id) y = JSON.parse(JSON.stringify(z))
// })
// }
// newElements.push(y)
// })
// x.elements = newElements
// }
// }
if(tempDatas.value.GId!=userInfo.value.gid&&!searchData.value.isTeamManage){
for(let j=0;j<colorList.value.length;j++){
if (getRgbLevel(colorList.value[j].Color) > 50) dark = true
}
for(let i=0;i<newSlides.length;i++){
if(i>colorList.value.length-2) dark = false
let x = newSlides[i]
let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1)
let newElementsImg = await ResolveTripLogoHandler(eles,i,dark)
let newElements = []
x.elements.forEach(y=>{
if(newElementsImg?.elements){
newElementsImg?.elements.forEach(z=>{
if(y.id==z.id) y = JSON.parse(JSON.stringify(z))
})
}
newElements.push(y)
})
x.elements = newElements
}
}
layoutsStore.setLayouts(JSON.parse(JSON.stringify(newSlides)))
if(searchData.value.sellId&&!searchData.value.TempId) return
slidesStore.setSlides(newSlides)
......@@ -572,7 +574,8 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false) =
// if(Colors[1]||scale==6) templateObj[i].filters.invert = '20%'
if(scale==1) url = dark==true?acquiesceLogo.value[0]:acquiesceLogo.value[3]
if(scale<1) url = dark==true?acquiesceLogo.value[1]:acquiesceLogo.value[4]
if(scale>1) url = dark==true?acquiesceLogo.value[2]:acquiesceLogo.value[5]
if(scale==6) url = dark==true?acquiesceLogo.value[2]:acquiesceLogo.value[5]
if(scale==3) url = dark==true?acquiesceLogo.value[5]:acquiesceLogo.value[2]
let newTempSize = await FileService.getImageSizeWithoutDownloading(url)
let width = 0
let height = 0
......
......@@ -168,7 +168,8 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false) =
// if(Colors[1]||scale==6) templateObj[i].filters.invert = '20%'
if(scale==1) url = dark==true?acquiesceLogo.value[0]:acquiesceLogo.value[3]
if(scale<1) url = dark==true?acquiesceLogo.value[1]:acquiesceLogo.value[4]
if(scale>1) url = dark==true?acquiesceLogo.value[2]:acquiesceLogo.value[5]
if(scale==6) url = dark==true?acquiesceLogo.value[2]:acquiesceLogo.value[5]
if(scale==3) url = dark==true?acquiesceLogo.value[5]:acquiesceLogo.value[2]
let newTempSize = await FileService.getImageSizeWithoutDownloading(url)
let width = 0
let height = 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