var homeApp = angular.module('timehr.homeServer', []);

//本地测试 homeApp.constant("dataURL",'http://192.168.7.157/sunyang/test.php/Weixinajax');  //定义常量
homeApp.constant("dataURL",'http://tjd.timehr.com/test.php/Weixinajax'); 
homeApp.factory('jobFactory',function ($rootScope,$timeout,$ionicLoading,$ionicPopup,jobService) {
	return{
		joblistFactory:function(pid) {
			
			$ionicLoading.show({
					template: "正在载入数据，请稍后...",
					duration:2000
				});
		    jobService.joblist(pid).success(function (data,status,config) {
		   		$rootScope.datas = data; //输出数组
		   		
		    }).error(function() {
		   		$ionicLoading.hide();
		   		$ionicPopup.alert({
					title: "警告",
					template: "网络连接状态不太好,请重新连接"
				})
		   	})
		   	$ionicLoading.hide(); //消失载入loading示意图
		},
		job_idFactory:function(id) {

		    jobService.job_id(id).success(function (data,status,config) {
		   		//console.log(config);
		   		$rootScope.user = data; //输出数组
		    }).error(function() {
		   		$ionicLoading.hide();
		   		$ionicPopup.alert({
					title: "警告",
					template: "网络连接状态不太好,请重新连接"
				})
		   	});

		},
		user_imgFactory:function(pid) {
			jobService.user_img(pid).success(function (data,status,config) {
				$rootScope.user_img = data;
			}).error(function() {
				//错误代码
			})
		},
		job_showFactory:function(id) {
			jobService.job_show(id).success(function (data,status,config) {
				$rootScope.jobdata = data;
				$rootScope.newUser = {'pid':data['pid'],'jobname':data['jobtitle']};
				//console.log(data);
			}).error(function () {
				//错误代码
			})
		}
	}

})
.service('jobService',function ($http,$log,dataURL) {  //在参数中加入常量dataURL
	this.joblist = function (pid) {
		var URL = dataURL+'/home/pid/'+pid;  //常量执行
		return $http.get(URL,{cache:true});
	},
	this.job_id = function (pid) {
		var URL = dataURL+'/userId/id/'+pid;
		return $http.get(URL,{cache:true});
	}
	this.user_img = function(pid) {
		var URL = dataURL+'/user_img/id/'+pid;
		return $http.get(URL,{cache:true});
	}
	this.job_show = function (id) {
		var URL = dataURL+'/job_show/id/'+id;
		return $http.get(URL,{cache:true});
	}
});
@@ -1300,24 +1300,107 @@
 ction(id) %7B%0A
+%09%09%09$ionicLoading.show(%7B%0A%09%09%09%09%09template: %22%E6%AD%A3%E5%9C%A8%E8%BD%BD%E5%85%A5%E6%95%B0%E6%8D%AE%EF%BC%8C%E8%AF%B7%E7%A8%8D%E5%90%8E...%22,%0A%09%09%09%09%09duration:2000%0A%09%09%09%09%7D);%0A
 %09%09%09jobServic
@@ -1558,16 +1558,42 @@
 tle'%5D%7D;%0A
+%09%09%09%09$ionicLoading.hide();%0A
 %09%09%09%09//co

add loadding img