Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-home
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bcd044e2
authored
May 30, 2023
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
5107f663
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
253 additions
and
111 deletions
src/mixins/draw.js
src/store/modules/marketing.js
src/utils/drawing.js
src/views/home/components/Marketing/ChatGPT.vue
src/views/home/components/Marketing/GPTAnalysis.vue
src/views/home/components/Marketing/MarketingRight.vue
src/views/home/components/Marketing/PhoneView.vue
src/mixins/draw.js
0 → 100644
View file @
bcd044e
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-19 13:46:20
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-30 14:30:14
* @FilePath: \scrm-micro-home\src\mixins\gpt.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
mapState
,
mapActions
}
from
'vuex'
import
Drawing
from
'@/utils/drawing'
export
default
{
data
()
{
return
{
cavansObj
:
{
1
:
{
titleStyle
:
{
x
:
82
,
y
:
224
,
fontSize
:
52
,
color
:
'#AD604C'
},
subTitleStyle
:
{
x
:
66
,
y
:
362
,
fontSize
:
28
,
color
:
'#AD604C'
}
},
2
:
{
titleStyle
:
{
x
:
10
,
y
:
104
,
fontSize
:
54
,
color
:
'#185D5E'
},
subTitleStyle
:
{
x
:
10
,
y
:
176
,
fontSize
:
16
,
color
:
'#185D5E'
}
}
}
}
},
methods
:
{
//主图、内容图、logo合并图片
async
createCanvas
()
{
this
.
loading
=
true
const
{
backgroundImage
,
detailImage
,
merchantLog
,
marketingTitle
,
marketingSubtitle
}
=
this
.
editForm
if
(
!
backgroundImage
)
return
try
{
const
res
=
await
Promise
.
all
([
this
.
getImgWH
(
backgroundImage
),
this
.
getImgWH
(
detailImage
),
this
.
getImgWH
(
merchantLog
)])
const
h
=
(
res
[
0
].
dh
/
res
[
0
].
dw
)
*
375
+
(
res
[
1
].
dh
/
res
[
1
].
dw
)
*
375
this
.
logoInfo
=
{
url
:
merchantLog
,
x
:
375
-
res
[
2
].
dw
/
2
-
20
,
y
:
20
,
width
:
res
[
2
].
dw
/
2
,
height
:
res
[
2
].
dh
/
2
}
const
drawfun
=
new
Drawing
(
document
.
getElementById
(
'canvasId'
),
{
width
:
375
,
height
:
h
}),
imageList
=
[
{
url
:
backgroundImage
,
x
:
0
,
y
:
0
,
width
:
375
,
height
:
(
res
[
0
].
dh
/
res
[
0
].
dw
)
*
375
},
{
url
:
detailImage
,
x
:
0
,
y
:
(
res
[
0
].
dh
/
res
[
0
].
dw
)
*
375
,
width
:
375
,
height
:
(
res
[
1
].
dh
/
res
[
1
].
dw
)
*
375
},
{
...
this
.
logoInfo
}
].
filter
(
item
=>
item
.
url
)
let
textList
=
[],
title
=
this
.
cavansObj
[
this
.
editForm
.
templateId
]
if
(
title
)
{
marketingTitle
.
split
(
' '
).
forEach
((
item
,
index
)
=>
{
textList
.
push
({
x
:
title
.
titleStyle
.
x
,
y
:
title
.
titleStyle
.
y
+
index
*
60
,
fontSize
:
title
.
titleStyle
.
fontSize
,
color
:
title
.
titleStyle
.
color
,
text
:
item
})
})
new
Array
(
marketingSubtitle
).
forEach
((
item
,
index
)
=>
{
textList
.
push
({
x
:
title
.
subTitleStyle
.
x
,
y
:
title
.
subTitleStyle
.
y
+
index
*
60
,
fontSize
:
title
.
subTitleStyle
.
fontSize
,
color
:
title
.
subTitleStyle
.
color
,
text
:
item
})
})
}
console
.
log
(
title
,
textList
)
const
canvasBase64
=
await
drawfun
.
begin
({
imageList
,
textList
})
await
this
.
uploadImg
(
canvasBase64
)
this
.
addOrUpdate
()
}
catch
(
e
)
{
console
.
log
(
e
)
}
}
},
mounted
()
{}
}
src/store/modules/marketing.js
View file @
bcd044e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 17:13:33
* @Date: 2023-05-16 17:13:33
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-2
4 14:45:33
* @LastEditTime: 2023-05-2
6 16:19:48
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -22,6 +22,7 @@ export default {
...
@@ -22,6 +22,7 @@ export default {
schemeList
:
{
schemeList
:
{
list
:
[]
list
:
[]
},
},
mergeImg
:
{},
keywords
:
''
,
keywords
:
''
,
GPTList
:
null
,
GPTList
:
null
,
merchantInfo
:
{}
merchantInfo
:
{}
...
@@ -51,6 +52,10 @@ export default {
...
@@ -51,6 +52,10 @@ export default {
SET_KET_WORDs
(
state
,
data
)
{
SET_KET_WORDs
(
state
,
data
)
{
state
.
keywords
=
data
state
.
keywords
=
data
},
},
// 设置合并图片
SET_MERGE_IMG
(
state
,
data
)
{
state
.
mergeImg
=
data
},
[
'SET_CALENDAR_DATA'
](
state
,
payload
)
{
[
'SET_CALENDAR_DATA'
](
state
,
payload
)
{
state
.
calendarData
=
payload
.
calendarData
state
.
calendarData
=
payload
.
calendarData
},
},
...
@@ -83,6 +88,9 @@ export default {
...
@@ -83,6 +88,9 @@ export default {
setActivityProject
({
commit
},
data
)
{
setActivityProject
({
commit
},
data
)
{
commit
(
'SET_ACTIVITY_PEOJECT'
,
data
)
commit
(
'SET_ACTIVITY_PEOJECT'
,
data
)
},
},
setMergeImg
({
commit
},
data
)
{
commit
(
'SET_MERGE_IMG'
,
data
)
},
setKeyWords
({
commit
,
state
},
data
)
{
setKeyWords
({
commit
,
state
},
data
)
{
if
(
state
.
keywords
==
data
)
return
if
(
state
.
keywords
==
data
)
return
commit
(
'SET_KET_WORDs'
,
data
)
commit
(
'SET_KET_WORDs'
,
data
)
...
...
src/utils/drawing.js
View file @
bcd044e
...
@@ -2,40 +2,70 @@
...
@@ -2,40 +2,70 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-17 16:07:55
* @Date: 2023-05-17 16:07:55
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-
18 09:58:54
* @LastEditTime: 2023-05-
30 12:57:42
* @FilePath: \scrm-micro-home\src\utils\drawing.js
* @FilePath: \scrm-micro-home\src\utils\drawing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
class
Drawing
{
class
Drawing
{
constructor
(
canvasParams
,
list
=
[],
fn
)
{
constructor
(
el
,
canvasParams
)
{
this
.
count
=
0
this
.
canvasId
=
el
this
.
fn
=
fn
this
.
list
=
list
this
.
canvasId
=
document
.
createElement
(
'canvas'
)
const
{
width
,
height
}
=
canvasParams
const
{
width
,
height
}
=
canvasParams
this
.
canvasId
.
width
=
width
this
.
canvasId
.
width
=
width
this
.
canvasId
.
height
=
height
this
.
canvasId
.
height
=
height
this
.
ctx
=
this
.
canvasId
.
getContext
(
'2d'
)
this
.
ctx
=
this
.
canvasId
.
getContext
(
'2d'
)
}
}
drawImages
(
fn
)
{
async
drawImages
(
imageParams
,
callback
)
{
const
{
imgSrc
,
x
,
y
,
width
,
height
}
=
this
.
list
[
this
.
count
]
this
.
ctx
.
beginPath
()
this
.
ctx
.
save
()
let
{
height
,
width
,
url
,
x
,
y
}
=
imageParams
let
image
=
this
.
createImage
()
let
image
=
this
.
createImage
()
image
.
src
=
imgSrc
image
.
src
=
url
this
.
count
++
return
new
Promise
(
resolve
=>
{
image
.
onload
=
()
=>
{
image
.
onload
=
()
=>
{
setTimeout
(()
=>
{
this
.
ctx
.
drawImage
(
image
,
x
,
y
,
width
,
height
)
this
.
ctx
.
drawImage
(
image
,
x
,
y
,
width
,
height
)
console
.
log
(
this
.
count
,
this
.
list
.
length
)
// 再将图片填充到画布
if
(
this
.
count
===
this
.
list
.
length
)
{
let
pattern
=
this
.
ctx
.
createPattern
(
image
,
'no-repeat'
)
this
.
fn
(
this
.
canvasId
.
toDataURL
(
'image/png'
))
this
.
ctx
.
fillStyle
=
pattern
}
else
{
resolve
(
imageParams
)
this
.
drawImages
(
)
},
3000
)
}
}
})
}
}
drawText
(
textParams
)
{
const
{
fontSize
,
color
,
text
,
x
,
y
}
=
textParams
console
.
log
(
x
,
y
)
this
.
ctx
.
font
=
`
${
fontSize
}
px Calibri`
this
.
ctx
.
fillStyle
=
color
this
.
ctx
.
fillText
(
text
,
x
,
y
+
fontSize
)
}
}
createImage
()
{
createImage
()
{
let
image
=
new
Image
()
let
image
=
new
Image
()
image
.
setAttribute
(
'crossOrigin'
,
'Anonymous'
)
image
.
setAttribute
(
'crossOrigin'
,
'Anonymous'
)
return
image
return
image
}
}
async
begin
(
data
=
{})
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
drawFun
=
()
=>
{
data
.
textList
&&
data
.
textList
.
length
&&
data
.
textList
.
map
(
e
=>
{
this
.
drawText
(
e
)
})
console
.
log
(
this
.
canvasId
.
toDataURL
(
'image/png'
))
resolve
(
this
.
canvasId
.
toDataURL
(
'image/png'
))
}
if
(
data
.
imageList
&&
data
.
imageList
.
length
)
{
await
this
.
drawImages
(
data
.
imageList
[
0
])
if
(
data
.
imageList
.
length
>
1
)
for
(
let
index
=
1
;
index
<
data
.
imageList
.
length
;
index
++
)
{
await
this
.
drawImages
(
data
.
imageList
[
index
])
if
(
index
==
data
.
imageList
.
length
-
1
)
drawFun
()
}
else
drawFun
()
}
else
drawFun
()
})
}
}
}
export
default
Drawing
export
default
Drawing
src/views/home/components/Marketing/ChatGPT.vue
View file @
bcd044e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-16 10:20:01
* @Date: 2023-05-16 10:20:01
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-2
2 15:10:15
* @LastEditTime: 2023-05-2
6 18:26:10
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\ChatGPT.vue
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\ChatGPT.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
-->
...
@@ -96,8 +96,8 @@ export default {
...
@@ -96,8 +96,8 @@ export default {
chatRef
.
scrollTop
=
height
//滚动到最底部
chatRef
.
scrollTop
=
height
//滚动到最底部
})
})
},
},
activityInfo
()
{
activityInfo
(
val
)
{
this
.
chatItem
=
[]
if
(
val
.
id
)
this
.
chatItem
=
[]
}
}
},
},
methods
:
{
methods
:
{
...
...
src/views/home/components/Marketing/GPTAnalysis.vue
View file @
bcd044e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 10:23:52
* @Date: 2023-05-16 10:23:52
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-
25 16:24:0
2
* @LastEditTime: 2023-05-
30 14:26:4
2
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\GPTAnalysis.vue
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\GPTAnalysis.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
-->
...
@@ -195,12 +195,12 @@ import selectGiftDialog from './selectGiftDialog'
...
@@ -195,12 +195,12 @@ import selectGiftDialog from './selectGiftDialog'
import
selectGoodsDialog
from
'./selectGoodsDialog'
import
selectGoodsDialog
from
'./selectGoodsDialog'
import
selectEquityDialog
from
'./selectEquityDialog'
import
selectEquityDialog
from
'./selectEquityDialog'
import
selectEmpDialog
from
'./selectEmpDialog'
import
selectEmpDialog
from
'./selectEmpDialog'
import
Drawing
from
'@/utils/drawing'
import
getUploadImgColor
from
'@/utils/color'
import
getUploadImgColor
from
'@/utils/color'
import
{
mapState
,
mapActions
}
from
'vuex'
import
{
mapState
,
mapActions
}
from
'vuex'
import
gpt
from
'@/mixins/gpt'
import
gpt
from
'@/mixins/gpt'
import
draw
from
'@/mixins/draw'
export
default
{
export
default
{
mixins
:
[
gpt
],
mixins
:
[
gpt
,
draw
],
name
:
'analysis'
,
name
:
'analysis'
,
data
()
{
data
()
{
return
{
return
{
...
@@ -406,8 +406,7 @@ export default {
...
@@ -406,8 +406,7 @@ export default {
goodsStock
:
[{
required
:
true
,
message
:
'请输入库存'
,
trigger
:
'input'
}],
goodsStock
:
[{
required
:
true
,
message
:
'请输入库存'
,
trigger
:
'input'
}],
merchantname
:
[{
required
:
true
,
message
:
'请输入门店名称'
,
trigger
:
'input'
}],
merchantname
:
[{
required
:
true
,
message
:
'请输入门店名称'
,
trigger
:
'input'
}],
merchantAddress
:
[{
required
:
true
,
message
:
'请选择门店地址'
,
trigger
:
'input'
}],
merchantAddress
:
[{
required
:
true
,
message
:
'请选择门店地址'
,
trigger
:
'input'
}],
serviceHotline
:
[{
required
:
true
,
message
:
'请输入服务热线'
,
trigger
:
'input'
}],
serviceHotline
:
[{
required
:
true
,
message
:
'请输入服务热线'
,
trigger
:
'input'
}]
merchantLog
:
[{
required
:
true
,
message
:
'请选择门店Logo'
,
trigger
:
'change'
}]
}
}
}
}
},
},
...
@@ -415,22 +414,17 @@ export default {
...
@@ -415,22 +414,17 @@ export default {
computed
:
{
computed
:
{
...
mapState
(
'marketing'
,
[
'activityInfo'
,
'GPTList'
,
'merchantInfo'
]),
...
mapState
(
'marketing'
,
[
'activityInfo'
,
'GPTList'
,
'merchantInfo'
]),
mergeStr
()
{
mergeStr
()
{
const
{
backgroundImage
,
detailImage
,
merchantLog
}
=
this
.
editForm
const
{
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
}
=
this
.
editForm
return
[
backgroundImage
,
detailImage
,
merchantLog
]
return
[
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
]
}
}
},
},
watch
:
{
watch
:
{
activityInfo
(
val
)
{
activityInfo
(
val
)
{
val
&&
this
.
confirmMsg
(
val
)
val
&&
this
.
confirmMsg
(
val
)
},
},
//监听主图、内容图、logo
mergeStr
(
val
)
{
mergeStr
(
val
)
{
if
(
val
&&
val
.
every
(
item
=>
item
))
{
console
.
log
(
val
,
999999999999
)
this
.
getMergeImgs
()
this
.
setMergeImg
(
val
)
}
else
{
this
.
editForm
.
bigImage
=
null
}
console
.
log
(
this
.
editForm
.
bigImage
)
}
}
},
},
components
:
{
components
:
{
...
@@ -440,7 +434,7 @@ export default {
...
@@ -440,7 +434,7 @@ export default {
selectEmpDialog
selectEmpDialog
},
},
methods
:
{
methods
:
{
...
mapActions
(
'marketing'
,
[
'setActivityInfo'
,
'setSchemeListData'
]),
...
mapActions
(
'marketing'
,
[
'setActivityInfo'
,
'setSchemeListData'
,
'setMergeImg'
]),
//获取优惠券模板
//获取优惠券模板
couponTemplate
()
{
couponTemplate
()
{
this
.
$apis
.
giftBag
.
couponTemplate
({
pageSize
:
10000
,
pageNum
:
1
}).
then
(
res
=>
{
this
.
$apis
.
giftBag
.
couponTemplate
({
pageSize
:
10000
,
pageNum
:
1
}).
then
(
res
=>
{
...
@@ -496,6 +490,9 @@ export default {
...
@@ -496,6 +490,9 @@ export default {
//获取图片宽度高度
//获取图片宽度高度
getImgWH
(
src
)
{
getImgWH
(
src
)
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
if
(
!
src
)
{
resolve
({
dw
:
0
,
dh
:
0
,
src
})
}
const
img
=
new
Image
()
const
img
=
new
Image
()
img
.
src
=
src
img
.
src
=
src
img
.
onload
=
()
=>
{
img
.
onload
=
()
=>
{
...
@@ -504,54 +501,13 @@ export default {
...
@@ -504,54 +501,13 @@ export default {
})
})
},
},
uploadImg
(
imgFile
)
{
uploadImg
(
imgFile
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
base64
=
'png'
+
'@'
+
imgFile
.
split
(
','
)[
1
]
const
base64
=
'png'
+
'@'
+
imgFile
.
split
(
','
)[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
base64
,
fileType
:
'image'
}).
then
(
res
=>
{
this
.
$apis
.
common
.
pictureUpload
({
file
:
base64
,
fileType
:
'image'
}).
then
(
res
=>
{
this
.
editForm
.
bigImage
=
res
this
.
editForm
.
bigImage
=
res
resolve
()
})
})
})
},
//主图、内容图、logo合并图片
async
getMergeImgs
()
{
const
{
backgroundImage
,
detailImage
,
merchantLog
}
=
this
.
editForm
try
{
const
res
=
await
Promise
.
all
([
this
.
getImgWH
(
backgroundImage
),
this
.
getImgWH
(
detailImage
),
this
.
getImgWH
(
merchantLog
)])
const
h
=
(
res
[
0
].
dh
/
res
[
0
].
dw
)
*
375
+
(
res
[
1
].
dh
/
res
[
1
].
dw
)
*
375
this
.
logoInfo
=
{
imgSrc
:
merchantLog
,
x
:
375
-
res
[
2
].
dw
/
2
-
20
,
y
:
20
,
width
:
res
[
2
].
dw
/
2
,
height
:
res
[
2
].
dh
/
2
}
const
draw
=
new
Drawing
(
{
width
:
375
,
height
:
h
},
[
{
imgSrc
:
backgroundImage
,
x
:
0
,
y
:
0
,
width
:
375
,
height
:
(
res
[
0
].
dh
/
res
[
0
].
dw
)
*
375
},
{
imgSrc
:
detailImage
,
x
:
0
,
y
:
(
res
[
0
].
dh
/
res
[
0
].
dw
)
*
375
,
width
:
375
,
height
:
(
res
[
1
].
dh
/
res
[
1
].
dw
)
*
375
},
{
...
this
.
logoInfo
}
],
base64
=>
{
this
.
uploadImg
(
base64
)
}
)
draw
.
drawImages
()
}
catch
(
e
)
{
console
.
log
(
e
)
}
},
},
//选择门店优惠券
//选择门店优惠券
handleGiftAdd
()
{
handleGiftAdd
()
{
...
@@ -582,7 +538,7 @@ export default {
...
@@ -582,7 +538,7 @@ export default {
handleEmpConfirm
(
selectedData
)
{
handleEmpConfirm
(
selectedData
)
{
this
.
editForm
.
followStaff
=
selectedData
.
staffId
this
.
editForm
.
followStaff
=
selectedData
.
staffId
this
.
handleEmpClose
()
this
.
handleEmpClose
()
this
.
addOrUpdate
()
this
.
createCanvas
()
},
},
handleEquityConfirm
(
selectedData
)
{
handleEquityConfirm
(
selectedData
)
{
this
.
selectedEquityList
=
selectedData
this
.
selectedEquityList
=
selectedData
...
@@ -672,7 +628,8 @@ export default {
...
@@ -672,7 +628,8 @@ export default {
},
},
getViewParams
()
{
getViewParams
()
{
const
prams
=
this
.
getCouponInfoParams
()
const
prams
=
this
.
getCouponInfoParams
()
return
{
...
prams
,
selectedEquityList
:
this
.
selectedEquityList
,
couponList
:
this
.
editForm
.
superMarketingCouponRelRequestList
,
selectedGoodsList
:
this
.
selectedGoodsList
,
logoInfo
:
this
.
logoInfo
,
bigImage
:
this
.
editForm
.
bigImage
}
console
.
log
(
prams
)
return
{
...
prams
,
selectedEquityList
:
this
.
selectedEquityList
,
couponList
:
this
.
editForm
.
superMarketingCouponRelRequestList
,
selectedGoodsList
:
this
.
selectedGoodsList
}
},
},
getCouponInfoParams
()
{
getCouponInfoParams
()
{
var
param
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
var
param
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
...
@@ -705,6 +662,9 @@ export default {
...
@@ -705,6 +662,9 @@ export default {
delete
param
.
activityCouponBaseInfoDTOS
delete
param
.
activityCouponBaseInfoDTOS
return
param
return
param
},
},
handleCancel
()
{
this
.
$router
.
push
(
'/home/index'
)
},
handleConfirm
()
{
handleConfirm
()
{
if
(
this
.
selectedGoodsList
.
length
+
this
.
editForm
.
superMarketingCouponRelRequestList
.
length
+
this
.
selectedGoodsList
.
length
==
0
)
{
if
(
this
.
selectedGoodsList
.
length
+
this
.
editForm
.
superMarketingCouponRelRequestList
.
length
+
this
.
selectedGoodsList
.
length
==
0
)
{
this
.
$message
.
error
(
'权益服务、平台优惠、门店优惠券至少选一项'
)
this
.
$message
.
error
(
'权益服务、平台优惠、门店优惠券至少选一项'
)
...
@@ -712,7 +672,11 @@ export default {
...
@@ -712,7 +672,11 @@ export default {
}
}
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
if
(
this
.
importNum
)
{
this
.
isSelectEmpVisible
=
true
this
.
isSelectEmpVisible
=
true
}
else
{
this
.
createCanvas
()
}
}
}
})
})
},
},
...
@@ -735,9 +699,12 @@ export default {
...
@@ -735,9 +699,12 @@ export default {
const
{
id
}
=
this
.
activityInfo
const
{
id
}
=
this
.
activityInfo
this
.
$apis
.
activity
.
getCalendarDatail
({
id
}).
then
(
res
=>
{
this
.
$apis
.
activity
.
getCalendarDatail
({
id
}).
then
(
res
=>
{
this
.
setActivityInfo
()
this
.
setActivityInfo
()
const
{
title
,
subTitle
,
startTime
,
endTime
,
couponItemList
}
=
this
.
$common
.
utils
.
deepClone
(
res
.
data
||
{})
const
{
title
,
subTitle
,
startTime
,
endTime
,
couponItemList
,
backgroundImg
,
captionImg
}
=
this
.
$common
.
utils
.
deepClone
(
res
.
data
||
{})
this
.
editForm
.
templateId
=
id
this
.
editForm
.
marketingTitle
=
title
this
.
editForm
.
marketingTitle
=
title
this
.
editForm
.
marketingSubtitle
=
subTitle
this
.
editForm
.
marketingSubtitle
=
subTitle
this
.
editForm
.
backgroundImage
=
backgroundImg
this
.
editForm
.
detailImage
=
captionImg
this
.
editForm
.
activityTime
=
[
startTime
+
' 00:00:00'
,
endTime
+
' 00:00:00'
]
this
.
editForm
.
activityTime
=
[
startTime
+
' 00:00:00'
,
endTime
+
' 00:00:00'
]
this
.
selectedGoodsList
=
couponItemList
this
.
selectedGoodsList
=
couponItemList
this
.
selectedGoodsList
.
forEach
(
item
=>
{
this
.
selectedGoodsList
.
forEach
(
item
=>
{
...
...
src/views/home/components/Marketing/MarketingRight.vue
View file @
bcd044e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-
25 16:24:16
* @LastEditTime: 2023-05-
30 14:27:42
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
-->
...
@@ -23,38 +23,29 @@ export default {
...
@@ -23,38 +23,29 @@ export default {
getComponent
:
''
getComponent
:
''
}
}
},
},
mounted
()
{
setTimeout
(()
=>
{
let
children
=
this
.
$parent
.
$children
this
.
findComponent
(
children
)
},
300
)
},
components
:
{
components
:
{
PhoneView
PhoneView
},
},
computed
:
{
computed
:
{
...
mapState
(
'marketing'
,
[
'activityInfo'
]),
...
mapState
(
'marketing'
,
[
'activityInfo'
,
'mergeImg'
])
imgArr
()
{
const
{
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
bigImage
}
=
this
.
getComponent
&&
this
.
getComponent
.
getViewParams
()
return
[
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
bigImage
]
}
},
},
watch
:
{
watch
:
{
imgArr
(
val
)
{
mergeImg
:
{
const
[
backgroundImage
=
''
,
detailImage
=
''
,
merchantLog
=
''
,
mainColor
,
logoInfo
,
bigImage
]
=
val
handler
(
val
)
{
this
.
activityDetail
=
{
...
this
.
activityDetail
,
...{
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
bigImage
}
}
const
[
backgroundImage
=
''
,
detailImage
=
''
,
merchantLog
=
''
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
]
=
val
console
.
log
(
this
.
activityDetail
)
this
.
activityDetail
=
{
...
this
.
activityDetail
,
...{
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
}
}
},
},
activityInfo
(
val
)
{
deep
:
true
this
.
activityDetail
=
{}
console
.
log
(
this
.
activityDetail
)
}
}
// activityInfo(val) {
// this.activityDetail = {}
// }
},
},
methods
:
{
methods
:
{
findComponent
(
children
)
{
findComponent
(
children
)
{
for
(
let
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
children
.
length
;
i
++
)
{
if
(
children
[
i
].
$options
.
componentsName
==
'analysis'
)
{
if
(
children
[
i
].
$options
.
componentsName
==
'analysis'
)
{
this
.
getComponent
=
children
[
i
]
this
.
activityDetail
=
children
[
i
].
getViewParams
()
return
return
}
}
if
(
children
[
i
].
$children
)
{
if
(
children
[
i
].
$children
)
{
...
@@ -63,8 +54,8 @@ export default {
...
@@ -63,8 +54,8 @@ export default {
}
}
},
},
renewImg
()
{
renewImg
()
{
this
.
activityDetail
=
this
.
getComponent
.
getViewParams
()
let
children
=
this
.
$parent
.
$children
console
.
log
(
this
.
activityDetail
)
this
.
findComponent
(
children
)
}
}
}
}
}
}
...
...
src/views/home/components/Marketing/PhoneView.vue
View file @
bcd044e
...
@@ -2,23 +2,20 @@
...
@@ -2,23 +2,20 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-
25 16:22:34
* @LastEditTime: 2023-05-
30 14:34:01
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
-->
<
template
>
<
template
>
<div
class=
"review-body"
>
<div
class=
"review-body"
>
<canvas
id=
"canvasId"
></canvas>
<template
v-if=
"isSuper"
>
<template
v-if=
"isSuper"
>
<img
src=
"@/assets/img/phone.png"
class=
"review-phone"
/>
<img
src=
"@/assets/img/phone.png"
class=
"review-phone"
/>
<div
class=
"review-title_top"
>
{{
detail
.
marketingTitle
||
detail
.
activityName
}}
</div>
<div
class=
"review-title_top"
>
{{
detail
.
marketingTitle
||
detail
.
activityName
}}
</div>
<div
class=
"review-content"
>
<div
class=
"review-content"
>
<div
class=
"review-main"
>
<div
class=
"review-main"
>
<template
v-if=
"detail.activityBigImg || detail.bigImage"
>
<template>
<div
class=
"review-bg-img"
>
<div
class=
"main-title"
:style=
"
{ top: item.y + 'px', left: item.x + 'px', 'font-size': item.fontSize + 'px', color: item.color }" v-for="(item, index) in textList" :key="index">
{{
item
.
text
}}
</div>
<img
:src=
"detail.activityBigImg || detail.bigImage"
/>
</div>
</
template
>
<
template
v-else
>
<div
class=
"review-bg-img"
>
<div
class=
"review-bg-img"
>
<img
:src=
"detail.backgroundImage"
v-if=
"detail.backgroundImage"
/>
<img
:src=
"detail.backgroundImage"
v-if=
"detail.backgroundImage"
/>
</div>
</div>
...
@@ -98,11 +95,14 @@
...
@@ -98,11 +95,14 @@
</template>
</template>
<
script
>
<
script
>
import
PhoneViewA
from
'./PhoneViewA'
import
PhoneViewA
from
'./PhoneViewA'
import
draw
from
'@/mixins/draw'
export
default
{
export
default
{
mixins
:
[
draw
],
data
()
{
data
()
{
return
{
return
{
detail
:
{},
detail
:
{},
logoInfo
:
{},
logoInfo
:
{},
textList
:
[],
discount
:
{
discount
:
{
2
:
'折扣券'
,
2
:
'折扣券'
,
3
:
'代金券'
,
3
:
'代金券'
,
...
@@ -128,7 +128,32 @@ export default {
...
@@ -128,7 +128,32 @@ export default {
activityInfo
:
{
activityInfo
:
{
handler
(
val
)
{
handler
(
val
)
{
this
.
detail
=
val
this
.
detail
=
val
if
(
!
this
.
detail
.
logoInfo
)
return
const
title
=
this
.
cavansObj
[
this
.
detail
.
templateId
],
{
marketingTitle
,
marketingSubtitle
}
=
this
.
detail
,
textList
=
[]
console
.
log
(
this
.
detail
)
if
(
title
)
{
marketingTitle
.
split
(
' '
).
forEach
((
item
,
index
)
=>
{
textList
.
push
({
x
:
(
title
.
titleStyle
.
x
)
*
.
7
,
y
:
(
title
.
titleStyle
.
y
+
index
*
60
)
*
.
7
,
fontSize
:
title
.
titleStyle
.
fontSize
*
.
7
,
color
:
title
.
titleStyle
.
color
,
text
:
item
})
})
new
Array
(
marketingSubtitle
).
forEach
((
item
,
index
)
=>
{
textList
.
push
({
x
:
title
.
subTitleStyle
.
x
*
.
7
,
y
:
(
title
.
subTitleStyle
.
y
+
index
*
60
)
*
.
7
,
fontSize
:
title
.
subTitleStyle
.
fontSize
*
.
7
,
color
:
title
.
subTitleStyle
.
color
,
text
:
item
})
})
}
this
.
textList
=
textList
if
(
!
this
.
detail
.
logoInfo
)
return
const
{
x
,
y
,
height
,
width
}
=
this
.
detail
.
logoInfo
const
{
x
,
y
,
height
,
width
}
=
this
.
detail
.
logoInfo
this
.
logoInfo
=
{
this
.
logoInfo
=
{
x
:
(
x
*
262
)
/
375
,
x
:
(
x
*
262
)
/
375
,
...
@@ -149,6 +174,10 @@ export default {
...
@@ -149,6 +174,10 @@ export default {
width
:
288px
;
width
:
288px
;
height
:
645px
;
height
:
645px
;
position
:
relative
;
position
:
relative
;
#canvasId
{
display
:
none
;
transform
:
translate
(
-56px
,
-328px
)
scale
(
0.69
);
}
.review-phone
{
.review-phone
{
width
:
100%
;
width
:
100%
;
}
}
...
@@ -180,6 +209,10 @@ export default {
...
@@ -180,6 +209,10 @@ export default {
left
:
13px
;
left
:
13px
;
.review-main
{
.review-main
{
position
:
relative
;
position
:
relative
;
overflow
:
hidden
;
.main-title
{
position
:
absolute
;
}
.review-logo-img
{
.review-logo-img
{
position
:
absolute
;
position
:
absolute
;
width
:
50px
;
width
:
50px
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment