优化缓存机制

This commit is contained in:
kuaifan 2021-12-11 23:08:38 +08:00
parent cece720f68
commit f260d83923
3 changed files with 8 additions and 46 deletions

View File

@ -217,9 +217,6 @@ export default {
}, },
mounted() { mounted() {
this.$store.state.method.clearLocal();
this.$store.dispatch("saveUserInfo", this.userInfo);
//
this.$store.dispatch("getUserInfo"); this.$store.dispatch("getUserInfo");
this.$store.dispatch("getTaskPriority"); this.$store.dispatch("getTaskPriority");
// //

View File

@ -278,9 +278,6 @@ export default {
} }
state.cacheUserActive = Object.assign(data, {__:Math.random()}); state.cacheUserActive = Object.assign(data, {__:Math.random()});
Store.set('cacheUserActive', data); Store.set('cacheUserActive', data);
setTimeout(() => {
state.method.setStorage("cacheUserBasic", state.cacheUserBasic);
})
}, },
/** /**
@ -408,9 +405,6 @@ export default {
} else { } else {
state.projects.push(data); state.projects.push(data);
} }
setTimeout(() => {
state.method.setStorage("cacheProjects", state.cacheProjects = state.projects);
})
} }
}, },
@ -432,9 +426,6 @@ export default {
$A.goForward({path: '/manage/dashboard'}); $A.goForward({path: '/manage/dashboard'});
} }
} }
setTimeout(() => {
state.method.setStorage("cacheProjects", state.cacheProjects = state.projects);
})
}, },
/** /**
@ -618,9 +609,6 @@ export default {
} else { } else {
state.columns.push(data); state.columns.push(data);
} }
setTimeout(() => {
state.method.setStorage("cacheColumns", state.cacheColumns = state.columns);
})
} }
}, },
@ -636,9 +624,6 @@ export default {
dispatch('getProjectOne', state.columns[index].project_id) dispatch('getProjectOne', state.columns[index].project_id)
state.columns.splice(index, 1); state.columns.splice(index, 1);
} }
setTimeout(() => {
state.method.setStorage("cacheColumns", state.cacheColumns = state.columns);
})
}, },
/** /**
@ -734,14 +719,6 @@ export default {
if (data.is_update_content) { if (data.is_update_content) {
dispatch("getTaskContent", data.id); 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]);
}
})
} }
}, },
@ -770,13 +747,6 @@ export default {
if (state.taskId == task_id) { if (state.taskId == task_id) {
state.taskId = 0; state.taskId = 0;
} }
setTimeout(() => {
if (key == 'taskSubs') {
state.method.setStorage("cacheTaskSubs", state.cacheTaskSubs = state[key]);
} else {
state.method.setStorage("cacheTasks", state.cacheTasks = state[key]);
}
})
}, },
/** /**
@ -1176,9 +1146,6 @@ export default {
} else { } else {
state.dialogs.push(data); state.dialogs.push(data);
} }
setTimeout(() => {
state.method.setStorage("cacheDialogs", state.cacheDialogs = state.dialogs);
})
} }
}, },
@ -1313,9 +1280,6 @@ export default {
} else { } else {
state.dialogMsgs.push(data); state.dialogMsgs.push(data);
} }
setTimeout(() => {
state.method.setStorage("cacheDialogMsgs", state.cacheDialogMsgs = state.dialogMsgs);
})
} }
}, },

View File

@ -266,15 +266,16 @@ state.cacheLoading = {};
// User // User
state.cacheUserActive = {}; state.cacheUserActive = {};
state.cacheUserWait = []; state.cacheUserWait = [];
state.cacheUserBasic = state.method.getStorageArray("cacheUserBasic"); state.cacheUserBasic = [];
// Dialog // Dialog
state.cacheDialogs = state.method.getStorageArray("cacheDialogs"); state.cacheDialogs = [];
state.cacheDialogMsgs = state.method.getStorageArray("cacheDialogMsgs"); state.cacheDialogMsgs = [];
// Project // Project
state.cacheProjects = state.method.getStorageArray("cacheProjects"); state.cacheProjects = [];
state.cacheColumns = state.method.getStorageArray("cacheColumns"); state.cacheColumns = [];
state.cacheTasks = state.method.getStorageArray("cacheTasks"); state.cacheTasks = [];
state.cacheTaskSubs = state.method.getStorageArray("cacheTaskSubs"); state.cacheTaskSubs = [];
// TablePanel
state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel"); state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel");
// Ajax // Ajax