HomeService.js
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"use strict";
var homeService = angular.module('HomeService',[]);
homeService.service("HomeService", [
'$rootScope',
'BaseService',
function ($rootScope,BaseService) {
var _service = {
onClickShopTypeId:undefined,
userinfo:"",
statistics:"",
getCurrentUserInfo:function() {
BaseService.request({
url:BaseService.url.getCurrentUserInfo_url,
method:'get',
mark:true,
fn:function(response) {
if(response.code == 0) {
_service.userinfo = response.data;
$rootScope.$broadcast('user.info');
}
}
});
},
getStatisticsInfo:function(){
BaseService.request({
url:BaseService.url.statistics_url,
method:'get',
mark:true,
fn:function(response) {
if(response.code == 0) {
_service.statistics = response.data;
$rootScope.$broadcast('statistics.info');
}
}
});
},
getTreeMenu:function(callback) {
BaseService.request({
url:BaseService.url.getTreeMenu_url,
method:'get',
mark:true,
fn:function(response) {
if(response.code == 0) {
callback.call(this,response);
}
}
});
}
}
return _service;
}]);