HomeController.js
1.4 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
"use strict";
var homeController = angular.module('homeController',[]);
homeController.controller('homeController', [
'$rootScope',
'$scope',
'HomeService',
function($rootScope,$scope,HomeService) {
$scope.menus = {};
HomeService.getTreeMenu(function(res) {
$scope.menus = res.data;
});
HomeService.getCurrentUserInfo();
$scope.$on('user.info', function() {
$scope.userinfo = HomeService.userinfo;
if(HomeService.userinfo.platformFlag == false){
$scope.platformType = 1; //商家
}else {
$scope.platformType = 0;
}
});
$scope.$on('ngRepeatFinished', function (ngRepeatFinishedEvent) {
jQuery('.vernav > ul li a, .vernav2 > ul li a').each(function(){
var url = jQuery(this).attr('rhref');
jQuery(this).click(function(){
console.log(url);
if(jQuery(url).length > 0) {
if(jQuery(url).is(':visible')) {
if(!jQuery(this).parents('div').hasClass('menucoll') &&
!jQuery(this).parents('div').hasClass('menucoll2'))
jQuery(url).slideUp();
} else {
jQuery('.vernav ul ul, .vernav2 ul ul').each(function(){
jQuery(this).slideUp();
});
if(!jQuery(this).parents('div').hasClass('menucoll') &&
!jQuery(this).parents('div').hasClass('menucoll2'))
jQuery(url).slideDown();
}
return false;
}
});
});
});
}]
);