admin_faceScore.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. app.controller('AdminFaceScoreCtrl', function($rootScope, $scope, $http, $timeout, $state, $window, $q, toaster) {
  2. $scope.pageObj = {pageSize: 10, total: 1, page: 1, totalPage: 1, query: '',passed:'',province:''};
  3. $scope.goPage = function(page){
  4. if(page < 1){
  5. toaster.pop('error', '已是第一页');
  6. return;
  7. }else if(page > $scope.pageObj.totalPage){
  8. toaster.pop('error', '超过最大页码');
  9. return;
  10. }
  11. console.log('go page std');
  12. $scope.pageObj.page = page;
  13. var getCount = $http({
  14. url : $rootScope.host_url + '/adminOptr/faceScoreCount?session=' + $rootScope.session,
  15. method : 'post',
  16. data : angular.toJson($scope.pageObj)
  17. }).success(function(data) {
  18. if(data.code == 0){
  19. $scope.pageObj.total = data.result.stdCount;
  20. $scope.pageObj.totalPage = Math.ceil(data.result.stdCount / $scope.pageObj.pageSize);
  21. $scope.pageObj.totalPage = $scope.pageObj.totalPage == 0 ? 1 : $scope.pageObj.totalPage;
  22. }
  23. }).error(function() {
  24. });
  25. var getData = $http({
  26. url : $rootScope.host_url + '/adminOptr/faceScore?session=' + $rootScope.session,
  27. method : 'post',
  28. data : angular.toJson($scope.pageObj)
  29. }).success(function(data) {
  30. if(data.code == 0){
  31. $scope.stds = data.result;
  32. }
  33. }).error(function() {
  34. });
  35. var getProvince = $http({
  36. url : $rootScope.host_url + '/adminOptr/getChushenProvinces?session=' + $rootScope.session,
  37. method : 'get'
  38. }).success(function(data) {
  39. if(data.code == 0){
  40. $scope.provinces = data.result;
  41. }
  42. }).error(function() {
  43. });
  44. $scope.myPromise = $q.all([getData, getCount, getProvince]);
  45. }
  46. $scope.load = function(){
  47. $scope.goPage(1);
  48. }
  49. $scope.load();
  50. $scope.showStdOverview = function(std_id){
  51. $state.go('stdInfo', {std_id: std_id});
  52. }
  53. });