Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e4d87c18
authored
Apr 09, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
b394797c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
202 additions
and
54 deletions
components/Canvas/wn-canvas.vue
pages/detail/components/Media_1.vue
pages/detail/components/Media_2.vue
pages/detail/components/Tabs.vue
pages/detail/detail.vue
components/Canvas/wn-canvas.vue
View file @
e4d87c1
<
template
>
<view
class=
"content"
>
<template
v-if=
"false"
>
<template
v-if=
"showPenBox"
>
<view
class=
"pen-box"
>
<view
class=
"pen"
:style=
"
{backgroundColor: currentColor, height: lineWidth+'px'}"
>
</view>
<slider
min=
"1"
max=
"20"
:value=
"lineWidth"
block-size=
"20"
activeColor=
"#84f876"
class=
"pen-slider"
@
change=
"penWidthChange"
/>
<view
class=
"pen-txt"
>
{{
lineWidth
}}
px
</view>
</view>
</
template
>
<template
v-if=
"showPenBox"
>
<view
class=
"pen-box"
>
<view
class=
"pen"
:style=
"
{backgroundColor: currentColor, height: lineWidth+'px'}"
>
</view>
<slider
min=
"1"
max=
"20"
:value=
"lineWidth"
block-size=
"20"
activeColor=
"#84f876"
class=
"pen-slider"
@
change=
"penWidthChange"
/>
<view
class=
"pen-txt"
>
{{
lineWidth
}}
px
</view>
</view>
</
template
>
<image
v-if=
"isLandScape"
src=
"./img/color.png"
...
...
@@ -64,7 +64,7 @@
>
<canvas
class=
"board-canvas"
canvas-id=
"drawCanvas
"
:canvas-id=
"canvasId
"
disable-scroll=
"true"
@
touchstart=
"touchStart"
@
touchmove=
"touchMove"
...
...
@@ -194,7 +194,7 @@ export default {
toolsShow
:
true
,
isLandScape
:
false
,
//是否横屏
aspectRatio
:
1
,
//图片宽高比
showPenBox
:
false
showPenBox
:
false
};
},
...
...
@@ -215,10 +215,14 @@ export default {
type
:
Boolean
,
default
:
false
},
drawStatus
:
Boolean
drawStatus
:
Boolean
,
canvasId
:
{
type
:
String
,
default
:
'drawCanvas'
}
},
mounted
(
opt
)
{
this
.
drawContext
=
uni
.
createCanvasContext
(
'drawCanvas'
,
this
);
this
.
drawContext
=
uni
.
createCanvasContext
(
this
.
canvasId
,
this
);
this
.
initBoard
();
},
methods
:
{
...
...
@@ -248,9 +252,9 @@ export default {
this
.
colorShowHandel
()
}
if
(
item
.
key
==
'line'
)
{
this
.
showPenBox
=
!
this
.
showPenBox
}
if
(
item
.
key
==
'line'
)
{
this
.
showPenBox
=
!
this
.
showPenBox
}
if
(
item
.
key
==
"download"
)
{
//下载
this
.
downloadHandle
()
...
...
@@ -695,7 +699,7 @@ export default {
}
if
(
this
.
saveImageType
==
2
||
this
.
saveImageType
==
3
)
{
uni
.
canvasToTempFilePath
({
canvasId
:
'drawCanvas'
,
canvasId
:
this
.
canvasId
,
success
:
function
(
res
)
{
console
.
log
(
'回调参数:'
+
JSON
.
stringify
(
res
));
// 在H5平台下,tempFilePath 为 base64
...
...
@@ -721,7 +725,7 @@ export default {
that
.
saveImageUrl
()
}
else
{
uni
.
canvasToTempFilePath
({
canvasId
:
'drawCanvas'
,
canvasId
:
this
.
canvasId
,
success
:
function
(
res
)
{
console
.
log
(
res
);
that
.
$emit
(
"saveImage"
,
res
.
tempFilePath
)
...
...
@@ -741,7 +745,7 @@ export default {
this
.
drawContext
.
draw
();
this
.
drawHistory
()
uni
.
canvasToTempFilePath
({
canvasId
:
'drawCanvas'
,
canvasId
:
this
.
canvasId
,
success
:
function
(
res
)
{
that
.
$emit
(
"saveImage"
,
res
.
tempFilePath
)
}
...
...
@@ -812,7 +816,7 @@ export default {
this
.
drawContext
.
setLineWidth
(
this
.
lineWidth
);
//设置画笔粗细
//设置背景
this
.
$nextTick
(()
=>
{
this
.
penWidthChange
()
this
.
penWidthChange
()
this
.
fillBackground
();
})
}
...
...
@@ -838,16 +842,16 @@ export default {
}
.pen-box
{
position
:
absolute
;
top
:
0
;
left
:
0
;
background-color
:
#fff
;
position
:
absolute
;
top
:
0
;
left
:
0
;
background-color
:
#fff
;
display
:
flex
;
justify-content
:
space-around
;
align-items
:
center
;
height
:
3rem
;
z-index
:
2
;
width
:
100%
;
z-index
:
2
;
width
:
100%
;
.pen
{
width
:
3rem
;
border-radius
:
0.2rem
;
...
...
pages/detail/components/Media_1.vue
View file @
e4d87c1
...
...
@@ -20,7 +20,13 @@
/>
</
template
>
<
template
>
<view
class=
"select"
>
<uni-icons
class=
"arrow"
type=
"down"
:size=
"16"
></uni-icons>
</view>
</
template
>
</view>
</view>
...
...
@@ -35,6 +41,7 @@
saveImageType=
"3"
:drawImage=
"i.detailUrl"
:isUnderBkg=
"true"
:canvasId=
"`c-1-$
{index}`"
drawStatus
>
</wnCanvas>
</view>
...
...
@@ -44,9 +51,7 @@
</template>
<
script
type=
'text/ecmascript-6'
>
import
Tabs
from
'./Tabs.vue'
export
default
{
components
:
{
Tabs
},
props
:
{
views
:
Array
},
...
...
@@ -84,9 +89,7 @@ export default {
mounted
()
{
},
methods
:
{
changeView
(
index
)
{
},
}
}
</
script
>
...
...
@@ -100,8 +103,7 @@ export default {
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
864
rpx
;
background-color
:
#096
;
height
:
432
rpx
;
}
.content
{
border-radius
:
40
rpx
40
rpx
0
0
;
...
...
@@ -116,15 +118,43 @@ export default {
padding
:
32
rpx
0
;
text-align
:
center
;
}
.form
{
.form
{
display
:
flex
;
flex-wrap
:
wrap
;
gap
:
28
rpx
0
;
&-item{
&-item
{
flex
:
50%
;
display
:
flex
;
align-items
:
center
;
.value{
}
color
:
#292d33
;
font-size
:
32
rpx
;
box-sizing
:
border-box
;
padding-right
:
64
rpx
;
.label
{
margin-left
:
auto
;
flex-shrink
:
0
;
}
.value
{
width
:
828
rpx
;
height
:
80
rpx
;
border
:
2
rpx
solid
#e8e8ea
;
background
:
#ffffff
;
margin-left
:
32
rpx
;
box-sizing
:
border-box
;
padding
:
0
40
rpx
;
input,
.select
{
width
:
100%
;
height
:
100%
;
}
.select
{
display
:
flex
;
align-items
:
center
;
.arrow{
margin-left
:
auto
;
}
}
}
}
}
}
...
...
pages/detail/components/Media_2.vue
0 → 100644
View file @
e4d87c1
<
template
>
<view
class=
"layout"
>
<view
class=
"bg"
>
<glsx-image
src=
"media/bg-2.png"
/>
</view>
<view
class=
"content"
>
<view
class=
"title"
>
问界·商城延保价格明细
</view>
<tabs
:list=
"views"
/>
<view
class=
"canvas-box"
>
<template
v-for=
"(i,index) in views"
>
<view
class=
"canvas-view"
:key=
"index"
>
<wnCanvas
saveImageType=
"3"
:drawImage=
"i.detailUrl"
:isUnderBkg=
"true"
drawStatus
:canvasId=
"`c-2-$
{index}`"
>
</wnCanvas>
</view>
</
template
>
</view>
</view>
</view>
</template>
<
script
type=
'text/ecmascript-6'
>
import
Tabs
from
'./Tabs.vue'
export
default
{
components
:
{
Tabs
},
props
:
{
views
:
Array
},
name
:
'Media_2'
,
data
()
{
return
{
viewIndex
:
0
}
},
mounted
()
{
},
methods
:
{
changeView
(
index
)
{
this
.
viewIndex
=
index
},
}
}
</
script
>
<
style
scoped
lang=
'scss'
>
.layout
{
padding-top
:
272
rpx
;
position
:
relative
;
.bg
{
position
:
absolute
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
432
rpx
;
}
.content
{
border-radius
:
40
rpx
40
rpx
0
0
;
background
:
linear-gradient
(
180deg
,
#f7f9fc
0%
,
#f7f9fc
100%
);
overflow
:
hidden
;
position
:
relative
;
z-index
:
1
;
.title
{
font-weight
:
500
;
font-size
:
48
rpx
;
color
:
#1a1a1a
;
padding
:
32
rpx
0
;
text-align
:
center
;
}
.canvas-box
{
display
:
flex
;
}
.canvas-view
{
}
}
}
</
style
>
\ No newline at end of file
pages/detail/components/Tabs.vue
View file @
e4d87c1
...
...
@@ -6,7 +6,7 @@
:key="index"
@click="tabClick(index)"
>
{{
item
}}
{{
item
.
tabName
}}
</view>
</
template
>
</view>
...
...
@@ -27,6 +27,7 @@ export default {
},
methods
:
{
tabClick
(
index
)
{
this
.
tabIndex
=
index
this
.
$emit
(
'tabclick'
,
index
)
}
}
...
...
pages/detail/detail.vue
View file @
e4d87c1
...
...
@@ -8,7 +8,14 @@
<
template
>
<view
class=
"detail-box"
>
<view
class=
"nav-bar"
>
<view
class=
"back"
@
click=
"back"
>
<view
class=
"back"
@
click=
"back"
>
<uni-icons
type=
"left"
:size=
"32"
></uni-icons>
</view>
</view>
<tool-box
...
...
@@ -16,7 +23,12 @@
@
choose=
"choose"
@
finish=
"open"
/>
<media
_1
:views=
"mediaList"
/>
<view
:class=
"['view',
{showView:id == 1}]">
<media
_1
:views=
"mediaList"
/>
</view>
<view
:class=
"['view',
{showView:id == 2}]">
<media
_2
:views=
"mediaList"
/>
</view>
<pay-pop
ref=
"pay"
></pay-pop>
</view>
</
template
>
...
...
@@ -25,8 +37,9 @@ import payPop from './components/payPop.vue';
import
ToolBox
from
'./components/ToolBox.vue'
import
myClick
from
"@/mixin/click"
;
import
Media_1
from
'./components/Media_1.vue'
import
Media_2
from
'./components/Media_2.vue'
export
default
{
components
:
{
ToolBox
,
payPop
,
Media_1
},
components
:
{
ToolBox
,
payPop
,
Media_1
,
Media_2
},
mixins
:
[
myClick
],
data
()
{
return
{
...
...
@@ -55,21 +68,24 @@ export default {
}
},
back
()
{
back
()
{
uni
.
navigateBack
()
}
},
};
</
script
>
<
style
scoped
lang=
"scss"
>
.nav-bar
{
.detail-box
{
position
:
relative
;
}
.nav-bar
{
position
:
fixed
;
width
:
100%
;
height
:
96
rpx
;
left
:
0
;
top
:
48
rpx
;
z-index
:
2
;
.back{
z-index
:
9
;
.back
{
height
:
100%
;
aspect-ratio
:
1
/
1
;
display
:
flex
;
...
...
@@ -77,4 +93,17 @@ export default {
justify-content
:
center
;
}
}
.view
{
position
:
absolute
;
z-index
:
-1
;
opacity
:
0
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
}
.showView
{
z-index
:
2
;
opacity
:
1
;
}
</
style
>
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