Skip to content

Commit

Permalink
优化缓存机制
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 11, 2021
1 parent cece720 commit f260d83
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 46 deletions.
3 changes: 0 additions & 3 deletions resources/assets/js/pages/manage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ export default {
},
mounted() {
this.$store.state.method.clearLocal();
this.$store.dispatch("saveUserInfo", this.userInfo);
//
this.$store.dispatch("getUserInfo");
this.$store.dispatch("getTaskPriority");
//
Expand Down
36 changes: 0 additions & 36 deletions resources/assets/js/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ export default {
}
state.cacheUserActive = Object.assign(data, {__:Math.random()});
Store.set('cacheUserActive', data);
setTimeout(() => {
state.method.setStorage("cacheUserBasic", state.cacheUserBasic);
})
},

/**
Expand Down Expand Up @@ -408,9 +405,6 @@ export default {
} else {
state.projects.push(data);
}
setTimeout(() => {
state.method.setStorage("cacheProjects", state.cacheProjects = state.projects);
})
}
},

Expand All @@ -432,9 +426,6 @@ export default {
$A.goForward({path: '/manage/dashboard'});
}
}
setTimeout(() => {
state.method.setStorage("cacheProjects", state.cacheProjects = state.projects);
})
},

/**
Expand Down Expand Up @@ -618,9 +609,6 @@ export default {
} else {
state.columns.push(data);
}
setTimeout(() => {
state.method.setStorage("cacheColumns", state.cacheColumns = state.columns);
})
}
},

Expand All @@ -636,9 +624,6 @@ export default {
dispatch('getProjectOne', state.columns[index].project_id)
state.columns.splice(index, 1);
}
setTimeout(() => {
state.method.setStorage("cacheColumns", state.cacheColumns = state.columns);
})
},

/**
Expand Down Expand Up @@ -734,14 +719,6 @@ export default {
if (data.is_update_content) {
dispatch("getTaskContent", data.id);
}
//
setTimeout(() => {
if (key == 'taskSubs') {
state.method.setStorage("cacheTaskSubs", state.cacheTaskSubs = state[key]);
} else {
state.method.setStorage("cacheTasks", state.cacheTasks = state[key]);
}
})
}
},

Expand Down Expand Up @@ -770,13 +747,6 @@ export default {
if (state.taskId == task_id) {
state.taskId = 0;
}
setTimeout(() => {
if (key == 'taskSubs') {
state.method.setStorage("cacheTaskSubs", state.cacheTaskSubs = state[key]);
} else {
state.method.setStorage("cacheTasks", state.cacheTasks = state[key]);
}
})
},

/**
Expand Down Expand Up @@ -1176,9 +1146,6 @@ export default {
} else {
state.dialogs.push(data);
}
setTimeout(() => {
state.method.setStorage("cacheDialogs", state.cacheDialogs = state.dialogs);
})
}
},

Expand Down Expand Up @@ -1313,9 +1280,6 @@ export default {
} else {
state.dialogMsgs.push(data);
}
setTimeout(() => {
state.method.setStorage("cacheDialogMsgs", state.cacheDialogMsgs = state.dialogMsgs);
})
}
},

Expand Down
15 changes: 8 additions & 7 deletions resources/assets/js/store/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,16 @@ state.cacheLoading = {};
// User
state.cacheUserActive = {};
state.cacheUserWait = [];
state.cacheUserBasic = state.method.getStorageArray("cacheUserBasic");
state.cacheUserBasic = [];
// Dialog
state.cacheDialogs = state.method.getStorageArray("cacheDialogs");
state.cacheDialogMsgs = state.method.getStorageArray("cacheDialogMsgs");
state.cacheDialogs = [];
state.cacheDialogMsgs = [];
// Project
state.cacheProjects = state.method.getStorageArray("cacheProjects");
state.cacheColumns = state.method.getStorageArray("cacheColumns");
state.cacheTasks = state.method.getStorageArray("cacheTasks");
state.cacheTaskSubs = state.method.getStorageArray("cacheTaskSubs");
state.cacheProjects = [];
state.cacheColumns = [];
state.cacheTasks = [];
state.cacheTaskSubs = [];
// TablePanel
state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel");

// Ajax
Expand Down

0 comments on commit f260d83

Please sign in to comment.