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
764ef11a
authored
2018-08-18 22:54:54 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
get ercode
1 parent
44a749ef
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
165 additions
and
97 deletions
.idea/workspace.xml
index.html
js/JSBridge.js
js/compress.js
js/controller/mainController.js
js/controller/mapController.js
js/service/wechatPaymentService.js
.idea/workspace.xml
View file @
764ef11
This diff is collapsed.
Click to expand it.
index.html
View file @
764ef11
...
...
@@ -98,6 +98,7 @@
<link
href=
"css/app.css"
rel=
"stylesheet"
/>
<link
href=
"bootstrap/css/bootstrap.min.css"
rel=
"stylesheet"
>
<script
type=
"text/javascript"
src=
"js/jquery-1.9.1.js"
></script>
<script
type=
"text/javascript"
src=
"js/JSBridge.js"
></script>
<script
type=
"text/javascript"
src=
"js/angularjs/angular.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/angularjs/angular-local-storage.js"
></script>
<script
type=
"text/javascript"
src=
"js/angularjs/angular-ui-router.js"
></script>
...
...
js/JSBridge.js
0 → 100644
View file @
764ef11
function
AppClient
(
appObj
,
isAndroid
)
{
this
.
appObj
=
appObj
;
this
.
isAndroid
=
isAndroid
;
};
AppClient
.
prototype
.
closePage
=
function
()
{
if
(
this
.
isAndroid
)
{
this
.
appObj
.
closePageAction
();
}
else
{
this
.
appObj
.
callHandler
(
"closePageAction"
);
}
}
function
isJson
(
str
)
{
try
{
JSON
.
parse
(
str
);
}
catch
(
e
)
{
return
false
;
}
return
true
;
}
// window.invokeJsPassCompanyCodeAndName = function(_params) {
// companyCode = _params.companyCode;
// companyName = _params.companyName;
// var jsonStr = "";
// getSign(jsonStr);
// }
AppClient
.
prototype
.
getERCode
=
function
(
callbackName
,
callback
,
jsonStr
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
)){
dataParams
=
JSON
.
parse
(
jsonStr
);
}
var
iOSData
=
{
from
:
'H5'
,
params
:
dataParams
};
if
(
this
.
isAndroid
)
{
this
.
appObj
.
getERCode
(
'H5'
,
jsonStr
);
}
else
{
this
.
appObj
.
callHandler
(
"getERCode"
,
iOSData
,
callback
);
}
};
if
(
window
.
android
)
{
appClient
=
new
AppClient
(
window
.
android
,
true
);
// 此处可以调用一些init的方法
}
else
{
function
setupWebViewJavascriptBridge
(
callback
)
{
if
(
window
.
WebViewJavascriptBridge
)
{
return
callback
(
WebViewJavascriptBridge
);
}
if
(
window
.
WVJBCallbacks
)
{
return
window
.
WVJBCallbacks
.
push
(
callback
);
}
window
.
WVJBCallbacks
=
[
callback
];
var
WVJBIframe
=
document
.
createElement
(
'iframe'
);
WVJBIframe
.
style
.
display
=
'none'
;
WVJBIframe
.
src
=
'https://__bridge_loaded__'
;
document
.
documentElement
.
appendChild
(
WVJBIframe
);
setTimeout
(
function
()
{
document
.
documentElement
.
removeChild
(
WVJBIframe
)
},
0
)
}
setupWebViewJavascriptBridge
(
function
(
bridge
)
{
appClient
=
new
AppClient
(
bridge
,
false
);
// 此处可以调用一些init的方法
});
}
window
.
getIOSERCode
=
function
(
_params
)
{
alert
(
JSON
.
parse
(
_params
))
}
js/compress.js
View file @
764ef11
///<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="weixinConfig.js" />
//});
///<jscompress sourcefile="weixinConfig.js" />
/**
* Created by zhanghong on 15/3/8.
*/
...
...
@@ -164,8 +164,8 @@ function initWeixinMenu($http){
// alert(arg1);
});
}
///<jscompress sourcefile="globalService.js" />
///<jscompress sourcefile="globalService.js" />
angular
.
module
(
'myApp.services'
)
.
service
(
'globalService'
,
...
...
@@ -300,8 +300,8 @@ angular.module('myApp.services')
return
globalConfig
;
}
]
);
///<jscompress sourcefile="dingdaService.js" />
);
///<jscompress sourcefile="dingdaService.js" />
angular
.
module
(
'myApp.services'
)
.
service
(
'dingdaService'
,
[
'$http'
,
'globalService'
,
function
(
$http
,
globalService
)
{
...
...
@@ -466,8 +466,8 @@ angular.module('myApp.services')
return
res
;
}
}
}])
///<jscompress sourcefile="wechatPaymentService.js" />
}])
///<jscompress sourcefile="wechatPaymentService.js" />
angular
.
module
(
'myApp.services'
)
.
service
(
'wechatPayment'
,[
'$http'
,
'$q'
,
'$rootScope'
,
function
(
$http
,
$q
,
$rootScope
)
{
...
...
@@ -573,8 +573,8 @@ angular.module('myApp.services')
}
}
}]);
///<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
;
...
...
@@ -1157,8 +1157,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
){
...
...
@@ -1211,8 +1211,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
){
...
...
@@ -1226,8 +1226,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
){
...
...
@@ -1273,8 +1273,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
=
[
...
...
@@ -1289,8 +1289,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
){
...
...
@@ -1378,8 +1378,8 @@ angular.module('myApp')
$state
.
go
(
'unusual'
,
{
id
:
$scope
.
datail
.
id
});
}
}])
///<jscompress sourcefile="tripController.js" />
}])
///<jscompress sourcefile="tripController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'tripController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
'dingdaService'
,
function
(
$scope
,
$rootScope
,
$state
,
dingdaService
){
...
...
@@ -1422,8 +1422,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
)
{
...
...
@@ -1547,8 +1547,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
){
...
...
@@ -1582,8 +1582,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
){
...
...
@@ -1602,8 +1602,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
){
...
...
@@ -1674,8 +1674,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
){
...
...
@@ -1701,8 +1701,8 @@ angular.module('myApp')
}])
///<jscompress sourcefile="bondSuccessController.js" />
}])
///<jscompress sourcefile="bondSuccessController.js" />
angular
.
module
(
'myApp'
)
.
controller
(
'bondSuccessController'
,[
'$scope'
,
'$rootScope'
,
'$state'
,
function
(
$scope
,
$rootScope
,
$state
){
...
...
@@ -1712,8 +1712,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
){
...
...
@@ -1769,8 +1769,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
(){
...
...
@@ -1970,8 +1970,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
){
...
...
@@ -2097,16 +2097,16 @@ angular.module('myApp')
// alert(JSON.stringify(data))
if
(
data
.
meta
.
code
==
200
)
{
if
(
data
.
data
.
orderDetail
.
id
)
{
layer
.
open
({
content
:
"租车成功,订单号为:"
+
data
.
data
.
orderDetail
.
id
,
time
:
2
});
// alert("租车成功,订单号为:" + data.data.orderDetail.id);
$rootScope
.
isRendBike
=
true
;
$state
.
go
(
'rentDetail'
,
{},
{
reload
:
true
});
}
}
else
if
(
data
.
meta
.
code
==
202
)
{
layer
.
open
({
...
...
@@ -2178,4 +2178,4 @@ angular.module('myApp')
}]);
...
...
js/controller/mainController.js
View file @
764ef11
...
...
@@ -4,7 +4,6 @@ angular.module('myApp')
$rootScope
.
isRendBike
=
false
;
$rootScope
.
isLoadFinish
=
false
;
$scope
.
unfinishOrder
=
{};
var
init
=
function
()
{
// globalService.init();
$scope
.
userinfo
=
globalService
.
getData
(
"user"
);
...
...
@@ -105,56 +104,60 @@ 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
});
return
;
}
//
if($scope.unfinishOrder.status == 200) {
//
$state.go('tripDetail' , { orderId : $scope.unfinishOrder.id});
//
return;
//
}
$rootScope
.
openScan
=
false
;
wx
.
scanQRCode
({
needResult
:
1
,
// 默认为1,扫描结果由微信处理,1则直接返回扫描结果,
scanType
:
[
"qrCode"
,
"barCode"
],
// 可以指定扫二维码还是一维码,默认二者都有
success
:
function
(
res
)
{
var
result
=
res
.
resultStr
;
// 当needResult 为 1 时,扫码返回的结果
// alert(result);
dingdaService
.
verifyScanCode
(
result
).
success
(
function
(
data
,
status
){
// alert(JSON.stringify(data))
if
(
data
.
meta
.
code
==
200
)
{
if
(
data
.
data
.
orderDetail
.
id
)
{
layer
.
open
({
content
:
"租车成功,订单号为:"
+
data
.
data
.
orderDetail
.
id
,
time
:
2
});
// alert("租车成功,订单号为:" + data.data.orderDetail.id);
$rootScope
.
isRendBike
=
true
;
$state
.
go
(
'rentDetail'
,
{},
{
reload
:
true
});
}
}
else
if
(
data
.
meta
.
code
==
202
)
{
layer
.
open
({
content
:
data
.
meta
.
message
,
time
:
2
});
$state
.
go
(
'bond'
,
{
longitude
:
$rootScope
.
currentPoint
.
longitude
,
latitude
:
$rootScope
.
currentPoint
.
latitude
});
}
else
{
layer
.
open
({
content
:
data
.
meta
.
message
,
time
:
2
});
}
}).
error
(
function
(
data
,
status
){
layer
.
open
({
content
:
"租车失败"
+
JSON
.
stringify
(
data
),
time
:
2
});
});
}
});
console
.
log
(
appClient
)
appClient
.
getERCode
(
'getIOSERCode'
,
function
(
res
)
{
alert
(
JSON
.
parse
(
res
))
},
''
)
// wx.scanQRCode({
// needResult: 1, // 默认为1,扫描结果由微信处理,1则直接返回扫描结果,
// scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
// success: function (res) {
// var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
// // alert(result);
// dingdaService.verifyScanCode(result).success(function(data , status){
// // alert(JSON.stringify(data))
// if(data.meta.code == 200) {
// if(data.data.orderDetail.id) {
//
// layer.open({
// content: "租车成功,订单号为:" + data.data.orderDetail.id,
// time:2
// });
// // alert("租车成功,订单号为:" + data.data.orderDetail.id);
// $rootScope.isRendBike = true;
//
// $state.go('rentDetail', {}, {reload: true});
//
// }
// } else if(data.meta.code == 202) {
// layer.open({
// content: data.meta.message,
// time:2
// });
// $state.go('bond', {longitude: $rootScope.currentPoint.longitude , latitude: $rootScope.currentPoint.latitude });
// } else {
// layer.open({
// content: data.meta.message,
// time:2
// });
// }
// }).error(function(data , status){
// layer.open({
// content: "租车失败" + JSON.stringify(data),
// time:2
// });
// });
// }
// });
}
})
$rootScope
.
$watch
(
"openDetail"
,
function
(
newVal
,
oldVal
){
...
...
js/controller/mapController.js
View file @
764ef11
...
...
@@ -9,7 +9,6 @@ angular.module('myApp')
var
map
;
var
endPosition
;
var
polyline
;
$rootScope
.
currentPoint
=
{};
var
rendBike
=
function
()
{
...
...
@@ -154,7 +153,6 @@ angular.module('myApp')
img
.
src
=
"images/scancode.png"
;
scanControlContent
.
innerHTML
=
img
.
outerHTML
+
" 扫码租车"
;
scanControlContainer
.
onclick
=
function
()
{
$scope
.
$apply
(
function
()
{
$rootScope
.
openScan
=
true
;
...
...
js/service/wechatPaymentService.js
View file @
764ef11
...
...
@@ -116,7 +116,7 @@ angular.module('myApp.services')
case
101
:
var
param
=
Object
.
assign
(
$location
.
search
(),{
amount
:
amount
,
body
:
"租车租金"
,
body
:
"租车租
git
金"
,
type
:
101
});
return
callUnifiedOrderApi
(
host
+
"/bill/wx/h5/"
+
orderId
,
param
);
...
...
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