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
dfa54f2b
authored
2018-08-28 09:43:52 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登录修改
1 parent
b33eccea
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
52 deletions
html/main.html
js/JSBridge.js
js/compress.min.js
js/controller/mainController.js
js/controller/mapController.js
js/service/dingdaService.js
js/service/globalService.js
html/main.html
View file @
dfa54f2
<div
ng-controller=
"mainController"
>
<div
id=
"mapContainer"
class=
"mapContainer"
ng-controller=
"mapController"
></div>
<div
id=
"sliderMenu"
class=
"sliderMenu"
style=
"display:
block
;"
<div
id=
"sliderMenu"
class=
"sliderMenu"
style=
"display:
none
;"
ng-class=
"{true: 'menuOpen', false: 'menuClose'}[$root.openMenu]"
>
<img
src=
"images/slideMenuBackground.png"
/>
...
...
js/JSBridge.js
View file @
dfa54f2
...
...
@@ -25,6 +25,14 @@ function isJson(str) {
}
return
true
;
}
function
toJson
(
str
)
{
try
{
var
arr
=
str
.
split
(
2
,
str
.
length
-
4
)
console
.
log
(
arr
)
}
catch
(
e
)
{
return
''
}
}
// window.invokeJsPassCompanyCodeAndName = function(_params) {
// companyCode = _params.companyCode;
// companyName = _params.companyName;
...
...
@@ -45,16 +53,7 @@ AppClient.prototype.getERCode = function (callbackName, callback, jsonStr) {
this
.
appObj
.
getERCode
(
'H5'
,
jsonStr
);
}
else
{
this
.
appObj
.
callHandler
(
"getERCode"
,
iOSData
,
callback
);
this
.
appObj
.
registerHandler
(
'postERCode'
,
function
(
data
,
responseCallback
)
{
layer
.
open
({
content
:
JSON
.
stringify
(
data
),
time
:
10
});
// log('ObjC called testJavascriptHandler with', data)
// var responseData = { 'Javascript Says':'Right back atcha!' }
// log('JS responding with', responseData)
// responseCallback(responseData)
})
}
};
AppClient
.
prototype
.
getGPS
=
function
(
callbackName
,
callback
,
jsonStr
)
{
...
...
@@ -70,27 +69,7 @@ AppClient.prototype.getGPS = function (callbackName, callback, jsonStr) {
this
.
appObj
.
getGPS
(
'H5'
,
jsonStr
);
}
else
{
this
.
appObj
.
callHandler
(
"getGPS"
,
iOSData
,
callback
);
this
.
appObj
.
registerHandler
(
'postGPS'
,
function
(
data
,
responseCallback
)
{
var
res
=
JSON
.
parse
(
data
)
layer
.
open
({
content
:
data
,
time
:
2
});
layer
.
open
({
content
:
JSON
.
stringify
(
key
),
time
:
2
});
var
key
=
res
[
'testKey'
]
layer
.
open
({
content
:
JSON
.
stringify
(
key
),
time
:
2
});
// log('ObjC called testJavascriptHandler with', data)
// var responseData = { 'Javascript Says':'Right back atcha!' }
// log('JS responding with', responseData)
// responseCallback(responseData)
})
}
};
//
...
...
@@ -108,10 +87,6 @@ if(window.android) {
appClient
=
new
AppClient
(
window
.
android
,
true
);
// 此处可以调用一些init的方法
}
else
{
layer
.
open
({
content
:
'初始化'
,
time
:
2
})
function
setupWebViewJavascriptBridge
(
callback
)
{
if
(
window
.
WebViewJavascriptBridge
)
{
return
callback
(
WebViewJavascriptBridge
);
}
if
(
window
.
WVJBCallbacks
)
{
return
window
.
WVJBCallbacks
.
push
(
callback
);
}
...
...
@@ -126,6 +101,6 @@ if(window.android) {
appClient
=
new
AppClient
(
bridge
,
false
);
// 此处可以调用一些init的方法
});
}
...
...
js/compress.min.js
View file @
dfa54f2
js/controller/mainController.js
View file @
dfa54f2
...
...
@@ -2,20 +2,65 @@ angular.module('myApp')
.
controller
(
'mainController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
){
$rootScope
.
isRendBike
=
false
;
$rootScope
.
isLoadFinish
=
tru
e
;
$rootScope
.
isLoadFinish
=
fals
e
;
$scope
.
unfinishOrder
=
{};
var
init
=
function
()
{
// globalService.init();
function
getUrl
(
name
){
var
reg
=
new
RegExp
(
"(^|&)"
+
name
+
"=([^&]*)(&|$)"
);
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
}
$scope
.
userinfo
=
globalService
.
getData
(
"user"
);
if
(
!
$scope
.
userinfo
)
{
var
code
=
getUrl
(
'code'
)
if
(
code
){
dingdaService
.
verifyThirdCode
(
code
).
success
(
function
(
res
)
{
if
(
res
.
mate
.
code
==
200
)
{
dingdaService
.
verifyPhoneCode
(
res
.
data
.
mobile
,
res
.
data
.
code
).
success
(
function
(
data
)
{
if
(
data
.
meta
.
code
==
200
)
{
data
.
data
.
userName
=
$scope
.
phoneNumberVal
;
globalService
.
saveData
(
'user'
,
data
.
data
);
// layer.open({
// content: '登录成功',
// time:1
// });
setTimeout
(
function
()
{
location
.
reload
();
}
,
300
);
}
else
if
(
data
.
meta
.
code
==
401
)
{
layer
.
open
({
content
:
data
.
meta
.
message
,
time
:
1
});
// alert(data.meta.message);
// layer.msg(data.data.error);
return
;
}
})
}
if
(
res
.
mate
.
code
==
500
){
$state
.
go
(
'login'
,
{},
{
reload
:
true
});
}
})
}
else
{
$scope
.
userinfo
=
{};
$scope
.
userinfo
.
userName
=
"未登录"
;
$scope
.
userinfo
.
loginState
=
false
;
}
}
else
{
$scope
.
userinfo
.
loginState
=
true
;
// alert("getUnfinishedOrder")
dingdaService
.
getUnfinishedOrder
().
success
(
function
(
data
,
status
){
// alert(JSON.stringify(data))
if
(
data
.
meta
.
code
===
401
)
{
layer
.
open
({
content
:
'登录token失效,请重新登录'
,
time
:
2
})
return
}
if
(
data
.
data
.
unfinishedOrder
.
id
)
{
$rootScope
.
isRendBike
=
true
;
$scope
.
unfinishOrder
=
data
.
data
.
unfinishedOrder
;
...
...
@@ -104,9 +149,9 @@ angular.module('myApp')
$rootScope
.
openRing
=
false
;
$rootScope
.
$watch
(
"openScan"
,
function
(
newVal
,
oldVal
){
if
(
newVal
!==
oldVal
&&
newVal
)
{
//
if(!$scope.checkLogin()) {
//
return;
//
}
if
(
!
$scope
.
checkLogin
())
{
return
;
}
// if($scope.unfinishOrder.status == 200) {
// $state.go('tripDetail' , { orderId : $scope.unfinishOrder.id});
...
...
@@ -114,15 +159,26 @@ angular.module('myApp')
// }
$rootScope
.
openScan
=
false
;
if
(
appClient
){
appClient
.
getERCode
(
'postERCode'
,
function
(
res
)
{
appClient
.
appObj
.
registerHandler
(
'postERCode'
,
function
(
data
,
responseCallback
)
{
layer
.
open
({
content
:
JSON
.
stringify
(
res
)
+
'cb'
,
content
:
JSON
.
stringify
(
data
)
,
time
:
10
});
// log('ObjC called testJavascriptHandler with', data)
// var responseData = { 'Javascript Says':'Right back atcha!' }
// log('JS responding with', responseData)
// responseCallback(responseData)
})
appClient
.
getERCode
(
'postERCode'
,
function
(
res
)
{
// layer.open({
// content: JSON.stringify(res) + 'cb',
// time: 10
// });
},
''
)
}
else
{
layer
.
open
({
content
:
'
JSBridge 初始化
失败'
,
content
:
'
调起摄像头
失败'
,
time
:
2
});
}
...
...
js/controller/mapController.js
View file @
dfa54f2
...
...
@@ -297,7 +297,15 @@ angular.module('myApp')
// onSuccess(res)
// }
// });
if
(
appClient
){
appClient
.
appObj
.
registerHandler
(
'postGPS'
,
function
(
data
,
responseCallback
)
{
var
res
=
JSON
.
parse
(
data
)
layer
.
open
({
content
:
data
,
time
:
2
});
})
appClient
.
getGPS
(
'getGPS'
,
function
(
res
)
{
// layer.open({
// content: JSON.stringify(res) + 'cb',
...
...
@@ -309,9 +317,15 @@ angular.module('myApp')
})
},
''
)
}
// onSuccess({latitude:30.2741500000,longitude:120.1551500000})
}
else
{
onSuccess
({
latitude
:
30.2741500000
,
longitude
:
120.1551500000
})
setTimeout
(
function
()
{
$rootScope
.
isLoadFinish
=
true
},
1000
)
}
}
...
...
js/service/dingdaService.js
View file @
dfa54f2
...
...
@@ -3,7 +3,7 @@ angular.module('myApp.services')
function
(
$http
,
globalService
)
{
return
{
sendPhoneCode
:
function
(
phone
,
openId
){
var
url
=
globalService
.
getParam
(
'dingdaLoginAPI'
)
+
'/login/sms?mobile='
+
phone
+
'&openId='
+
openId
;
var
url
=
globalService
.
getParam
(
'dingdaLoginAPI'
)
+
'/login/sms?mobile='
+
phone
+
(
openId
?(
'&openId='
+
(
openId
||
''
)):
''
)
;
var
res
=
$http
.
get
(
url
).
success
(
function
(
data
,
status
)
{
}).
error
(
function
(
data
,
status
)
{
alert
(
data
.
meta
.
message
)
...
...
@@ -12,15 +12,21 @@ angular.module('myApp.services')
},
verifyPhoneCode
:
function
(
phone
,
code
){
var
url
=
globalService
.
getParam
(
'dingdaLoginAPI'
)
+
'/login/sms?mobile='
+
phone
+
'&code='
+
code
;
var
res
=
$http
.
post
(
url
,
{
}
,
{
}).
success
(
function
(
data
,
status
)
{
var
res
=
$http
.
post
(
url
,
{},
{}).
success
(
function
(
data
,
status
)
{
}).
error
(
function
(
data
,
status
)
{
alert
(
data
.
meta
.
message
)
});
return
res
;
},
verifyThirdCode
:
function
(
code
){
// 通过第三方登录
var
url
=
globalService
.
getParam
(
'dingdaLoginAPI'
)
+
'/login/sms?code='
+
code
;
var
res
=
$http
.
get
(
url
).
success
(
function
(
data
,
status
)
{
}).
error
(
function
(
data
,
status
)
{
// alert(data.meta.message)
});
return
res
;
},
getStationList
:
function
(
longitude
,
latitude
){
var
url
=
globalService
.
getParam
(
'dingdaAPI'
)
+
'/service/bicycle/stations?longitude='
+
longitude
+
'&latitude='
+
latitude
;
...
...
js/service/globalService.js
View file @
dfa54f2
...
...
@@ -18,7 +18,8 @@ angular.module('myApp.services')
$rootScope
.
inited
=
true
;
//--------------------自行车服务--------------
// 生产环境
var
dingdaAPI
=
"http://bike.dy.dingdatech.com:880"
;
// var dingdaAPI = "http://bike.dy.dingdatech.com:880";
var
dingdaAPI
=
"http://47.99.81.49:60612"
;
// 测试环境
//var dingdaAPI = "http://bike.api.dingdachuxing.com";
globalConfig
.
setParam
(
"dingdaAPI"
,
dingdaAPI
);
...
...
@@ -36,7 +37,8 @@ angular.module('myApp.services')
globalConfig
.
setParam
(
"feedbackAPI"
,
feedbackAPI
);
//--------------------认证服务--------------
// 生产环境
var
dingdaLoginAPI
=
"http://auth.dy.dingdatech.com:880"
;
// var dingdaLoginAPI = "http://auth.dy.dingdatech.com:880";
var
dingdaLoginAPI
=
"http://47.99.81.49:40411"
;
// 测试环境
//var dingdaLoginAPI = "http://auth.api.dingdachuxing.com";
globalConfig
.
setParam
(
"dingdaLoginAPI"
,
dingdaLoginAPI
);
...
...
@@ -53,7 +55,8 @@ angular.module('myApp.services')
loadPersistData
();
loadCityConfig
();
loadPathParams
();
initWeixinMenu
(
$http
);
// initWeixinMenu($http);
}
var
loadPersistData
=
function
()
{
...
...
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