HomeController.js 1.4 KB
"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;
    				}
    			});
    		});
		});
	}]
);