Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨建斌
/
dy-wx2
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2615f045
authored
2018-09-02 18:38:05 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提示运行环境
1 parent
e8101757
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
36 deletions
js/JSBridge.js
js/controller/mainController.js
js/controller/mapController.js
js/JSBridge.js
View file @
2615f04
...
...
@@ -14,11 +14,22 @@ function isJson(str) {
}
return
true
;
}
// var str = '{latitude:30.2741500000,longitude:120.1551500000}'
console
.
log
(
toJson
(
str
))
function
toJson
(
str
)
{
var
i
=
str
.
index
(
'{'
)
try
{
var
arr
=
str
.
split
(
2
,
str
.
length
-
4
)
console
.
log
(
arr
)
if
(
str
.
length
>
2
){
var
result
=
/
\{([\s\S]
*
)\}
/
.
exec
(
str
);
}
var
arr
=
result
[
1
].
split
(
','
)
var
obj
=
{}
arr
.
forEach
(
function
(
value
)
{
var
key
=
value
.
split
(
':'
)[
0
]
var
val
=
value
.
split
(
':'
)[
1
]
obj
[
key
]
=
val
})
return
obj
}
catch
(
e
)
{
return
{}
}
...
...
@@ -41,7 +52,7 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
window
.
WebViewJavascriptBridge
.
registerHandler
(
'postERCode'
,
callback
);
}
else
{
this
.
appObj
.
registerHandler
(
"postERCOde"
,
callback
)
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
function
(
data
,
resCallback
)
{
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
function
(
data
,
res
ponse
Callback
)
{
});
}
...
...
@@ -59,7 +70,7 @@ AppClient.prototype.getGPS = function (jsonStr, callback) {
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
callback
);
}
else
{
this
.
appObj
.
registerHandler
(
"postGPS"
,
callback
)
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
function
(
data
,
resCallback
)
{
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
function
(
data
,
res
ponse
Callback
)
{
});
}
...
...
js/controller/mainController.js
View file @
2615f04
...
...
@@ -160,39 +160,40 @@ angular.module('myApp')
$rootScope
.
openScan
=
false
;
if
(
isAndroid
){
if
(
!
appClient
){
layer
.
open
({
content
:
'调起摄像头失败'
,
time
:
2
});
}
else
{
appClient
.
getERCode
(
''
,
function
(
data
,
cb
)
{
layer
.
open
({
content
:
data
,
time
:
2
})
})
// window.WebViewJavascriptBridge.registerHandler('postERCode', function(data, responseCallback) {
// layer.open({
// content: data,
// time: 10
// });
// })
// window.WebViewJavascriptBridge.callHandler('getERCode', function(data, responseCallback) {
// })
// }else if(isiOS){
// appClient.appObj.registerHandler('postERCode', function(data, responseCallback) {
// layer.open({
// content: JSON.stringify(data),
// time: 10
// });
// })
// appClient.getERCode('getERCode', function (res) {
// // layer.open({
// // content: JSON.stringify(res) + 'cb',
// // time: 10
// // });
// }, '')
}
else
{
layer
.
open
({
content
:
'调起摄像头失败'
,
time
:
2
});
// window.WebViewJavascriptBridge.registerHandler('postERCode', function(data, responseCallback) {
// layer.open({
// content: data,
// time: 10
// });
// })
// window.WebViewJavascriptBridge.callHandler('getERCode', function(data, responseCallback) {
// })
// }else if(isiOS){
// appClient.appObj.registerHandler('postERCode', function(data, responseCallback) {
// layer.open({
// content: JSON.stringify(data),
// time: 10
// });
// })
// appClient.getERCode('getERCode', function (res) {
// // layer.open({
// // content: JSON.stringify(res) + 'cb',
// // time: 10
// // });
// }, '')
}
// wx.scanQRCode({
...
...
js/controller/mapController.js
View file @
2615f04
...
...
@@ -303,10 +303,12 @@ angular.module('myApp')
},
1000
)
}
else
{
appClient
.
getGPS
(
''
,
function
(
data
,
cb
)
{
onSuccess
({
latitude
:
30.2741500000
,
longitude
:
120.1551500000
})
var
obj
=
toJson
(
data
)
onSuccess
(
obj
)
// onSuccess({
// latitude:30.2741500000,
// longitude:120.1551500000
// })
layer
.
open
({
content
:
data
,
time
:
2
...
...
Write
Preview
Styling with
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