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 66d415b2
authored
May 30, 2023
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
2c4a8414
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
39 deletions
src/mixins/draw.js
src/mixins/gpt.js
src/store/modules/marketing.js
src/utils/color.js
src/utils/drawing.js
src/views/home/components/Marketing/ChatGPT.vue
src/views/home/components/Marketing/GPTAnalysis.vue
src/mixins/draw.js
View file @
66d415b
...
@@ -59,7 +59,7 @@ export default {
...
@@ -59,7 +59,7 @@ export default {
new
Array
(
marketingSubtitle
).
forEach
((
item
,
index
)
=>
{
new
Array
(
marketingSubtitle
).
forEach
((
item
,
index
)
=>
{
textList
.
push
({
textList
.
push
({
x
:
title
.
subTitleStyle
.
x
,
x
:
title
.
subTitleStyle
.
x
,
y
:
title
.
subTitleStyle
.
y
+
title
.
titleStyle
.
fontSize
*
1.1
*
(
textList
.
length
-
1
),
y
:
title
.
subTitleStyle
.
y
+
title
.
titleStyle
.
fontSize
*
1.1
*
(
textList
.
length
-
1
),
fontSize
:
title
.
subTitleStyle
.
fontSize
,
fontSize
:
title
.
subTitleStyle
.
fontSize
,
color
:
title
.
subTitleStyle
.
color
,
color
:
title
.
subTitleStyle
.
color
,
text
:
item
text
:
item
...
...
src/mixins/gpt.js
View file @
66d415b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-19 13:46:20
* @Date: 2023-05-19 13:46:20
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-
23 10:14:30
* @LastEditTime: 2023-05-
30 16:21:24
* @FilePath: \scrm-micro-home\src\mixins\gpt.js
* @FilePath: \scrm-micro-home\src\mixins\gpt.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
*/
*/
...
@@ -18,9 +18,12 @@ export default {
...
@@ -18,9 +18,12 @@ export default {
...
mapState
(
'marketing'
,
[
'keywords'
,
'GPTList'
])
...
mapState
(
'marketing'
,
[
'keywords'
,
'GPTList'
])
},
},
watch
:
{
watch
:
{
keywords
()
{
GPTList
:
{
this
.
t1
=
0
handler
()
{
this
.
t2
=
0
this
.
t1
=
0
this
.
t2
=
0
},
deep
:
true
}
}
},
},
methods
:
{
methods
:
{
...
...
src/store/modules/marketing.js
View file @
66d415b
...
@@ -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-
26 16:19:48
* @LastEditTime: 2023-05-
30 16:58:01
* @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
*/
*/
...
@@ -94,6 +94,9 @@ export default {
...
@@ -94,6 +94,9 @@ export default {
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
)
setTimeout
(()
=>
{
commit
(
'SET_KET_WORDs'
,
''
)
},
1000
);
apis
.
activity
.
getChatGPTList
({
'req.userPrompt'
:
data
}).
then
(
res
=>
{
apis
.
activity
.
getChatGPTList
({
'req.userPrompt'
:
data
}).
then
(
res
=>
{
const
gptList
=
JSON
.
parse
(
res
.
message
)
const
gptList
=
JSON
.
parse
(
res
.
message
)
if
(
gptList
.
mainTitles
)
{
if
(
gptList
.
mainTitles
)
{
...
...
src/utils/color.js
View file @
66d415b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-22 20:12:55
* @Date: 2023-05-22 20:12:55
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-
25 11:36:45
* @LastEditTime: 2023-05-
30 16:17:39
* @FilePath: \scrm-micro-home\src\utils\color.js
* @FilePath: \scrm-micro-home\src\utils\color.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
*/
*/
...
@@ -38,24 +38,20 @@ function gethex(r, g, b) {
...
@@ -38,24 +38,20 @@ function gethex(r, g, b) {
return
hex
return
hex
}
}
function
uploadImg
(
img
,
callbackFn
)
{
async
function
uploadImg
(
url
,
callbackFn
)
{
var
reader
=
new
FileReader
()
var
image
=
new
Image
()
reader
.
readAsDataURL
(
img
)
image
.
src
=
url
image
.
setAttribute
(
'crossOrigin'
,
'Anonymous'
)
image
.
onload
=
function
()
{
img_width
=
this
.
width
img_height
=
this
.
height
// 设置画布尺寸
canvas
.
width
=
img_width
canvas
.
height
=
img_height
reader
.
onload
=
function
(
e
)
{
// 将图片按像素写入画布
var
image
=
new
Image
()
context
.
drawImage
(
this
,
0
,
0
,
img_width
,
img_height
)
image
.
src
=
e
.
target
.
result
callbackFn
(
getColor
())
image
.
onload
=
function
()
{
img_width
=
this
.
width
img_height
=
this
.
height
// 设置画布尺寸
canvas
.
width
=
img_width
canvas
.
height
=
img_height
// 将图片按像素写入画布
context
.
drawImage
(
this
,
0
,
0
,
img_width
,
img_height
)
callbackFn
(
getColor
())
}
}
}
}
}
export
default
uploadImg
export
default
uploadImg
src/utils/drawing.js
View file @
66d415b
...
@@ -2,22 +2,29 @@
...
@@ -2,22 +2,29 @@
* @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-30 1
5:02:01
* @LastEditTime: 2023-05-30 1
6:50:44
* @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
(
el
,
canvasParams
)
{
constructor
(
el
,
canvasParams
)
{
this
.
canvasId
=
el
this
.
canvasId
=
el
const
{
width
,
height
}
=
canvasParams
let
{
width
,
height
}
=
canvasParams
this
.
pixelRatio
=
2
this
.
ctx
=
this
.
canvasId
.
getContext
(
'2d'
)
width
=
this
.
toRpx
(
width
)
height
=
this
.
toRpx
(
height
)
this
.
canvasId
.
width
=
width
this
.
canvasId
.
width
=
width
this
.
canvasId
.
height
=
height
this
.
canvasId
.
height
=
height
this
.
ctx
=
this
.
canvasId
.
getContext
(
'2d'
)
}
}
async
drawImages
(
imageParams
,
callback
)
{
async
drawImages
(
imageParams
,
callback
)
{
this
.
ctx
.
beginPath
()
this
.
ctx
.
beginPath
()
this
.
ctx
.
save
()
this
.
ctx
.
save
()
let
{
height
,
width
,
url
,
x
,
y
}
=
imageParams
let
{
height
,
width
,
url
,
x
,
y
}
=
imageParams
height
=
this
.
toRpx
(
height
)
width
=
this
.
toRpx
(
width
)
x
=
this
.
toRpx
(
x
)
y
=
this
.
toRpx
(
y
)
let
image
=
this
.
createImage
()
let
image
=
this
.
createImage
()
image
.
src
=
url
image
.
src
=
url
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
...
@@ -32,9 +39,14 @@ class Drawing {
...
@@ -32,9 +39,14 @@ class Drawing {
}
}
})
})
}
}
toRpx
(
val
)
{
return
this
.
pixelRatio
*
val
}
drawText
(
textParams
)
{
drawText
(
textParams
)
{
const
{
fontSize
,
color
,
text
,
x
,
y
}
=
textParams
let
{
fontSize
,
color
,
text
,
x
,
y
}
=
textParams
console
.
log
(
x
,
y
)
fontSize
=
this
.
toRpx
(
fontSize
)
x
=
this
.
toRpx
(
x
)
y
=
this
.
toRpx
(
y
)
this
.
ctx
.
font
=
`
${
fontSize
}
px Calibri`
this
.
ctx
.
font
=
`
${
fontSize
}
px Calibri`
this
.
ctx
.
fillStyle
=
color
this
.
ctx
.
fillStyle
=
color
this
.
ctx
.
textAlign
=
'center'
this
.
ctx
.
textAlign
=
'center'
...
...
src/views/home/components/Marketing/ChatGPT.vue
View file @
66d415b
...
@@ -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-
26 18:26:10
* @LastEditTime: 2023-05-
30 17:00:21
* @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
-->
-->
...
@@ -86,7 +86,7 @@ export default {
...
@@ -86,7 +86,7 @@ export default {
}
}
},
},
computed
:
{
computed
:
{
...
mapState
(
'marketing'
,
[
'calendarDataAll'
,
'activityInfo'
])
...
mapState
(
'marketing'
,
[
'calendarDataAll'
,
'activityInfo'
,
'keywords'
])
},
},
watch
:
{
watch
:
{
chatItem
()
{
chatItem
()
{
...
@@ -97,7 +97,8 @@ export default {
...
@@ -97,7 +97,8 @@ export default {
})
})
},
},
activityInfo
(
val
)
{
activityInfo
(
val
)
{
if
(
val
.
id
)
this
.
chatItem
=
[]
this
.
chatItem
=
[]
}
}
},
},
methods
:
{
methods
:
{
...
...
src/views/home/components/Marketing/GPTAnalysis.vue
View file @
66d415b
...
@@ -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-30 1
5:28:53
* @LastEditTime: 2023-05-30 1
6:23:42
* @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
-->
-->
...
@@ -199,7 +199,7 @@ import getUploadImgColor from '@/utils/color'
...
@@ -199,7 +199,7 @@ 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'
import
draw
from
'@/mixins/draw'
import
util
from
'@/utils/util'
import
util
from
'@/utils/util'
export
default
{
export
default
{
mixins
:
[
gpt
,
draw
],
mixins
:
[
gpt
,
draw
],
name
:
'analysis'
,
name
:
'analysis'
,
...
@@ -290,9 +290,6 @@ export default {
...
@@ -290,9 +290,6 @@ export default {
maxPhotoNum
:
1
,
maxPhotoNum
:
1
,
suffixSlot
:
'detailImage'
,
suffixSlot
:
'detailImage'
,
handleUpload
:
(
e
,
file
,
targetItem
)
=>
{
handleUpload
:
(
e
,
file
,
targetItem
)
=>
{
getUploadImgColor
(
file
,
color
=>
{
this
.
editForm
.
mainColor
=
color
})
const
imgFile
=
e
.
target
.
result
const
imgFile
=
e
.
target
.
result
const
base64
=
file
.
name
.
split
(
'.'
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
const
base64
=
file
.
name
.
split
(
'.'
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
this
.
loading
=
true
this
.
loading
=
true
...
@@ -413,7 +410,7 @@ export default {
...
@@ -413,7 +410,7 @@ export default {
},
},
componentsName
:
'analysis'
,
componentsName
:
'analysis'
,
computed
:
{
computed
:
{
...
mapState
(
'marketing'
,
[
'activityInfo'
,
'GPTList'
,
'merchantInfo'
]),
...
mapState
(
'marketing'
,
[
'activityInfo'
,
'GPTList'
,
'merchantInfo'
,
'keywords'
]),
mergeStr
()
{
mergeStr
()
{
const
{
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
}
=
this
.
editForm
const
{
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
}
=
this
.
editForm
return
[
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
]
return
[
backgroundImage
,
detailImage
,
merchantLog
,
mainColor
,
logoInfo
,
marketingTitle
,
marketingSubtitle
,
templateId
]
...
@@ -430,6 +427,11 @@ export default {
...
@@ -430,6 +427,11 @@ export default {
'editForm.activityPrice'
(
newValue
,
oldValue
)
{
'editForm.activityPrice'
(
newValue
,
oldValue
)
{
this
.
editForm
.
activityPrice
=
util
.
limitPrice
(
newValue
,
oldValue
,
6
,
2
,
0
)
this
.
editForm
.
activityPrice
=
util
.
limitPrice
(
newValue
,
oldValue
,
6
,
2
,
0
)
},
},
'editForm.detailImage'
(
newValue
,
oldValue
)
{
getUploadImgColor
(
newValue
,
color
=>
{
this
.
editForm
.
mainColor
=
color
})
}
},
},
components
:
{
components
:
{
selectGiftDialog
,
selectGiftDialog
,
...
@@ -719,7 +721,7 @@ export default {
...
@@ -719,7 +721,7 @@ export default {
// isGetList =true 创建成功初始化
// isGetList =true 创建成功初始化
init
(
isGetList
=
true
)
{
init
(
isGetList
=
true
)
{
isGetList
&&
this
.
setSchemeListData
({
merchantId
:
this
.
editForm
.
merchantId
,
pageSize
:
5
,
currentPage
:
1
})
isGetList
&&
this
.
setSchemeListData
({
merchantId
:
this
.
editForm
.
merchantId
,
pageSize
:
5
,
currentPage
:
1
})
this
.
editForm
=
{
mainColor
:
''
,
marketingTitle
:
''
,
bigImage
:
''
,
marketingSubtitle
:
''
,
activityTime
:
[],
superMarketingCouponRelRequestList
:
[],
backgroundImage
:
''
,
detailImage
:
''
,
merchantLog
:
''
,
merchantname
:
this
.
merchantInfo
.
merchantName
,
merchantAddress
:
this
.
merchantInfo
.
merchantAddress
,
merchantId
:
this
.
merchantInfo
.
merchantNo
}
this
.
editForm
=
{
mainColor
:
''
,
activityPrice
:
''
,
marketingTitle
:
''
,
bigImage
:
''
,
marketingSubtitle
:
''
,
activityTime
:
[],
superMarketingCouponRelRequestList
:
[],
backgroundImage
:
''
,
detailImage
:
''
,
merchantLog
:
''
,
merchantname
:
this
.
merchantInfo
.
merchantName
,
merchantAddress
:
this
.
merchantInfo
.
merchantAddress
,
merchantId
:
this
.
merchantInfo
.
merchantNo
}
this
.
selectedGoodsList
=
[]
this
.
selectedGoodsList
=
[]
this
.
selectedEquityList
=
[]
this
.
selectedEquityList
=
[]
this
.
exportUrl
=
''
this
.
exportUrl
=
''
...
...
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