lxnd 8 years ago
parent
commit
5041322055
2 changed files with 71 additions and 26 deletions
  1. 70 25
      yanshi/www/js/controllers.js
  2. 1 1
      yanshi/www/templates/show.html

+ 70 - 25
yanshi/www/js/controllers.js

xqd xqd xqd xqd xqd
@@ -41,31 +41,31 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading','$sta
 		$ionicLoading.show({
             template: '加载中...',
         });
-        	$http({
-        		method:'get',
-        		url:config.server+'/list',
-        	}).success(function(newItem){
-		        $timeout(function(){
-		        	$ionicLoading.hide();
-		        	$scope.excals = newItem
+    	$http({
+    		method:'get',
+    		url:config.server+'/list',
+    	}).success(function(newItem){
+	        $timeout(function(){
+	        	$ionicLoading.hide();
+	        	$scope.excals = newItem
+	        });
+    	}).error(function(){
+    		$timeout(function(){
+    			$ionicLoading.hide();
+    			var alertPopup = $ionicPopup.alert({
+	            title: '连接超时',
+	            buttons: [
+			       {
+			         text: '<b>确定</b>',
+			         type: 'button-calm',
+			       },
+			     ]
 		        });
-        	}).error(function(){
-        		$timeout(function(){
-        			$ionicLoading.hide();
-        			var alertPopup = $ionicPopup.alert({
-		            title: '连接超时',
-		            buttons: [
-				       {
-				         text: '<b>确定</b>',
-				         type: 'button-calm',
-				       },
-				     ]
-			        });
-        		})
-        	})
-            .finally(function() {
-	              $scope.$broadcast('scroll.refreshComplete');
-            });
+    		})
+    	})
+        .finally(function() {
+              $scope.$broadcast('scroll.refreshComplete');
+        });
 		
 	}
 	$scope.getName = function(name){
@@ -82,6 +82,7 @@ starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$st
     	}).success(function(newItem){
     		$scope.excels = newItem
     	})
+<<<<<<< HEAD
 		$scope.change = function(selectedName){
 			$ionicLoading.show({
 	            template: '加载中...',
@@ -114,6 +115,9 @@ starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$st
 				})
 			})
 		}
+=======
+		
+>>>>>>> ede8857903a17ac912d5c1ef522cf634ae4c137b
     	name = $stateParams.item;
     	$scope.name = name;
     	$ionicLoading.show({
@@ -150,6 +154,41 @@ starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$st
 			})
 		})
     });
+    $scope.change = function(selectedName){
+    	$scope.name = selectedName;
+		$ionicLoading.show({
+            template: '加载中...',
+        });
+    	$http({
+			method:'get',
+			url:config.server+'/data/'+selectedName
+		}).success(function(req){	
+		    $ionicLoading.hide();
+			$timeout(function() {
+		        //tn曲线图参数
+				$scope.item1= req.speed;
+				$scope.data2 = [req.torque,req.v,req.p,req.a,req.efficiency];
+				//五轴图参数
+				$scope.item2 = req.torque;
+				$scope.data3 = [req.speed,req.v,req.p,req.a,req.efficiency];
+				console.log(req)
+			});
+		}).error(function(){
+			$timeout(function(){
+				$ionicLoading.hide();
+				var alertPopup = $ionicPopup.alert({
+	            title: '连接超时',
+	            buttons: [
+			       {
+			         text: '<b>确定</b>',
+			         type: 'button-calm',
+			       },
+			     ]
+		        });
+			})
+		})
+	}
+
 	$scope.tabs = [
 	{"title":"主页","url":"line.html"},
 	{"title":"TN曲线","url":"tn.html"},
@@ -172,7 +211,13 @@ starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$st
     $scope.num = [0,1,2,3,4];
 
 }])
-  
+starter.filter('filet', function () {
+    return function (filepath) {
+        var pos = filepath.replace(".xlsx", "");
+        alert(pos);
+        return pos;
+    };
+}) 
 starter.directive('main', function() {  
     return {  
         scope: {  

+ 1 - 1
yanshi/www/templates/show.html

xqd
@@ -1,4 +1,4 @@
-<ion-view view-title="{{name}}">
+<ion-view view-title="{{name | filet }}">
     <ion-nav-bar class="nav-bar-container" nav-bar-transition="ios" nav-bar-direction="exit" nav-swipe="">
         <ion-nav-buttons side="left">
              <button class="icon ion-chevron-left" style="font-size: 16px;border: none;background: white;" ng-click="go('home')">返回</button>