Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
pptist
Commits
25e84c88
Commit
25e84c88
authored
Dec 02, 2023
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化数据源更新
parent
d980bc80
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
5 deletions
+52
-5
screen.ts
src/store/screen.ts
+6
-1
index.vue
src/views/Editor/DataaSource/index.vue
+6
-3
index.vue
src/views/Editor/Thumbnails/index.vue
+40
-1
No files found.
src/store/screen.ts
View file @
25e84c88
...
...
@@ -13,7 +13,8 @@ export interface ScreenState {
CoverImg
:
any
,
isCoverImg
:
boolean
,
dataLoading
:
number
,
FeatureImg
:
any
FeatureImg
:
any
,
SourceLoading
:
boolean
,
}
...
...
@@ -31,6 +32,7 @@ export const useScreenStore = defineStore('screen', {
isCoverImg
:
false
,
// 封面
dataLoading
:
0
,
// 记录保存是否成功
FeatureImg
:
[],
// 行程特色图
SourceLoading
:
false
,
// 记录数据源是否更改
}),
actions
:
{
...
...
@@ -72,6 +74,9 @@ export const useScreenStore = defineStore('screen', {
},
setFeatureImg
(
FeatureImg
:
any
)
{
this
.
FeatureImg
=
FeatureImg
},
setSourceLoading
(
SourceLoading
:
boolean
)
{
this
.
SourceLoading
=
SourceLoading
}
},
})
\ No newline at end of file
src/views/Editor/DataaSource/index.vue
View file @
25e84c88
...
...
@@ -2,11 +2,11 @@
<div
v-if=
"datas.DataSource.DataSourceOverlay"
>
<div
class=
"DataaSourceOverlay"
@
click=
"OffDataSource"
></div>
<div
class=
"DataaSource"
>
<div
class=
"DataaSourceButtom"
>
<
!--
<
div
class=
"DataaSourceButtom"
>
<el-button
type=
"primary"
style=
"color: #ffff;"
@
click=
"setNewDatas()"
>
暂存选择
</el-button>
</div>
</div>
-->
<div
class=
"DataaSourceList"
>
<el-table
:data=
"datas.DataSource.DataSourceList"
...
...
@@ -75,7 +75,7 @@
<
script
lang=
"ts"
setup
>
import
{
computed
,
nextTick
,
ref
,
watch
,
reactive
,
inject
}
from
'vue'
import
{
storeToRefs
}
from
'pinia'
import
{
useSlidesStore
}
from
'@/store'
import
{
useSlidesStore
,
useScreenStore
}
from
'@/store'
import
{
injectKeyDataSource
}
from
'@/types/injectKey'
import
{
getHtmlPlainText
}
from
'@/utils/common'
...
...
@@ -89,14 +89,17 @@
}
datas
.
DataSource
=
inject
(
injectKeyDataSource
)
const
slidesStore
=
useSlidesStore
()
const
sourceLoadingStore
=
useScreenStore
()
const
{
slides
,
slideIndex
}
=
storeToRefs
(
slidesStore
)
watch
(()
=>
datas
.
DataSource
.
DataSourceOverlay
,
(
n
,
o
)
=>
{
if
(
n
){
datas
.
loading
=
false
sourceLoadingStore
.
setSourceLoading
(
false
)
}
if
(
!
n
&&
datas
.
loading
){
setNewDatas
()
sourceLoadingStore
.
setSourceLoading
(
true
)
}
})
const
setType
=
(
x
)
=>
{
...
...
src/views/Editor/Thumbnails/index.vue
View file @
25e84c88
...
...
@@ -77,7 +77,7 @@ const { slidesLoadLimit } = useLoadSlides()
const
TemplateTypeStore
=
useScreenStore
()
const
CoverImgStore
=
useScreenStore
()
const
dataLoadingStore
=
useScreenStore
()
const
{
ConfigId
,
TemplateDataSource
,
TemplateType
,
dataLoading
,
TempId
}
=
storeToRefs
(
TemplateTypeStore
)
const
{
ConfigId
,
TemplateDataSource
,
TemplateType
,
dataLoading
,
TempId
,
SourceLoading
}
=
storeToRefs
(
TemplateTypeStore
)
const
selectedSlidesIndex
=
computed
(()
=>
[...
_selectedSlidesIndex
.
value
,
slideIndex
.
value
])
const
presetLayoutPopoverVisible
=
ref
(
false
)
...
...
@@ -128,6 +128,13 @@ watch(() => dataLoading.value, (n,o) =>{
}
})
// 监听数据源是否更新
watch
(()
=>
SourceLoading
.
value
,
(
n
,
o
)
=>
{
if
(
n
){
setNewDatas
()
}
})
queryObj
.
value
=
inject
(
injectKeyDataSource
).
queryObj
...
...
@@ -186,6 +193,7 @@ const GetTripFiledData = async () =>{
cursors
.
push
(
temp
)
}
if
(
y
.
TemplateDataSource
.
index
!=
null
&&
y
.
TemplateDataSource
.
index
>=
0
){
console
.
log
(
value
[
oo
],
'-------'
)
if
(
value
[
oo
].
length
>
temp
.
index
)
value
=
value
[
oo
][
y
.
TemplateDataSource
.
index
]
}
else
{
if
(
value
[
oo
].
length
>
temp
.
index
)
value
=
value
[
oo
][
temp
.
index
]
...
...
@@ -291,6 +299,37 @@ 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
>>
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment