9
This commit is contained in:
@@ -20,5 +20,9 @@ export default {
|
||||
storeReinstall: (state) => state.user.reinstall,
|
||||
storeProgress: (state) => state.user.progress,
|
||||
storeAuthData: (state) => state.user.authData,
|
||||
storeCircleData: (state) => state.circle.list,
|
||||
storeCircleUnreadCount: (state) => state.circle.unread_count,
|
||||
storeCircleLastUnreadItem: (state) => state.circle.last_unread_item,
|
||||
storeCircleSettings: (state) => state.circle.settings,
|
||||
config: (state) => state.system.config,
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import contact from "./modules/contact";
|
||||
import conversation from "./modules/conversation";
|
||||
import message from "./modules/message";
|
||||
import system from "./modules/system";
|
||||
import circle from "./modules/circle";
|
||||
import getters from "./getters";
|
||||
|
||||
Vue.use(Vuex);
|
||||
@@ -16,6 +17,7 @@ const store = new Vuex.Store({
|
||||
conversation,
|
||||
message,
|
||||
system,
|
||||
circle,
|
||||
},
|
||||
getters,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
const state = {
|
||||
list: [],
|
||||
unread_count: 0,
|
||||
last_unread_item: {"avatar":"","user_id":"","nickname":""},
|
||||
settings: {bg:""}
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
SET_LIST(state, info) {
|
||||
state.list = [...list];
|
||||
},
|
||||
SET_UNREAD_COUNT(state, count) {
|
||||
state.unread_count = count;
|
||||
if(count<1){
|
||||
uni.removeTabBarBadge({
|
||||
index:2
|
||||
})
|
||||
}else{
|
||||
uni.setTabBarBadge({
|
||||
index:2,
|
||||
text:count
|
||||
})
|
||||
}
|
||||
},
|
||||
SET_LAST_UNREAD(state, data) {
|
||||
state.last_unread_item = {...data};
|
||||
},
|
||||
SET_SETTINGS(state, data) {
|
||||
state.settings = {...data};
|
||||
},
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getFriendCircleList({ commit},params) {
|
||||
uni.$u.http.get('/friendcircle/list',params).then(res=>{
|
||||
commit("SET_LIST", res.data);
|
||||
}).catch(e=>{
|
||||
uni.$u.toast("获取个人信息失败");
|
||||
})
|
||||
},
|
||||
async getFriendCircleInfo({ commit, state}) {
|
||||
uni.$u.http.get('/friendcircle/info').then(data=>{
|
||||
commit("SET_UNREAD_COUNT", data.count);
|
||||
commit("SET_LAST_UNREAD", data.last_unread_item);
|
||||
commit("SET_SETTINGS", data.settings);
|
||||
}).catch(e=>{
|
||||
uni.$u.toast("获取个人信息失败");
|
||||
})
|
||||
},
|
||||
async updateUnreadCount({commit,state},v) {
|
||||
commit("SET_UNREAD_COUNT", state.unread_count+v);
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions,
|
||||
};
|
||||
@@ -47,7 +47,7 @@ const actions = {
|
||||
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,filterBlack:true});
|
||||
//console.log(data);
|
||||
friendInfoList = [
|
||||
...friendInfoList,
|
||||
|
||||
Reference in New Issue
Block a user