diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..219f97edf052d29ce9ab3fb0a27f2e7ef7190e7a --- /dev/null +++ b/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo "build start" + +DEST=/Users/xiweicheng/tms/src/main/resources/static +SRC=/Users/xiweicheng/tms-frontend + +echo "DEST DIR: $DEST" +echo "SRC DIR: $SRC" + +echo "au pkg --env prod" + +cd $SRC +au pkg --env prod + +echo "rm page/scripts & page/index.html" + +rm -rf $DEST/page/scripts +rm -rf $DEST/page/index.html + +echo "cp tms-frontend to tms" + +cp -rf $SRC/scripts $DEST/page +cp -rf $SRC/index.html $DEST/page + +echo "build end" \ No newline at end of file diff --git a/index.html b/index.html index 1dd34487e4ef71839ba0eae1595a78d6a0a5e9df..0f074f4b974a754b322be25d43197fef0080848d 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@ - + diff --git a/src/chat/chat-direct.js b/src/chat/chat-direct.js index cde1be7cfe689729dbae104abaa54bfa5df51812..2e7a47176a157548e53b64f27cca134107b9c23a 100644 --- a/src/chat/chat-direct.js +++ b/src/chat/chat-direct.js @@ -42,9 +42,24 @@ export class ChatDirect { toastr.error('复制到剪贴板失败!'); }); + $(window).resize((event) => { + this.doResize(); + }); + this.initSubscribeEvent(); } + doResize() { + if (nsCtx.isRightSidebarShow) { + let wid = $(this.contentRef).width() - 392; + $(this.contentBodyRef).width(wid); + $(this.contentBodyRef).children('.scroll-wrapper').width(wid); + } else { + $(this.contentBodyRef).css('width', '100%'); + $(this.contentBodyRef).children('.scroll-wrapper').css('width', '100%'); + } + } + initSubscribeEvent() { this.subscribe = ea.subscribe(nsCons.EVENT_CHAT_MSG_SENDED, (payload) => { @@ -63,14 +78,7 @@ export class ChatDirect { this.subscribe2 = ea.subscribe(nsCons.EVENT_CHAT_SIDEBAR_TOGGLE, (payload) => { this.isRightSidebarShow = nsCtx.isRightSidebarShow = payload.isShow; - if (this.isRightSidebarShow) { - let wid = $(this.contentRef).width() - 392; - $(this.contentBodyRef).width(wid); - $(this.contentBodyRef).children('.scroll-wrapper').width(wid); - } else { - $(this.contentBodyRef).css('width', '100%'); - $(this.contentBodyRef).children('.scroll-wrapper').css('width', '100%'); - } + this.doResize(); }); this.subscribe3 = ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_CREATED, (payload) => { diff --git a/src/common/common-constant.js b/src/common/common-constant.js index 7e54480b65266a9badcb07375af479953badd249..fd243b696990cf44322b2beaf5a90a347a955e20 100644 --- a/src/common/common-constant.js +++ b/src/common/common-constant.js @@ -63,6 +63,7 @@ window.nsCons = { ACTION_TYPE_DIR: 'action_type_dir', ACTION_TYPE_ATTACH: 'action_type_attach', ACTION_TYPE_SCHEDULE: 'action_type_schedule', + ACTION_TYPE_TODO: 'action_type_todo', NUM_TEXT_COMPLETE_MAX_COUNT: 20, STR_EMOJI_SEARCH_URL: 'http://emoji.muan.co/', KEY_REMEMBER_LAST_CHAT_TO: 'tms/remember_last_chat_to', diff --git a/src/environment.js b/src/environment.js index 3495e9a9d2dc8567e56c399ed05f43c4a8ae2bec..da32a4b8736ba562799dc386e9e61a586c197be4 100644 --- a/src/environment.js +++ b/src/environment.js @@ -1,4 +1,4 @@ export default { - debug: true, - testing: true + debug: false, + testing: false }; diff --git a/src/resources/elements/em-chat-sidebar-right.html b/src/resources/elements/em-chat-sidebar-right.html index fb6fa512e6dab6594be666b21f6873d5524763a6..daeae2894524c3ec5885fb910cc1aee2f7f3ad10 100644 --- a/src/resources/elements/em-chat-sidebar-right.html +++ b/src/resources/elements/em-chat-sidebar-right.html @@ -20,6 +20,7 @@ + diff --git a/src/resources/elements/em-chat-sidebar-right.js b/src/resources/elements/em-chat-sidebar-right.js index d82fd5ba50fe6dab86b6d64563fd36c67d136145..ff5df86230cad8347049e0c35ad4e1b198237917 100644 --- a/src/resources/elements/em-chat-sidebar-right.js +++ b/src/resources/elements/em-chat-sidebar-right.js @@ -16,6 +16,7 @@ export class EmChatSidebarRight { [nsCons.ACTION_TYPE_SEARCH]: { nodata: '无符合检索结果', show: 'msg', icon: 'search', title: '检索结果' }, [nsCons.ACTION_TYPE_PIN]: { nodata: '暂无频道固定消息', show: 'msg', icon: 'pin', title: '频道固定消息' }, [nsCons.ACTION_TYPE_TOPIC]: { nodata: '', show: 'topic', icon: 'talk outline', title: '话题讨论' }, + [nsCons.ACTION_TYPE_TODO]: { handler: this.todoHandler, nodata: '暂无待办事项', show: 'todo', icon: 'ordered list', title: '待办事项' }, } /** @@ -57,6 +58,10 @@ export class EmChatSidebarRight { this.chatScheduleVm.show(); } + todoHandler(payload) { + // this.chatScheduleVm.show(); + } + closeHandler() { ea.publish(nsCons.EVENT_CHAT_TOGGLE_RIGHT_SIDEBAR, {}); } diff --git a/src/resources/elements/em-chat-todo.html b/src/resources/elements/em-chat-todo.html new file mode 100644 index 0000000000000000000000000000000000000000..c82a093f6bded9d2a79807ea746ce78f3e0fcc4f --- /dev/null +++ b/src/resources/elements/em-chat-todo.html @@ -0,0 +1,63 @@ + diff --git a/src/resources/elements/em-chat-todo.js b/src/resources/elements/em-chat-todo.js new file mode 100644 index 0000000000000000000000000000000000000000..9f11005da43f5163114ca0a7e2845d12ab949f78 --- /dev/null +++ b/src/resources/elements/em-chat-todo.js @@ -0,0 +1,116 @@ +import { bindable, containerless } from 'aurelia-framework'; + +@containerless +export class EmChatTodo { + + @bindable actived; + loginUser = nsCtx.loginUser; + title; + todos = []; + dones = []; + + activedChanged(newValue, oldValue) { + if (!newValue || this.actived.payload.action != nsCons.ACTION_TYPE_TODO) { + return; + } + + this.listMy(); + } + + listMy() { + this.ajax = $.get('/admin/todo/listMy', {}, (data) => { + if (data.success) { + this.todos = _.reject(data.data, { status: 'Done' }); + this.dones = _.filter(data.data, { status: 'Done' }); + } else { + toastr.error(data.data, '获取待办事项列表失败!'); + } + }); + } + + addTodoHandler() { + + $(this.todoInputRef).focus(); + + if (!this.title) { + toastr.error('请输入待办事项内容!'); + return; + } + + this.ajax = $.post('/admin/todo/create', { title: this.title }, (data, textStatus, xhr) => { + if (data.success) { + this.title = ''; + this.todos = [data.data, ...this.todos]; + } else { + toastr.error(data.data, '创建待办事项失败!'); + } + }); + } + + statusToggleHandler(item) { + $.post('/admin/todo/update', { id: item.id, status: item.status == 'New' ? 'Doing' : "New" }, (data, textStatus, xhr) => { + if (data.success) { + item.status = data.data.status; + } else { + toastr.error(data.data, '更新待办事项失败!'); + } + }); + } + + statusDoneHandler(item) { + $.post('/admin/todo/update', { id: item.id, status: 'Done' }, (data, textStatus, xhr) => { + if (data.success) { + this.todos = _.reject(this.todos, { id: item.id }); + this.dones = [data.data, ...this.dones]; + } else { + toastr.error(data.data, '更新待办事项失败!'); + } + }); + } + + statusNewHandler(item) { + $.post('/admin/todo/update', { id: item.id, status: 'New' }, (data, textStatus, xhr) => { + if (data.success) { + this.dones = _.reject(this.dones, { id: item.id }); + this.todos = [data.data, ...this.todos]; + } else { + toastr.error(data.data, '更新待办事项失败!'); + } + }); + } + + delHandler(item, type) { + $.post(`/admin/todo/delete/${item.id}`, {}, (data, textStatus, xhr) => { + if (data.success) { + if (type == 'todo') { + this.todos = _.reject(this.todos, { id: item.id }); + } else { + this.dones = _.reject(this.dones, { id: item.id }); + } + } else { + toastr.error(data.data, '删除待办事项失败!'); + } + }); + } + + editHandler(item, inputRef) { + item.isEditing = true; + item.oldTitle = item.title; + _.defer(() => $(inputRef).focus()); + } + + updateHandler(item) { + item.isEditing = false; + if (!_.trim(item.title) || item.title == item.oldTitle) { + item.title = item.oldTitle + return; + } + $.post('/admin/todo/update', { id: item.id, title: item.title }, (data, textStatus, xhr) => { + if (data.success) {} else { + item.title = item.oldTitle; + toastr.error(data.data, '更新待办事项失败!'); + } + }); + } + +} diff --git a/src/resources/elements/em-chat-todo.less b/src/resources/elements/em-chat-todo.less new file mode 100644 index 0000000000000000000000000000000000000000..e9e1c5034bfa44aeaf13edf670c6a3f2f8e004c9 --- /dev/null +++ b/src/resources/elements/em-chat-todo.less @@ -0,0 +1,31 @@ +.em-chat-todo { + .ui.list { + .item { + .content { + text-overflow: ellipsis; + overflow: hidden; + max-width: 300px; + min-width: 300px; + // width: 300px; + white-space: nowrap; + &.red { + color: red; + } + } + .actions { + display: none; + position: absolute; + right: 10px; + >i.icon { + margin-right: 0; + } + } + + &:hover { + .actions { + display: inline-block; + } + } + } + } +} diff --git a/src/resources/elements/em-chat-top-menu.html b/src/resources/elements/em-chat-top-menu.html index b4cacce535db1073cb2110030a1551bd46b63fea..2228f5b7d7ecb2a778035b6e71207fedb29c970a 100644 --- a/src/resources/elements/em-chat-top-menu.html +++ b/src/resources/elements/em-chat-top-menu.html @@ -107,6 +107,12 @@
+
+ +
diff --git a/src/resources/elements/em-chat-top-menu.js b/src/resources/elements/em-chat-top-menu.js index caf398031983c24d56f07e9eaebe9b4c2ca5de5a..1b4f11382e5c9ad87e434ae4a7639d8eff6d11f5 100644 --- a/src/resources/elements/em-chat-top-menu.js +++ b/src/resources/elements/em-chat-top-menu.js @@ -21,6 +21,7 @@ export class EmChatTopMenu { ACTION_TYPE_DIR = nsCons.ACTION_TYPE_DIR; ACTION_TYPE_ATTACH = nsCons.ACTION_TYPE_ATTACH; ACTION_TYPE_SCHEDULE = nsCons.ACTION_TYPE_SCHEDULE; + ACTION_TYPE_TODO = nsCons.ACTION_TYPE_TODO; countAt = null; newAtCnt = 0; @@ -374,6 +375,20 @@ export class EmChatTopMenu { this.toggleRightSidebar(true); } + showTodoHandler(event) { + + if (this.isRightSidebarShow && (this.activeType == nsCons.ACTION_TYPE_TODO) && !event.ctrlKey) { + this.toggleRightSidebar(); + return; + } + + this.activeType = nsCons.ACTION_TYPE_TODO; + ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, { + action: this.activeType + }); + this.toggleRightSidebar(true); + } + userEditHandler() { this.userEditMd.show(); } diff --git a/src/resources/index.js b/src/resources/index.js index 8140adb15d2ef641277de3d4ea1fa2a782faa46d..7f4a820410a5ac552a646cef1e78dec9afa346f4 100644 --- a/src/resources/index.js +++ b/src/resources/index.js @@ -61,6 +61,7 @@ export function configure(aurelia) { 'resources/elements/em-chat-topic', 'resources/elements/em-chat-topic-input', 'resources/elements/em-chat-settings', + 'resources/elements/em-chat-todo', 'resources/elements/em-blog-write', 'resources/elements/em-blog-left-sidebar', 'resources/elements/em-blog-right-sidebar',