Mike 9 年之前
父節點
當前提交
82cd40086f
共有 4 個文件被更改,包括 138 次插入104 次删除
  1. 39 38
      yanshi/config.xml
  2. 0 0
      yanshi/hooks/after_prepare/010_add_platform_class.js
  3. 91 60
      yanshi/www/js/controllers.js
  4. 8 6
      yanshi/www/templates/show.html

+ 39 - 38
yanshi/config.xml

xqd
@@ -1,43 +1,44 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<?xml version='1.0' encoding='utf-8'?>
 <widget id="com.ionicframework.myapp576034" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
-  <name>myApp</name>
-  <description>
+    <name>myApp</name>
+    <description>
         An Ionic Framework and Cordova project.
     </description>
-  <author email="you@example.com" href="http://example.com/">
+    <author email="you@example.com" href="http://example.com/">
       Your Name Here
     </author>
-  <content src="index.html"/>
-  <access origin="*"/>
-  <preference name="webviewbounce" value="false"/>
-  <preference name="UIWebViewBounce" value="false"/>
-  <preference name="DisallowOverscroll" value="true"/>
-  <preference name="SplashScreenDelay" value="2000"/>
-  <preference name="FadeSplashScreenDuration" value="2000"/>
-  <preference name="android-minSdkVersion" value="16"/>
-  <preference name="BackupWebStorage" value="none"/>
-  <preference name="SplashScreen" value="screen"/>
-  <feature name="StatusBar">
-    <param name="ios-package" value="CDVStatusBar" onload="true"/>
-  </feature>
-  <platform name="android">
-    <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
-    <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
-    <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
-    <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
-    <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
-    <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
-    <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
-    <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
-    <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
-    <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
-    <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
-    <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
-    <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
-    <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
-    <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
-    <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
-    <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
-    <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
-  </platform>
-</widget>
+    <content src="index.html" />
+    <access origin="*" />
+    <preference name="webviewbounce" value="false" />
+    <preference name="UIWebViewBounce" value="false" />
+    <preference name="DisallowOverscroll" value="true" />
+    <preference name="SplashScreenDelay" value="2000" />
+    <preference name="FadeSplashScreenDuration" value="2000" />
+    <preference name="android-minSdkVersion" value="16" />
+    <preference name="BackupWebStorage" value="none" />
+    <preference name="SplashScreen" value="screen" />
+    <feature name="StatusBar">
+        <param name="ios-package" onload="true" value="CDVStatusBar" />
+    </feature>
+    <platform name="android">
+        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
+        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
+        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
+        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
+        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
+        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
+        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
+        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
+        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
+        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
+        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
+        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
+        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
+        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
+        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
+        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
+        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
+        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
+    </platform>
+    <plugin name="cordova-plugin-device" spec="~1.1.4" />
+</widget>

+ 0 - 0
yanshi/hooks/after_prepare/010_add_platform_class.js


+ 91 - 60
yanshi/www/js/controllers.js

xqd xqd xqd xqd
@@ -7,23 +7,31 @@ starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$i
 	};
 	$scope.login = function(){
 		if($scope.vm.username == 'admin' && $scope.vm.password == 'admin'){
-			$ionicLoading.show({
-            template: '<div class="loader"><svg class="circular"><circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/></svg></div>'
-        });
-        $timeout(function(){
-        	$ionicLoading.hide();
-        	$state.go('home')
-        },1500);
-			
+
+        	$state.go('home');
+
+			// $ionicLoading.show({
+            // template: '<div class="loader"><svg class="circular"><circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/></svg></div>'
+	        // });
+	        // $timeout(function(){
+	        // 	$ionicLoading.hide();
+	        // },1500);
+				
 		}else{
 			var alertPopup = $ionicPopup.alert({
             title: '账号密码不正确',
-            template: '唯一账号密码:admin!!!'
-        });
+            template: '唯一账号密码:admin!!!',
+            buttons: [
+		       {
+		         text: '<b>确定</b>',
+		         type: 'button-calm',
+		       },
+		     ]
+	        });
 
-        $timeout(function() {
-            ionicMaterialInk.displayEffect();
-        }, 0);
+	        // $timeout(function() {
+	        //     ionicMaterialInk.displayEffect();
+	        // }, 0);
 		}
 	}	
 }])
@@ -38,7 +46,7 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading','$sta
     
 	$scope.doRefresh = function(){
 		$ionicLoading.show({
-            tcontent: 'Loading',
+            template: '加载中...',
 		    animation: 'fade-in',
 		    showBackdrop: true,
 		    maxWidth: 200,
@@ -60,8 +68,8 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading','$sta
 	}
 	
 
-		$scope.getName = function(item){
-			name = this.$$watchers[0].last;
+		$scope.getName = function(name){
+			// name = this.$$watchers[0].last;
 			$state.go('show',{item:name});
 	}
 }])
@@ -69,54 +77,77 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading','$sta
 	
 
 //数据展示控制器
-starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$http',function($scope,$ionicHistory,$state,$http){
-		$scope.tabs = [{"title":"主页","url":"line.html"},
-		{"title":"TN曲线","url":"tn.html"},
-		{"title":"五轴图","url":"zhou.html"},
-		{"title":"效率云图","url":"strom.html"}];
-		$scope.name = name;
-		$scope.currentTab = 'line.html';
-		$scope.go = function(result){
-			$state.go(result)
-		};
-		$scope.isActiveTab = function(tabUrl){
-			return tabUrl == $scope.currentTab;
-		};
-		$scope.onClickTab = function(tab){
-			$scope.currentTab = tab.url;
-			$http({
-				method:'get',
-				url:'http://172.31.40.29/data/'+name
-			}).success(function(req){
+starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$stateParams','$http',function($scope,$ionicHistory,$state,$timeout,$stateParams,$http){
+    $scope.$on('$ionicView.beforeEnter', function () {
+    	name = $stateParams.item;
+    	$scope.name = name;
+    	$ionicLoading.show({
+            template: '加载中...',
+		    animation: 'fade-in',
+		    showBackdrop: true,
+		    maxWidth: 200,
+		    showDelay: 0 
+        });
+    	$http({
+			method:'get',
+			url:'http://172.31.40.29/data/'+name
+		}).success(function(req){
+			$timeout(function() {
+		        $ionicLoading.hide();
 				$scope.item= req.speed;
 				$scope.data = [req.torque,req.v,req.p,req.a,req.efficiency];
 				$scope.item1 = req.torque;
 				$scope.data1 = [req.speed,req.v,req.p,req.a,req.efficiency];
-			})
-		};
-		//TN曲线图
-		$scope.legend = ["扭矩", "电压",'输入功率','电流','效率'];  
-		$scope.legend1 = ["转速", "电压",'输入功率','电流','效率'];  
-	   
-	    $scope.item = ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm','2400rpm']; 
-	    $scope.item1 = [0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5];
-	    $scope.num = [0,1,2,3,4];
-	    $scope.data = [  
-	        [1,1,1,1,1,1,1,1,1,1,1,1], //扭矩  
-	        [196,196,196,196,196,196,196,196,196,196,196,196,], //电压 
-	        [500,500,500,500,500,500,500,500,500,500,500,500,],    //输入功率  
-	        [4,4,4,4,4,4,4,4,4,4,4,4],   //电流
-	        [68,68,68,68,68,68,68,68,68,68,68,68,]//效率
-	    ]; 
-	     $scope.data1 = [  
-	        [800,800,800,800,800,800,800,800,800,800,800,800], //转速  
-	        [196,196,196,196,196,196,196,196,196,196,196,196,], //电压 
-	        [500,500,500,500,500,500,500,500,500,500,500,500,],    //输入功率  
-	        [4,4,4,4,4,4,4,4,4,4,4,4],   //电流
-	        [68,68,68,68,68,68,68,68,68,68,68,68,]//效率
-	    ];
-			
-	}])
+			});
+		})
+    });
+	$scope.tabs = [
+	{"title":"主页","url":"line.html"},
+	{"title":"TN曲线","url":"tn.html"},
+	{"title":"五轴图","url":"zhou.html"},
+	{"title":"效率云图","url":"strom.html"}];
+	
+	$scope.currentTab = 'line.html';
+	$scope.go = function(result){
+		$state.go(result)
+	};
+	$scope.isActiveTab = function(tabUrl){
+		return tabUrl == $scope.currentTab;
+	};
+	$scope.onClickTab = function(tab){
+		$scope.currentTab = tab.url;
+		// $http({
+		// 	method:'get',
+		// 	url:'http://172.31.40.29/data/'+name
+		// }).success(function(req){
+		// 	$scope.item= req.speed;
+		// 	$scope.data = [req.torque,req.v,req.p,req.a,req.efficiency];
+		// 	$scope.item1 = req.torque;
+		// 	$scope.data1 = [req.speed,req.v,req.p,req.a,req.efficiency];
+		// })
+	};
+	//TN曲线图
+	$scope.legend = ["扭矩", "电压",'输入功率','电流','效率'];  
+	$scope.legend1 = ["转速", "电压",'输入功率','电流','效率'];  
+   
+    $scope.item = ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm','2400rpm']; 
+    $scope.item1 = [0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5];
+    $scope.num = [0,1,2,3,4];
+    $scope.data = [  
+        [1,1,1,1,1,1,1,1,1,1,1,1], //扭矩  
+        [196,196,196,196,196,196,196,196,196,196,196,196,], //电压 
+        [500,500,500,500,500,500,500,500,500,500,500,500,],    //输入功率  
+        [4,4,4,4,4,4,4,4,4,4,4,4],   //电流
+        [68,68,68,68,68,68,68,68,68,68,68,68,]//效率
+    ]; 
+     $scope.data1 = [  
+        [800,800,800,800,800,800,800,800,800,800,800,800], //转速  
+        [196,196,196,196,196,196,196,196,196,196,196,196,], //电压 
+        [500,500,500,500,500,500,500,500,500,500,500,500,],    //输入功率  
+        [4,4,4,4,4,4,4,4,4,4,4,4],   //电流
+        [68,68,68,68,68,68,68,68,68,68,68,68,]//效率
+    ];
+}])
   
 starter.directive('main', function() {  
     return {  

+ 8 - 6
yanshi/www/templates/show.html

xqd
@@ -1,10 +1,12 @@
-<ion-view>
-	<div class="bar bar-header">
-	  <button class="icon ion-chevron-left" style="font-size: 16px;border: none;background: white;" ng-click="go('home')">返回</button>
-	  <h1 class="title">{{name}}</h1>
-	</div>
+<ion-view view-title="{{name}}">
+    <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>
+        </ion-nav-buttons>
+    </ion-nav-bar>
+
 	<ion-content overflow-scroll="true" style="overflow: hidden;" class="has-header">
-			<div ng-include="currentTab"></div>
+		<div ng-include="currentTab"></div>
 		<div class="tabs">
 		  <a ng-repeat="tab in tabs" class="tab-item" 
 		  	ng-class="{active:isActiveTab(tab.url)}"