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
68c79bf1
Commit
68c79bf1
authored
Dec 06, 2023
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
插入图片 替换图片
parent
e640fc2c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
380 additions
and
9 deletions
+380
-9
ConfigService.ts
src/services/ConfigService.ts
+7
-0
screen.ts
src/store/screen.ts
+10
-0
UploadPicture.vue
src/views/Editor/CanvasTool/UploadPicture.vue
+329
-0
index.vue
src/views/Editor/CanvasTool/index.vue
+18
-5
ImageStylePanel.vue
...iews/Editor/Toolbar/ElementStylePanel/ImageStylePanel.vue
+16
-4
No files found.
src/services/ConfigService.ts
View file @
68c79bf1
...
@@ -60,5 +60,12 @@ class ConfigService{
...
@@ -60,5 +60,12 @@ class ConfigService{
static
async
GetTemplagePageAsync
(
params
:
any
):
Promise
<
HttpResponse
>
{
static
async
GetTemplagePageAsync
(
params
:
any
):
Promise
<
HttpResponse
>
{
return
Api
.
Post
(
"triptemplate_GetTripTemplatePage"
,
params
)
return
Api
.
Post
(
"triptemplate_GetTripTemplatePage"
,
params
)
}
}
/**
* 图片素材分页列表
*/
static
async
GetPicList
(
params
:
any
):
Promise
<
HttpResponse
>
{
return
Api
.
Post
(
"hotel_post_GetPicList"
,
params
)
}
}
}
export
default
ConfigService
;
export
default
ConfigService
;
\ No newline at end of file
src/store/screen.ts
View file @
68c79bf1
...
@@ -16,6 +16,8 @@ export interface ScreenState {
...
@@ -16,6 +16,8 @@ export interface ScreenState {
FeatureImg
:
any
,
FeatureImg
:
any
,
SourceLoading
:
boolean
,
SourceLoading
:
boolean
,
pageIndex
:
number
,
pageIndex
:
number
,
imgPoolVisible
:
boolean
,
imgReplaceVisible
:
boolean
,
}
}
export
const
useScreenStore
=
defineStore
(
'screen'
,
{
export
const
useScreenStore
=
defineStore
(
'screen'
,
{
...
@@ -34,6 +36,8 @@ export const useScreenStore = defineStore('screen', {
...
@@ -34,6 +36,8 @@ export const useScreenStore = defineStore('screen', {
FeatureImg
:
[],
// 行程特色图
FeatureImg
:
[],
// 行程特色图
SourceLoading
:
false
,
// 记录数据源是否更改
SourceLoading
:
false
,
// 记录数据源是否更改
pageIndex
:
0
,
//需要生成图的行程特色
pageIndex
:
0
,
//需要生成图的行程特色
imgPoolVisible
:
false
,
//新增上传图片弹窗
imgReplaceVisible
:
false
,
//替换图片弹窗
}),
}),
actions
:
{
actions
:
{
...
@@ -81,6 +85,12 @@ export const useScreenStore = defineStore('screen', {
...
@@ -81,6 +85,12 @@ export const useScreenStore = defineStore('screen', {
},
},
setPageIndex
(
pageIndex
:
number
){
setPageIndex
(
pageIndex
:
number
){
this
.
pageIndex
=
pageIndex
this
.
pageIndex
=
pageIndex
},
setImgPoolVisible
(
imgPoolVisible
:
boolean
)
{
this
.
imgPoolVisible
=
imgPoolVisible
},
setImgReplaceVisible
(
imgReplaceVisible
:
boolean
)
{
this
.
imgReplaceVisible
=
imgReplaceVisible
}
}
},
},
})
})
\ No newline at end of file
src/views/Editor/CanvasTool/UploadPicture.vue
0 → 100644
View file @
68c79bf1
This diff is collapsed.
Click to expand it.
src/views/Editor/CanvasTool/index.vue
View file @
68c79bf1
...
@@ -20,9 +20,10 @@
...
@@ -20,9 +20,10 @@
<IconDown
class=
"arrow"
/>
<IconDown
class=
"arrow"
/>
</Popover>
</Popover>
</div>
</div>
<FileInput
@
change=
"files => insertImageElement(files)"
>
<!-- <FileInput @change="files => insertImageElement(files)">
<IconPicture
class=
"handler-item"
v-tooltip=
"'插入图片'"
/>
<IconPicture class="handler-item" v-tooltip="'插入图片'" />
</FileInput>
</FileInput> imgPoolVisible-->
<IconPicture
class=
"handler-item"
v-tooltip=
"'插入图片'"
@
click=
"getImgVis()"
/>
<Popover
trigger=
"click"
v-model:value=
"shapePoolVisible"
>
<Popover
trigger=
"click"
v-model:value=
"shapePoolVisible"
>
<
template
#
content
>
<
template
#
content
>
<ShapePool
@
select=
"shape => drawShape(shape)"
/>
<ShapePool
@
select=
"shape => drawShape(shape)"
/>
...
@@ -89,13 +90,16 @@
...
@@ -89,13 +90,16 @@
@
update=
"data => { createLatexElement(data); latexEditorVisible = false }"
@
update=
"data => { createLatexElement(data); latexEditorVisible = false }"
/>
/>
</Modal>
</Modal>
<!-- 上传图片 -->
<UploadPicture
v-if=
"imgPoolVisible"
></UploadPicture>
</div>
</div>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
}
from
'vue'
import
{
ref
,
provide
}
from
'vue'
import
{
storeToRefs
}
from
'pinia'
import
{
storeToRefs
}
from
'pinia'
import
{
useMainStore
,
useSnapshotStore
}
from
'@/store'
import
{
useMainStore
,
useSnapshotStore
,
useScreenStore
}
from
'@/store'
import
{
getImageDataURL
}
from
'@/utils/image'
import
{
getImageDataURL
}
from
'@/utils/image'
import
type
{
ShapePoolItem
}
from
'@/configs/shapes'
import
type
{
ShapePoolItem
}
from
'@/configs/shapes'
import
type
{
LinePoolItem
}
from
'@/configs/lines'
import
type
{
LinePoolItem
}
from
'@/configs/lines'
...
@@ -114,6 +118,7 @@ import Modal from '@/components/Modal.vue'
...
@@ -114,6 +118,7 @@ import Modal from '@/components/Modal.vue'
import
Divider
from
'@/components/Divider.vue'
import
Divider
from
'@/components/Divider.vue'
import
Popover
from
'@/components/Popover.vue'
import
Popover
from
'@/components/Popover.vue'
import
PopoverMenuItem
from
'@/components/PopoverMenuItem.vue'
import
PopoverMenuItem
from
'@/components/PopoverMenuItem.vue'
import
UploadPicture
from
'./UploadPicture.vue'
const
mainStore
=
useMainStore
()
const
mainStore
=
useMainStore
()
const
{
creatingElement
,
creatingCustomShape
,
showSelectPanel
,
showSearchPanel
}
=
storeToRefs
(
mainStore
)
const
{
creatingElement
,
creatingCustomShape
,
showSelectPanel
,
showSearchPanel
}
=
storeToRefs
(
mainStore
)
...
@@ -121,6 +126,8 @@ const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
...
@@ -121,6 +126,8 @@ const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
const
{
redo
,
undo
}
=
useHistorySnapshot
()
const
{
redo
,
undo
}
=
useHistorySnapshot
()
const
{
imgPoolVisible
}
=
storeToRefs
(
useScreenStore
())
const
{
const
{
scaleCanvas
,
scaleCanvas
,
setCanvasScalePercentage
,
setCanvasScalePercentage
,
...
@@ -145,6 +152,8 @@ const {
...
@@ -145,6 +152,8 @@ const {
createAudioElement
,
createAudioElement
,
}
=
useCreateElement
()
}
=
useCreateElement
()
provide
(
'imgType'
,
1
)
const
insertImageElement
=
(
files
:
FileList
)
=>
{
const
insertImageElement
=
(
files
:
FileList
)
=>
{
const
imageFile
=
files
[
0
]
const
imageFile
=
files
[
0
]
if
(
!
imageFile
)
return
if
(
!
imageFile
)
return
...
@@ -159,6 +168,10 @@ const mediaInputVisible = ref(false)
...
@@ -159,6 +168,10 @@ const mediaInputVisible = ref(false)
const
latexEditorVisible
=
ref
(
false
)
const
latexEditorVisible
=
ref
(
false
)
const
textTypeSelectVisible
=
ref
(
false
)
const
textTypeSelectVisible
=
ref
(
false
)
const
getImgVis
=
()
=>
{
imgPoolVisible
.
value
=
true
}
// 绘制文字范围
// 绘制文字范围
const
drawText
=
(
vertical
=
false
)
=>
{
const
drawText
=
(
vertical
=
false
)
=>
{
mainStore
.
setCreatingElement
({
mainStore
.
setCreatingElement
({
...
...
src/views/Editor/Toolbar/ElementStylePanel/ImageStylePanel.vue
View file @
68c79bf1
...
@@ -50,19 +50,22 @@
...
@@ -50,19 +50,22 @@
<Divider
/>
<Divider
/>
<ElementShadow
/>
<ElementShadow
/>
<Divider
/>
<Divider
/>
<!--
<FileInput @change="files => replaceImage(files)">
<FileInput @change="files => replaceImage(files)">
<Button class="full-width-btn"><IconTransform class="btn-icon" /> 替换图片</Button>
<Button class="full-width-btn"><IconTransform class="btn-icon" /> 替换图片</Button>
</FileInput>
</FileInput> -->
<Button
class=
"full-width-btn"
@
click=
"getImgVis()"
><IconTransform
class=
"btn-icon"
/>
替换图片
</Button>
<Button
class=
"full-width-btn"
@
click=
"resetImage()"
><IconUndo
class=
"btn-icon"
/>
重置样式
</Button>
<Button
class=
"full-width-btn"
@
click=
"resetImage()"
><IconUndo
class=
"btn-icon"
/>
重置样式
</Button>
<Button
class=
"full-width-btn"
@
click=
"setBackgroundImage()"
><IconTheme
class=
"btn-icon"
/>
设为背景
</Button>
<Button
class=
"full-width-btn"
@
click=
"setBackgroundImage()"
><IconTheme
class=
"btn-icon"
/>
设为背景
</Button>
<!-- 上传图片 -->
<UploadPicture
v-if=
"imgReplaceVisible"
></UploadPicture>
</div>
</div>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
type
Ref
,
ref
}
from
'vue'
import
{
type
Ref
,
ref
,
provide
}
from
'vue'
import
{
storeToRefs
}
from
'pinia'
import
{
storeToRefs
}
from
'pinia'
import
{
useMainStore
,
useSlidesStore
}
from
'@/store'
import
{
useMainStore
,
useSlidesStore
,
useScreenStore
}
from
'@/store'
import
type
{
PPTImageElement
,
SlideBackground
}
from
'@/types/slides'
import
type
{
PPTImageElement
,
SlideBackground
}
from
'@/types/slides'
import
{
CLIPPATHS
}
from
'@/configs/imageClip'
import
{
CLIPPATHS
}
from
'@/configs/imageClip'
import
{
getImageDataURL
}
from
'@/utils/image'
import
{
getImageDataURL
}
from
'@/utils/image'
...
@@ -78,6 +81,7 @@ import Divider from '@/components/Divider.vue'
...
@@ -78,6 +81,7 @@ import Divider from '@/components/Divider.vue'
import
Button
from
'@/components/Button.vue'
import
Button
from
'@/components/Button.vue'
import
ButtonGroup
from
'@/components/ButtonGroup.vue'
import
ButtonGroup
from
'@/components/ButtonGroup.vue'
import
Popover
from
'@/components/Popover.vue'
import
Popover
from
'@/components/Popover.vue'
import
UploadPicture
from
'../../CanvasTool/UploadPicture.vue'
const
shapeClipPathOptions
=
CLIPPATHS
const
shapeClipPathOptions
=
CLIPPATHS
const
ratioClipOptions
=
[
const
ratioClipOptions
=
[
...
@@ -124,6 +128,14 @@ const clipPanelVisible = ref(false)
...
@@ -124,6 +128,14 @@ const clipPanelVisible = ref(false)
const
{
addHistorySnapshot
}
=
useHistorySnapshot
()
const
{
addHistorySnapshot
}
=
useHistorySnapshot
()
const
{
imgReplaceVisible
}
=
storeToRefs
(
useScreenStore
())
provide
(
'imgType'
,
2
)
const
getImgVis
=
()
=>
{
imgReplaceVisible
.
value
=
true
}
// 打开自由裁剪
// 打开自由裁剪
const
clipImage
=
()
=>
{
const
clipImage
=
()
=>
{
mainStore
.
setClipingImageElementId
(
handleElementId
.
value
)
mainStore
.
setClipingImageElementId
(
handleElementId
.
value
)
...
...
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