去掉复制按钮,同时更新一下详情逻辑

This commit is contained in:
luchenqun 2017-02-27 14:44:08 +08:00
parent 1117c89a99
commit 3059b18bf8
8 changed files with 24 additions and 23 deletions

View File

@ -1,4 +1,4 @@
app.controller('bookmarkInfoCtr', ['$scope', '$state', '$timeout', '$sce', 'bookmarkService', 'pubSubService', function($scope, $state, $timeout, $sce, bookmarkService, pubSubService) {
app.controller('bookmarkInfoCtr', ['$scope', '$state', '$timeout', '$sce', '$window', '$filter', 'bookmarkService', 'pubSubService', function($scope, $state, $timeout, $sce, $window, $filter, bookmarkService, pubSubService) {
console.log("Hello bookmarkInfoCtr");
$scope.bookmark = {}
$scope.content = '';
@ -6,7 +6,9 @@ app.controller('bookmarkInfoCtr', ['$scope', '$state', '$timeout', '$sce', 'book
pubSubService.subscribe('TagCtr.showBookmarkInfo', $scope, function(event, bookmark) {
console.log('subscribe TagCtr.showBookmarkInfo', bookmark);
$('.ui.modal.js-bookmark-info').modal('show');
$('.ui.modal.js-bookmark-info').modal({
closable: false,
}).modal('show');
$scope.bookmark = bookmark;
$scope.content = '';
var params = {
@ -17,7 +19,7 @@ app.controller('bookmarkInfoCtr', ['$scope', '$state', '$timeout', '$sce', 'book
bookmarkService.getArticle(params)
.then((data) => {
$scope.content = data.content ? $sce.trustAsHtml(data.content) : $sce.trustAsHtml('<p>数据获取失败可能是服务器不允许获取或者是https网站</p>');
setTimeout(function(){
setTimeout(function() {
$('.ui.modal.js-bookmark-info').modal("refresh");
}, 100);
$scope.loading = false;
@ -27,4 +29,15 @@ app.controller('bookmarkInfoCtr', ['$scope', '$state', '$timeout', '$sce', 'book
$scope.loading = false;
})
});
$scope.jumpToUrl = function(url, id) {
$window.open(url, '_blank');
if ($scope.bookmark.own) {
bookmarkService.clickBookmark({
id: id
});
$scope.bookmark.click_count += 1;
$scope.bookmark.last_click = $filter("date")(new Date(), "yyyy-MM-dd");
}
}
}]);

View File

@ -87,7 +87,7 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
$scope.detailBookmark = function(b) {
var bookmark = $.extend(true, {}, b); // 利用jQuery执行深度拷贝
console.log(JSON.stringify(bookmark), ' ddddd ', JSON.stringify(b));
bookmark.own = true;
if ($scope.showStyle == 'navigate') {
bookmark.last_click = bookmark.last_click.substring(0, 10);
bookmark.created_at = bookmark.created_at.substring(0, 10);
@ -104,9 +104,6 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
id: bookmark.id
});
}
$scope.copyBookmark = function(bookmarkUrl) {
toastr.warning('功能暂未实现。。。', "警告");
}
$scope.jumpToTags = function(tagId) {
$state.go('tags', {

View File

@ -98,10 +98,6 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
pubSubService.publish('TagCtr.showBookmarkInfo', bookmark);
}
$scope.copyBookmark = function(bookmarkUrl) {
toastr.warning('功能暂未实现。。。', "警告");
}
$scope.search = function() {
var params = {}
params.userRange = $('.js-user-range').dropdown('get value');

View File

@ -118,16 +118,13 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
}
$scope.detailBookmark = function(bookmark) {
bookmark.own = true;
pubSubService.publish('TagCtr.showBookmarkInfo', bookmark);
bookmarkService.clickBookmark({
id: bookmark.id
});
}
$scope.copyBookmark = function(bookmarkUrl) {
toastr.warning('功能暂未实现。。。', "警告");
}
$scope.toggleMode = function() {
$scope.edit = !$scope.edit;
if (!$scope.edit) {

View File

@ -13,7 +13,7 @@
<div class="ui vertically divided grid">
<div class="one column row">
<div class="column">
<i class="internet explorer icon"></i>网页地址:{{bookmark.url}}
<i class="internet explorer icon" ng-click="jumpToUrl(bookmark.url, bookmark.id)" style="cursor:pointer;"></i><span ng-click="jumpToUrl(bookmark.url, bookmark.id)" style="cursor:pointer;">网页地址</span>{{bookmark.url}}
</div>
</div>
<div class="two column row">
@ -59,6 +59,7 @@
</div>
</div>
<div class="actions">
<button class="positive ui right button">确定</button>
<div class="ui right button" ng-click="jumpToUrl(bookmark.url, bookmark.id)">跳转到原页面</div>
<button class="positive ui right button">关闭页面</button>
</div>
</div>

View File

@ -50,7 +50,7 @@
<th style="width:100px;">创建日期</th>
<th style="width:100px;">最后点击</th>
<th style="width:150px;">分类</th>
<th style="width:105px;">操作</th>
<th style="width:88px;">操作</th>
</tr>
</thead>
<tbody>
@ -76,7 +76,6 @@
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/delete.png" ng-click="delBookmark(bookmark)" title="删除书签">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/edit-bookmark.png" ng-click="editBookmark(bookmark.id)" title="编辑书签">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/detail.png" ng-click="detailBookmark(bookmark)" title="书签详情">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/copy.png" ng-click="copyBookmark(bookmark.url)" title="复制书签">
</td>
</tr>
</tbody>

View File

@ -124,7 +124,7 @@
<th style="width:100px;">创建日期</th>
<th style="width:100px;">最后点击</th>
<th style="width:150px;">分类</th>
<th style="width:105px;">操作</th>
<th style="width:88px;">操作</th>
</tr>
</thead>
<tbody>
@ -154,7 +154,6 @@
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/edit-bookmark.png" ng-click="editBookmark(bookmark.id)" title="编辑书签">
</span>
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/detail.png" ng-click="detailBookmark(bookmark)" title="书签详情">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/copy.png" ng-click="copyBookmark(bookmark.url)" title="复制链接">
</td>
</tr>
</tbody>

View File

@ -54,7 +54,7 @@
<th style="width:100px;">创建日期</th>
<th style="width:100px;">最后点击</th>
<th style="width:150px;">分类</th>
<th style="width:105px;">操作</th>
<th style="width:88px;">操作</th>
</tr>
</thead>
<tbody>
@ -80,7 +80,6 @@
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/delete.png" ng-click="delBookmark(bookmark)" title="删除书签">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/edit-bookmark.png" ng-click="editBookmark(bookmark.id)" title="编辑书签">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/detail.png" ng-click="detailBookmark(bookmark)" title="书签详情">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/copy.png" ng-click="copyBookmark(bookmark.url)" title="复制书签">
</td>
</tr>
</tbody>