Commit 986affff authored by zhengke's avatar zhengke

no message

parent a4ee9fcb
......@@ -7,16 +7,17 @@ export interface ScreenState {
model:number,
isModel: boolean,
ConfigId:number,
TemplateType: []
}
export const useScreenStore = defineStore('screen', {
state: (): ScreenState => ({
screening: false, // 是否进入放映状态
market: true,
model: 0, //是否有新增修改模版权限
isModel: false,//该团是否存在模版
model: 0, // 是否有新增修改模版权限
isModel: false,// 该团是否存在模版
ConfigId: 0,
TemplateType: [],
}),
actions: {
......@@ -37,6 +38,9 @@ export const useScreenStore = defineStore('screen', {
},
setConfigId(ConfigId: number) {
this.ConfigId = ConfigId
},
setTemplateType(TemplateType: []) {
this.TemplateType = TemplateType
}
},
})
\ No newline at end of file
......@@ -32,12 +32,12 @@
<el-select v-model="scope.row.TemplateDataSource.Id" class="m-2"
placeholder="请绑定数据源"
@change="setTemplateDataSource(scope.row.TemplateDataSource.Id,scope.$index)">
<!-- :disabled="scope.row.type=='image'&&item.Name.indexOf('图')==-1" -->
<el-option
v-for="item in scope.row.TemplateList"
v-for="item in setType(scope.row)"
:key="item.Id"
:label="item.Name"
:value="item.Id"
/>
:value="item.Id"/>
</el-select>
</div>
</template>
......@@ -53,17 +53,25 @@
import { storeToRefs } from 'pinia'
import { useSlidesStore } from '@/store'
import { injectKeyDataSource } from '@/types/injectKey'
import { getHtmlPlainText } from '@/utils/common'
const datas = reactive({
DataSource:{},
})
datas.DataSource = inject(injectKeyDataSource)
const slidesStore = useSlidesStore()
const { slides, slideIndex } = storeToRefs(slidesStore)
const slidesData = slides.value
const setType = (x) =>{
if(x.type=="image"){
return x.TemplateList.filter(item=>{ return item.Name.indexOf('图')!=-1})
}if(x.type=="text"){
return x.TemplateList.filter(item=>{ return item.Name.indexOf('图')==-1})
}
}
const setNewDatas = () => {
const slidesData = slides.value
// 更新Slides数据
const savelides = []
const newSlides = []
......@@ -88,8 +96,7 @@
}
newSlides.push(x)
})
console.log(newSlides,'=====-----')
slidesStore.setSlides(newSlides)
slidesStore.setSlides(JSON.parse(JSON.stringify(newSlides)))
}
}
// 数据源关键数据赋值
......@@ -101,6 +108,11 @@
})
x.TemplateDataSource.Content = obj.Content
x.TemplateDataSource.Name = obj.Name
if(x.type=="text"){
x.FiledTypeStr = obj.Name
x.content = x.content.replace(getHtmlPlainText(x.content),obj.Name)
}
}
})
setNewDatas()
......
......@@ -106,6 +106,7 @@ import PopoverMenuItem from '@/components/PopoverMenuItem.vue'
const mainStore = useMainStore()
const slidesStore = useSlidesStore()
const layoutsStore = useSlidesStore()
const { title, slides } = storeToRefs(slidesStore)
const { enterScreening, enterScreeningFromStart } = useScreening()
const { importSpecificFile, importPPTXFile, exporting } = useImport()
......@@ -132,7 +133,24 @@ const marketStore = useScreenStore()
const { market, model, ConfigId } = storeToRefs(useScreenStore())
const goBack = () =>{
if(model.value) return marketStore.setMarket(true)
let list = [
{
id: 'test-slide-1',
pageType: 1,
elements: [],
background: {
type: 'solid',
color: '#ffffff',
},
}
]
if(model.value) {
searchData.value.TempId = 0
marketStore.setMarket(true)
slidesStore.setSlides(list)
layoutsStore.setLayouts([])
return
}
ElMessageBox.confirm(
'退出此页面将清空当前数据,请谨慎操作?',
'提示',
......@@ -143,7 +161,10 @@ const goBack = () =>{
}
)
.then(() => {
searchData.value.TempId = 0
marketStore.setMarket(true)
slidesStore.setSlides(list)
layoutsStore.setLayouts([])
})
.catch(() => {
......@@ -158,6 +179,7 @@ const UploadPsd = () => {
// 新增修改模版
const SetTripTemplateSlide = async () => {
console.log(JSON.parse(queryObj.value.TempData),'--------')
try {
console.log(queryObj.value,'新增修改模版---')
let TemplateRes = await ConfigService.SetTripTemplateSlide(queryObj.value);
......@@ -225,9 +247,9 @@ const setTemplate = async () =>{
}
queryObj.value.TempData = JSON.stringify(slides.value)
datas.loading = true
if(!ConfigId&&model&&userInfo.IsEditTripTemplate==1){
if(model.value&&userInfo.value.IsEditTripTemplate==1){
await SetTripTemplateSlide()
}else if(ConfigId){
}else if(ConfigId.value){
await SetTripTemplateConfig()
}
}
......
......@@ -49,7 +49,7 @@
<script lang="ts" setup>
import { computed, nextTick, ref, reactive, watch, inject } from 'vue'
import { storeToRefs } from 'pinia'
import { useMainStore, useSlidesStore, useKeyboardStore } from '@/store'
import { useMainStore, useSlidesStore, useKeyboardStore, useScreenStore } from '@/store'
import { fillDigit } from '@/utils/common'
import { isElementInViewport } from '@/utils/element'
import type { ContextmenuItem } from '@/components/Contextmenu/types'
......@@ -73,6 +73,8 @@ const { slides, slideIndex } = storeToRefs(slidesStore)
const { ctrlKeyState, shiftKeyState } = storeToRefs(keyboardStore)
const { slidesLoadLimit } = useLoadSlides()
const TemplateTypeStore = useScreenStore()
const { TemplateType } = storeToRefs(TemplateTypeStore)
const selectedSlidesIndex = computed(() => [..._selectedSlidesIndex.value, slideIndex.value])
......@@ -238,7 +240,7 @@ const changeSlideIndex = (index: number) => {
return index==indexs
})
datas.DataSource.pageType = newElements.pageType
let TemplateList = datas.DataSource.TemplateDataSource.filter(x=>{
let TemplateList = TemplateType.value.filter(x=>{
return x.FiledType==newElements.pageType
})
datas.DataSource.DataSourceList = []
......@@ -253,9 +255,9 @@ const changeSlideIndex = (index: number) => {
FiledTypeStr: FiledTypeStr,
TemplateList: TemplateList,
TemplateDataSource: {
Content: slide.TemplateDataSource.Content?slide.TemplateDataSource.Content:'',
Name: slide.TemplateDataSource.Name?slide.TemplateDataSource.Name:'',
Id: slide.TemplateDataSource.Id?slide.TemplateDataSource.Id:null as Number
Content: slide.TemplateDataSource&&slide.TemplateDataSource.Content?slide.TemplateDataSource.Content:'',
Name: slide.TemplateDataSource&&slide.TemplateDataSource.Name?slide.TemplateDataSource.Name:'',
Id: slide.TemplateDataSource&&slide.TemplateDataSource.Id?slide.TemplateDataSource.Id:null as Number
}
}
if(Obj){
......
......@@ -9,7 +9,7 @@
<el-select v-model="datas.DataSource.pageType" class="m-2"
placeholder="请页面类型">
<el-option
v-for="item in pageTypesList"
v-for="item in TemplateType"
:key="item.FiledType"
:label="item.Name"
:value="item.FiledType"
......@@ -88,12 +88,14 @@
<script lang="ts" setup>
import { computed, ref, reactive, watch, inject } from 'vue'
import { storeToRefs } from 'pinia'
import { useMainStore, useSlidesStore } from '@/store'
import { useMainStore, useSlidesStore, useScreenStore } from '@/store'
import LineService from '@/services/LineService'
import ConfigService from '@/services/ConfigService'
import { injectKeyDataSource } from '@/types/injectKey'
import { getHtmlPlainText } from '@/utils/common'
const { TemplateType } = storeToRefs(useScreenStore())
const datas = reactive({
DataSource:{},
CountryValue: null
......@@ -107,16 +109,6 @@
const cursors = [] as Array<any>
const pageTypesList = ref([] as any)
let TemplateList = datas.DataSource.TemplateDataSource.filter(x=>{
let obj = pageTypesList.value.findIndex(z=>{
return z.FiledType==x.FiledType
})
if(obj==-1){
pageTypesList.value.push(x)
}
})
const slidesStore = useSlidesStore()
const { slides, slideIndex } = storeToRefs(slidesStore)
const setCountryValue = () =>{
......@@ -152,7 +144,7 @@
return slideIndex.value==indexs
})
datas.DataSource.DataSourceOverlay = !datas.DataSource.DataSourceOverlay
let TemplateList = datas.DataSource.TemplateDataSource.filter(x=>{
let TemplateList = TemplateType.value.filter(x=>{
return x.FiledType==newElements.pageType
})
datas.DataSource.DataSourceList = []
......
......@@ -33,11 +33,10 @@
<script lang="ts" setup>
import { ref, reactive, provide, watch, inject } from 'vue'
import { storeToRefs } from 'pinia'
import { useMainStore } from '@/store'
import { useMainStore, useSlidesStore, useScreenStore } from '@/store'
import useGlobalHotkey from '@/hooks/useGlobalHotkey'
import usePasteEvent from '@/hooks/usePasteEvent'
import { injectKeyDataSource, injectKeyTemplate } from '@/types/injectKey'
import { useSlidesStore } from '@/store'
import EditorHeader from './EditorHeader/index.vue'
import Canvas from './Canvas/index.vue'
......@@ -58,7 +57,6 @@ const datas = reactive({
pageType: 1,//1基础 2酒店 3景 4餐
DataSourceOverlay: false,
DataSourceList:[],
TemplateDataSource:[],// 所有模版类型 1基础 2酒店 3景 4餐
queryObj:{
TempId: inject(injectKeyTemplate).TempId?inject(injectKeyTemplate).TempId:0,//编号(新增传0) 是 [int]
LineId: null,//线路Id 是 [int]
......@@ -79,7 +77,10 @@ const datas = reactive({
const slidesStore = useSlidesStore()
const TemplateTypeStore = useScreenStore()
const { slides, slideIndex } = storeToRefs(slidesStore)
const { TemplateType } = storeToRefs(TemplateTypeStore)
const pageTypesList = ref([] as any)
watch(() => datas.DataSource, () => {
provide(injectKeyDataSource,datas.DataSource)
......@@ -89,7 +90,19 @@ const GetTripFiled = async () =>{
try {
let TemplateRes = await ConfigService.TemplateGetTripFiled();
if (TemplateRes.data.resultCode == 1) {
datas.DataSource.TemplateDataSource = TemplateRes.data.data
TemplateRes.data.data.forEach(x=>{
let obj = pageTypesList.value.findIndex(z=>{
return z.FiledType==x.FiledType
})
if(obj==-1){
let object = {
FiledType: x.FiledType,
Name: x.FiledTypeStr
}
pageTypesList.value.push(object)
}
})
TemplateTypeStore.setTemplateType(pageTypesList.value)
}
} catch (error) {
console.log("TemplateGetTripFiled", error);
......
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