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
Commit
fcc748dc
authored
Nov 03, 2023
by
jason
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
753f5de8
20c59b81
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 @
fcc748dc
...
@@ -33,3 +33,13 @@ export const updateDiyPage = async (data: DiyPageVO) => {
...
@@ -33,3 +33,13 @@ export const updateDiyPage = async (data: DiyPageVO) => {
export
const
deleteDiyPage
=
async
(
id
:
number
)
=>
{
export
const
deleteDiyPage
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/promotion/diy-page/delete?id=`
+
id
})
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 @
fcc748dc
import
request
from
'@/config/axios'
import
request
from
'@/config/axios'
import
{
DiyPageVO
}
from
'@/api/mall/promotion/diy/page'
export
interface
DiyTemplateVO
{
export
interface
DiyTemplateVO
{
id
?:
number
id
?:
number
...
@@ -10,6 +11,10 @@ export interface DiyTemplateVO {
...
@@ -10,6 +11,10 @@ export interface DiyTemplateVO {
property
:
string
property
:
string
}
}
export
interface
DiyTemplatePropertyVO
extends
DiyTemplateVO
{
pages
:
DiyPageVO
[]
}
// 查询装修模板列表
// 查询装修模板列表
export
const
getDiyTemplatePage
=
async
(
params
:
any
)
=>
{
export
const
getDiyTemplatePage
=
async
(
params
:
any
)
=>
{
return
await
request
.
get
({
url
:
`/promotion/diy-template/page`
,
params
})
return
await
request
.
get
({
url
:
`/promotion/diy-template/page`
,
params
})
...
@@ -39,3 +44,15 @@ export const deleteDiyTemplate = async (id: number) => {
...
@@ -39,3 +44,15 @@ export const deleteDiyTemplate = async (id: number) => {
export
const
useDiyTemplate
=
async
(
id
:
number
)
=>
{
export
const
useDiyTemplate
=
async
(
id
:
number
)
=>
{
return
await
request
.
put
({
url
:
`/promotion/diy-template/use?id=`
+
id
})
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 @
fcc748dc
...
@@ -40,7 +40,6 @@ defineProps<{ property: NavigationBarProperty }>()
...
@@ -40,7 +40,6 @@ defineProps<{ property: NavigationBarProperty }>()
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
center
;
align-items
:
center
;
cursor
:
pointer
;
/* 左边 */
/* 左边 */
.left
{
.left
{
margin-left
:
8px
;
margin-left
:
8px
;
...
...
src/components/DiyEditor/components/mobile/NoticeBar/index.vue
View file @
fcc748dc
<
template
>
<
template
>
<div
<div
class=
"flex items-center text-12px"
class=
"flex items-center
p-y-4px
text-12px"
:style=
"
{ backgroundColor: property.backgroundColor, color: property.textColor }"
:style=
"
{ backgroundColor: property.backgroundColor, color: property.textColor }"
>
>
<el-image
:src=
"property.iconUrl"
class=
"h-18px"
/>
<el-image
:src=
"property.iconUrl"
class=
"h-18px"
/>
...
...
src/components/DiyEditor/index.vue
View file @
fcc748dc
This diff is collapsed.
Click to expand it.
src/views/mall/promotion/diy/page/decorate.vue
View file @
fcc748dc
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
v-model=
"formData.property"
v-model=
"formData.property"
:title=
"formData.name"
:title=
"formData.name"
:libs=
"componentLibs"
:libs=
"componentLibs"
:show-page-config=
"true"
:show-navigation-bar=
"true"
:show-navigation-bar=
"true"
:show-tab-bar=
"false"
:show-tab-bar=
"false"
@
save=
"submitForm"
@
save=
"submitForm"
...
@@ -51,7 +52,7 @@ const formRef = ref() // 表单 Ref
...
@@ -51,7 +52,7 @@ const formRef = ref() // 表单 Ref
const
getPageDetail
=
async
(
id
:
any
)
=>
{
const
getPageDetail
=
async
(
id
:
any
)
=>
{
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
formData
.
value
=
await
DiyPageApi
.
getDiyPage
(
id
)
formData
.
value
=
await
DiyPageApi
.
getDiyPage
Property
(
id
)
}
finally
{
}
finally
{
formLoading
.
value
=
false
formLoading
.
value
=
false
}
}
...
@@ -63,7 +64,7 @@ const submitForm = async () => {
...
@@ -63,7 +64,7 @@ const submitForm = async () => {
// 提交请求
// 提交请求
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
await
DiyPageApi
.
updateDiyPage
(
unref
(
formData
)
!
)
await
DiyPageApi
.
updateDiyPage
Property
(
unref
(
formData
)
!
)
message
.
success
(
'保存成功'
)
message
.
success
(
'保存成功'
)
}
finally
{
}
finally
{
formLoading
.
value
=
false
formLoading
.
value
=
false
...
...
src/views/mall/promotion/diy/template/decorate.vue
View file @
fcc748dc
<
template
>
<
template
>
<DiyEditor
<DiyEditor
v-if=
"formData && !formLoading"
v-if=
"formData && !formLoading"
v-model=
"
formData
.property"
v-model=
"
currentFormData!
.property"
:title=
"templateItems[selectedTemplateItem].name"
:title=
"templateItems[selectedTemplateItem].name"
:libs=
"libs"
:libs=
"libs"
:show-page-config=
"selectedTemplateItem !== 0"
:show-tab-bar=
"selectedTemplateItem === 0"
:show-tab-bar=
"selectedTemplateItem === 0"
:show-navigation-bar=
"selectedTemplateItem
>
0"
:show-navigation-bar=
"selectedTemplateItem
!==
0"
@
save=
"submitForm"
@
save=
"submitForm"
>
>
<template
#
toolBarLeft
>
<template
#
toolBarLeft
>
...
@@ -25,6 +26,7 @@
...
@@ -25,6 +26,7 @@
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
*
as
DiyTemplateApi
from
'@/api/mall/promotion/diy/template'
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
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
import
{
DiyComponentLibrary
}
from
'@/components/DiyEditor/util'
import
{
DiyComponentLibrary
}
from
'@/components/DiyEditor/util'
...
@@ -42,14 +44,17 @@ const templateItems = reactive([
...
@@ -42,14 +44,17 @@ const templateItems = reactive([
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formData
=
ref
<
DiyTemplateApi
.
DiyTemplateVO
>
()
const
formData
=
ref
<
DiyTemplateApi
.
DiyTemplate
Property
VO
>
()
const
formRef
=
ref
()
// 表单 Ref
const
formRef
=
ref
()
// 表单 Ref
// 当前编辑的属性
const
currentFormData
=
ref
<
DiyTemplateApi
.
DiyTemplatePropertyVO
|
DiyPageApi
.
DiyPageVO
>
()
// 获取详情
// 获取详情
const
getPageDetail
=
async
(
id
:
any
)
=>
{
const
getPageDetail
=
async
(
id
:
any
)
=>
{
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
formData
.
value
=
await
DiyTemplateApi
.
getDiyTemplate
(
id
)
formData
.
value
=
await
DiyTemplateApi
.
getDiyTemplateProperty
(
id
)
currentFormData
.
value
=
formData
.
value
}
finally
{
}
finally
{
formLoading
.
value
=
false
formLoading
.
value
=
false
}
}
...
@@ -82,12 +87,21 @@ const pageLibs = [
...
@@ -82,12 +87,21 @@ const pageLibs = [
]
as
DiyComponentLibrary
[]
]
as
DiyComponentLibrary
[]
// 当前组件库
// 当前组件库
const
libs
=
ref
<
DiyComponentLibrary
[]
>
(
templateLibs
)
const
libs
=
ref
<
DiyComponentLibrary
[]
>
(
templateLibs
)
// 模板选项切换
const
handleTemplateItemChange
=
()
=>
{
const
handleTemplateItemChange
=
()
=>
{
// 编辑模板
if
(
selectedTemplateItem
.
value
===
0
)
{
if
(
selectedTemplateItem
.
value
===
0
)
{
libs
.
value
=
templateLibs
libs
.
value
=
templateLibs
}
else
{
currentFormData
.
value
=
formData
.
value
libs
.
value
=
pageLibs
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 () => {
...
@@ -97,7 +111,13 @@ const submitForm = async () => {
// 提交请求
// 提交请求
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
await
DiyTemplateApi
.
updateDiyTemplate
(
unref
(
formData
)
!
)
if
(
selectedTemplateItem
.
value
===
0
)
{
// 提交模板属性
await
DiyTemplateApi
.
updateDiyTemplateProperty
(
unref
(
formData
)
!
)
}
else
{
// 提交页面属性
await
DiyPageApi
.
updateDiyPageProperty
(
unref
(
currentFormData
)
!
)
}
message
.
success
(
'保存成功'
)
message
.
success
(
'保存成功'
)
}
finally
{
}
finally
{
formLoading
.
value
=
false
formLoading
.
value
=
false
...
@@ -113,8 +133,9 @@ const resetForm = () => {
...
@@ -113,8 +133,9 @@ const resetForm = () => {
usedTime
:
undefined
,
usedTime
:
undefined
,
remark
:
''
,
remark
:
''
,
previewImageUrls
:
[],
previewImageUrls
:
[],
property
:
''
property
:
''
,
}
as
DiyTemplateApi
.
DiyTemplateVO
pages
:
[]
}
as
DiyTemplateApi
.
DiyTemplatePropertyVO
formRef
.
value
?.
resetFields
()
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