Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
df64aa0b
Commit
df64aa0b
authored
Nov 29, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/luochao/confucius
parents
13f7e083
dbdf4dbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
21 deletions
+50
-21
course-form.vue
src/components/course/course-form.vue
+50
-21
No files found.
src/components/course/course-form.vue
View file @
df64aa0b
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
</div>
</div>
<div
class=
"col-6 q-pb-lg q-pr-lg"
>
<div
class=
"col-6 q-pb-lg q-pr-lg"
>
<q-uploader
:style=
"{ backgroundImage: 'url(' + objOption.B2BIcon + ')' }"
<q-uploader
:style=
"{ backgroundImage: 'url(' + objOption.B2BIcon + ')' }"
style=
"width: auto;
height: 139px
"
flat
hide-upload-btn
max-files=
"1"
label=
"图标"
accept=
".jpg, image/*"
style=
"width: auto; "
flat
hide-upload-btn
max-files=
"1"
label=
"图标"
accept=
".jpg, image/*"
:factory=
"uploadFile2"
auto-upload
>
:factory=
"uploadFile2"
auto-upload
>
</q-uploader>
</q-uploader>
<q-input
<q-input
...
@@ -356,20 +356,46 @@
...
@@ -356,20 +356,46 @@
let
domImg
=
document
.
querySelector
(
'#background'
);
let
domImg
=
document
.
querySelector
(
'#background'
);
let
colorthief
=
new
ColorThief
();
let
colorthief
=
new
ColorThief
();
domImg
.
addEventListener
(
'load'
,
()
=>
{
domImg
.
addEventListener
(
'load'
,
()
=>
{
// console.log('加载好了并取色', colorthief.getPalette(domImg));//第二个参数可选(1~10)
// console.log('加载好了并取色', colorthief.getPalette(domImg
,2
));//第二个参数可选(1~10)
// console.log('加载好了并取色', colorthief.getColor(domImg));//第二个参数可选(1~10)
// console.log('加载好了并取色', colorthief.getColor(domImg));//第二个参数可选(1~10)
let
color
=
colorthief
.
getColor
(
domImg
)
let
color
=
colorthief
.
getColor
(
domImg
,
2
)
this
.
objOption
.
B2BBackground
=
this
.
rgb2Hex
(
color
[
0
],
color
[
1
],
color
[
2
])
this
.
objOption
.
B2BBackground
=
this
.
rgb2Hex
(
`RGB(
${
color
[
0
]}
,
${
color
[
1
]}
,
${
color
[
2
]}
)`
)
console
.
log
(
this
.
objOption
.
B2BBackground
)
})
})
},
},
rgb2Hex
(
r
,
g
,
b
){
//rhg转化为16进制
rgb2Hex
(
string
){
//rgb转化为16进制
r
=
Math
.
max
(
Math
.
min
(
Number
(
r
),
100
),
0
)
*
2.55
console
.
log
(
string
)
g
=
Math
.
max
(
Math
.
min
(
Number
(
g
),
100
),
0
)
*
2.55
var
reg
=
/^#
([
0-9a-fA-f
]{3}
|
[
0-9a-fA-f
]{6})
$/
;
b
=
Math
.
max
(
Math
.
min
(
Number
(
b
),
100
),
0
)
*
2.55
if
(
/^
(
rgb|RGB
)
/
.
test
(
string
)){
r
=
(
'0'
+
(
Math
.
round
(
r
)
||
0
).
toString
(
16
)).
slice
(
-
2
)
var
aColor
=
string
.
replace
(
/
(?:\(
|
\)
|rgb|RGB
)
*/g
,
""
).
split
(
","
);
g
=
(
'0'
+
(
Math
.
round
(
g
)
||
0
).
toString
(
16
)).
slice
(
-
2
)
var
strHex
=
"#"
;
b
=
(
'0'
+
(
Math
.
round
(
b
)
||
0
).
toString
(
16
)).
slice
(
-
2
)
for
(
var
i
=
0
;
i
<
aColor
.
length
;
i
++
){
return
'#'
+
r
+
g
+
b
var
hex
=
Number
(
aColor
[
i
]).
toString
(
16
);
if
(
hex
===
"0"
){
hex
+=
hex
;
}
strHex
+=
hex
;
}
if
(
strHex
.
length
!==
7
){
strHex
=
string
;
}
return
strHex
;
}
else
if
(
reg
.
test
(
string
)){
var
aNum
=
string
.
replace
(
/#/
,
""
).
split
(
""
);
if
(
aNum
.
length
===
6
){
return
string
;
}
else
if
(
aNum
.
length
===
3
){
var
numHex
=
"#"
;
for
(
var
i
=
0
;
i
<
aNum
.
length
;
i
+=
1
){
numHex
+=
(
aNum
[
i
]
+
aNum
[
i
]);
}
return
numHex
;
}
}
else
{
return
string
;
}
},
},
...
@@ -431,15 +457,18 @@
...
@@ -431,15 +457,18 @@
this
.
objOption
.
CourseSubject
=
res
.
Data
.
CourseSubject
;
this
.
objOption
.
CourseSubject
=
res
.
Data
.
CourseSubject
;
this
.
objOption
.
B2BIcon
=
res
.
Data
.
B2BIcon
;
this
.
objOption
.
B2BIcon
=
res
.
Data
.
B2BIcon
;
this
.
objOption
.
B2BBackground
=
res
.
Data
.
B2BBackground
;
this
.
objOption
.
B2BBackground
=
res
.
Data
.
B2BBackground
;
this
.
objOption
.
CourseEmphasis
=
res
.
Data
.
CourseEmphasis
;
this
.
CourseEmphasis
=
[]
if
(
this
.
objOption
.
CourseEmphasis
&&
this
.
objOption
.
CourseEmphasis
!=
''
){
setTimeout
(()
=>
{
//Todo 暂时不知道什么原因 偶尔会出现2个 所以加了一个延迟
this
.
CourseEmphasis
=
this
.
objOption
.
CourseEmphasis
.
split
(
","
)
if
(
res
.
Data
.
CourseEmphasis
&&
res
.
Data
.
CourseEmphasis
!=
''
){
}
else
{
this
.
CourseEmphasis
=
res
.
Data
.
CourseEmphasis
.
split
(
","
).
map
(
Number
)
this
.
CourseEmphasis
=
[]
this
.
keynoteList
.
map
((
x
)
=>
{
}
else
{
this
.
CourseEmphasis
.
push
(
x
.
Id
)
this
.
keynoteList
.
map
((
x
)
=>
{
})
this
.
CourseEmphasis
.
push
(
x
.
Id
)
}
})
}
},
100
)
if
(
res
.
Data
.
StepPriceList
&&
res
.
Data
.
StepPriceList
.
length
>
0
)
{
if
(
res
.
Data
.
StepPriceList
&&
res
.
Data
.
StepPriceList
.
length
>
0
)
{
this
.
ladderPriceList
=
res
.
Data
.
StepPriceList
;
this
.
ladderPriceList
=
res
.
Data
.
StepPriceList
;
}
}
...
...
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