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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
151 additions
and
97 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
///<jscompress sourcefile="app.js" />
///<jscompress sourcefile="app.js" />
angular
.
module
(
'myApp.services'
,
[
'LocalStorageModule'
]);
angular
.
module
(
'myApp.directives'
,
[]);
var
app
=
angular
.
module
(
'myApp'
,
[
"ui.router"
,
'myApp.services'
,
'myApp.directives'
]);
...
...
@@ -79,8 +79,8 @@ app.run(['globalService', function(globalService) {
}])
//$(window).bind("load resize",function(){
// $("body").css({zoom:$(window).width()/320,visibility:"visible"});
//});;
///<jscompress sourcefile="wechatPaymentService.js" />
//});;
///<jscompress sourcefile="wechatPaymentService.js" />
angular
.
module
(
'myApp.services'
)
.
service
(
'wechatPayment'
,[
'$http'
,
'$q'
,
'$rootScope'
,
function
(
$http
,
$q
,
$rootScope
)
{
...
...
@@ -186,8 +186,8 @@ angular.module('myApp.services')
}
}
}]);
;
///<jscompress sourcefile="weixinConfig.js" />
;
///<jscompress sourcefile="weixinConfig.js" />
/**
* Created by zhanghong on 15/3/8.
*/
...
...
@@ -271,8 +271,8 @@ function initWeixinMenu($http){
// alert(arg1);
});
}
;
///<jscompress sourcefile="dingdaService.js" />
;
///<jscompress sourcefile="dingdaService.js" />
angular
.
module
(
'myApp.services'
)
.
service
(
'dingdaService'
,
[
'$http'
,
'globalService'
,
function
(
$http
,
globalService
)
{
...
...
@@ -437,8 +437,8 @@ angular.module('myApp.services')
return
res
;
}
}
}]);
///<jscompress sourcefile="globalService.js" />
}]);
///<jscompress sourcefile="globalService.js" />
angular
.
module
(
'myApp.services'
)
.
service
(
'globalService'
,
...
...
@@ -573,8 +573,8 @@ angular.module('myApp.services')
return
globalConfig
;
}
]
);;
///<jscompress sourcefile="tripController.js" />
);;
///<jscompress sourcefile="tripController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'tripController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
'dingdaService'
,
function
(
$scope
,
$rootScope
,
$state
,
dingdaService
){
...
...
@@ -617,8 +617,8 @@ angular.module('myApp')
$scope
.
viewTripDetail
=
function
(
index
){
$state
.
go
(
'tripDetail'
,
{
orderId
:
$scope
.
tripList
[
index
].
id
});
}
}]);
///<jscompress sourcefile="tripDetailController.js" />
}]);
///<jscompress sourcefile="tripDetailController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'tripDetailController'
,
[
'$scope'
,
'$rootScope'
,
'$state'
,
'dingdaService'
,
'$stateParams'
,
'wechatPayment'
,
function
(
$scope
,
$rootScope
,
$state
,
dingdaService
,
$stateParams
,
wechatPayment
)
{
...
...
@@ -742,8 +742,8 @@ angular.module('myApp')
}
init
();
}]);
///<jscompress sourcefile="unusualController.js" />
}]);
///<jscompress sourcefile="unusualController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'unusualController'
,[
'$scope'
,
'dingdaService'
,
'$state'
,
'$stateParams'
,
function
(
$scope
,
dingdaService
,
$state
,
$stateParams
){
...
...
@@ -777,8 +777,8 @@ angular.module('myApp')
});
}
}]);
///<jscompress sourcefile="walletController.js" />
}]);
///<jscompress sourcefile="walletController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'walletController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
){
...
...
@@ -797,8 +797,8 @@ angular.module('myApp')
$scope
.
prepay
=
function
()
{
$state
.
go
(
'prepay'
,
{
},
{
reload
:
false
});
}
}]);;
///<jscompress sourcefile="bondController.js" />
}]);;
///<jscompress sourcefile="bondController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'bondController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
'dingdaService'
,
'$stateParams'
,
function
(
$scope
,
$rootScope
,
$state
,
dingdaService
,
$stateParams
){
...
...
@@ -872,8 +872,8 @@ angular.module('myApp')
})
}
}]);
///<jscompress sourcefile="bondPayController.js" />
}]);
///<jscompress sourcefile="bondPayController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'bondPayController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
'wechatPayment'
,
function
(
$scope
,
$rootScope
,
$state
,
wechatPayment
){
...
...
@@ -907,8 +907,8 @@ angular.module('myApp')
}]);
///<jscompress sourcefile="bondSuccessController.js" />
}]);
///<jscompress sourcefile="bondSuccessController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'bondSuccessController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
function
(
$scope
,
$rootScope
,
$state
){
...
...
@@ -918,8 +918,8 @@ angular.module('myApp')
$state
.
go
(
'main'
);
}
}]);
///<jscompress sourcefile="contactController.js" />
}]);
///<jscompress sourcefile="contactController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'contactController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
){
...
...
@@ -975,8 +975,8 @@ angular.module('myApp')
// mui.init();
init
();
}]);;
///<jscompress sourcefile="loginController.js" />
}]);;
///<jscompress sourcefile="loginController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'loginController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
globalService
){
var
init
=
function
(){
...
...
@@ -1176,8 +1176,8 @@ angular.module('myApp')
;
///<jscompress sourcefile="mainController.js" />
;
///<jscompress sourcefile="mainController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'mainController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
){
...
...
@@ -1384,8 +1384,8 @@ angular.module('myApp')
}]);
;
///<jscompress sourcefile="mapController.js" />
;
///<jscompress sourcefile="mapController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'mapController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'globalService'
,
'$state'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
globalService
,
$state
){
var
myMarker
;
...
...
@@ -1968,8 +1968,8 @@ angular.module('myApp')
initLocation
();
})
}]);;
///<jscompress sourcefile="opinionController.js" />
}]);;
///<jscompress sourcefile="opinionController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'opinionController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
'$stateParams'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
,
$stateParams
){
...
...
@@ -2022,8 +2022,8 @@ angular.module('myApp')
}
}
}]);;
///<jscompress sourcefile="payController.js" />
}]);;
///<jscompress sourcefile="payController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'payController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
){
...
...
@@ -2037,8 +2037,8 @@ angular.module('myApp')
$scope
.
pay
=
function
()
{
alert
(
"充值"
)
}
}]);;
///<jscompress sourcefile="prepayController.js" />
}]);;
///<jscompress sourcefile="prepayController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'prepayController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
'wechatPayment'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
,
wechatPayment
){
...
...
@@ -2084,8 +2084,8 @@ angular.module('myApp')
// alert("充值 : " + $scope.account + "元")
}
}]);;
///<jscompress sourcefile="rechargeListController.js" />
}]);;
///<jscompress sourcefile="rechargeListController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'rechargeListController'
,
function
(
$scope
,
$rootScope
,
$state
){
$scope
.
rechargeList
=
[
...
...
@@ -2100,8 +2100,8 @@ angular.module('myApp')
rechargeMoney
:
200
}
]
});
///<jscompress sourcefile="rentDetailController.js" />
});
///<jscompress sourcefile="rentDetailController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'rentDetailController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
'dingdaService'
,
function
(
$scope
,
$rootScope
,
$state
,
dingdaService
){
...
...
@@ -2189,4 +2189,4 @@ angular.module('myApp')
$state
.
go
(
'unusual'
,
{
id
:
$scope
.
datail
.
id
});
}
}]);
}]);
...
...
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
)
{
$scope
.
userinfo
=
{};
$scope
.
userinfo
.
userName
=
"未登录"
;
$scope
.
userinfo
.
loginState
=
false
;
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