Commit 027d6589 authored by zhengke's avatar zhengke

no message

parent d45ff1fc
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
width="200"> width="200">
<template #default="scope"> <template #default="scope">
<div class="DataaSourceR" v-if="scope.row.TemplateList"> <div class="DataaSourceR" v-if="scope.row.TemplateList">
<el-select v-model="scope.row.TemplateObj.Name" class="m-2" placeholder="Select"> <el-select v-model="scope.row.TemplateDataSource.Id" class="m-2" placeholder="Select"
@change="setTemplateDataSource(scope.row.TemplateDataSource.Id,scope.$index)">
<el-option <el-option
v-for="item in scope.row.TemplateList" v-for="item in scope.row.TemplateList"
:key="item.Id" :key="item.Id"
...@@ -57,22 +58,29 @@ ...@@ -57,22 +58,29 @@
const datas = reactive({ const datas = reactive({
DataSource:{ DataSource:{
DataSourceOverlay: false, // DataSourceOverlay: false,
DataSourceList:[], // DataSourceList:[],
TemplateDataSource:[] // TemplateDataSource:[]
}, },
}) })
datas.DataSource = inject(injectKeyDataSource).DataSource datas.DataSource = inject(injectKeyDataSource).DataSource
const multipleTableRef = ref<InstanceType<typeof any>>() const multipleTableRef = ref<InstanceType<typeof any>>()
const multipleSelection = ref<[]>([]) const multipleSelection = ref<[]>([])
console.log(datas.DataSource)
watch(datas.DataSource, (n, o) => { watch(datas.DataSource, (n, o) => {
}) })
const setTemplateDataSource = (Id,index) => {
datas.DataSource.DataSourceList.forEach((x,indexs)=>{
if(index==indexs){
x.
}
})
}
const toggleSelection = (rows?: []) => { const toggleSelection = (rows?: []) => {
if (rows) { if (rows) {
rows.forEach((row) => { rows.forEach((row) => {
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, nextTick, ref, watch } from 'vue' import { computed, nextTick, ref, reactive, watch, inject } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useMainStore, useSlidesStore, useKeyboardStore } from '@/store' import { useMainStore, useSlidesStore, useKeyboardStore } from '@/store'
import { fillDigit } from '@/utils/common' import { fillDigit } from '@/utils/common'
...@@ -56,6 +56,7 @@ import type { ContextmenuItem } from '@/components/Contextmenu/types' ...@@ -56,6 +56,7 @@ import type { ContextmenuItem } from '@/components/Contextmenu/types'
import useSlideHandler from '@/hooks/useSlideHandler' import useSlideHandler from '@/hooks/useSlideHandler'
import useScreening from '@/hooks/useScreening' import useScreening from '@/hooks/useScreening'
import useLoadSlides from '@/hooks/useLoadSlides' import useLoadSlides from '@/hooks/useLoadSlides'
import { injectKeyDataSource } from '@/types/injectKey'
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'
...@@ -87,6 +88,11 @@ const { ...@@ -87,6 +88,11 @@ const {
sortSlides, sortSlides,
} = useSlideHandler() } = useSlideHandler()
const datas = reactive({
DataSource:{}
})
datas.DataSource = inject(injectKeyDataSource).DataSource
// 页面被切换时 // 页面被切换时
const thumbnailsRef = ref<InstanceType<typeof Draggable>>() const thumbnailsRef = ref<InstanceType<typeof Draggable>>()
watch(() => slideIndex.value, () => { watch(() => slideIndex.value, () => {
...@@ -107,10 +113,54 @@ watch(() => slideIndex.value, () => { ...@@ -107,10 +113,54 @@ watch(() => slideIndex.value, () => {
}) })
}) })
//提取字符串中的文字
const getHtmlPlainText = (html_str) => {
let re = new RegExp('<[^<>]+>', 'g')
if (html_str) {
let text = html_str.replace(re, '')
return text
} else {
return ''
}
}
// 切换页面 // 切换页面
const changeSlideIndex = (index: number) => { const changeSlideIndex = (index: number) => {
mainStore.setActiveElementIdList([]) mainStore.setActiveElementIdList([])
// 数据源
const newElements = slides.value.find((slide,indexs) => {
return index==indexs
})
datas.DataSource.DataSourceList = []
newElements.elements.forEach(slide=>{
if(slide.type=="text"){
let Obj = {
...slide,
FiledTypeStr: getHtmlPlainText(slide.content),
TemplateList: datas.DataSource.jc,
TemplateDataSource: {
Content: "",
Name: "",
Id: null as Number
},
}
datas.DataSource.DataSourceList.push(Obj)
}
if(slide.type=="image"){
let Obj = {
...slide,
FiledTypeStr: slide.src,
TemplateList: datas.DataSource.jd,
TemplateDataSource: {
Content: "",
Name: "",
Id: null as Number
},
}
datas.DataSource.DataSourceList.push(Obj)
}
})
if (slideIndex.value === index) return if (slideIndex.value === index) return
slidesStore.updateSlideIndex(index) slidesStore.updateSlideIndex(index)
} }
...@@ -125,6 +175,7 @@ const handleClickSlideThumbnail = (e: MouseEvent, index: number) => { ...@@ -125,6 +175,7 @@ const handleClickSlideThumbnail = (e: MouseEvent, index: number) => {
// 如果被取消选中的页面刚好是当前激活页面,则需要从其他被选中的页面中选择第一个作为当前激活页面 // 如果被取消选中的页面刚好是当前激活页面,则需要从其他被选中的页面中选择第一个作为当前激活页面
if (ctrlKeyState.value) { if (ctrlKeyState.value) {
if (slideIndex.value === index) { if (slideIndex.value === index) {
if (!isMultiSelected) return if (!isMultiSelected) return
const newSelectedSlidesIndex = selectedSlidesIndex.value.filter(item => item !== index) const newSelectedSlidesIndex = selectedSlidesIndex.value.filter(item => item !== index)
......
...@@ -344,52 +344,11 @@ const { ...@@ -344,52 +344,11 @@ const {
applyThemeToAllSlides, applyThemeToAllSlides,
} = useSlideTheme() } = useSlideTheme()
//提取字符串中的文字
const getHtmlPlainText = (html_str) => {
let re = new RegExp('<[^<>]+>', 'g')
if (html_str) {
let text = html_str.replace(re, '')
return text
} else {
return ''
}
}
datas.DataSource = inject(injectKeyDataSource).DataSource datas.DataSource = inject(injectKeyDataSource).DataSource
// 所有数据源 // 所有数据源
const AllDataSource = () => { const AllDataSource = () => {
datas.DataSource.DataSourceOverlay = !datas.DataSource.DataSourceOverlay datas.DataSource.DataSourceOverlay = !datas.DataSource.DataSourceOverlay
const newElements = slides.value.find((slide,index) => {
return slideIndex.value==index
})
datas.DataSource.DataSourceList = []
newElements.elements.forEach(slide=>{
if(slide.type=="text"){
let Obj = {
...slide,
FiledTypeStr: getHtmlPlainText(slide.content),
TemplateList: datas.DataSource.jc,
TemplateObj: {
Content: "",
Name: ""
},
}
datas.DataSource.DataSourceList.push(Obj)
}
if(slide.type=="image"){
let Obj = {
...slide,
FiledTypeStr: slide.src,
TemplateList: datas.DataSource.jd,
TemplateObj: {
Content: "",
Name: ""
},
}
datas.DataSource.DataSourceList.push(Obj)
}
})
} }
// 设置背景模式:纯色、图片、渐变色 // 设置背景模式:纯色、图片、渐变色
......
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