Commit 4599d5de by 杨铁龙

Merge branch 'ytl003' into 'master'

im合并

See merge request !1
parents d7ef878e 609951c8
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
"follow-redirects": "1.5.10" "follow-redirects": "1.5.10"
} }
}, },
"call-bind": {
"version": "1.0.2",
"resolved": "http://npm.job.qinqinxiaobao.com/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha1-sdTonmiBGcPJqQOtMKuy9qkZvjw=",
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"charenc": { "charenc": {
"version": "0.0.2", "version": "0.0.2",
"resolved": "http://npm.job.qinqinxiaobao.com/charenc/-/charenc-0.0.2.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/charenc/-/charenc-0.0.2.tgz",
...@@ -58,34 +49,6 @@ ...@@ -58,34 +49,6 @@
"debug": "=3.1.0" "debug": "=3.1.0"
} }
}, },
"function-bind": {
"version": "1.1.1",
"resolved": "http://npm.job.qinqinxiaobao.com/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0="
},
"get-intrinsic": {
"version": "1.1.1",
"resolved": "http://npm.job.qinqinxiaobao.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha1-FfWfN2+FXERpY5SPDSTNNje0q8Y=",
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
}
},
"has": {
"version": "1.0.3",
"resolved": "http://npm.job.qinqinxiaobao.com/has/-/has-1.0.3.tgz",
"integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=",
"requires": {
"function-bind": "^1.1.1"
}
},
"has-symbols": {
"version": "1.0.2",
"resolved": "http://npm.job.qinqinxiaobao.com/has-symbols/-/has-symbols-1.0.2.tgz",
"integrity": "sha1-Fl0wcMADCXUqEjakeTMeOsVvFCM="
},
"moment": { "moment": {
"version": "2.29.1", "version": "2.29.1",
"resolved": "http://npm.job.qinqinxiaobao.com/moment/-/moment-2.29.1.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/moment/-/moment-2.29.1.tgz",
...@@ -96,18 +59,10 @@ ...@@ -96,18 +59,10 @@
"resolved": "http://npm.job.qinqinxiaobao.com/ms/-/ms-2.0.0.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}, },
"object-inspect": {
"version": "1.11.0",
"resolved": "http://npm.job.qinqinxiaobao.com/object-inspect/-/object-inspect-1.11.0.tgz",
"integrity": "sha1-nc6xRs7dQUig2eUauI00z1CZIrE="
},
"qs": { "qs": {
"version": "6.10.1", "version": "6.9.6",
"resolved": "http://npm.job.qinqinxiaobao.com/qs/-/qs-6.10.1.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/qs/-/qs-6.9.6.tgz",
"integrity": "sha1-STFIL6jWR6Wqt5nFJx0hM7mB+2o=", "integrity": "sha1-Ju08gkOkMbKSSsqEzJBHHzXVoO4="
"requires": {
"side-channel": "^1.0.4"
}
}, },
"sha1": { "sha1": {
"version": "1.1.1", "version": "1.1.1",
...@@ -118,16 +73,6 @@ ...@@ -118,16 +73,6 @@
"crypt": ">= 0.0.1" "crypt": ">= 0.0.1"
} }
}, },
"side-channel": {
"version": "1.0.4",
"resolved": "http://npm.job.qinqinxiaobao.com/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha1-785cj9wQTudRslxY1CkAEfpeos8=",
"requires": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
}
},
"tweetnacl": { "tweetnacl": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "http://npm.job.qinqinxiaobao.com/tweetnacl/-/tweetnacl-1.0.3.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/tweetnacl/-/tweetnacl-1.0.3.tgz",
...@@ -148,14 +93,14 @@ ...@@ -148,14 +93,14 @@
} }
}, },
"ws": { "ws": {
"version": "7.5.3", "version": "7.5.5",
"resolved": "http://npm.job.qinqinxiaobao.com/ws/-/ws-7.5.3.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/ws/-/ws-7.5.5.tgz",
"integrity": "sha1-Fgg1tjx9l7+rQY/BuKn87SrAGnQ=" "integrity": "sha1-i0vEr1GM+r0Ec65PmRRCh7M+uIE="
}, },
"xchat-client": { "xchat-client": {
"version": "2.2.1", "version": "2.2.2",
"resolved": "http://npm.job.qinqinxiaobao.com/xchat-client/-/xchat-client-2.2.1.tgz", "resolved": "http://npm.job.qinqinxiaobao.com/xchat-client/-/xchat-client-2.2.2.tgz",
"integrity": "sha512-AK5Wye6Eex6JV+PoA5H1N0Jen3wwzZ9mb9IC/HQJUhYUEFTF99N62nImPqDTARHp4KEHFm3JHbmPf6cZvSBEKw==", "integrity": "sha512-cGuq/BqVNMkdiAI7LXRw8DfGJkVGkE6zc9O7wjbSMTcEw+5FnVYQlb+z1kpfrRNsM5BGoD8u6FiGAmR43GEmsw==",
"requires": { "requires": {
"wamp.js": "0.3.2" "wamp.js": "0.3.2"
} }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
"@types/sha1": "^1.1.2", "@types/sha1": "^1.1.2",
"axios": "^0.19.2", "axios": "^0.19.2",
"moment": "^2.29.1", "moment": "^2.29.1",
"qs": "^6.9.3", "qs": "~6.9.3",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"vuex-class": "^0.3.2", "vuex-class": "^0.3.2",
"xchat-client": "2.2.1" "xchat-client": "2.2.2"
} }
} }
import Vue from "vue"; import Vue from "vue";
import { Module } from "vuex"; import { Module } from "vuex";
import { dbController } from "../database"; import { dbController } from "../database";
import { ChatMember, ServiceType, MessageHandled, RawChatItem } from "../model"; import { ChatMember, MessageType,ServiceType, MessageHandled, RawChatItem } from "../model";
import { isAccessibleUrl } from "../service/tools"; import { isAccessibleUrl } from "../service/tools";
import { unique } from "../utils"; import { unique } from "../utils";
import { getChatModelInfo } from "../utils/chat-info"; import { getChatModelInfo } from "../utils/chat-info";
...@@ -44,7 +43,10 @@ function filterMessages( ...@@ -44,7 +43,10 @@ function filterMessages(
let removeRegisterChatEvents: (() => void)[] = []; let removeRegisterChatEvents: (() => void)[] = [];
async function preCacheImgs(msgs: any[]) { async function preCacheImgs(msgs?: any[]) {
if (!msgs) {
return Promise.resolve();
}
await Promise.all( await Promise.all(
msgs.map((k) => { msgs.map((k) => {
return new Promise((resolve: (p: void) => void) => { return new Promise((resolve: (p: void) => void) => {
...@@ -547,10 +549,9 @@ export default { ...@@ -547,10 +549,9 @@ export default {
.createChat(true); .createChat(true);
const chatId = Number(imChatId); const chatId = Number(imChatId);
await commit(ChatStore.MUTATION_SHOW_CHAT, true); await commit(ChatStore.MUTATION_SHOW_CHAT, true);
await dispatch( await dispatch(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, chatId);
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, // 打开会话后获取一下会话列表,刷新未读消息
chatId dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
);
}, },
async [ChatStore.ACTION_REGISTER_EVENT]({ dispatch, commit, state }) { async [ChatStore.ACTION_REGISTER_EVENT]({ dispatch, commit, state }) {
const chatId = state[ChatStore.STATE_CHAT_CURRENT_CHAT_ID]; const chatId = state[ChatStore.STATE_CHAT_CURRENT_CHAT_ID];
...@@ -884,7 +885,10 @@ export default { ...@@ -884,7 +885,10 @@ export default {
}, },
getters: { getters: {
[ChatStore.STATE_CHAT_MSG_HISTORY](state) { [ChatStore.STATE_CHAT_MSG_HISTORY](state) {
return state[ChatStore.STATE_CHAT_MSG_HISTORY] ?? []; // 过滤消息撤回
const msgList = state[ChatStore.STATE_CHAT_MSG_HISTORY] ?? [];
const drawList = msgList.filter(i => i.type === MessageType.Withdraw).map(i => +i.msg);
return msgList.filter(i => !drawList.includes(i.id));
}, },
[ChatStore.STATE_CHAT_SENDING_MESSAGES](state) { [ChatStore.STATE_CHAT_SENDING_MESSAGES](state) {
return state[ChatStore.STATE_CHAT_SENDING_MESSAGES] || []; return state[ChatStore.STATE_CHAT_SENDING_MESSAGES] || [];
......
...@@ -316,6 +316,10 @@ export class Xim { ...@@ -316,6 +316,10 @@ export class Xim {
return this.client?.syncReadMsg(chatId, start_msg_id, end_msg_id); return this.client?.syncReadMsg(chatId, start_msg_id, end_msg_id);
} }
public setUnRead(chatId: number) {
return this.client?.unreadChat(chatId);
}
private parseEventListener(...args: any[]): [string, Function] { private parseEventListener(...args: any[]): [string, Function] {
if (args.length < 2) { if (args.length < 2) {
throw new Error("参数个数不正确"); throw new Error("参数个数不正确");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment