fix(core): fixed home page warning issue

This commit is contained in:
OldHawk
2017-12-09 23:13:08 +08:00
parent 0d34e33c14
commit 4195a6059a
4 changed files with 48 additions and 47 deletions

View File

@@ -5,10 +5,10 @@
.module('core')
.controller('HeaderController', HeaderController);
HeaderController.$inject = ['$scope', '$state', '$stateParams', '$translate', 'Authentication', 'menuService', 'MeanTorrentConfig', 'localStorageService',
HeaderController.$inject = ['$scope', '$state', '$timeout', '$translate', 'Authentication', 'menuService', 'MeanTorrentConfig', 'localStorageService',
'ScoreLevelService', 'InvitationsService', '$interval', 'MessagesService', 'TorrentsService', 'UsersService', 'DebugConsoleService'];
function HeaderController($scope, $state, $stateParams, $translate, Authentication, menuService, MeanTorrentConfig, localStorageService, ScoreLevelService,
function HeaderController($scope, $state, $timeout, $translate, Authentication, menuService, MeanTorrentConfig, localStorageService, ScoreLevelService,
InvitationsService, $interval, MessagesService, TorrentsService, UsersService, mtDebug) {
var vm = this;
vm.user = Authentication.user;
@@ -30,6 +30,19 @@
$scope.$on('$stateChangeSuccess', stateChangeSuccess);
$(document).ready(function () {
$('#warning_popup').popup({
outline: false,
focusdelay: 400,
vertical: 'top',
autoopen: false,
opacity: 0.6,
closetransitionend: function () {
$('.popup_wrapper').remove();
}
});
});
/**
* auth-user-changed
*/
@@ -74,6 +87,25 @@
}
};
/**
* getWarningInfo
*/
vm.getWarningInfo = function () {
var sw = localStorageService.get('showed_warning');
if (vm.appConfig.showDemoWarningPopup && !sw) {
$timeout(function () {
$('#warning_popup').popup('show');
//$('.warning_popup_open').trigger('click');
//angular.element('#myselector').triggerHandler('click');
}, 300);
localStorageService.set('showed_warning', true);
}
if (sw) {
$('.popup_wrapper').remove();
}
};
/**
* checkMessageUnread
*/