APP热更新
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ export default {
|
||||
storeAuthData: (state) => state.user.authData,
|
||||
storeCircleData: (state) => state.circle.list,
|
||||
storeCircleUnreadCount: (state) => state.circle.unread_count,
|
||||
storeCircleLastUnreadItem: (state) => state.circle.last_unread_item,
|
||||
storeCircleTopUnreadItems: (state) => state.circle.top_unread_items,
|
||||
storeCircleSettings: (state) => state.circle.settings,
|
||||
config: (state) => state.system.config,
|
||||
};
|
||||
+20
-16
@@ -1,7 +1,7 @@
|
||||
const state = {
|
||||
list: [],
|
||||
unread_count: 0,
|
||||
last_unread_item: {"avatar":"","user_id":"","nickname":""},
|
||||
top_unread_items: [],
|
||||
settings: {bg:""}
|
||||
};
|
||||
|
||||
@@ -22,8 +22,8 @@ const mutations = {
|
||||
})
|
||||
}
|
||||
},
|
||||
SET_LAST_UNREAD(state, data) {
|
||||
state.last_unread_item = {...data};
|
||||
SET_TOP_UNREAD_ITEMS(state, data) {
|
||||
state.top_unread_items = [...data];
|
||||
},
|
||||
SET_SETTINGS(state, data) {
|
||||
state.settings = {...data};
|
||||
@@ -41,8 +41,8 @@ const actions = {
|
||||
},
|
||||
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_UNREAD_COUNT", data.unread_count);
|
||||
commit("SET_TOP_UNREAD_ITEMS", data.top_unread_items);
|
||||
commit("SET_SETTINGS", data.settings);
|
||||
}).catch(e=>{
|
||||
uni.$u.toast("获取信息失败");
|
||||
@@ -77,19 +77,23 @@ const actions = {
|
||||
return new Promise((resolve,reject)=>{
|
||||
uni.$u.http.post('/friendcircle/like',params).then(data=>{
|
||||
console.log("点赞成功",data);
|
||||
let index = -1;
|
||||
for(let i=0;i<state.list.length;i++){
|
||||
if(state.list[i].id==params.id){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log("index",index);
|
||||
if(index!=-1){
|
||||
const index = state.list.findIndex(i => i.id ==params.id);
|
||||
|
||||
//console.log("index",index);
|
||||
if(index>=0){
|
||||
if(data.is_liked){
|
||||
state.list[index].likes.push(params.user_id);
|
||||
state.list[index].likes.push({
|
||||
user_id:params.user_id,
|
||||
nickname:params.nickname,
|
||||
avatar:params.avatar
|
||||
});
|
||||
state.list[index].is_liked = params.is_liked;
|
||||
}else{
|
||||
state.list[index].likes.splice(state.list[index].likes.indexOf(params.user_id),1);
|
||||
const likes = state.list[index].likes.filter((item)=>{
|
||||
item.user_id != params.user_id
|
||||
});
|
||||
state.list[index].likes = likes;
|
||||
state.list[index].is_liked = params.is_liked;
|
||||
}
|
||||
resolve(data);
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user