更新一下日志显示方式,优化一下分类页面书签添加的显示。

This commit is contained in:
luchenqun 2017-06-24 20:26:07 +08:00
parent a0bf765f82
commit fb7e52152d
4 changed files with 36 additions and 30 deletions

View File

@ -2,7 +2,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
console.log('Hello settingsCtr......', $stateParams); console.log('Hello settingsCtr......', $stateParams);
$scope.forbidQuickKey = dataService.forbidQuickKey $scope.forbidQuickKey = dataService.forbidQuickKey
$scope.form = [false, false, false, false]; $scope.form = [false, false, false, false, false, false];
$scope.passwordOrgin = ""; $scope.passwordOrgin = "";
$scope.passwordNew1 = ""; $scope.passwordNew1 = "";
$scope.passwordNew2 = ""; $scope.passwordNew2 = "";
@ -16,20 +16,26 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
$scope.quickUrl = {}; $scope.quickUrl = {};
$scope.updateLogs = []; $scope.updateLogs = [];
$scope.logsUrl = 'https://github.com/luchenqun/my-bookmark/commits/master'; $scope.logsUrl = 'https://github.com/luchenqun/my-bookmark/commits/master';
$scope.loadingLogs = false;
$scope.getUpdateLog = function(url) { $scope.getUpdateLog = function(url) {
console.log(url); if ($scope.updateLogs.length > 0 && url == 'https://github.com/luchenqun/my-bookmark/commits/master') {
$scope.updateLogs = []; toastr.warning('没有更早的日志可供您查看了!', "错误");
return;
}
$scope.loadingLogs = true;
bookmarkService.getUpdateLog({ bookmarkService.getUpdateLog({
url: url url: url
}) })
.then((data) => { .then((data) => {
$scope.updateLogs = data.updateLogs; Array.prototype.push.apply($scope.updateLogs, data.updateLogs);
$scope.logsUrl = data.oldUrl; $scope.logsUrl = data.oldUrl;
console.log(data); $scope.loadingLogs = false;
}) })
.catch((err) => { .catch((err) => {
toastr.error('获取更新日志失败。错误信息:' + JSON.stringify(err), "错误"); toastr.error('获取更新日志失败。错误信息:' + JSON.stringify(err), "错误");
$scope.loadingLogs = false;
}); });
} }
@ -74,6 +80,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
} }
if (index == 5) { if (index == 5) {
$scope.logsUrl = 'https://github.com/luchenqun/my-bookmark/commits/master'
$scope.getUpdateLog($scope.logsUrl); $scope.getUpdateLog($scope.logsUrl);
} }
} }
@ -224,7 +231,6 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
}); });
$state.go('bookmarks', {}) $state.go('bookmarks', {})
}, 3000); }, 3000);
}, },
}); });
$(".ui.pointing.menu .item").removeClass("selected"); $(".ui.pointing.menu .item").removeClass("selected");
@ -255,15 +261,5 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
}); });
} }
transition(); dataService.transition('.js-segment-settings');
function transition() {
var className = 'js-segment-settings';
$('.' + className).transition('hide');
$('.' + className).transition({
animation: dataService.animation(),
duration: 500,
});
}
}]); }]);

View File

@ -4,6 +4,8 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
var perPageItems = 20; var perPageItems = 20;
var dialog = null; var dialog = null;
var forbidTransition = false;
var addBookmarkId = -1;
$scope.hoverBookmark = null; $scope.hoverBookmark = null;
$scope.order = [false, false, false]; $scope.order = [false, false, false];
$scope.order[($stateParams && $stateParams.orderIndex) || 0] = true; $scope.order[($stateParams && $stateParams.orderIndex) || 0] = true;
@ -101,7 +103,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
perPageItems: perPageItems, perPageItems: perPageItems,
}; };
$('.js-tags-table').transition('hide');
bookmarkService.getBookmarksByTag(params) bookmarkService.getBookmarksByTag(params)
.then((data) => { .then((data) => {
$scope.bookmarkData = data; $scope.bookmarkData = data;
@ -116,11 +117,20 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
login: true, login: true,
index: dataService.LoginIndexTags 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) => { .catch((err) => {
console.log('getTags err', err); console.log('getTags err', err);
$scope.loadBookmarks = false; $scope.loadBookmarks = false;
forbidTransition = false;
addBookmarkId = -1;
}); });
}; };
@ -505,8 +515,10 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
if (!find) { if (!find) {
if (data.tags.map((tag) => tag.id).indexOf($scope.currentTagId) >= 0) { if (data.tags.map((tag) => tag.id).indexOf($scope.currentTagId) >= 0) {
if (!$scope.editMode) { 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) { function clickCmp(a, b) {
var click1 = parseInt(a.click_count); var click1 = parseInt(a.click_count);
var click2 = parseInt(b.click_count); var click2 = parseInt(b.click_count);

View File

@ -76,8 +76,9 @@ app.factory('dataService', [function() {
} }
$(selector).transition('hide'); // 不管怎样,先隐藏 $(selector).transition('hide'); // 不管怎样,先隐藏
console.log(data);
$(selector).transition(data); //这个执行完之后一定是show $(selector).transition(data); //这个执行完之后一定是show
return $(selector).length >= 1;
}, },
historyTypes: ['书签', '谷歌', 'Github', '栈溢出', '百度', '备忘录'], historyTypes: ['书签', '谷歌', 'Github', '栈溢出', '百度', '备忘录'],
showStyles: ['navigate', 'costomTag', 'card', 'table'], showStyles: ['navigate', 'costomTag', 'card', 'table'],

View File

@ -202,9 +202,9 @@
</div> </div>
<div class="ui container js-p-info" ng-show="form[5]"> <div class="ui container js-p-info" ng-show="form[5]">
<!-- <h3 class="ui dividing header">更新日志</h3> --> <!-- <h3 class="ui dividing header">更新日志</h3> -->
<div class="ui active inverted dimmer" ng-class="{active:updateLogs.length==0, disabled: updateLogs.length>0}"> <!-- <div class="ui active inverted dimmer" ng-class="{active:loadingLogs, disabled: !loadingLogs}">
<div class="ui text loader">正在从Github获取提交日志(大概需要30s)。。。</div> <div class="ui text loader">正在从Github获取提交日志。。。</div>
</div> </div> -->
<div class="ui message" ng-repeat="updateLog in updateLogs"> <div class="ui message" ng-repeat="updateLog in updateLogs">
<div class="header">{{ updateLog.date }}</div> <div class="header">{{ updateLog.date }}</div>
<ul class="list" style="cursor: default;"> <ul class="list" style="cursor: default;">
@ -213,7 +213,8 @@
</li> </li>
</ul> </ul>
</div> </div>
<button class="fluid ui button" ng-click='getUpdateLog(logsUrl)' ng-show="updateLogs.length>0"> <div ng-show="loadingLogs"><img class="ui centered medium image" src="/images/loading.gif"></div>
<button class="fluid ui button" ng-click='getUpdateLog(logsUrl)' ng-show="!loadingLogs">
更早日志 更早日志
</button> </button>
</div> </div>