|
@@ -1,6 +1,6 @@
|
|
(function (app) {
|
|
(function (app) {
|
|
- app.controller('wechatLoginCtrl', ["$scope","userService","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","common","config",
|
|
|
|
- function ($scope, userService, $ionicNavBarDelegate, storage, $state, msg, $http, util, common, config) {
|
|
|
|
|
|
+ app.controller('wechatLoginCtrl', ["$scope","userService","$ionicNavBarDelegate","$ionicModal", "storage", "$state", "msg", "$http", "util","common","config",
|
|
|
|
+ function ($scope, userService, $ionicNavBarDelegate,$ionicModal, storage, $state, msg, $http, util, common, config) {
|
|
//$ionicNavBarDelegate.showBackButton(false);
|
|
//$ionicNavBarDelegate.showBackButton(false);
|
|
$scope.addvideo = function () {
|
|
$scope.addvideo = function () {
|
|
common.chooseVideo().then(function (file) {
|
|
common.chooseVideo().then(function (file) {
|
|
@@ -19,78 +19,99 @@
|
|
//msg.error('视频上传失败');
|
|
//msg.error('视频上传失败');
|
|
msg.hide();
|
|
msg.hide();
|
|
});
|
|
});
|
|
- }, function (erro) {
|
|
|
|
|
|
+ }, function (error) {
|
|
console.log('选择视频失败');
|
|
console.log('选择视频失败');
|
|
});
|
|
});
|
|
};
|
|
};
|
|
$scope.wechat_login = function () {
|
|
$scope.wechat_login = function () {
|
|
- //$state.go("loginAccount", { wechat: 'orrk51inhmfmQRXA8VvGEQfow3Es' });
|
|
|
|
- //return;
|
|
|
|
- delete $http.defaults.headers.common["Authorization"];
|
|
|
|
- var scope = "snsapi_userinfo", state = "_" + (+new Date());
|
|
|
|
- //Wechat.auth(scope, state, function (response) {
|
|
|
|
- // // alert("response:"+JSON.stringify(response));
|
|
|
|
- // // var response={code:1231};
|
|
|
|
- // if(response.code){
|
|
|
|
- // msg.loading('登录中...');
|
|
|
|
- // userService.wechat_login(response.code).then(function(result){
|
|
|
|
- // msg.hide();
|
|
|
|
- // // alert("wechat_login success: " + JSON.stringify(result));
|
|
|
|
- // if(result.data.data.user){
|
|
|
|
- // storage.setObject('user', result.data.data.user);
|
|
|
|
- // storage.set('token', result.data.data.token);
|
|
|
|
- // $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
|
|
|
|
- // $scope.user=storage.getObject('user');
|
|
|
|
- // $state.go('app.home');
|
|
|
|
- // }else{
|
|
|
|
- // $state.go("loginAccount",{wechat:result.data.data.openid})
|
|
|
|
- // }
|
|
|
|
- // },function(error){
|
|
|
|
- // console.log("loginbywx Failed: " + JSON.stringify(error));
|
|
|
|
- // $state.go("loginAccount");
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- //}, function (error) {
|
|
|
|
- // console.log("Failed: " + JSON.stringify(error));
|
|
|
|
- //});
|
|
|
|
- userService.isTest().then(function(res){
|
|
|
|
- if(res.data.data){
|
|
|
|
- Wechat.auth(scope, state, function (response) {
|
|
|
|
- // var response={code:1231};
|
|
|
|
- if(response.code){
|
|
|
|
- msg.loading('登录中...');
|
|
|
|
- userService.wechat_login(response.code).then(function(result){
|
|
|
|
- msg.hide();
|
|
|
|
- if(result.data.data.user){
|
|
|
|
- storage.setObject('user', result.data.data.user);
|
|
|
|
- storage.set('token', result.data.data.token);
|
|
|
|
- $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
|
|
|
|
- $scope.user=storage.getObject('user');
|
|
|
|
- $state.go('app.home');
|
|
|
|
- if(localStorage['jpush']){
|
|
|
|
- console.log("jpush: " + localStorage['jpush']);
|
|
|
|
- userService.jpush({ jpush: localStorage['jpush']}).then(function (result) {}, function (erro) {});
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- $state.go("loginAccount",{wechat:result.data.data.openid})
|
|
|
|
- }
|
|
|
|
- },function(error){
|
|
|
|
- console.log("loginbywx Failed: " + JSON.stringify(error));
|
|
|
|
- $state.go("loginAccount");
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }, function (error) {
|
|
|
|
- console.log("Failed: " + JSON.stringify(error));
|
|
|
|
- })
|
|
|
|
- }else{
|
|
|
|
- $state.go("loginAccount",{wechat:'orrk51inhmfmQRXA8VvGEQfow3Es'});
|
|
|
|
- }
|
|
|
|
- } )
|
|
|
|
|
|
+ if(document.getElementById('read').checked){
|
|
|
|
+ //$state.go("loginAccount", { wechat: 'orrk51inhmfmQRXA8VvGEQfow3Es' });
|
|
|
|
+ //return;
|
|
|
|
+ delete $http.defaults.headers.common["Authorization"];
|
|
|
|
+ var scope = "snsapi_userinfo", state = "_" + (+new Date());
|
|
|
|
+ //Wechat.auth(scope, state, function (response) {
|
|
|
|
+ // // alert("response:"+JSON.stringify(response));
|
|
|
|
+ // // var response={code:1231};
|
|
|
|
+ // if(response.code){
|
|
|
|
+ // msg.loading('登录中...');
|
|
|
|
+ // userService.wechat_login(response.code).then(function(result){
|
|
|
|
+ // msg.hide();
|
|
|
|
+ // // alert("wechat_login success: " + JSON.stringify(result));
|
|
|
|
+ // if(result.data.data.user){
|
|
|
|
+ // storage.setObject('user', result.data.data.user);
|
|
|
|
+ // storage.set('token', result.data.data.token);
|
|
|
|
+ // $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
|
|
|
|
+ // $scope.user=storage.getObject('user');
|
|
|
|
+ // $state.go('app.home');
|
|
|
|
+ // }else{
|
|
|
|
+ // $state.go("loginAccount",{wechat:result.data.data.openid})
|
|
|
|
+ // }
|
|
|
|
+ // },function(error){
|
|
|
|
+ // console.log("loginbywx Failed: " + JSON.stringify(error));
|
|
|
|
+ // $state.go("loginAccount");
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ //}, function (error) {
|
|
|
|
+ // console.log("Failed: " + JSON.stringify(error));
|
|
|
|
+ //});
|
|
|
|
+ userService.isTest().then(function(res){
|
|
|
|
+ if(res.data.data){
|
|
|
|
+ Wechat.auth(scope, state, function (response) {
|
|
|
|
+ // var response={code:1231};
|
|
|
|
+ if(response.code){
|
|
|
|
+ msg.loading('登录中...');
|
|
|
|
+ userService.wechat_login(response.code).then(function(result){
|
|
|
|
+ msg.hide();
|
|
|
|
+ if(result.data.data.user){
|
|
|
|
+ storage.setObject('user', result.data.data.user);
|
|
|
|
+ storage.set('token', result.data.data.token);
|
|
|
|
+ $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
|
|
|
|
+ $scope.user=storage.getObject('user');
|
|
|
|
+ $state.go('app.home');
|
|
|
|
+ if(localStorage['jpush']){
|
|
|
|
+ console.log("jpush: " + localStorage['jpush']);
|
|
|
|
+ userService.jpush({ jpush: localStorage['jpush']}).then(function (result) {}, function (error) {});
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ $state.go("loginAccount",{wechat:result.data.data.openid})
|
|
|
|
+ }
|
|
|
|
+ },function(error){
|
|
|
|
+ console.log("loginbywx Failed: " + JSON.stringify(error));
|
|
|
|
+ $state.go("loginAccount");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, function (error) {
|
|
|
|
+ console.log("Failed: " + JSON.stringify(error));
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ $state.go("loginAccount",{wechat:'orrk51inhmfmQRXA8VvGEQfow3Es'});
|
|
|
|
+ }
|
|
|
|
+ } )
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ msg.error('请同意用户隐私条款');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // 隐私条款
|
|
|
|
+ $ionicModal.fromTemplateUrl('readClause.html', {
|
|
|
|
+ scope: $scope,
|
|
|
|
+ animation: 'slide-in-up'
|
|
|
|
+ }).then(function(modal) {
|
|
|
|
+ $scope.readClauseModal = modal;
|
|
|
|
+ });
|
|
|
|
+ $scope.readClause = function($event){
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
+ $scope.readClauseModal.show();
|
|
}
|
|
}
|
|
|
|
+ $scope.closeClause = function() {
|
|
|
|
+ $scope.readClauseModal.hide();
|
|
|
|
+ };
|
|
}]);
|
|
}]);
|
|
- app.controller('loginCtrl', ["$scope", "userService","$stateParams","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","$timeout",
|
|
|
|
- function ($scope, userService,$stateParams,$ionicNavBarDelegate, storage, $state, msg, $http, util, $timeout) {
|
|
|
|
|
|
+ app.controller('loginCtrl', ["$scope", "userService","$stateParams","$ionicNavBarDelegate", "$ionicModal","storage", "$state", "msg", "$http", "util","$timeout",
|
|
|
|
+ function ($scope, userService,$stateParams,$ionicNavBarDelegate,$ionicModal, storage, $state, msg, $http, util, $timeout) {
|
|
//$ionicNavBarDelegate.showBackButton(false);
|
|
//$ionicNavBarDelegate.showBackButton(false);
|
|
delete $http.defaults.headers.common["Authorization"];
|
|
delete $http.defaults.headers.common["Authorization"];
|
|
$scope.wechat = $stateParams.wechat;
|
|
$scope.wechat = $stateParams.wechat;
|
|
@@ -100,18 +121,24 @@
|
|
waitSeconds: "获取验证码"
|
|
waitSeconds: "获取验证码"
|
|
};
|
|
};
|
|
$scope.login = function () {
|
|
$scope.login = function () {
|
|
- msg.loading();
|
|
|
|
- userService.login($scope.vm.mobile, $scope.vm.verify_code,$scope.wechat).then(function (result) {
|
|
|
|
- //userService.login($scope.vm.mobile, $scope.vm.verify_code,124).then(function (result) {
|
|
|
|
- msg.hide();
|
|
|
|
- storage.setObject('user', result.data.data.user);
|
|
|
|
- storage.set('token', result.data.data.token);
|
|
|
|
- $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
|
|
|
|
- $scope.user=storage.getObject('user');
|
|
|
|
- $state.go('app.home');
|
|
|
|
- }, function (error) {
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+ if(document.getElementById('read').checked){
|
|
|
|
+ msg.loading();
|
|
|
|
+ userService.login($scope.vm.mobile, $scope.vm.verify_code,$scope.wechat).then(function (result) {
|
|
|
|
+ //userService.login($scope.vm.mobile, $scope.vm.verify_code,124).then(function (result) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ storage.setObject('user', result.data.data.user);
|
|
|
|
+ storage.set('token', result.data.data.token);
|
|
|
|
+ $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
|
|
|
|
+ $scope.user=storage.getObject('user');
|
|
|
|
+ $state.go('app.home');
|
|
|
|
+ }, function (error) {
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ msg.error('请同意用户隐私条款');
|
|
|
|
+ }
|
|
|
|
+
|
|
};
|
|
};
|
|
|
|
|
|
//获取验证码
|
|
//获取验证码
|
|
@@ -147,7 +174,22 @@
|
|
};
|
|
};
|
|
$scope.clear = function(){
|
|
$scope.clear = function(){
|
|
document.getElementById("tel").value = "";
|
|
document.getElementById("tel").value = "";
|
|
|
|
+ };
|
|
|
|
+ // 隐私条款
|
|
|
|
+ $ionicModal.fromTemplateUrl('readClause.html', {
|
|
|
|
+ scope: $scope,
|
|
|
|
+ animation: 'slide-in-up'
|
|
|
|
+ }).then(function(modal) {
|
|
|
|
+ $scope.readClauseModal = modal;
|
|
|
|
+ });
|
|
|
|
+ $scope.readClause = function($event){
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
+ $scope.readClauseModal.show();
|
|
}
|
|
}
|
|
|
|
+ $scope.closeClause = function() {
|
|
|
|
+ $scope.readClauseModal.hide();
|
|
|
|
+ };
|
|
|
|
+
|
|
}]);
|
|
}]);
|
|
|
|
|
|
})(angular.module('app.controllers'));
|
|
})(angular.module('app.controllers'));
|