7
This commit is contained in:
+23
-109
@@ -40,21 +40,15 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getFriendList({
|
||||
commit
|
||||
}) {
|
||||
async getFriendList({commit }) {
|
||||
let offset = 0;
|
||||
let friendInfoList = [];
|
||||
let initialFetch = true;
|
||||
while (true) {
|
||||
try {
|
||||
const count = initialFetch ? 10000 : 1000;
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi("getFriendListPage", uuidv4(), {
|
||||
offset,
|
||||
count,
|
||||
});
|
||||
const {data} = await IMSDK.asyncApi("getFriendListPage", uuidv4(), {offset,count,});
|
||||
//console.log(data);
|
||||
friendInfoList = [
|
||||
...friendInfoList,
|
||||
...data,
|
||||
@@ -68,9 +62,7 @@ const actions = {
|
||||
}
|
||||
commit("SET_FRIEND_LIST", friendInfoList);
|
||||
},
|
||||
async getGrouplist({
|
||||
commit
|
||||
}) {
|
||||
async getGrouplist({commit}) {
|
||||
let offset = 0;
|
||||
let groupList = [];
|
||||
while (true) {
|
||||
@@ -93,18 +85,14 @@ const actions = {
|
||||
}
|
||||
commit("SET_GROUP_LIST", groupList);
|
||||
},
|
||||
getBlacklist({
|
||||
commit
|
||||
}) {
|
||||
getBlacklist({commit}) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetBlackList, uuidv4()).then(({
|
||||
data
|
||||
}) => {
|
||||
commit("SET_BLACK_LIST", data);
|
||||
});
|
||||
},
|
||||
getRecvFriendApplications({
|
||||
commit
|
||||
}) {
|
||||
getRecvFriendApplications({commit}) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetFriendApplicationListAsRecipient,
|
||||
uuidv4(),
|
||||
@@ -114,9 +102,7 @@ const actions = {
|
||||
commit("SET_RECV_FRIEND_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
getSentFriendApplications({
|
||||
commit
|
||||
}) {
|
||||
getSentFriendApplications({ commit }) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetFriendApplicationListAsApplicant,
|
||||
uuidv4(),
|
||||
@@ -126,9 +112,7 @@ const actions = {
|
||||
commit("SET_SENT_FRIEND_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
getRecvGroupApplications({
|
||||
commit
|
||||
}) {
|
||||
getRecvGroupApplications({ commit }) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetGroupApplicationListAsRecipient,
|
||||
uuidv4(),
|
||||
@@ -138,9 +122,7 @@ const actions = {
|
||||
commit("SET_RECV_GROUP_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
getSentGroupApplications({
|
||||
commit
|
||||
}) {
|
||||
getSentGroupApplications({ commit }) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetGroupApplicationListAsApplicant,
|
||||
uuidv4(),
|
||||
@@ -150,23 +132,14 @@ const actions = {
|
||||
commit("SET_SENT_GROUP_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
pushNewFriend({
|
||||
commit,
|
||||
state
|
||||
}, friendInfo) {
|
||||
pushNewFriend({ commit, state}, friendInfo) {
|
||||
const tmpList = [...state.friendList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
|
||||
if (idx === -1) {
|
||||
commit("SET_FRIEND_LIST", [...tmpList, friendInfo]);
|
||||
}
|
||||
},
|
||||
updateFriendInfo({
|
||||
commit,
|
||||
state
|
||||
}, {
|
||||
friendInfo,
|
||||
isRemove = false
|
||||
}) {
|
||||
updateFriendInfo({commit,state}, { friendInfo,isRemove = false}) {
|
||||
const tmpList = [...state.friendList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
|
||||
|
||||
@@ -181,23 +154,14 @@ const actions = {
|
||||
commit("SET_FRIEND_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewBlack({
|
||||
commit,
|
||||
state
|
||||
}, blackInfo) {
|
||||
pushNewBlack({ commit, state}, blackInfo) {
|
||||
const tmpList = [...state.blackList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === blackInfo.userID);
|
||||
if (idx === -1) {
|
||||
commit("SET_BLACK_LIST", [...tmpList, blackInfo]);
|
||||
}
|
||||
},
|
||||
updateBlackInfo({
|
||||
commit,
|
||||
state
|
||||
}, {
|
||||
blackInfo,
|
||||
isRemove = false
|
||||
}) {
|
||||
updateBlackInfo({commit,state}, {blackInfo,isRemove = false}) {
|
||||
const tmpList = [...state.blackList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === blackInfo.userID);
|
||||
|
||||
@@ -212,24 +176,14 @@ const actions = {
|
||||
commit("SET_BLACK_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewGroup({
|
||||
commit,
|
||||
state
|
||||
}, groupInfo) {
|
||||
pushNewGroup({commit,state}, groupInfo) {
|
||||
const tmpList = [...state.groupList];
|
||||
const idx = tmpList.findIndex((item) => item.groupID === groupInfo.groupID);
|
||||
if (idx === -1) {
|
||||
commit("SET_GROUP_LIST", [...tmpList, groupInfo]);
|
||||
}
|
||||
},
|
||||
updateGroupInfo({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
groupInfo,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
updateGroupInfo({commit,state,rootState}, {groupInfo,isRemove = false}, ) {
|
||||
const tmpList = [...state.groupList];
|
||||
const idx = tmpList.findIndex((item) => item.groupID === groupInfo.groupID);
|
||||
|
||||
@@ -250,10 +204,7 @@ const actions = {
|
||||
commit("SET_GROUP_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewRecvFriendApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
pushNewRecvFriendApplition({commit,state}, application) {
|
||||
const tmpList = [...state.recvFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.fromUserID === application.fromUserID,
|
||||
@@ -263,14 +214,7 @@ const actions = {
|
||||
}
|
||||
commit("SET_RECV_FRIEND_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateRecvFriendApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
updateRecvFriendApplition({commit,state,rootState}, {application,isRemove = false}, ) {
|
||||
const tmpList = [...state.recvFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.fromUserID === application.fromUserID,
|
||||
@@ -287,10 +231,7 @@ const actions = {
|
||||
commit("SET_RECV_FRIEND_APPLICATIONS", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewSentFriendApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
pushNewSentFriendApplition({commit,state}, application) {
|
||||
const tmpList = [...state.sentFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.toUserID === application.toUserID,
|
||||
@@ -300,14 +241,7 @@ const actions = {
|
||||
}
|
||||
commit("SET_SENT_FRIEND_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateSentFriendApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
updateSentFriendApplition({commit,state,rootState}, {application,isRemove = false}, ) {
|
||||
const tmpList = [...state.sentFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.toUserID === application.toUserID,
|
||||
@@ -324,10 +258,7 @@ const actions = {
|
||||
commit("SET_SENT_FRIEND_APPLICATIONS", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewRecvGroupApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
pushNewRecvGroupApplition({commit,state}, application) {
|
||||
const tmpList = [...state.recvGroupApplications];
|
||||
const idx = tmpList.findIndex((item) => item.userID === application.userID);
|
||||
if (idx !== -1) {
|
||||
@@ -335,14 +266,7 @@ const actions = {
|
||||
}
|
||||
commit("SET_RECV_GROUP_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateRecvGroupApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
updateRecvGroupApplition({commit,state,rootState}, {application,isRemove = false}, ) {
|
||||
const tmpList = [...state.recvGroupApplications];
|
||||
const idx = tmpList.findIndex((item) => item.userID === application.userID);
|
||||
|
||||
@@ -357,10 +281,7 @@ const actions = {
|
||||
commit("SET_RECV_GROUP_APPLICATIONS", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewSentGroupApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
pushNewSentGroupApplition({commit,state}, application) {
|
||||
const tmpList = [...state.sentGroupApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.groupID === application.groupID,
|
||||
@@ -370,14 +291,7 @@ const actions = {
|
||||
}
|
||||
commit("SET_SENT_GROUP_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateSentGroupApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
updateSentGroupApplition({commit,state,rootState}, {application,isRemove = false}, ) {
|
||||
const tmpList = [...state.sentGroupApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.groupID === application.groupID,
|
||||
|
||||
Reference in New Issue
Block a user