Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
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
和慭琛
take_order
Commits
dee29850
Commit
dee29850
authored
Apr 01, 2021
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拍照优化
parent
de223b82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
43 deletions
+54
-43
App.vue
take-order/App.vue
+3
-0
take.vue
take-order/pages/photo/take.vue
+51
-43
No files found.
take-order/App.vue
View file @
dee29850
...
@@ -101,6 +101,7 @@ export default {
...
@@ -101,6 +101,7 @@ export default {
settleRecommend
:
''
,
settleRecommend
:
''
,
navHeight
:
0
,
//导航栏高度
navHeight
:
0
,
//导航栏高度
rpxScreenHeight
:
0
,
// 照相视框高度
rpxScreenHeight
:
0
,
// 照相视框高度
safeHeight
:
0
,
// 安全高度
//拍照相关数据
//拍照相关数据
photo
:
{
photo
:
{
product
:
{
product
:
{
...
@@ -165,6 +166,8 @@ export default {
...
@@ -165,6 +166,8 @@ export default {
this
.
globalData
.
navHeight
=
a
.
statusBarHeight
/
a
.
screenWidth
*
750
+
90
this
.
globalData
.
navHeight
=
a
.
statusBarHeight
/
a
.
screenWidth
*
750
+
90
this
.
globalData
.
rpxScreenHeight
=
a
.
screenHeight
/
a
.
screenWidth
*
750
this
.
globalData
.
rpxScreenHeight
=
a
.
screenHeight
/
a
.
screenWidth
*
750
this
.
globalData
.
screenHeight
=
a
.
screenHeight
this
.
globalData
.
screenHeight
=
a
.
screenHeight
this
.
globalData
.
safeHeight
=
a
.
safeArea
.
bottom
console
.
log
(
a
,
'a'
)
}
catch
(
a
)
{
}
catch
(
a
)
{
}
}
},
},
...
...
take-order/pages/photo/take.vue
View file @
dee29850
<
template
>
<
template
>
<view
class=
"camera-container"
>
<view
class=
"camera-container"
>
<cover-view
class=
"header-box"
:style=
"
{'height':navHeight
+ 'r
px'}">
<cover-view
class=
"header-box"
:style=
"
{'height':navHeight
/2 + '
px'}">
<cover-view
class=
"inner"
>
<cover-view
class=
"inner"
>
<cover-image
@
click=
"setCameraInfo('devicePosition')"
class=
"icon"
mode=
"aspectFit"
<cover-image
@
click=
"setCameraInfo('devicePosition')"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-switch.png"
></cover-image>
src=
"/static/photo/icon-switch.png"
></cover-image>
...
@@ -11,9 +11,10 @@
...
@@ -11,9 +11,10 @@
</cover-view>
</cover-view>
</cover-view>
</cover-view>
<camera
class=
"camera-box"
v-if=
"cameraChange&&!standardShow"
:device-position=
"cameraInfo.devicePosition"
<camera
class=
"camera-box"
v-if=
"cameraChange&&!standardShow"
:device-position=
"cameraInfo.devicePosition"
:flash=
"cameraInfo.flash"
:style=
"
{'height':cameraHeight + 'rpx'}" @error="cameraError">
:flash=
"cameraInfo.flash"
:style=
"
{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}"
@error="cameraError">
<cover-view
class=
"mark-box"
>
<cover-view
class=
"mark-box"
>
<cover-view
class=
"txt big"
>
{{
titleTxt
}}
</cover-view>
<cover-view
class=
"txt big"
v-if=
"titleTxt"
>
{{
titleTxt
}}
</cover-view>
<cover-view
class=
"txt"
v-for=
"(txt,index) in settingTxtArr"
:key=
"index"
>
{{
txt
||
'获取中'
}}
</cover-view>
<cover-view
class=
"txt"
v-for=
"(txt,index) in settingTxtArr"
:key=
"index"
>
{{
txt
||
'获取中'
}}
</cover-view>
<!--
<cover-view
class=
"txt u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<!--
<cover-view
class=
"txt u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
...
@@ -58,7 +59,7 @@
...
@@ -58,7 +59,7 @@
'https://qn-static.banshouhui.com/live_mark.png'
'https://qn-static.banshouhui.com/live_mark.png'
],
],
},
},
standardShow
:
fals
e
,
standardShow
:
tru
e
,
cameraInfo
:
{
cameraInfo
:
{
devicePosition
:
'back'
,
devicePosition
:
'back'
,
flash
:
'auto'
flash
:
'auto'
...
@@ -83,9 +84,9 @@
...
@@ -83,9 +84,9 @@
cameraWidth
:
750
,
cameraWidth
:
750
,
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
ratio
:
0
,
ratio
:
0
,
cameraChange
:
tru
e
,
cameraChange
:
fals
e
,
waterSetting
:
null
,
waterSetting
:
null
,
shadowInitShow
:
true
,
// 第一次进入页面需显示弹窗
shadowInitShow
:
true
,
// 第一次进入页面需显示弹窗
}
}
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
...
@@ -96,19 +97,21 @@
...
@@ -96,19 +97,21 @@
this
.
updateTime
()
this
.
updateTime
()
this
.
getLocation
()
this
.
getLocation
()
this
.
getMarkPath
()
this
.
getMarkPath
()
this
.
initData
()
this
.
currentItem
=
photo
.
currentItem
this
.
currentItem
=
photo
.
currentItem
},
},
computed
:
{
computed
:
{
titleTxt
(){
titleTxt
()
{
const
waterSetting
=
this
.
waterSetting
const
waterSetting
=
this
.
waterSetting
let
txt
=
''
let
txt
=
''
if
(
!
waterSetting
||
!
waterSetting
.
lower_right
)
{
if
(
!
waterSetting
||
!
waterSetting
.
lower_right
)
{
return
''
return
''
}
}
txt
=
waterSetting
.
lower_right
&&
waterSetting
.
lower_right
.
title_text
||
''
txt
=
waterSetting
.
lower_right
&&
waterSetting
.
lower_right
.
title_text
||
''
return
txt
return
txt
},
},
settingTxtArr
(){
settingTxtArr
()
{
let
arr
=
[]
let
arr
=
[]
// 包含经纬度
// 包含经纬度
const
waterInfo
=
this
.
waterInfo
const
waterInfo
=
this
.
waterInfo
...
@@ -134,24 +137,16 @@
...
@@ -134,24 +137,16 @@
})
})
return
settingTxtArr
return
settingTxtArr
}
}
},
},
watch
:
{},
watch
:
{},
onShow
()
{
onShow
()
{
this
.
initData
()
// 默认开启弹窗
// this.standardShow = true
this
.
standardShow
=
this
.
shadowInitShow
// this.initData()
// this.cameraHeight = globalData.rpxScreenHeight
// uni.authorize({
// scope: 'scope.writePhotosAlbum',
// success() {
// console.log('userLocation')
// // uni.getLocation()
// }
// })
},
},
methods
:
{
methods
:
{
closeShadow
(){
closeShadow
()
{
this
.
shadowInitShow
=
false
this
.
shadowInitShow
=
false
this
.
standardShow
=
false
this
.
standardShow
=
false
},
},
...
@@ -195,13 +190,15 @@
...
@@ -195,13 +190,15 @@
},
},
initData
()
{
initData
()
{
const
globalData
=
getApp
().
globalData
const
globalData
=
getApp
().
globalData
// this.navHeight = parseInt(globalData.navHeight)
this
.
navHeight
=
globalData
.
navHeight
this
.
cameraHeight
=
parseInt
(
globalData
.
safeHeight
*
2
-
globalData
.
navHeight
-
200
)
;
console
.
log
(
globalData
.
safeHeight
,
'globalData.safeHeight'
)
console
.
log
(
this
.
cameraHeight
,
'this.cameraHeight'
)
console
.
log
(
globalData
.
navHeight
,
'globalData.navHeight'
)
console
.
log
(
globalData
.
navHeight
,
'globalData.navHeight'
)
this
.
ratio
=
globalData
.
screenHeight
/
globalData
.
rpxScreenHeight
this
.
ratio
=
globalData
.
screenHeight
/
globalData
.
rpxScreenHeight
console
.
log
(
globalData
.
screenHeight
,
globalData
.
rpxScreenHeight
,
this
.
ratio
)
this
.
cameraChange
=
true
this
.
waterSetting
=
globalData
.
photo
.
waterSetting
this
.
waterSetting
=
globalData
.
photo
.
waterSetting
if
(
this
.
shadowInitShow
){
this
.
standardShow
=
true
}
// this.cameraHeight = globalData.rpxScreenHeight
// this.cameraHeight = globalData.rpxScreenHeight
},
},
baiduLocation
()
{
baiduLocation
()
{
...
@@ -342,6 +339,8 @@
...
@@ -342,6 +339,8 @@
const
waterSetting
=
this
.
waterSetting
const
waterSetting
=
this
.
waterSetting
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
ratio
=
this
.
ratio
const
ratio
=
this
.
ratio
console
.
log
(
this
.
ratio
,
'this.ratio'
)
// const ratio = 0.5
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
const
waterInfo
=
this
.
waterInfo
const
waterInfo
=
this
.
waterInfo
...
@@ -356,7 +355,7 @@
...
@@ -356,7 +355,7 @@
let
h
=
1
let
h
=
1
//加入 水印文字
//加入 水印文字
for
(
let
i
=
settingTxtArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
settingTxtArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
txtHeight
=
20
txtHeight
=
20
canvas
.
setFontSize
(
16
)
canvas
.
setFontSize
(
16
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
...
@@ -371,21 +370,22 @@
...
@@ -371,21 +370,22 @@
// canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
// canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}
}
const
title
=
this
.
titleTxt
const
title
=
this
.
titleTxt
if
(
title
)
{
if
(
title
)
{
canvas
.
save
()
canvas
.
save
()
let
titleHeight
=
title
.
length
>
14
?
60
:
30
let
titleHeight
=
title
.
length
>
14
?
60
:
30
let
rectWidth
=
title
.
length
>
14
?
215
:
title
.
length
*
10
canvas
.
setFillStyle
(
'rgba(34, 114, 255, 0.6)'
)
canvas
.
setFillStyle
(
'rgba(34, 114, 255, 0.6)'
)
canvas
.
fillRect
(
10
,
canvasHeight
-
txtHeight
*
h
-
titleHeight
,
215
,
titleHeight
)
canvas
.
fillRect
(
10
,
canvasHeight
-
txtHeight
*
h
-
titleHeight
,
215
,
titleHeight
)
canvas
.
restore
()
canvas
.
restore
()
canvas
.
setFontSize
(
20
)
canvas
.
setFontSize
(
20
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
// canvas.setTextAlign('center')
// canvas.setTextAlign('center')
if
(
title
.
length
>
14
)
{
if
(
title
.
length
>
14
)
{
canvas
.
fillText
(
title
.
substr
(
14
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
+
20
);
canvas
.
fillText
(
title
.
substr
(
14
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
+
20
);
}
}
canvas
.
fillText
(
title
.
substr
(
0
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
-
titleHeight
/
2
+
10
);
canvas
.
fillText
(
title
.
substr
(
0
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
-
titleHeight
/
2
+
10
);
}
}
if
(
this
.
waterSetting
&&
this
.
waterSetting
.
mid_text
)
{
if
(
this
.
waterSetting
&&
this
.
waterSetting
.
mid_text
)
{
//加入 水印图片
//加入 水印图片
canvas
.
drawImage
(
this
.
tempImgs
.
markImage
,
canvasWidth
/
2
-
100
,
canvasHeight
/
2
-
25
,
200
,
50
)
canvas
.
drawImage
(
this
.
tempImgs
.
markImage
,
canvasWidth
/
2
-
100
,
canvasHeight
/
2
-
25
,
200
,
50
)
}
}
...
@@ -445,7 +445,7 @@
...
@@ -445,7 +445,7 @@
let
hour
=
(
d
.
getHours
()
<
10
)
?
(
"0"
+
d
.
getHours
())
:
d
.
getHours
();
let
hour
=
(
d
.
getHours
()
<
10
)
?
(
"0"
+
d
.
getHours
())
:
d
.
getHours
();
let
min
=
(
d
.
getMinutes
()
<
10
)
?
(
"0"
+
d
.
getMinutes
())
:
d
.
getMinutes
();
let
min
=
(
d
.
getMinutes
()
<
10
)
?
(
"0"
+
d
.
getMinutes
())
:
d
.
getMinutes
();
let
sec
=
(
d
.
getSeconds
()
<
10
)
?
(
"0"
+
d
.
getSeconds
())
:
d
.
getSeconds
();
let
sec
=
(
d
.
getSeconds
()
<
10
)
?
(
"0"
+
d
.
getSeconds
())
:
d
.
getSeconds
();
let
now
=
year
+
"年"
+
month
+
"月"
+
date
+
"日 "
+
hour
+
":"
+
min
+
":"
+
sec
;
let
now
=
year
+
"年"
+
month
+
"月"
+
date
+
"日 "
+
hour
+
":"
+
min
+
":"
+
sec
;
return
now
return
now
},
},
...
@@ -480,7 +480,8 @@
...
@@ -480,7 +480,8 @@
}
}
.camera-box
{
.camera-box
{
position
:
relative
;
position
:
absolute
;
left
:
0
;
width
:
100%
;
width
:
100%
;
// height: 100vh;
// height: 100vh;
z-index
:
1
;
z-index
:
1
;
...
@@ -503,15 +504,16 @@
...
@@ -503,15 +504,16 @@
padding
:
20rpx
;
padding
:
20rpx
;
.txt
{
.txt
{
margin-top
:
5rpx
;
margin-top
:
5rpx
;
line-height
:
40rpx
;
line-height
:
40rpx
;
white-space
:
normal
;
white-space
:
normal
;
font-size
:
28rpx
;
font-size
:
28rpx
;
color
:
#fff
;
color
:
#fff
;
&
.big
{
padding
:
10rpx
;
&
.big
{
padding
:
10rpx
;
margin-bottom
:
10rpx
;
margin-bottom
:
10rpx
;
width
:
430rpx
;
width
:
430rpx
;
line-height
:
40rpx
;
line-height
:
40rpx
;
font-size
:
32rpx
;
font-size
:
32rpx
;
background-color
:
rgba
(
34
,
114
,
255
,
0
.6
);
background-color
:
rgba
(
34
,
114
,
255
,
0
.6
);
...
@@ -523,9 +525,11 @@
...
@@ -523,9 +525,11 @@
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
z-index
:
5
;
z-index
:
5
;
height
:
160rpx
;
box-sizing
:
border-box
;
height
:
200rpx
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
padding
:
20rpx
78rpx
;
padding
:
20rpx
78rpx
;
...
@@ -559,6 +563,8 @@
...
@@ -559,6 +563,8 @@
.page-mask
{
.page-mask
{
position
:
fixed
;
position
:
fixed
;
bottom
:
0
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
z-index
:
1000
;
z-index
:
1000
;
width
:
750rpx
;
width
:
750rpx
;
height
:
100vh
;
height
:
100vh
;
...
@@ -574,6 +580,8 @@
...
@@ -574,6 +580,8 @@
.btn-close
{
.btn-close
{
position
:
absolute
;
position
:
absolute
;
bottom
:
0
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
height
:
200rpx
;
height
:
200rpx
;
...
...
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