Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
20c59b81
authored
Nov 01, 2023
by
芋道源码
Committed by
Gitee
Nov 01, 2023
Browse files
Options
Browse Files
Download
Plain Diff
!301 营销:完善商城装修
Merge pull request !301 from 疯狂的世界/dev
parents
c1534bf1
9bd33355
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
61 additions
and
13 deletions
+61
-13
src/api/mall/promotion/diy/page.ts
+10
-0
src/api/mall/promotion/diy/template.ts
+17
-0
src/components/DiyEditor/components/mobile/NavigationBar/index.vue
+0
-1
src/components/DiyEditor/components/mobile/NoticeBar/index.vue
+1
-1
src/components/DiyEditor/index.vue
+0
-0
src/views/mall/promotion/diy/page/decorate.vue
+3
-2
src/views/mall/promotion/diy/template/decorate.vue
+30
-9
No files found.
src/api/mall/promotion/diy/page.ts
View file @
20c59b81
...
...
@@ -33,3 +33,13 @@ export const updateDiyPage = async (data: DiyPageVO) => {
export
const
deleteDiyPage
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/promotion/diy-page/delete?id=`
+
id
})
}
// 获得装修页面属性
export
const
getDiyPageProperty
=
async
(
id
:
number
)
=>
{
return
await
request
.
get
({
url
:
`/promotion/diy-page/get-property?id=`
+
id
})
}
// 更新装修页面属性
export
const
updateDiyPageProperty
=
async
(
data
:
DiyPageVO
)
=>
{
return
await
request
.
put
({
url
:
`/promotion/diy-page/update-property`
,
data
})
}
src/api/mall/promotion/diy/template.ts
View file @
20c59b81
import
request
from
'@/config/axios'
import
{
DiyPageVO
}
from
'@/api/mall/promotion/diy/page'
export
interface
DiyTemplateVO
{
id
?:
number
...
...
@@ -10,6 +11,10 @@ export interface DiyTemplateVO {
property
:
string
}
export
interface
DiyTemplatePropertyVO
extends
DiyTemplateVO
{
pages
:
DiyPageVO
[]
}
// 查询装修模板列表
export
const
getDiyTemplatePage
=
async
(
params
:
any
)
=>
{
return
await
request
.
get
({
url
:
`/promotion/diy-template/page`
,
params
})
...
...
@@ -39,3 +44,15 @@ export const deleteDiyTemplate = async (id: number) => {
export
const
useDiyTemplate
=
async
(
id
:
number
)
=>
{
return
await
request
.
put
({
url
:
`/promotion/diy-template/use?id=`
+
id
})
}
// 获得装修模板属性
export
const
getDiyTemplateProperty
=
async
(
id
:
number
)
=>
{
return
await
request
.
get
<
DiyTemplatePropertyVO
>
({
url
:
`/promotion/diy-template/get-property?id=`
+
id
})
}
// 更新装修模板属性
export
const
updateDiyTemplateProperty
=
async
(
data
:
DiyTemplateVO
)
=>
{
return
await
request
.
put
({
url
:
`/promotion/diy-template/update-property`
,
data
})
}
src/components/DiyEditor/components/mobile/NavigationBar/index.vue
View file @
20c59b81
...
...
@@ -40,7 +40,6 @@ defineProps<{ property: NavigationBarProperty }>()
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
cursor
:
pointer
;
/* 左边 */
.left
{
margin-left
:
8px
;
...
...
src/components/DiyEditor/components/mobile/NoticeBar/index.vue
View file @
20c59b81
<
template
>
<div
class=
"flex items-center text-12px"
class=
"flex items-center
p-y-4px
text-12px"
:style=
"
{ backgroundColor: property.backgroundColor, color: property.textColor }"
>
<el-image
:src=
"property.iconUrl"
class=
"h-18px"
/>
...
...
src/components/DiyEditor/index.vue
View file @
20c59b81
This diff is collapsed.
Click to expand it.
src/views/mall/promotion/diy/page/decorate.vue
View file @
20c59b81
...
...
@@ -4,6 +4,7 @@
v-model=
"formData.property"
:title=
"formData.name"
:libs=
"componentLibs"
:show-page-config=
"true"
:show-navigation-bar=
"true"
:show-tab-bar=
"false"
@
save=
"submitForm"
...
...
@@ -51,7 +52,7 @@ const formRef = ref() // 表单 Ref
const
getPageDetail
=
async
(
id
:
any
)
=>
{
formLoading
.
value
=
true
try
{
formData
.
value
=
await
DiyPageApi
.
getDiyPage
(
id
)
formData
.
value
=
await
DiyPageApi
.
getDiyPage
Property
(
id
)
}
finally
{
formLoading
.
value
=
false
}
...
...
@@ -63,7 +64,7 @@ const submitForm = async () => {
// 提交请求
formLoading
.
value
=
true
try
{
await
DiyPageApi
.
updateDiyPage
(
unref
(
formData
)
!
)
await
DiyPageApi
.
updateDiyPage
Property
(
unref
(
formData
)
!
)
message
.
success
(
'保存成功'
)
}
finally
{
formLoading
.
value
=
false
...
...
src/views/mall/promotion/diy/template/decorate.vue
View file @
20c59b81
<
template
>
<DiyEditor
v-if=
"formData && !formLoading"
v-model=
"
formData
.property"
v-model=
"
currentFormData!
.property"
:title=
"templateItems[selectedTemplateItem].name"
:libs=
"libs"
:show-page-config=
"selectedTemplateItem !== 0"
:show-tab-bar=
"selectedTemplateItem === 0"
:show-navigation-bar=
"selectedTemplateItem
>
0"
:show-navigation-bar=
"selectedTemplateItem
!==
0"
@
save=
"submitForm"
>
<template
#
toolBarLeft
>
...
...
@@ -25,6 +26,7 @@
</template>
<
script
setup
lang=
"ts"
>
import
*
as
DiyTemplateApi
from
'@/api/mall/promotion/diy/template'
import
*
as
DiyPageApi
from
'@/api/mall/promotion/diy/page'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
import
{
DiyComponentLibrary
}
from
'@/components/DiyEditor/util'
...
...
@@ -42,14 +44,17 @@ const templateItems = reactive([
const
message
=
useMessage
()
// 消息弹窗
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formData
=
ref
<
DiyTemplateApi
.
DiyTemplateVO
>
()
const
formData
=
ref
<
DiyTemplateApi
.
DiyTemplate
Property
VO
>
()
const
formRef
=
ref
()
// 表单 Ref
// 当前编辑的属性
const
currentFormData
=
ref
<
DiyTemplateApi
.
DiyTemplatePropertyVO
|
DiyPageApi
.
DiyPageVO
>
()
// 获取详情
const
getPageDetail
=
async
(
id
:
any
)
=>
{
formLoading
.
value
=
true
try
{
formData
.
value
=
await
DiyTemplateApi
.
getDiyTemplate
(
id
)
formData
.
value
=
await
DiyTemplateApi
.
getDiyTemplateProperty
(
id
)
currentFormData
.
value
=
formData
.
value
}
finally
{
formLoading
.
value
=
false
}
...
...
@@ -82,12 +87,21 @@ const pageLibs = [
]
as
DiyComponentLibrary
[]
// 当前组件库
const
libs
=
ref
<
DiyComponentLibrary
[]
>
(
templateLibs
)
// 模板选项切换
const
handleTemplateItemChange
=
()
=>
{
// 编辑模板
if
(
selectedTemplateItem
.
value
===
0
)
{
libs
.
value
=
templateLibs
}
else
{
libs
.
value
=
pageLibs
currentFormData
.
value
=
formData
.
value
return
}
// 编辑页面
libs
.
value
=
pageLibs
currentFormData
.
value
=
formData
.
value
!
.
pages
.
find
(
(
page
:
DiyPageApi
.
DiyPageVO
)
=>
page
.
name
===
templateItems
[
selectedTemplateItem
.
value
].
name
)
console
.
log
(
currentFormData
.
value
)
}
// 提交表单
...
...
@@ -97,7 +111,13 @@ const submitForm = async () => {
// 提交请求
formLoading
.
value
=
true
try
{
await
DiyTemplateApi
.
updateDiyTemplate
(
unref
(
formData
)
!
)
if
(
selectedTemplateItem
.
value
===
0
)
{
// 提交模板属性
await
DiyTemplateApi
.
updateDiyTemplateProperty
(
unref
(
formData
)
!
)
}
else
{
// 提交页面属性
await
DiyPageApi
.
updateDiyPageProperty
(
unref
(
currentFormData
)
!
)
}
message
.
success
(
'保存成功'
)
}
finally
{
formLoading
.
value
=
false
...
...
@@ -113,8 +133,9 @@ const resetForm = () => {
usedTime
:
undefined
,
remark
:
''
,
previewImageUrls
:
[],
property
:
''
}
as
DiyTemplateApi
.
DiyTemplateVO
property
:
''
,
pages
:
[]
}
as
DiyTemplateApi
.
DiyTemplatePropertyVO
formRef
.
value
?.
resetFields
()
}
...
...
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