Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-outbound
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 d8a02087
authored
Jul 13, 2023
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
c808cf13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletions
src/utils/color.js
src/views/calendar/add.vue
src/utils/color.js
0 → 100644
View file @
d8a0208
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-22 20:12:55
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-06 13:41:22
* @FilePath: \scrm-micro-home\src\utils\color.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
var
img_width
=
0
,
img_height
=
0
var
canvas
=
document
.
createElement
(
'canvas'
)
var
context
=
canvas
.
getContext
(
'2d'
)
var
myColor
=
[]
function
getColor
()
{
var
imageData
=
context
.
getImageData
(
img_width
-
10
,
img_height
-
10
,
img_width
,
img_height
)
myColor
=
[
imageData
.
data
[
0
],
imageData
.
data
[
1
],
imageData
.
data
[
2
]]
var
hexColor
=
gethex
(...
myColor
)
return
`#
${
hexColor
}
`
}
// 获取16进制颜色
function
gethex
(
r
,
g
,
b
)
{
console
.
log
(
r
,
g
,
b
)
r
=
r
.
toString
(
16
)
g
=
g
.
toString
(
16
)
b
=
b
.
toString
(
16
)
// 补0
r
.
length
==
1
?
(
r
=
'0'
+
r
)
:
''
g
.
length
==
1
?
(
g
=
'0'
+
g
)
:
''
b
.
length
==
1
?
(
b
=
'0'
+
b
)
:
''
var
hex
=
r
+
g
+
b
// 简化处理,如 FFEEDD 可以写为 FED
if
(
r
.
slice
(
0
,
1
)
==
r
.
slice
(
1
,
1
)
&&
g
.
slice
(
0
,
1
)
==
g
.
slice
(
1
,
1
)
&&
b
.
slice
(
0
,
1
)
==
b
.
slice
(
1
,
1
))
{
hex
=
r
.
slice
(
0
,
1
)
+
g
.
slice
(
0
,
1
)
+
b
.
slice
(
0
,
1
)
}
return
hex
}
async
function
uploadImg
(
url
,
callbackFn
)
{
var
image
=
new
Image
()
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
// 将图片按像素写入画布
context
.
drawImage
(
this
,
0
,
0
,
img_width
,
img_height
)
callbackFn
(
getColor
())
}
}
export
default
uploadImg
src/views/calendar/add.vue
View file @
d8a0208
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-10 17:17:31
* @Date: 2023-05-10 17:17:31
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-
06 17:38:54
* @LastEditTime: 2023-07-
13 16:33:10
* @FilePath: \outbound\src\views\calendar\add.vue
* @FilePath: \outbound\src\views\calendar\add.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
-->
-->
...
@@ -66,6 +66,7 @@
...
@@ -66,6 +66,7 @@
<
script
>
<
script
>
import
selectGoodsDialog
from
'./components/SelectGoodsDialog'
import
selectGoodsDialog
from
'./components/SelectGoodsDialog'
import
PhoneView
from
'./components/PhoneView'
import
PhoneView
from
'./components/PhoneView'
import
getUploadImgColor
from
'@/utils/color'
export
default
{
export
default
{
name
:
'addCalendar'
,
name
:
'addCalendar'
,
data
()
{
data
()
{
...
@@ -176,6 +177,9 @@ export default {
...
@@ -176,6 +177,9 @@ export default {
if
(
res
.
startTime
)
{
if
(
res
.
startTime
)
{
this
.
$set
(
this
.
editForm
,
'activityTime'
,
[
res
.
startTime
,
res
.
endTime
])
this
.
$set
(
this
.
editForm
,
'activityTime'
,
[
res
.
startTime
,
res
.
endTime
])
}
}
getUploadImgColor
(
res
.
backgroundImg
,
color
=>
{
this
.
editForm
.
mainColor
=
color
})
this
.
selectedGoodsList
=
this
.
editForm
.
couponItemList
||
[]
this
.
selectedGoodsList
=
this
.
editForm
.
couponItemList
||
[]
this
.
selectedGoodsList
.
forEach
(
item
=>
{
this
.
selectedGoodsList
.
forEach
(
item
=>
{
item
.
id
=
item
.
couponId
item
.
id
=
item
.
couponId
...
...
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