Commit ce253946 authored by 罗超's avatar 罗超

1、处理重新生成封面图的路径问题

2、销售端支持保存后仍然可以新增模板页面
3、支持行程天数超出,自动分页
4、新增模板管理端口的图层命名问题
parent d1c5929d
...@@ -71,6 +71,7 @@ import Draggable from 'vuedraggable' ...@@ -71,6 +71,7 @@ import Draggable from 'vuedraggable'
import { ElLoading, ElMessageBox } from 'element-plus' import { ElLoading, ElMessageBox } from 'element-plus'
import FileService from '@/services/FileService' import FileService from '@/services/FileService'
import { Slide } from '@/types/slides' import { Slide } from '@/types/slides'
import { uniqueId } from 'lodash'
const mainStore = useMainStore() const mainStore = useMainStore()
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
...@@ -206,15 +207,16 @@ const GetTripFiledData = async () =>{ ...@@ -206,15 +207,16 @@ const GetTripFiledData = async () =>{
} }
const travel = dataRes.data.data const travel = dataRes.data.data
const cursors = [] as Array<any> const cursors = [] as Array<any>
const elementsData = [] as Array<any>
for (let index = 0; index < slidesData.length; index++) { for (let index = 0; index < slidesData.length; index++) {
const x = slidesData[index] as any; const x = slidesData[index] as any;
let eles = x.elements.filter(y=>y.groupId && y.groupId=='first_row') let eles = x.elements.filter(y=>y.groupId && y.groupId=='first_row')
if(eles.length>0){ if(eles.length>0){
x.elements = x.elements.filter(y=>!y.groupId || y.groupId!='first_row') x.elements = x.elements.filter(y=>!y.groupId || y.groupId!='first_row')
let newElements = ResolveTripDaysHandler(eles) let newElements = ResolveTripDaysHandler(eles,index)
console.log(newElements) x.elements = x.elements.concat(newElements?.elements)
x.elements = x.elements.concat(newElements) if(newElements?.newSlider){
slidesData.splice(index+1,0,newElements.newSlider)
}
} }
for (let j = 0; j < x.elements.length; j++) { for (let j = 0; j < x.elements.length; j++) {
let y = x.elements[j] let y = x.elements[j]
...@@ -309,7 +311,6 @@ const GetTripFiledData = async () =>{ ...@@ -309,7 +311,6 @@ const GetTripFiledData = async () =>{
} }
} }
} }
slidesStore.setSlides(slidesData) slidesStore.setSlides(slidesData)
} }
} catch (error) { } catch (error) {
...@@ -318,11 +319,14 @@ const GetTripFiledData = async () =>{ ...@@ -318,11 +319,14 @@ const GetTripFiledData = async () =>{
loadingObj.close() loadingObj.close()
} }
const ResolveTripDaysHandler = (items)=>{ const ResolveTripDaysHandler = (items:any, slideIndex:number)=>{
let elements = [] let elements = []
if(items.length>0){ if(items.length>0){
let topList = items.map(item=>{ return item.top }) let topList = items.map(item=>{ return item.top })
let heightList = items.map(item=>{ return item.height }) let heightList = items.map(item=>{ return item.height })
let tempNewSlide:any = null //JSON.parse(JSON.stringify(slides.value[slideIndex]))
let formBg:any = slides.value[slideIndex].elements.find(x=>x.layerName &&x.layerName=='form_bg')
let maxTop = formBg?(formBg.top+formBg.height):-1
let max=Math.max.apply(null,topList); let max=Math.max.apply(null,topList);
let min=Math.min.apply(null,topList); let min=Math.min.apply(null,topList);
let maxh = Math.max.apply(null,heightList) let maxh = Math.max.apply(null,heightList)
...@@ -330,9 +334,10 @@ const ResolveTripDaysHandler = (items)=>{ ...@@ -330,9 +334,10 @@ const ResolveTripDaysHandler = (items)=>{
let elementsHeight = maxh>mutils?maxh:mutils; let elementsHeight = maxh>mutils?maxh:mutils;
let value=datas.DataSource.TravelAatas.simpleTripInfo; let value=datas.DataSource.TravelAatas.simpleTripInfo;
let baseIndex = 0
for(let i=0;i<value.length;i++){ for(let i=0;i<value.length;i++){
let templateObj = JSON.parse(JSON.stringify(items)) let templateObj = JSON.parse(JSON.stringify(items))
let currentTop = elementsHeight*baseIndex
for(let k=0;k<templateObj.length;k++){ for(let k=0;k<templateObj.length;k++){
const oo = templateObj[k].layerName; const oo = templateObj[k].layerName;
let valueData let valueData
...@@ -341,7 +346,7 @@ const ResolveTripDaysHandler = (items)=>{ ...@@ -341,7 +346,7 @@ const ResolveTripDaysHandler = (items)=>{
if(oo=='hotel') valueData = '宿:'+value[i]['Hotel'] if(oo=='hotel') valueData = '宿:'+value[i]['Hotel']
if(oo=='dinner') valueData = '餐:'+value[i]['Zao']+'/'+value[i]['Wu']+'/'+value[i]['Wan'] if(oo=='dinner') valueData = '餐:'+value[i]['Zao']+'/'+value[i]['Wu']+'/'+value[i]['Wan']
if(oo=='dinner_hotel') valueData = '餐:'+value[i]['Zao']+'/'+value[i]['Wu']+'/'+value[i]['Wan']+' 宿:'+value[i]['Hotel'] if(oo=='dinner_hotel') valueData = '餐:'+value[i]['Zao']+'/'+value[i]['Wu']+'/'+value[i]['Wan']+' 宿:'+value[i]['Hotel']
templateObj[k].top += elementsHeight*i templateObj[k].top += currentTop
templateObj[k].groupId +="_"+i.toString() templateObj[k].groupId +="_"+i.toString()
templateObj[k].id +="_"+i.toString()+"_"+k.toString() templateObj[k].id +="_"+i.toString()+"_"+k.toString()
if(valueData){ if(valueData){
...@@ -351,13 +356,32 @@ const ResolveTripDaysHandler = (items)=>{ ...@@ -351,13 +356,32 @@ const ResolveTripDaysHandler = (items)=>{
templateObj[k].content = templateObj[k].content.replace(txt,valueData) templateObj[k].content = templateObj[k].content.replace(txt,valueData)
} }
} }
elements.push(...templateObj) if(tempNewSlide){
tempNewSlide.elements.push(...templateObj)
}else{
elements.push(...templateObj)
if((currentTop+elementsHeight*2+min)>maxTop){
tempNewSlide = copySlidHandler(slideIndex)
baseIndex = -1
}
}
baseIndex++
}
return {
elements,
newSlider:tempNewSlide
} }
return elements
} }
} }
const copySlidHandler = (slideIndex:number)=>{
let newSlide = JSON.parse(JSON.stringify(slides.value[slideIndex]))
newSlide.id = uniqueId()
newSlide.elements = newSlide.elements.filter((y:any)=>!y.groupId || y.groupId!='first_row')
return newSlide
}
// 获取行程模版数据 // 获取行程模版数据
const GetTripTemplate = async () =>{ const GetTripTemplate = async () =>{
// console.log(searchData.value.TempId,searchData.value.TempId2,TempId.value,searchData.value.sellTempId) // console.log(searchData.value.TempId,searchData.value.TempId2,TempId.value,searchData.value.sellTempId)
...@@ -431,8 +455,10 @@ const GetTripTemplate = async () =>{ ...@@ -431,8 +455,10 @@ const GetTripTemplate = async () =>{
if(ConfigId.value>0){ if(ConfigId.value>0){
newSlides = newSlides.filter((x:Slide)=>!x.isTripItems) newSlides = newSlides.filter((x:Slide)=>!x.isTripItems)
} }
slidesStore.setSlides(newSlides)
layoutsStore.setLayouts(JSON.parse(JSON.stringify(newSlides))) layoutsStore.setLayouts(JSON.parse(JSON.stringify(newSlides)))
if(searchData.value.sellId&&!searchData.value.TempId) return
slidesStore.setSlides(newSlides)
CoverImgStore.setCoverImg(dataRes.data.data.CoverImg) CoverImgStore.setCoverImg(dataRes.data.data.CoverImg)
slidesStore.updateSlideIndex(0) slidesStore.updateSlideIndex(0)
datas.DataSource.pageType = newSlides[0].pageType datas.DataSource.pageType = newSlides[0].pageType
...@@ -712,7 +738,7 @@ const contextmenusThumbnailItem = (): ContextmenuItem[] => { ...@@ -712,7 +738,7 @@ const contextmenusThumbnailItem = (): ContextmenuItem[] => {
] ]
} }
if(searchData.value.sellId&&!searchData.value.TempId) sellGetTripTemplate() if(searchData.value.sellId&&!searchData.value.TempId) sellGetTripTemplate()
else GetTripTemplate() GetTripTemplate()
</script> </script>
......
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
:style="{ backgroundImage: `url(${handleImageElement.src})` }" :style="{ backgroundImage: `url(${handleImageElement.src})` }"
></div> ></div>
<Divider v-if="mode==1" />
<div v-if="mode==1" class="row items-center">
<div class="col">图层名称:</div>
<el-input style="width:60%;" v-model="layerName" @input="updateLayerName"></el-input>
</div>
<Divider v-if="mode==1" />
<ElementFlip /> <ElementFlip />
<div class="element-data-mapping"> <div class="element-data-mapping">
<divider /> <divider />
...@@ -133,7 +140,7 @@ const keyboardStore = useKeyboardStore() ...@@ -133,7 +140,7 @@ const keyboardStore = useKeyboardStore()
const { handleElement, handleElementId } = storeToRefs(mainStore) const { handleElement, handleElementId } = storeToRefs(mainStore)
const { currentSlide } = storeToRefs(slidesStore) const { currentSlide } = storeToRefs(slidesStore)
const { ctrlKeyState } = storeToRefs(useKeyboardStore()) const { ctrlKeyState } = storeToRefs(useKeyboardStore())
const layerName = ref(handleElement.value?.layerName??'')
const param = query() const param = query()
const mode = parseInt(param.model??1) const mode = parseInt(param.model??1)
...@@ -280,6 +287,13 @@ const resetImage = () => { ...@@ -280,6 +287,13 @@ const resetImage = () => {
addHistorySnapshot() addHistorySnapshot()
} }
const updateLayerName = (e:any)=>{
slidesStore.updateElement({
id: handleElementId.value,
props: { layerName: e }
})
}
// 将图片设置为背景 // 将图片设置为背景
const setBackgroundImage = () => { const setBackgroundImage = () => {
const _handleElement = handleElement.value as PPTImageElement const _handleElement = handleElement.value as PPTImageElement
......
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
>{{item.label}}</div> >{{item.label}}</div>
</div> </div>
<Divider v-if="mode==1" />
<div v-if="mode==1" class="row items-center">
<div class="col">图层名称:</div>
<el-input style="width:60%;" v-model="layerName" @input="updateLayerName"></el-input>
</div>
<ElementDataMapping v-if="mode==0||mode==2"></ElementDataMapping> <ElementDataMapping v-if="mode==0||mode==2"></ElementDataMapping>
<Divider /> <Divider />
...@@ -456,6 +463,7 @@ const bulletListPanelVisible = ref(false) ...@@ -456,6 +463,7 @@ const bulletListPanelVisible = ref(false)
const orderedListPanelVisible = ref(false) const orderedListPanelVisible = ref(false)
const indentLeftPanelVisible = ref(false) const indentLeftPanelVisible = ref(false)
const indentRightPanelVisible = ref(false) const indentRightPanelVisible = ref(false)
const layerName = ref(handleElement.value?.layerName??'')
const bulletListStyleTypeOption = ref(['disc', 'circle', 'square']) const bulletListStyleTypeOption = ref(['disc', 'circle', 'square'])
const orderedListStyleTypeOption = ref(['decimal', 'lower-roman', 'upper-roman', 'lower-alpha', 'upper-alpha', 'lower-greek']) const orderedListStyleTypeOption = ref(['decimal', 'lower-roman', 'upper-roman', 'lower-alpha', 'upper-alpha', 'lower-greek'])
...@@ -529,6 +537,10 @@ const updateLink = (link?: string) => { ...@@ -529,6 +537,10 @@ const updateLink = (link?: string) => {
linkPopoverVisible.value = false linkPopoverVisible.value = false
} }
const updateLayerName = (e:any)=>{
updateElement({ layerName: e })
}
const initMapping = ()=>{ const initMapping = ()=>{
if(handleElement.value && !handleElement.value.dataMapping && 'TemplateDataSource' in handleElement.value && handleElement.value.TemplateDataSource){ if(handleElement.value && !handleElement.value.dataMapping && 'TemplateDataSource' in handleElement.value && handleElement.value.TemplateDataSource){
if(handleElement.value.TemplateDataSource.index!=null && handleElement.value.TemplateDataSource.Content){ if(handleElement.value.TemplateDataSource.index!=null && handleElement.value.TemplateDataSource.Content){
......
...@@ -405,10 +405,10 @@ ...@@ -405,10 +405,10 @@
namePaths = CoverImgPath[CoverImgPath.length-1] namePaths = CoverImgPath[CoverImgPath.length-1]
namePath = namePaths.split('?')[0] namePath = namePaths.split('?')[0]
} }
url = await AliyunUpload.UploadAsync(file,`Feature/${namePath}?t=${t}`) url = await AliyunUpload.UploadAsync(file,`Feature/${namePath}`)
coverImgStore.setCoverImg(url) coverImgStore.setCoverImg(url+`?t=${t}`)
isCoverImgStore.setIsCoverImg(false) isCoverImgStore.setIsCoverImg(false)
queryObj.value.CoverImg = url queryObj.value.CoverImg = url+`?t=${t}`
} }
} }
......
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