no message

This commit is contained in:
kuaifan 2021-06-15 00:21:32 +08:00
parent 438f74fac9
commit 3f69a3e6dd
8 changed files with 102 additions and 20 deletions

View File

@ -169,13 +169,26 @@ export default {
},
computed: {
...mapState(['userId', 'userInfo', 'dialogMsgUnread', 'projectList', 'projectOpenTask']),
...mapState(['userId', 'userInfo', 'dialogMsgUnread', 'projectList', 'projectOpenTask', 'projectChatShow']),
},
watch: {
'$route' (route) {
this.curPath = route.path;
},
'projectOpenTask._show' (show) {
if (show) {
if (this.projectChatShow) {
this._projectChatShow = true;
this.$store.dispatch("toggleBoolean", "projectChatShow");
}
} else {
if (this._projectChatShow) {
this._projectChatShow = false;
this.$store.dispatch("toggleBoolean", "projectChatShow");
}
}
}
},
methods: {

View File

@ -267,7 +267,7 @@
<li v-for="file in taskDetail.files">
<img v-if="file.id" class="file-ext" :src="file.thumb"/>
<Loading v-else class="file-load"/>
<div class="file-name">{{file.name}}</div>
<a class="file-name" :href="file.path||'javascript:;'" target="_blank">{{file.name}}</a>
<div class="file-size">{{$A.bytesToSize(file.size)}}</div>
</li>
</ul>
@ -583,14 +583,14 @@ export default {
openTask: {
handler(data) {
this.taskDetail = $A.cloneJSON(data);
this.$store.dispatch("getDialogMsgList", this.taskDetail.dialog_id);
},
immediate: true,
deep: true
},
'openTask._show' (v) {
if (v) {
'openTask._show' (show) {
if (show) {
this.$nextTick(() => {
this.$store.dispatch("getDialogMsgList", this.taskDetail.dialog_id)
this.$refs.input.focus()
});
} else {

View File

@ -51,7 +51,7 @@
</EDropdownMenu>
</EDropdown>
<div class="item-title" @click="openTask(item)">{{item.name}}</div>
<div class="item-icons">
<div class="item-icons" @click="openTask(item)">
<div v-if="item.file_num > 0" class="item-icon">{{item.file_num}}<Icon type="ios-link-outline" /></div>
<div v-if="item.msg_num > 0" class="item-icon">{{item.msg_num}}<Icon type="ios-chatbubbles-outline" /></div>
</div>

View File

@ -8,6 +8,12 @@
<Input prefix="ios-search" v-model="dialogKey" :placeholder="$L('搜索...')" clearable />
</div>
</div>
<div v-if="tabActive==='dialog'" class="messenger-nav">
<p :class="{active:dialogType==''}" @click="dialogType=''">{{$L('全部')}}</p>
<p :class="{active:dialogType=='project'}" @click="dialogType='project'">{{$L('项目')}}</p>
<p :class="{active:dialogType=='task'}" @click="dialogType='task'">{{$L('任务')}}</p>
<p :class="{active:dialogType=='user'}" @click="dialogType='user'">{{$L('个人')}}</p>
</div>
<div ref="list" class="messenger-list overlay-y">
<ul v-if="tabActive==='dialog'" class="dialog">
<li
@ -15,7 +21,11 @@
:key="key"
:class="{active: dialog.id == dialogId}"
@click="openDialog(dialog, true)">
<Icon v-if="dialog.type=='group'" class="icon-avatar" type="ios-people" />
<template v-if="dialog.type=='group'">
<Icon v-if="dialog.group_type=='project'" class="icon-avatar project" type="logo-buffer" />
<Icon v-else-if="dialog.group_type=='task'" class="icon-avatar task" type="md-checkbox-outline" />
<Icon v-else class="icon-avatar" type="ios-people" />
</template>
<div v-else-if="dialog.dialog_user" class="user-avatar"><UserAvatar :userid="dialog.dialog_user.userid" :size="46" hide-icon-menu/></div>
<Icon v-else class="icon-avatar" type="md-person" />
<div class="dialog-box">
@ -72,6 +82,7 @@ export default {
dialogLoad: 0,
dialogKey: '',
dialogType: '',
contactsLoad: 0,
contactsLists: null,
@ -97,18 +108,36 @@ export default {
...mapState(['userId', 'dialogId', 'dialogList']),
dialogLists() {
const {dialogKey} = this;
if (dialogKey == '') {
const {dialogType, dialogKey} = this;
if (dialogType == '' && dialogKey == '') {
return this.dialogList;
}
return this.dialogList.filter(({name, last_msg}) => {
if ($A.strExists(name, dialogKey)) {
return true;
return this.dialogList.filter(({name, type, group_type, last_msg}) => {
if (dialogType) {
switch (dialogType) {
case 'project':
case 'task':
if (group_type != dialogType) {
return false;
}
break;
case 'user':
if (type != 'user') {
return false;
}
break;
default:
return false;
}
}
if (last_msg && last_msg.type === 'text' && $A.strExists(last_msg.msg.text, dialogKey)) {
return true;
if (dialogKey) {
let existName = $A.strExists(name, dialogKey);
let existMsg = last_msg && last_msg.type === 'text' && $A.strExists(last_msg.msg.text, dialogKey);
if (!existName && !existMsg) {
return false;
}
}
return false;
return true;
})
},
},
@ -223,6 +252,20 @@ export default {
behavior: smooth === true ? 'smooth' : 'instant',
scrollMode: 'if-needed',
});
} else {
let dialog = this.dialogList.find(({id}) => id == this.dialogId)
if (dialog && this.dialogType) {
this.dialogType = '';
this.$nextTick(() => {
let active = this.$refs.list.querySelector(".active")
if (active) {
scrollIntoView(active, {
behavior: smooth === true ? 'smooth' : 'instant',
scrollMode: 'if-needed',
});
}
});
}
}
}
})

View File

@ -507,10 +507,6 @@ export default {
* @param task_id
*/
openTask({state, dispatch}, task_id) {
if (state.projectChatShow) {
dispatch("toggleBoolean", "projectChatShow");
}
//
let data = state.method.isJson(task_id) ? task_id : {id: task_id};
state.projectDetail.project_column.some(({project_task}) => {
const task = project_task.find(({id}) => id === data.id);

View File

@ -54,7 +54,7 @@
position: relative;
margin-left: 16px;
cursor: pointer;
transition: all 0.3s;
transition: box-shadow 0.3s;
&:hover {
box-shadow: 0 0 6px #cccccc;
}

View File

@ -157,10 +157,14 @@
width: 16px;
}
.file-name {
color: #515a6e;
padding-left: 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&:hover {
color: #2d8cf0;
}
}
.file-size {
flex-shrink: 0;

View File

@ -46,6 +46,25 @@
}
}
}
.messenger-nav {
display: flex;
align-items: center;
justify-content: center;
padding: 2px 0 12px;
> p {
line-height: 1;
padding: 0 16px;
color: #888888;
cursor: pointer;
&.active {
color: #555555;
font-weight: 500;
}
&:hover {
color: #777777;
}
}
}
.messenger-list {
flex: 1;
height: 0;
@ -91,6 +110,13 @@
font-size: 26px;
background-color: #61B2F9;
color: #ffffff;
&.project {
background-color: #7274E3;
}
&.task {
background-color: #4EA3F4;
font-size: 24px;
}
}
.dialog-box {
flex: 1;