|
| 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);
|
|
|
}
|
|
|
}
|
|
|
}])
|
|
| xqd
@@ -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,
|
|
| xqd
@@ -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});
|
|
|
}
|
|
|
}])
|
|
| xqd
@@ -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 {
|