将删除做了一下动画

This commit is contained in:
luchenqun 2017-03-02 22:46:25 +08:00
parent 2eaea860c3
commit 7909209042
10 changed files with 241 additions and 55 deletions

View File

@ -679,6 +679,20 @@ db.getTagsBookmarks = function(bookmark_ids) {
}); });
} }
db.getActiveUsers = function() {
var sql = " (SELECT username, DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') as created_at, DATE_FORMAT(last_login, '%Y-%m-%d %H:%i:%s') as last_login, email FROM users ORDER BY last_login DESC LIMIT 0, 5) UNION (SELECT username, DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') as created_at, DATE_FORMAT(last_login, '%Y-%m-%d %H:%i:%s') as last_login, email FROM users ORDER BY created_at DESC LIMIT 0, 5)";
console.log('getActiveUsers', sql);
return new Promise(function(resolve, reject) {
client.query(sql, (err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
}
db.getBookmarks = function() { db.getBookmarks = function() {
var sql = "SELECT id, snap_state FROM `bookmarks`"; // 如果是空的,那查一个不存在的就行了。 var sql = "SELECT id, snap_state FROM `bookmarks`"; // 如果是空的,那查一个不存在的就行了。
console.log('getBookmarks', sql); console.log('getBookmarks', sql);

View File

@ -71,7 +71,13 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
ngDialog.close(dialog); ngDialog.close(dialog);
bookmarkService.delBookmark(params) bookmarkService.delBookmark(params)
.then((data) => { .then((data) => {
$("#" + bookmarkId).remove(); $("#" + bookmarkId).transition({
animation: animation(),
duration: 500,
onComplete: function() {
$("#" + bookmarkId).remove();
}
});
toastr.success($scope.waitDelBookmark.title + ' 书签删除成功!', "提示"); toastr.success($scope.waitDelBookmark.title + ' 书签删除成功!', "提示");
}) })
.catch((err) => { .catch((err) => {

View File

@ -101,7 +101,7 @@ app.controller('editCtr', ['$scope', '$state', '$timeout', 'bookmarkService', 'p
$('.ui.modal.js-add-bookmark').modal('hide'); $('.ui.modal.js-add-bookmark').modal('hide');
pubSubService.publish('EditCtr.inserBookmarsSuccess', data); pubSubService.publish('EditCtr.inserBookmarsSuccess', data);
if (data.title) { if (data.title) {
toastr.success('[ ' + data.title + ' ] 添加成功', "提示"); toastr.success('[ ' + data.title + ' ] 添加成功,将自动重新更新书签!', "提示");
} else { } else {
toastr.error('[ ' + params.title + ' ] 添加失败', "提示"); toastr.error('[ ' + params.title + ' ] 添加失败', "提示");
} }
@ -115,7 +115,7 @@ app.controller('editCtr', ['$scope', '$state', '$timeout', 'bookmarkService', 'p
.then((data) => { .then((data) => {
$('.ui.modal.js-add-bookmark').modal('hide'); $('.ui.modal.js-add-bookmark').modal('hide');
pubSubService.publish('EditCtr.inserBookmarsSuccess', data); pubSubService.publish('EditCtr.inserBookmarsSuccess', data);
toastr.success('[ ' + params.title + ' ] 更新成功', "提示"); toastr.success('[ ' + params.title + ' ] 更新成功,将自动重新更新书签!', "提示");
}) })
.catch((err) => { .catch((err) => {
console.log('updateBookmark err', err); console.log('updateBookmark err', err);

View File

@ -85,7 +85,13 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
ngDialog.close(dialog); ngDialog.close(dialog);
bookmarkService.delBookmark(params) bookmarkService.delBookmark(params)
.then((data) => { .then((data) => {
$("#" + bookmarkId).remove(); $("#" + bookmarkId).transition({
animation: animation(),
duration: 500,
onComplete: function() {
$("#" + bookmarkId).remove();
}
});
toastr.success($scope.waitDelBookmark.title + ' 书签删除成功!', "提示"); toastr.success($scope.waitDelBookmark.title + ' 书签删除成功!', "提示");
}) })
.catch((err) => { .catch((err) => {
@ -109,7 +115,7 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
} }
$scope.copy = function(id, url) { $scope.copy = function(id, url) {
var clipboard = new Clipboard('#searchurl'+id, { var clipboard = new Clipboard('#searchurl' + id, {
text: function() { text: function() {
return url; return url;
} }
@ -208,17 +214,21 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
}); });
} }
function transition() { function animation() {
var data = ['scale', 'fade', 'fade up', 'fade down', 'fade left', 'fade right', 'horizontal flip', var data = ['scale', 'fade', 'fade up', 'fade down', 'fade left', 'fade right', 'horizontal flip',
'vertical flip', 'drop', 'fly left', 'fly right', 'fly up', 'fly down', 'swing left', 'swing right', 'swing up', 'vertical flip', 'drop', 'fly left', 'fly right', 'fly up', 'fly down', 'swing left', 'swing right', 'swing up',
'swing down', 'browse', 'browse right', 'slide down', 'slide up', 'slide left', 'slide right' 'swing down', 'browse', 'browse right', 'slide down', 'slide up', 'slide left', 'slide right'
]; ];
var t = data[parseInt(Math.random() * 1000) % data.length]; var t = data[parseInt(Math.random() * 1000) % data.length];
return t;
}
function transition() {
var className = 'js-table-search'; var className = 'js-table-search';
$('.' + className).transition('hide'); $('.' + className).transition('hide');
$('.' + className).transition({ $('.' + className).transition({
animation: t, animation: animation(),
duration: 500, duration: 500,
}); });
} }

View File

@ -4,12 +4,36 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
$scope.passwordOrgin = ""; $scope.passwordOrgin = "";
$scope.passwordNew1 = ""; $scope.passwordNew1 = "";
$scope.passwordNew2 = ""; $scope.passwordNew2 = "";
$scope.user = {};
$scope.tagCnt = 0;
$scope.bookmarkCnt = 0;
$scope.form[($stateParams && $stateParams.formIndex) || 0] = true; $scope.form[($stateParams && $stateParams.formIndex) || 0] = true;
$scope.changeForm = function(index) { $scope.changeForm = function(index) {
$scope.form = $scope.form.map(() => false); $scope.form = $scope.form.map(() => false);
$scope.form[index] = true; $scope.form[index] = true;
if (index == 1) {
bookmarkService.userInfo({})
.then((data) => {
$scope.user = data;
})
.catch((err) => {
toastr.error('获取信息失败。错误信息:' + JSON.stringify(err), "错误");
});
bookmarkService.getTags({})
.then((data) => {
$scope.tagCnt = data.length;
$scope.bookmarkCnt = 0;
data.forEach((tag) => {
$scope.bookmarkCnt += tag.cnt;
})
})
.catch((err) => {
console.log('getTags err', err);
});
}
} }
$scope.resetPassword = function() { $scope.resetPassword = function() {

View File

@ -91,6 +91,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
$scope.delBookmark = function(bookmark) { $scope.delBookmark = function(bookmark) {
$scope.waitDelBookmark = $.extend(true, {}, bookmark); // 利用jQuery执行深度拷贝 $scope.waitDelBookmark = $.extend(true, {}, bookmark); // 利用jQuery执行深度拷贝
console.log(JSON.stringify(bookmark));
dialog = ngDialog.open({ dialog = ngDialog.open({
template: './views/dialog-del-bookmark.html', template: './views/dialog-del-bookmark.html',
className: 'ngdialog-theme-default', className: 'ngdialog-theme-default',
@ -105,7 +106,21 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
ngDialog.close(dialog); ngDialog.close(dialog);
bookmarkService.delBookmark(params) bookmarkService.delBookmark(params)
.then((data) => { .then((data) => {
$("#" + bookmarkId).remove(); $("#" + bookmarkId).transition({
animation: animation(),
duration: 500,
onComplete: function() {
$("#" + bookmarkId).remove();
}
});
// 更新分类里面含有书签的数量
$scope.tags.forEach((t1) => {
$scope.waitDelBookmark.tags.forEach((t2) => {
if (t1.id == t2.id) {
t1.cnt--;
}
})
})
toastr.success($scope.waitDelBookmark.title + ' 书签删除成功!', "提示"); toastr.success($scope.waitDelBookmark.title + ' 书签删除成功!', "提示");
}) })
.catch((err) => { .catch((err) => {
@ -150,7 +165,17 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
if (!$scope.editMode) { if (!$scope.editMode) {
getTags({}); getTags({});
} else { } else {
$('.js-edit').transition('hide'); // 没装完逼之前,不允许切换编辑模式,否则动画模式乱了。
$('.js-tags-table').transition('hide'); $('.js-tags-table').transition('hide');
$('.stackable.cards .card').transition('hide');
$('.stackable.cards .card').transition({
animation: animation(),
reverse: 'auto', // default setting
interval: 50,
onComplete: function() {
$('.js-edit').transition('show');
}
});
} }
updateEditPos(); updateEditPos();
} }
@ -200,7 +225,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
} }
$scope.confirmDelTag = function(tagId, tagName) { $scope.confirmDelTag = function(tagId, tagName) {
console.log(tagId);
ngDialog.close(dialog); ngDialog.close(dialog);
var params = { var params = {
del: tagName == '未分类' ? false : true, del: tagName == '未分类' ? false : true,
@ -209,8 +233,25 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
bookmarkService.delTag(params) bookmarkService.delTag(params)
.then((data) => { .then((data) => {
if (data.retCode == 0) { if (data.retCode == 0) {
toastr.success('[ ' + tagName + ' ]分类删除成功!将自动更新分类信息', "提示"); toastr.success('[ ' + tagName + ' ]分类删除成功!', "提示");
getTags({}); var index = -1;
$scope.tags.forEach((tag, i) => {
if (tag.id == tagId) {
index = i;
}
})
if (index !== -1) {
$("#tag" + tagId).transition({
animation: animation(),
duration: 500,
onComplete: function() {
$("#tag" + tagId).remove();
$scope.tags.splice(index, 1);
}
});
} else {
getTags({});
}
} else { } else {
toastr.error('[ ' + tagName + ' ]分类删除失败!', "提示"); toastr.error('[ ' + tagName + ' ]分类删除失败!', "提示");
getTags({}); getTags({});
@ -386,17 +427,21 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
} }
} }
function transition() { function animation() {
var data = ['scale', 'fade', 'fade up', 'fade down', 'fade left', 'fade right', 'horizontal flip', var data = ['scale', 'fade', 'fade up', 'fade down', 'fade left', 'fade right', 'horizontal flip',
'vertical flip', 'drop', 'fly left', 'fly right', 'fly up', 'fly down', 'swing left', 'swing right', 'swing up', 'vertical flip', 'drop', 'fly left', 'fly right', 'fly up', 'fly down', 'swing left', 'swing right', 'swing up',
'swing down', 'browse', 'browse right', 'slide down', 'slide up', 'slide left', 'slide right' 'swing down', 'browse', 'browse right', 'slide down', 'slide up', 'slide left', 'slide right'
]; ];
var t = data[parseInt(Math.random() * 1000) % data.length]; var t = data[parseInt(Math.random() * 1000) % data.length];
return t;
}
function transition() {
var className = 'js-tags-table'; var className = 'js-tags-table';
$('.' + className).transition('hide'); $('.' + className).transition('hide');
$('.' + className).transition({ $('.' + className).transition({
animation: t, animation: animation(),
duration: 500, duration: 500,
}); });
} }

View File

@ -90,6 +90,19 @@ app.factory('bookmarkService', ['$http', '$q', function($http, $q) {
}); });
return def.promise; return def.promise;
}, },
userInfo: function(params) {
var def = $q.defer();
$http.get('/api/userInfo/', {
params: params
})
.success(function(data) {
def.resolve(data);
})
.error(function(data) {
def.reject('userInfo error');
});
return def.promise;
},
/** /**
* @func * @func
* @desc 根据显示页数的索引获取书签的数据 * @desc 根据显示页数的索引获取书签的数据

View File

@ -28,9 +28,59 @@
</div> </div>
<button class="ui button" type="submit" ng-click="resetPassword()">重置密码</button> <button class="ui button" type="submit" ng-click="resetPassword()">重置密码</button>
</form> </form>
<form class="ui form" ng-show="form[1]"> <div class="ui four statistics" style="margin-top:30px;" ng-show="form[1]">
正在开发中... <div class="statistic">
</form> <div class="text value">{{user.created_at.substring(0, 4)}}<br>
{{user.created_at.substring(5, 10)}}
</div>
<div class="label">注册时间
</div>
</div>
<div class="statistic">
<div class="text value">{{user.last_login.substring(0, 4)}}<br>
{{user.last_login.substring(5, 10)}}
</div>
<div class="label">最近登陆
</div>
</div>
<div class="statistic">
<div class="value">
<i class="tags icon"></i>
{{ tagCnt }}
</div>
<div class="label">分类数目</div>
</div>
<div class="statistic">
<div class="value">
<i class="bookmark icon"></i>
{{ bookmarkCnt }}
</div>
<div class="label">书签数目</div>
</div>
</div>
<table class="ui celled table" ng-if="form[1]" ng-show="user.activeUsers.length > 0">
<thead>
<tr>
<th colspan="4">
用户活跃度排名
</th>
</tr>
<tr>
<th>用户名</th>
<th>邮箱</th>
<th>注册时间</th>
<th>最后登陆</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="activeUser in user.activeUsers">
<td>{{ activeUser.username }}</td>
<td>{{ activeUser.email }}</td>
<td>{{ activeUser.created_at }}</td>
<td>{{ activeUser.last_login }}</td>
</tr>
</tbody>
</table>
<form class="ui form" ng-show="form[2]"> <form class="ui form" ng-show="form[2]">
<div id="fileuploader" style="min-width:100px">点我上传</div> <div id="fileuploader" style="min-width:100px">点我上传</div>
<h2 class="ui dividing header">注意事项</h2> <h2 class="ui dividing header">注意事项</h2>
@ -41,36 +91,36 @@
</p> </p>
<p>4、导入的文件不能超过10M</p> <p>4、导入的文件不能超过10M</p>
<p>5、最好不要重复导入。</p> <p>5、最好不要重复导入。</p>
</p> </p>
</form> </form>
<div class="ui container" ng-show="form[3]"> <div class="ui container" ng-show="form[3]">
<h2 class="ui dividing header">为什么要做个网络书签</h2> <h2 class="ui dividing header">为什么要做个网络书签</h2>
<p>每个浏览器上面都会有个书签可以供你收藏你以后可能还要用到的网址。但是这个书签有以下几个缺点我没法忍受由于浏览器我只用Google Chrome下面的观点我都是基于该浏览器</p> <p>每个浏览器上面都会有个书签可以供你收藏你以后可能还要用到的网址。但是这个书签有以下几个缺点我没法忍受由于浏览器我只用Google Chrome下面的观点我都是基于该浏览器</p>
<p>1、各个浏览器之间无法同步。</p> <p>1、各个浏览器之间无法同步。</p>
<p>2、容易丢失。因为这个东西是不强制注册账号的你只要一重装电脑忘记备份了你的书签就没有了。还有一个如果你使用Chrome浏览器由于Google被ZF封杀你要是不翻墙书签是没法同步的。</p> <p>2、容易丢失。因为这个东西是不强制注册账号的你只要一重装电脑忘记备份了你的书签就没有了。还有一个如果你使用Chrome浏览器由于Google被ZF封杀你要是不翻墙书签是没法同步的。</p>
<p>3、搜索不方便只能搜索关键字无法按照特定条件比如搜索特定的加入时间特定的类型搜索。</p> <p>3、搜索不方便只能搜索关键字无法按照特定条件比如搜索特定的加入时间特定的类型搜索。</p>
<p>4、查阅不方便。一旦一个分类目录你收藏的过多尼玛你在那个目录下面找起来想死的心都有。</p> <p>4、查阅不方便。一旦一个分类目录你收藏的过多尼玛你在那个目录下面找起来想死的心都有。</p>
<p>5、无法查看别人收藏的书签。</p> <p>5、无法查看别人收藏的书签。</p>
<p>6、在别人的电脑上无法查看我收藏的书签。</p> <p>6、在别人的电脑上无法查看我收藏的书签。</p>
<p>7、如果公用一台电脑那么收藏夹里面会收藏其他人的网址。</p> <p>7、如果公用一台电脑那么收藏夹里面会收藏其他人的网址。</p>
<p>PS注册在登录界面的右下角。</p> <p>PS注册在登录界面的右下角。</p>
<h2 class="ui dividing header">主要功能(有好的功能,可以在留言里面进行留言)</h2> <h2 class="ui dividing header">主要功能(有好的功能,可以在留言里面进行留言)</h2>
<p>1、需要注册账号用户。(初步完成)</p> <p>1、需要注册账号用户。(初步完成)</p>
<p>2、网站展示有三种展示方式导航列表卡片。其中导航以分类展示分类顺序可以在书签分类下面拖动编辑。按照点击的次数从高到低在每个分类里面提取16个书签再按照最近添加的书签提取前面的16个书签然后合并起来。列表以表格展示显示书签详细类容按照点击次数优先显示点击次数相同则按添加顺序优先。卡片以卡片方式显示按照最近添加优先显示。(完成)</p> <p>2、网站展示有三种展示方式导航列表卡片。其中导航以分类展示分类顺序可以在书签分类下面拖动编辑。按照点击的次数从高到低在每个分类里面提取16个书签再按照最近添加的书签提取前面的16个书签然后合并起来。列表以表格展示显示书签详细类容按照点击次数优先显示点击次数相同则按添加顺序优先。卡片以卡片方式显示按照最近添加优先显示。(完成)</p>
<p>3、在书签分类里面可以更新分类删除分类新增分类对分类显示进行排序。(完成)</p> <p>3、在书签分类里面可以更新分类删除分类新增分类对分类显示进行排序。(完成)</p>
<p>4、可以按照指定添加时间段指定分类目录指定网址关键字等进行查询。(完成)</p> <p>4、可以按照指定添加时间段指定分类目录指定网址关键字等进行查询。(完成)</p>
<p>5、添加书签的时候会自动获取title供用户编辑。(完成)</p> <p>5、添加书签的时候会自动获取title供用户编辑。(完成)</p>
<p>6、可以导入Chrome的书签导出文件暂时做在设置里面。(完成)</p> <p>6、可以导入Chrome的书签导出文件暂时做在设置里面。(完成)</p>
<p>7、书签可以作为公有或者私有公有可供所有人搜索。(暂时可以通过用户名进行搜索,待优化)</p> <p>7、书签可以作为公有或者私有公有可供所有人搜索。(暂时可以通过用户名进行搜索,待优化)</p>
<p>8、可以将搜索到其他用户的书签转存为自己的书签。(已完成)</p> <p>8、可以将搜索到其他用户的书签转存为自己的书签。(已完成)</p>
<p>9、可以将书签导出来然后导入到浏览器。(未完成)</p> <p>9、可以将书签导出来然后导入到浏览器。(未完成)</p>
<h2 class="ui dividing header">联系方式</h2> <h2 class="ui dividing header">联系方式</h2>
<p>微信跟扣扣530485521记得备注加书签。</p> <p>微信跟扣扣530485521记得备注加书签。</p>
<h2 class="ui dividing header">开发备忘(非开发人员请无视)</h2> <h2 class="ui dividing header">开发备忘(非开发人员请无视)</h2>
<p>1、该代码我托管在Github上<a href="https://github.com/luchenqun/my-bookmark" target="_blank">my-bookmark</a>。git地址git@github.com:luchenqun/my-bookmark.git。我不做Web开发这玩意儿主要是我自己用Chrome浏览器收藏网址不好用而写的。如果你需要源码你尽可随意使用此项目无需通知我。</p> <p>1、该代码我托管在Github上<a href="https://github.com/luchenqun/my-bookmark" target="_blank">my-bookmark</a>。git地址git@github.com:luchenqun/my-bookmark.git。我不做Web开发这玩意儿主要是我自己用Chrome浏览器收藏网址不好用而写的。如果你需要源码你尽可随意使用此项目无需通知我。</p>
<p>2、使用到的东西有NodeJS(做后台) + Express(做Web框架) + AngularJS(有了这个就不要用jQuery了) + Semantic UI(有了这个,界面不会太丑) + MySql(做后台数据库) + MongoDb(做session)。对了用到的sql表在schema.sql里面。</p> <p>2、使用到的东西有NodeJS(做后台) + Express(做Web框架) + AngularJS(有了这个就不要用jQuery了) + Semantic UI(有了这个,界面不会太丑) + MySql(做后台数据库) + MongoDb(做session)。对了用到的sql表在schema.sql里面。</p>
<p>PS暂时还没有README.md文件等整理完公司的一个项目会添加</p> <p>PS暂时还没有README.md文件等整理完公司的一个项目会添加</p>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@ -1,9 +1,10 @@
<div class="ui segment js-tags"> <div class="ui segment js-tags">
<div class="ui container" ng-show="!editMode"> <div class="ui container" ng-show="!editMode">
<div class="ui grid"> <div class="ui grid">
<div class="two wide column" ng-class="" ng-mouseover="" ng-mouseleave="" ng-repeat="tag in tags"> <div class="two wide column js-tag-label" ng-class="" ng-mouseover="" ng-mouseleave="" ng-repeat="tag in tags">
<div class="ui small label" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, 1)"> <div class="ui small label" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, 1)">
{{ tag.name }} ({{ tag.cnt || 0 }}) {{ tag.name }}
({{ tag.cnt || 0 }})
</div> </div>
</div> </div>
</div> </div>
@ -11,7 +12,7 @@
<div class="ui container" ng-show="editMode" ng-mousedown="storeTagIndex()" ng-mouseup="updateTagIndex()"> <div class="ui container" ng-show="editMode" ng-mousedown="storeTagIndex()" ng-mouseup="updateTagIndex()">
<p>提示:拖拽分类即可进行排序</p> <p>提示:拖拽分类即可进行排序</p>
<div class="ui six stackable cards" sv-root sv-part="tags"> <div class="ui six stackable cards" sv-root sv-part="tags">
<div class="card" ng-repeat="tag in tags" sv-element> <div class="card" ng-repeat="tag in tags" id="tag{{tag.id}}" sv-element>
<div class="content"> <div class="content">
<div class="header" ng-if="!tag.edit">{{ tag.name }}</div> <div class="header" ng-if="!tag.edit">{{ tag.name }}</div>
<div class="ui large fluid transparent input" style="height:19px;" ng-if="tag.edit"> <div class="ui large fluid transparent input" style="height:19px;" ng-if="tag.edit">
@ -29,8 +30,8 @@
<div class="extra content"> <div class="extra content">
<img class="ui mini spaced image right floated" style="width:16px;height:16px;margin:0 5px" ng-src="./images/delete.png" ng-click="delTag(tag)" title="删除分类"> <img class="ui mini spaced image right floated" style="width:16px;height:16px;margin:0 5px" ng-src="./images/delete.png" ng-click="delTag(tag)" title="删除分类">
<label for="tag{{tag.id}}" ng-show="!tag.edit"> <label for="tag{{tag.id}}" ng-show="!tag.edit">
<img class="ui mini spaced image right floated" style="width:16px;height:16px;margin:0 5px" ng-src="./images/edit-bookmark.png" ng-click="editTag(tag)" title="编辑分类"> <img class="ui mini spaced image right floated" style="width:16px;height:16px;margin:0 5px" ng-src="./images/edit-bookmark.png" ng-click="editTag(tag)" title="编辑分类">
</label> </label>
</div> </div>
</div> </div>
<div class="card" ng-click="showAddTag()"> <div class="card" ng-click="showAddTag()">
@ -47,7 +48,7 @@
<div class="ui huge text centered inline loader" ng-class="{active:loadBookmarks, disabled: !loadBookmarks}"> <div class="ui huge text centered inline loader" ng-class="{active:loadBookmarks, disabled: !loadBookmarks}">
正在加载中... 正在加载中...
</div> </div>
<table class="ui celled table js-tags-table"ng-if="bookmarkCount > 0" style="margin-top:-14px;" ng-show="!loadBookmarks && !editMode"> <table class="ui celled table js-tags-table" ng-if="bookmarkCount > 0" style="margin-top:-14px;" ng-show="!loadBookmarks && !editMode">
<thead> <thead>
<tr> <tr>
<th>标题</th> <th>标题</th>
@ -64,8 +65,8 @@
<td> <td>
<img class="ui ui middle aligned tiny image" ng-src="http://g.soz.im/{{bookmark.url}}/cdn.ico" style="width:16px;height:16px;cursor:pointer;" ng-click="jumpToUrl(bookmark.url, bookmark.id)" favicon-err="./images/favicon/{{bookmark.id}}.ico"> <img class="ui ui middle aligned tiny image" ng-src="http://g.soz.im/{{bookmark.url}}/cdn.ico" style="width:16px;height:16px;cursor:pointer;" ng-click="jumpToUrl(bookmark.url, bookmark.id)" favicon-err="./images/favicon/{{bookmark.id}}.ico">
<span ng-click="jumpToUrl(bookmark.url, bookmark.id)" title="{{bookmark.title}}" style="cursor:pointer;"> <span ng-click="jumpToUrl(bookmark.url, bookmark.id)" title="{{bookmark.title}}" style="cursor:pointer;">
{{ bookmark.title }} {{ bookmark.title }}
</span> </span>
</td> </td>
<td> <td>
<span title="{{bookmark.url}} 点击复制链接" ng-click="copy(bookmark.id, bookmark.url)" id="tagurl{{bookmark.id}}" style="cursor:default;">{{ bookmark.url }}</span> <span title="{{bookmark.url}} 点击复制链接" ng-click="copy(bookmark.id, bookmark.url)" id="tagurl{{bookmark.id}}" style="cursor:default;">{{ bookmark.url }}</span>

View File

@ -76,6 +76,29 @@ api.post('/login', function(req, res) {
.catch((err) => console.log('login error', err)); .catch((err) => console.log('login error', err));
}); });
api.get('/userInfo', function(req, res) {
console.log("userInfo");
if (!req.session.user) {
res.send(401);
return;
}
var user = {};
db.getUser(req.session.username)
.then((_user) => {
user = _user
if (req.session.username == 'lcq' && req.session.userId == 1) {
return db.getActiveUsers();
} else {
return Promise.resolve([]);
}
})
.then((_activeUsers) => {
user.activeUsers = _activeUsers;
res.json(user);
})
.catch((err) => console.log('userInfo error', err));
});
api.post('/register', function(req, res) { api.post('/register', function(req, res) {
var params = req.body.params; var params = req.body.params;
params.password = md5(params.password); // 进行密码加密 params.password = md5(params.password); // 进行密码加密