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

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);
$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,20 +16,26 @@ 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;
});
}
@ -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');
}]);

View File

@ -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);

View File

@ -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'],

View File

@ -202,9 +202,9 @@
</div>
<div class="ui container js-p-info" ng-show="form[5]">
<!-- <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 text loader">正在从Github获取提交日志(大概需要30s)。。。</div>
</div>
<!-- <div class="ui active inverted dimmer" ng-class="{active:loadingLogs, disabled: !loadingLogs}">
<div class="ui text loader">正在从Github获取提交日志。。。</div>
</div> -->
<div class="ui message" ng-repeat="updateLog in updateLogs">
<div class="header">{{ updateLog.date }}</div>
<ul class="list" style="cursor: default;">
@ -213,7 +213,8 @@
</li>
</ul>
</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>
</div>