Commit 1883b6a2 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/viitto/pptist

# Conflicts:
#	src/views/Editor/Canvas/index.vue
parents b4c750b6 647f5312
...@@ -122,4 +122,7 @@ window.addEventListener('unload', () => { ...@@ -122,4 +122,7 @@ window.addEventListener('unload', () => {
#app { #app {
height: 100%; height: 100%;
} }
.el-overlay{
z-index: 99999 !important;
}
</style> </style>
\ No newline at end of file
import { ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useSlidesStore, useScreenStore } from '@/store'
export default () => {
const slidesStore = useSlidesStore()
const sourceLoadingStore = useScreenStore()
const { slides, slideIndex } = storeToRefs(slidesStore)
const { SourceLoading } = storeToRefs(useScreenStore())
// 数据源更新
const setNewDatasList = (DataSource:any) => {
sourceLoadingStore.setSourceLoading(false)
const slidesData = slides.value
// 更新Slides数据
let savelides = [] as any
let newSlides = [] as any
const obj = slidesData.find((x,index) =>{
return slideIndex.value == index
})
if(obj){
obj.elements.forEach(x=>{
let dataObj = DataSource.DataSourceList.find((y:any)=>{
return y.id == x.id
})
if(dataObj){
x = dataObj
}
savelides.push(x)
})
obj.elements = JSON.parse(JSON.stringify(savelides))
slidesData.forEach((x:any,index)=>{
if(slideIndex.value == index){
x.pgaeType = DataSource.pgaeType
x.elements = obj.elements
}
newSlides.push(x)
})
slidesStore.setSlides(newSlides)
}
}
return {
setNewDatasList,
}
}
\ No newline at end of file
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
import { useSlidesStore, useScreenStore } from '@/store' import { useSlidesStore, useScreenStore } from '@/store'
import { injectKeyDataSource } from '@/types/injectKey' import { injectKeyDataSource } from '@/types/injectKey'
import { getHtmlPlainText } from '@/utils/common' import { getHtmlPlainText } from '@/utils/common'
import useEditor from '@/utils/Editor/index'
const datas = reactive({ const datas = reactive({
sortList:[], sortList:[],
...@@ -91,6 +92,7 @@ ...@@ -91,6 +92,7 @@
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const sourceLoadingStore = useScreenStore() const sourceLoadingStore = useScreenStore()
const { slides, slideIndex } = storeToRefs(slidesStore) const { slides, slideIndex } = storeToRefs(slidesStore)
const { setNewDatasList } = useEditor()
watch(() => datas.DataSource.DataSourceOverlay, (n,o) => { watch(() => datas.DataSource.DataSourceOverlay, (n,o) => {
if(n){ if(n){
...@@ -98,8 +100,7 @@ ...@@ -98,8 +100,7 @@
sourceLoadingStore.setSourceLoading(false) sourceLoadingStore.setSourceLoading(false)
} }
if(!n&&datas.loading){ if(!n&&datas.loading){
setNewDatas() setNewDatasList(datas.DataSource)
sourceLoadingStore.setSourceLoading(true)
} }
}) })
const setType = (x) =>{ const setType = (x) =>{
...@@ -109,37 +110,8 @@ ...@@ -109,37 +110,8 @@
return x.TemplateList.filter(item=>{ return item.Name.indexOf('图')==-1}) return x.TemplateList.filter(item=>{ return item.Name.indexOf('图')==-1})
} }
} }
const setNewDatas = () => {
const slidesData = slides.value
// 更新Slides数据
const savelides = []
const newSlides = []
let obj = slidesData.find((x,index)=>{
return slideIndex.value == index
})
if(obj){
obj.elements.forEach(x=>{
let dataObj = datas.DataSource.DataSourceList.find(y=>{
return y.id == x.id
})
if(dataObj){
x = dataObj
}
savelides.push(x)
})
obj.elements = JSON.parse(JSON.stringify(savelides))
slidesData.forEach((x,index)=>{
if(slideIndex.value == index){
x.pgaeType = datas.DataSource.pgaeType
x.elements = obj.elements
}
newSlides.push(x)
})
slidesStore.setSlides(JSON.parse(JSON.stringify(newSlides)))
}
}
// 数据源关键数据赋值
const setTemplateDataSource = (Id,index,type) => { const setTemplateDataSource = (Id,index,type) => {
sourceLoadingStore.setSourceLoading(true)
datas.loading = true datas.loading = true
if(type) return if(type) return
datas.DataSource.DataSourceList.forEach((x,indexs)=>{ datas.DataSource.DataSourceList.forEach((x,indexs)=>{
......
...@@ -118,7 +118,7 @@ import { svg2Base64 } from '@/utils/svg2Base64' ...@@ -118,7 +118,7 @@ import { svg2Base64 } from '@/utils/svg2Base64'
import UploadService from '@/services/UploadService' import UploadService from '@/services/UploadService'
import { domainManager } from '@/utils/domainManager' import { domainManager } from '@/utils/domainManager'
import { ToolbarStates } from '@/types/toolbar' import { ToolbarStates } from '@/types/toolbar'
import useEditor from '@/utils/Editor/index'
import HotkeyDoc from './HotkeyDoc.vue' import HotkeyDoc from './HotkeyDoc.vue'
...@@ -136,7 +136,7 @@ import { ElLoading, ElMessage } from 'element-plus' ...@@ -136,7 +136,7 @@ import { ElLoading, ElMessage } from 'element-plus'
const mainStore = useMainStore() const mainStore = useMainStore()
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const layoutsStore = useSlidesStore() const layoutsStore = useSlidesStore()
const { title, slides } = storeToRefs(slidesStore) const { title, slides, slideIndex } = storeToRefs(slidesStore)
const { enterScreening, enterScreeningFromStart } = useScreening() const { enterScreening, enterScreeningFromStart } = useScreening()
const { importSpecificFile, importPPTXFile, exporting } = useImport() const { importSpecificFile, importPPTXFile, exporting } = useImport()
const { resetSlides } = useSlideHandler() const { resetSlides } = useSlideHandler()
...@@ -147,6 +147,7 @@ const hotkeyDrawerVisible = ref(false) ...@@ -147,6 +147,7 @@ const hotkeyDrawerVisible = ref(false)
const editingTitle = ref(false) const editingTitle = ref(false)
const titleInputRef = ref<InstanceType<typeof Input>>() const titleInputRef = ref<InstanceType<typeof Input>>()
const titleValue = ref('') const titleValue = ref('')
const { setNewDatasList } = useEditor()
const { userInfo } = storeToRefs(userStore()) const { userInfo } = storeToRefs(userStore())
...@@ -170,7 +171,7 @@ const FeatureImgStore = useScreenStore() ...@@ -170,7 +171,7 @@ const FeatureImgStore = useScreenStore()
const ConfigIdStore = useScreenStore() const ConfigIdStore = useScreenStore()
const psdVisibleStatus = ref(false) const psdVisibleStatus = ref(false)
const { market, model, ConfigId, CoverImg, dataLoading, TempId, FeatureImg } = storeToRefs(useScreenStore()) const { market, model, ConfigId, CoverImg, dataLoading, TempId, FeatureImg, SourceLoading } = storeToRefs(useScreenStore())
// 返回到首页 // 返回到首页
const goBack = () =>{ const goBack = () =>{
...@@ -201,17 +202,13 @@ const goBack = () =>{ ...@@ -201,17 +202,13 @@ const goBack = () =>{
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
} }
) ).then(() => {
.then(() => {
searchData.value.TempId = 0 searchData.value.TempId = 0
marketStore.setMarket(true) marketStore.setMarket(true)
slidesStore.setSlides(list) slidesStore.setSlides(list)
layoutsStore.setLayouts([]) layoutsStore.setLayouts([])
CoverImgStore.setCoverImg(null) CoverImgStore.setCoverImg(null)
}) }).catch(() => {})
.catch(() => {
})
} }
// 导入PSD // 导入PSD
...@@ -255,7 +252,7 @@ const uploadImageHandler = async ()=>{ ...@@ -255,7 +252,7 @@ const uploadImageHandler = async ()=>{
for (let i = 0; i < slides.value.length; i++) { for (let i = 0; i < slides.value.length; i++) {
const slide = slides.value[i]; const slide = slides.value[i];
if(slide.elements){ if(slide.elements){
count += (slide.elements.filter(x => "src" in x && x.src.startsWith("data:image")) ?? []).length count += (slide.elements.filter(x => "src" in x && x.src && x.src.startsWith("data:image")) ?? []).length
} }
} }
...@@ -330,6 +327,7 @@ const SetTripTemplateConfig = async () => { ...@@ -330,6 +327,7 @@ const SetTripTemplateConfig = async () => {
} }
// 保存 // 保存
const setTemplate = async () =>{ const setTemplate = async () =>{
if(SourceLoading.value) setNewDatasList(datas.DataSource)
await uploadImageHandler() await uploadImageHandler()
let arr = JSON.parse(JSON.stringify(slides.value)) let arr = JSON.parse(JSON.stringify(slides.value))
if(dataLoading.value){ if(dataLoading.value){
......
...@@ -59,6 +59,7 @@ import useLoadSlides from '@/hooks/useLoadSlides' ...@@ -59,6 +59,7 @@ import useLoadSlides from '@/hooks/useLoadSlides'
import { injectKeyDataSource, injectKeyTemplate } from '@/types/injectKey' import { injectKeyDataSource, injectKeyTemplate } from '@/types/injectKey'
import ConfigService from '@/services/ConfigService' import ConfigService from '@/services/ConfigService'
import { getHtmlPlainText } from '@/utils/common' import { getHtmlPlainText } from '@/utils/common'
import useEditor from '@/utils/Editor/index'
import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue' import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue'
import LayoutPool from './LayoutPool.vue' import LayoutPool from './LayoutPool.vue'
...@@ -82,6 +83,7 @@ const CoverImgStore = useScreenStore() ...@@ -82,6 +83,7 @@ const CoverImgStore = useScreenStore()
const dataLoadingStore = useScreenStore() const dataLoadingStore = useScreenStore()
const { ConfigId, TemplateDataSource, TemplateType, dataLoading, TempId, SourceLoading } = storeToRefs(TemplateTypeStore) const { ConfigId, TemplateDataSource, TemplateType, dataLoading, TempId, SourceLoading } = storeToRefs(TemplateTypeStore)
const selectedSlidesIndex = computed(() => [..._selectedSlidesIndex.value, slideIndex.value]) const selectedSlidesIndex = computed(() => [..._selectedSlidesIndex.value, slideIndex.value])
const { setNewDatasList } = useEditor()
const presetLayoutPopoverVisible = ref(false) const presetLayoutPopoverVisible = ref(false)
...@@ -134,7 +136,7 @@ watch(() => dataLoading.value, (n,o) =>{ ...@@ -134,7 +136,7 @@ watch(() => dataLoading.value, (n,o) =>{
// 监听数据源是否更新 // 监听数据源是否更新
watch(() => SourceLoading.value, (n,o) =>{ watch(() => SourceLoading.value, (n,o) =>{
if(n){ if(n){
setNewDatas()
} }
}) })
...@@ -331,43 +333,12 @@ const GetTripTemplate = async () =>{ ...@@ -331,43 +333,12 @@ const GetTripTemplate = async () =>{
} }
} }
// 切换页面前保存数据源
const setNewDatas = () => {
const slidesData = slides.value
// 更新Slides数据
const savelides = []
const newSlides = []
let obj = slidesData.find((x,index)=>{
return slideIndex.value == index
})
if(obj){
obj.elements.forEach(x=>{
let dataObj = datas.DataSource.DataSourceList.find(y=>{
return y.id == x.id
})
if(dataObj){
x = dataObj
}
savelides.push(x)
})
obj.elements = JSON.parse(JSON.stringify(savelides))
slidesData.forEach((x,index)=>{
if(slideIndex.value == index){
x.pgaeType = datas.DataSource.pgaeType
x.elements = obj.elements
}
newSlides.push(x)
})
slidesStore.setSlides(JSON.parse(JSON.stringify(newSlides)))
}
}
// 页面被切换时 // 页面被切换时
const thumbnailsRef = ref<InstanceType<typeof Draggable>>() const thumbnailsRef = ref<InstanceType<typeof Draggable>>()
// 切换页面 // 切换页面
const changeSlideIndex = (index: number) => { const changeSlideIndex = (index: number) => {
if(SourceLoading.value) setNewDatasList(datas.DataSource)
mainStore.setActiveElementIdList([]) mainStore.setActiveElementIdList([])
// 绑定数据源 // 绑定数据源
const newElements = slides.value.find((slide,indexs) => { const newElements = slides.value.find((slide,indexs) => {
...@@ -404,6 +375,7 @@ const changeSlideIndex = (index: number) => { ...@@ -404,6 +375,7 @@ const changeSlideIndex = (index: number) => {
} }
}) })
if (slideIndex.value === index) return if (slideIndex.value === index) return
slidesStore.updateSlideIndex(index) slidesStore.updateSlideIndex(index)
} }
......
...@@ -128,7 +128,8 @@ ...@@ -128,7 +128,8 @@
</div> </div>
<!-- 生成封面图 --> <!-- 生成封面图 -->
<div style="opacity: 0;position: absolute;left: 100px;" v-if="isCoverImg"> <div style="opacity: 0;position: absolute;left: 100px;top: 0;bottom: 0;z-index: -1;"
v-if="isCoverImg">
<div class="export-img-dialog"> <div class="export-img-dialog">
<div class="thumbnails-view"> <div class="thumbnails-view">
<div class="thumbnails" ref="FeatureImgRef"> <div class="thumbnails" ref="FeatureImgRef">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<EditorHeader class="layout-header" /> <EditorHeader class="layout-header" />
<div class="layout-content"> <div class="layout-content">
<Thumbnails class="layout-content-left" /> <Thumbnails class="layout-content-left" />
<div class="layout-content-center"> <div class="layout-content-center" style="overflow: hidden;">
<CanvasTool class="center-top" /> <CanvasTool class="center-top" />
<!-- :style="{ height: `calc(100% - ${remarkHeight + 40}px)` }" --> <!-- :style="{ height: `calc(100% - ${remarkHeight + 40}px)` }" -->
<Canvas class="center-body" :style="{ height: `calc(100% - 40px)`}" /> <Canvas class="center-body" :style="{ height: `calc(100% - 40px)`}" />
......
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