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
af0189e5
Commit
af0189e5
authored
Dec 24, 2020
by
和慭琛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定位功能添加
parent
51a08d00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
7 deletions
+73
-7
pages.json
take-order/pages.json
+8
-5
try.vue
take-order/pages/photo/try.vue
+65
-2
No files found.
take-order/pages.json
View file @
af0189e5
...
@@ -6,21 +6,24 @@
...
@@ -6,21 +6,24 @@
*/
*/
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
{
{
"path"
:
"pages/
index/index
"
,
"path"
:
"pages/
photo/try
"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"
下单
"
"navigationBarTitleText"
:
"
拍照
"
}
}
},
},
{
{
"path"
:
"pages/
photo/try
"
,
"path"
:
"pages/
index/index
"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"
拍照
"
"navigationBarTitleText"
:
"
下单
"
}
}
},
},
{
{
"path"
:
"pages/photo/preview"
,
"path"
:
"pages/photo/preview"
,
"style"
:
{
"style"
:
{
...
...
take-order/pages/photo/try.vue
View file @
af0189e5
...
@@ -14,6 +14,12 @@
...
@@ -14,6 +14,12 @@
<cover-image
class=
'takeIcon'
:src=
'icon_take'
@
click=
"takePhoto()"
>
</cover-image>
<cover-image
class=
'takeIcon'
:src=
'icon_take'
@
click=
"takePhoto()"
>
</cover-image>
<cover-image
class=
'flashIcon'
:src=
'icon_light_on_white'
@
click=
"flashClick()"
>
</cover-image>
<cover-image
class=
'flashIcon'
:src=
'icon_light_on_white'
@
click=
"flashClick()"
>
</cover-image>
</cover-view>
</cover-view>
<cover-view
class=
"locationView"
>
<text
class=
"locationText u-m-l-20 u-m-t-30"
>
{{
longitude
}}
</text>
<text
class=
"locationText u-m-l-20 u-m-t-10"
>
{{
latitude
}}
</text>
<text
class=
"locationText u-m-l-20 u-m-t-10"
>
{{
address
}}
</text>
<text
class=
"locationText u-m-l-20 u-m-t-10"
>
{{
date
}}
</text>
</cover-view>
<canvas
v-show=
'showImage'
canvas-id=
"canvas"
style=
'width:1000px; height:1500px;'
></canvas>
<canvas
v-show=
'showImage'
canvas-id=
"canvas"
style=
'width:1000px; height:1500px;'
></canvas>
...
@@ -33,6 +39,10 @@
...
@@ -33,6 +39,10 @@
image
:
""
,
image
:
""
,
showImage
:
false
,
showImage
:
false
,
canvas
:
null
,
canvas
:
null
,
longitude
:
'经度:正在获取中...'
,
latitude
:
'纬度:正在获取中...'
,
address
:
'地址:正在获取中...'
,
date
:
'时间:正在获取中...'
,
icon_location
:
'https://qn-static.banshouhui.com/take_order/icon/location.png'
,
icon_location
:
'https://qn-static.banshouhui.com/take_order/icon/location.png'
,
scale
:
"4_3"
,
scale
:
"4_3"
,
icon_take
:
'https://qn-static.banshouhui.com/take.png'
,
icon_take
:
'https://qn-static.banshouhui.com/take.png'
,
...
@@ -43,7 +53,9 @@
...
@@ -43,7 +53,9 @@
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
this
.
ctx
=
uni
.
createCameraContext
();
this
.
ctx
=
uni
.
createCameraContext
();
this
.
date
=
'时间:'
+
this
.
getTime
()
this
.
getLocation
()
//this.address = ''
},
},
methods
:
{
methods
:
{
...
@@ -52,6 +64,21 @@
...
@@ -52,6 +64,21 @@
},
},
//获取位置
getLocation
(){
let
that
=
this
uni
.
getLocation
({
type
:
'wgs84'
,
success
:
function
(
res
)
{
that
.
longitude
=
'经度:'
+
res
.
longitude
that
.
latitude
=
'纬度:'
+
res
.
latitude
console
.
log
(
'当前位置的经度:'
+
res
.
longitude
);
console
.
log
(
'当前位置的纬度:'
+
res
.
latitude
);
console
.
log
(
'当前位置的地址:'
+
res
.
address
);
}
});
},
//拍照
//拍照
takePhoto
(){
takePhoto
(){
this
.
ctx
.
takePhoto
({
this
.
ctx
.
takePhoto
({
...
@@ -167,7 +194,24 @@
...
@@ -167,7 +194,24 @@
},
1000
);
},
1000
);
}
}
})
})
}
},
//获取当前时间
getTime
:
function
(){
var
date
=
new
Date
(),
year
=
date
.
getFullYear
(),
month
=
date
.
getMonth
()
+
1
,
day
=
date
.
getDate
(),
hour
=
date
.
getHours
()
<
10
?
"0"
+
date
.
getHours
()
:
date
.
getHours
(),
minute
=
date
.
getMinutes
()
<
10
?
"0"
+
date
.
getMinutes
()
:
date
.
getMinutes
(),
second
=
date
.
getSeconds
()
<
10
?
"0"
+
date
.
getSeconds
()
:
date
.
getSeconds
();
month
>=
1
&&
month
<=
9
?
(
month
=
"0"
+
month
)
:
""
;
day
>=
0
&&
day
<=
9
?
(
day
=
"0"
+
day
)
:
""
;
var
timer
=
year
+
'/'
+
month
+
'/'
+
day
+
' '
+
hour
+
':'
+
minute
+
':'
+
second
;
return
timer
;
},
...
@@ -218,4 +262,23 @@
...
@@ -218,4 +262,23 @@
margin-left
:
100
rpx
;
margin-left
:
100
rpx
;
}
}
.locationView
{
z-index
:
5
;
width
:
300
rpx
;
position
:
absolute
;
left
:
0
;
bottom
:
200
rpx
;
display
:
flex
;
flex-direction
:
column
;
padding-bottom
:
20
rpx
;
padding-right
:
20
rpx
;
}
.locationText
{
font-size
:
24
rpx
;
color
:
#999999
;
width
:
260
rpx
;
}
</
style
>
</
style
>
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