diff --git a/public/scripts/controllers/settings-controller.js b/public/scripts/controllers/settings-controller.js index 8c9c6eb..edf2e7a 100644 --- a/public/scripts/controllers/settings-controller.js +++ b/public/scripts/controllers/settings-controller.js @@ -2,7 +2,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$ console.log('Hello settingsCtr......', $stateParams); $scope.forbidQuickKey = dataService.forbidQuickKey - $scope.form = [false, false, false, false]; + $scope.form = [false, false, false, false, false, false]; $scope.passwordOrgin = ""; $scope.passwordNew1 = ""; $scope.passwordNew2 = ""; @@ -16,23 +16,29 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$ $scope.quickUrl = {}; $scope.updateLogs = []; $scope.logsUrl = 'https://github.com/luchenqun/my-bookmark/commits/master'; + $scope.loadingLogs = false; $scope.getUpdateLog = function(url) { - console.log(url); - $scope.updateLogs = []; + if ($scope.updateLogs.length > 0 && url == 'https://github.com/luchenqun/my-bookmark/commits/master') { + toastr.warning('没有更早的日志可供您查看了!', "错误"); + return; + } + + $scope.loadingLogs = true; bookmarkService.getUpdateLog({ url: url }) .then((data) => { - $scope.updateLogs = data.updateLogs; + Array.prototype.push.apply($scope.updateLogs, data.updateLogs); $scope.logsUrl = data.oldUrl; - console.log(data); + $scope.loadingLogs = false; }) .catch((err) => { toastr.error('获取更新日志失败。错误信息:' + JSON.stringify(err), "错误"); + $scope.loadingLogs = false; }); } - + $scope.changeForm = function(index) { console.log("changeForm = ", index); $scope.form = $scope.form.map(() => false); @@ -74,6 +80,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$ } if (index == 5) { + $scope.logsUrl = 'https://github.com/luchenqun/my-bookmark/commits/master' $scope.getUpdateLog($scope.logsUrl); } } @@ -224,7 +231,6 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$ }); $state.go('bookmarks', {}) }, 3000); - }, }); $(".ui.pointing.menu .item").removeClass("selected"); @@ -255,15 +261,5 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$ }); } - transition(); - - function transition() { - var className = 'js-segment-settings'; - $('.' + className).transition('hide'); - $('.' + className).transition({ - animation: dataService.animation(), - duration: 500, - }); - } - + dataService.transition('.js-segment-settings'); }]); diff --git a/public/scripts/controllers/tags-controller.js b/public/scripts/controllers/tags-controller.js index 31a9482..381a9c3 100644 --- a/public/scripts/controllers/tags-controller.js +++ b/public/scripts/controllers/tags-controller.js @@ -4,6 +4,8 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim var perPageItems = 20; var dialog = null; + var forbidTransition = false; + var addBookmarkId = -1; $scope.hoverBookmark = null; $scope.order = [false, false, false]; $scope.order[($stateParams && $stateParams.orderIndex) || 0] = true; @@ -101,7 +103,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim perPageItems: perPageItems, }; - $('.js-tags-table').transition('hide'); bookmarkService.getBookmarksByTag(params) .then((data) => { $scope.bookmarkData = data; @@ -116,11 +117,20 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim login: true, index: dataService.LoginIndexTags }); - transition(); + if (!forbidTransition) { + dataService.transition($scope.showMode == 'item' ? '.js-tag-costomTag' : '.js-tags-table'); + } + $timeout(function() { + dataService.transition('#' + addBookmarkId); + addBookmarkId = -1; + }, 1000); + forbidTransition = false; }) .catch((err) => { console.log('getTags err', err); $scope.loadBookmarks = false; + forbidTransition = false; + addBookmarkId = -1; }); }; @@ -505,8 +515,10 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim if (!find) { if (data.tags.map((tag) => tag.id).indexOf($scope.currentTagId) >= 0) { if (!$scope.editMode) { - $scope.getBookmarks($scope.currentTagId, $scope.currentPage = 1); + $scope.getBookmarks($scope.currentTagId, $scope.currentPage); + forbidTransition = true; } + addBookmarkId = data.id; } } } @@ -546,10 +558,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim } } - function transition() { - dataService.transition($scope.showMode == 'item' ? '.js-tag-costomTag' : '.js-tags-table'); - } - function clickCmp(a, b) { var click1 = parseInt(a.click_count); var click2 = parseInt(b.click_count); diff --git a/public/scripts/services/data-service.js b/public/scripts/services/data-service.js index 03f356c..7e43f31 100644 --- a/public/scripts/services/data-service.js +++ b/public/scripts/services/data-service.js @@ -76,8 +76,9 @@ app.factory('dataService', [function() { } $(selector).transition('hide'); // 不管怎样,先隐藏 - console.log(data); $(selector).transition(data); //这个执行完之后一定是show + + return $(selector).length >= 1; }, historyTypes: ['书签', '谷歌', 'Github', '栈溢出', '百度', '备忘录'], showStyles: ['navigate', 'costomTag', 'card', 'table'], diff --git a/public/views/settings.html b/public/views/settings.html index dff1494..6dacb5b 100644 --- a/public/views/settings.html +++ b/public/views/settings.html @@ -202,9 +202,9 @@
-
-
正在从Github获取提交日志(大概需要30s)。。。
-
+
{{ updateLog.date }}
-