Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
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
李俊赕
self-support
Commits
205a9191
Commit
205a9191
authored
May 12, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
相机-请求位置缓存
parent
6a939c3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
index.vue
src/components/take/index.vue
+22
-1
No files found.
src/components/take/index.vue
View file @
205a9191
...
@@ -113,7 +113,17 @@
...
@@ -113,7 +113,17 @@
photo
.
currentItemLength
=
0
photo
.
currentItemLength
=
0
// this.ctx = uni.createCameraContext();
// this.ctx = uni.createCameraContext();
this
.
updateTime
()
this
.
updateTime
()
this
.
getLocation
()
const
locationData
=
uni
.
getStorageSync
(
'locationData'
)
const
validityTime
=
60000
if
(
Date
.
now
()
-
locationData
.
locationTime
<
validityTime
)
{
// 1分钟内不重复请求位置信息
this
.
waterInfo
.
latitude
=
locationData
.
waterInfo
.
latitude
this
.
waterInfo
.
longitude
=
locationData
.
waterInfo
.
longitude
this
.
baiduLocation
()
}
else
{
this
.
getLocation
()
}
this
.
getMarkPath
()
this
.
getMarkPath
()
this
.
initData
()
this
.
initData
()
...
@@ -266,6 +276,17 @@
...
@@ -266,6 +276,17 @@
success
:
function
(
res
)
{
success
:
function
(
res
)
{
waterInfo
.
longitude
=
parseFloat
(
res
.
longitude
).
toFixed
(
4
)
waterInfo
.
longitude
=
parseFloat
(
res
.
longitude
).
toFixed
(
4
)
waterInfo
.
latitude
=
parseFloat
(
res
.
latitude
).
toFixed
(
3
)
waterInfo
.
latitude
=
parseFloat
(
res
.
latitude
).
toFixed
(
3
)
const
data
=
{
waterInfo
:
{
latitude
:
waterInfo
.
latitude
,
longitude
:
waterInfo
.
longitude
},
locationTime
:
Date
.
now
()
}
uni
.
setStorage
({
key
:
'locationData'
,
data
:
data
,
})
that
.
baiduLocation
()
that
.
baiduLocation
()
},
},
fail
(
err
)
{
fail
(
err
)
{
...
...
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