no message
This commit is contained in:
parent
be2f4d65b8
commit
a78437ea72
@ -18,7 +18,7 @@
|
|||||||
static>
|
static>
|
||||||
<div ref="manageList" class="dialog-list">
|
<div ref="manageList" class="dialog-list">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-if="dialogMsgLoad > 0" class="loading"><Loading/></li>
|
<li v-if="dialogMsgLoad > 0 && dialogMsgList.length === 0" class="loading"><Loading/></li>
|
||||||
<li v-else-if="dialogMsgList.length === 0" class="nothing">{{$L('暂无消息')}}</li>
|
<li v-else-if="dialogMsgList.length === 0" class="nothing">{{$L('暂无消息')}}</li>
|
||||||
<li v-for="(item, key) in dialogMsgList" :key="key" :class="{self:item.userid == userId}">
|
<li v-for="(item, key) in dialogMsgList" :key="key" :class="{self:item.userid == userId}">
|
||||||
<div class="dialog-avatar">
|
<div class="dialog-avatar">
|
||||||
|
@ -124,12 +124,12 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
openDialog(dialog) {
|
openDialog(dialog) {
|
||||||
this.$store.state.method.setStorage('messengerDialogId', dialog.id)
|
this.$store.state.method.setStorage("messengerDialogId", dialog.id)
|
||||||
this.$store.dispatch("getDialogMsgList", dialog.id);
|
this.$store.dispatch("getDialogMsgList", dialog.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
openDialogStorage() {
|
openDialogStorage() {
|
||||||
let tmpId = this.$store.state.method.getStorageInt('messengerDialogId')
|
let tmpId = this.$store.state.method.getStorageInt("messengerDialogId")
|
||||||
if (tmpId > 0) {
|
if (tmpId > 0) {
|
||||||
const dialog = this.dialogList.find(({id}) => id === tmpId);
|
const dialog = this.dialogList.find(({id}) => id === tmpId);
|
||||||
dialog && this.openDialog(dialog);
|
dialog && this.openDialog(dialog);
|
||||||
|
46
resources/assets/js/store/actions.js
vendored
46
resources/assets/js/store/actions.js
vendored
@ -129,7 +129,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
toggleBoolean({state}, key) {
|
toggleBoolean({state}, key) {
|
||||||
state[key] = !state[key]
|
state[key] = !state[key]
|
||||||
state.method.setStorage('boolean:' + key, state[key]);
|
state.method.setStorage("boolean:" + key, state[key]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,10 +167,10 @@ export default {
|
|||||||
state.userId = userInfo.userid;
|
state.userId = userInfo.userid;
|
||||||
state.userToken = userInfo.token;
|
state.userToken = userInfo.token;
|
||||||
state.userIsAdmin = state.method.inArray('admin', userInfo.identity);
|
state.userIsAdmin = state.method.inArray('admin', userInfo.identity);
|
||||||
state.method.setStorage('userInfo', state.userInfo);
|
state.method.setStorage("userInfo", state.userInfo);
|
||||||
dispatch('getProjectList');
|
dispatch("getProjectList");
|
||||||
dispatch('getDialogMsgUnread');
|
dispatch("getDialogMsgUnread");
|
||||||
dispatch('websocketConnection');
|
dispatch("websocketConnection");
|
||||||
resolve()
|
resolve()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -285,7 +285,7 @@ export default {
|
|||||||
state.projectList.unshift(data);
|
state.projectList.unshift(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.method.setStorage("cacheProjectList", state.projectList);
|
state.method.setStorage("cacheProjectList", state.cacheProjectList = state.projectList);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -343,8 +343,9 @@ export default {
|
|||||||
const project = state.cacheProjectList.find(({id}) => id == project_id);
|
const project = state.cacheProjectList.find(({id}) => id == project_id);
|
||||||
if (project) {
|
if (project) {
|
||||||
state.projectDetail = Object.assign({project_column: [], project_user: []}, project);
|
state.projectDetail = Object.assign({project_column: [], project_user: []}, project);
|
||||||
|
} else {
|
||||||
|
state.projectDetail.id = project_id;
|
||||||
}
|
}
|
||||||
state.projectDetail.id = project_id;
|
|
||||||
//
|
//
|
||||||
state.projectLoad++;
|
state.projectLoad++;
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
@ -370,7 +371,7 @@ export default {
|
|||||||
let index = state.projectList.findIndex(({id}) => id == project_id);
|
let index = state.projectList.findIndex(({id}) => id == project_id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.projectList.splice(index, 1);
|
state.projectList.splice(index, 1);
|
||||||
state.method.setStorage("cacheProjectList", state.projectList);
|
state.method.setStorage("cacheProjectList", state.cacheProjectList = state.projectList);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -506,6 +507,11 @@ export default {
|
|||||||
* @param task_id
|
* @param task_id
|
||||||
*/
|
*/
|
||||||
openTask({state, dispatch}, task_id) {
|
openTask({state, dispatch}, task_id) {
|
||||||
|
if (state.projectChatShow) {
|
||||||
|
dispatch("toggleBoolean", "projectChatShow");
|
||||||
|
}
|
||||||
|
state.dialogId = 0;
|
||||||
|
//
|
||||||
let data = {id: task_id};
|
let data = {id: task_id};
|
||||||
state.projectDetail.project_column.some(({project_task}) => {
|
state.projectDetail.project_column.some(({project_task}) => {
|
||||||
const task = project_task.find(({id}) => id === task_id);
|
const task = project_task.find(({id}) => id === task_id);
|
||||||
@ -754,7 +760,7 @@ export default {
|
|||||||
userid,
|
userid,
|
||||||
},
|
},
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
state.method.setStorage('messengerDialogId', result.data.id)
|
state.method.setStorage("messengerDialogId", result.data.id)
|
||||||
dispatch("getDialogMsgList", result.data.id);
|
dispatch("getDialogMsgList", result.data.id);
|
||||||
dispatch("saveDialog", result.data);
|
dispatch("saveDialog", result.data);
|
||||||
}).catch(result => {
|
}).catch(result => {
|
||||||
@ -777,20 +783,20 @@ export default {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
state.dialogMsgList = [];
|
state.dialogMsgList = [];
|
||||||
if (state.method.isJson(state.cacheDialogList[dialog_id])) {
|
if (state.method.isJson(state.cacheDialogMsg[dialog_id])) {
|
||||||
let length = state.cacheDialogList[dialog_id].data.length;
|
let length = state.cacheDialogMsg[dialog_id].data.length;
|
||||||
if (length > 50) {
|
if (length > 50) {
|
||||||
state.cacheDialogList[dialog_id].data.splice(0, length - 50);
|
state.cacheDialogMsg[dialog_id].data.splice(0, length - 50);
|
||||||
}
|
}
|
||||||
state.dialogDetail = state.cacheDialogList[dialog_id].dialog
|
state.dialogDetail = state.cacheDialogMsg[dialog_id].dialog
|
||||||
state.dialogMsgList = state.cacheDialogList[dialog_id].data
|
state.dialogMsgList = state.cacheDialogMsg[dialog_id].data
|
||||||
}
|
}
|
||||||
state.dialogId = dialog_id;
|
state.dialogId = dialog_id;
|
||||||
//
|
//
|
||||||
if (state.cacheDialogList[dialog_id + "::load"]) {
|
if (state.cacheDialogMsg[dialog_id + "::load"]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.cacheDialogList[dialog_id + "::load"] = true;
|
state.cacheDialogMsg[dialog_id + "::load"] = true;
|
||||||
//
|
//
|
||||||
state.dialogMsgLoad++;
|
state.dialogMsgLoad++;
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
@ -800,15 +806,15 @@ export default {
|
|||||||
},
|
},
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
state.dialogMsgLoad--;
|
state.dialogMsgLoad--;
|
||||||
state.cacheDialogList[dialog_id + "::load"] = false;
|
state.cacheDialogMsg[dialog_id + "::load"] = false;
|
||||||
const dialog = result.data.dialog;
|
const dialog = result.data.dialog;
|
||||||
const reverse = result.data.data.reverse();
|
const reverse = result.data.data.reverse();
|
||||||
// 更新缓存
|
// 更新缓存
|
||||||
state.cacheDialogList[dialog_id] = {
|
state.cacheDialogMsg[dialog_id] = {
|
||||||
dialog,
|
dialog,
|
||||||
data: reverse,
|
data: reverse,
|
||||||
};
|
};
|
||||||
state.method.setStorage("cacheDialogList", state.cacheDialogList);
|
state.method.setStorage("cacheDialogMsg", state.cacheDialogMsg);
|
||||||
// 更新当前会话消息
|
// 更新当前会话消息
|
||||||
if (state.dialogId == dialog_id) {
|
if (state.dialogId == dialog_id) {
|
||||||
state.dialogDetail = dialog;
|
state.dialogDetail = dialog;
|
||||||
@ -825,7 +831,7 @@ export default {
|
|||||||
dispatch("saveDialog", dialog);
|
dispatch("saveDialog", dialog);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
state.dialogMsgLoad--;
|
state.dialogMsgLoad--;
|
||||||
state.cacheDialogList[dialog_id + "::load"] = false;
|
state.cacheDialogMsg[dialog_id + "::load"] = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
8
resources/assets/js/store/state.js
vendored
8
resources/assets/js/store/state.js
vendored
@ -215,7 +215,7 @@ const state = { method };
|
|||||||
'taskUndoneShow', // 项目面板显示未完成任务
|
'taskUndoneShow', // 项目面板显示未完成任务
|
||||||
'taskCompletedShow' // 项目面板显示已完成任务
|
'taskCompletedShow' // 项目面板显示已完成任务
|
||||||
].forEach((key) => {
|
].forEach((key) => {
|
||||||
state[key] = state.method.getStorageBoolean('boolean:' + key, true)
|
state[key] = state.method.getStorageBoolean("boolean:" + key, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
// ajax
|
// ajax
|
||||||
@ -225,14 +225,14 @@ state.ajaxWsListener = [];
|
|||||||
|
|
||||||
// 数据缓存
|
// 数据缓存
|
||||||
state.cacheUserBasic = state.method.getStorageJson("cacheUserBasic");
|
state.cacheUserBasic = state.method.getStorageJson("cacheUserBasic");
|
||||||
state.cacheDialogList = state.method.getStorageJson("cacheDialogList");
|
state.cacheDialogMsg = state.method.getStorageJson("cacheDialogMsg");
|
||||||
state.cacheProjectList = state.method.getStorageArray("cacheProjectList");
|
state.cacheProjectList = state.method.getStorageArray("cacheProjectList");
|
||||||
|
|
||||||
// 会员信息
|
// 会员信息
|
||||||
state.userInfo = state.method.getStorageJson('userInfo');
|
state.userInfo = state.method.getStorageJson("userInfo");
|
||||||
state.userId = state.userInfo.userid = state.method.runNum(state.userInfo.userid);
|
state.userId = state.userInfo.userid = state.method.runNum(state.userInfo.userid);
|
||||||
state.userToken = state.userInfo.token;
|
state.userToken = state.userInfo.token;
|
||||||
state.userIsAdmin = state.method.inArray('admin', state.userInfo.identity);
|
state.userIsAdmin = state.method.inArray("admin", state.userInfo.identity);
|
||||||
state.userOnline = {};
|
state.userOnline = {};
|
||||||
|
|
||||||
// Websocket
|
// Websocket
|
||||||
|
@ -227,6 +227,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
.dialog-no {
|
.dialog-no {
|
||||||
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user