优化清除缓存

This commit is contained in:
kuaifan 2021-12-19 18:16:13 +08:00
parent 5c2a82b7ee
commit 5181010d22
6 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.3.81", "version": "0.3.89",
"description": "DooTask is task management system.", "description": "DooTask is task management system.",
"main": "main.js", "main": "main.js",
"license": "MIT", "license": "MIT",

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.3.88", "version": "0.3.89",
"description": "DooTask is task management system.", "description": "DooTask is task management system.",
"scripts": { "scripts": {
"start": "./cmd dev", "start": "./cmd dev",

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -217,9 +217,8 @@ export default {
}, },
mounted() { mounted() {
if ($A.getObject(this.$route.query, '_cc')) { if (this.$store.state.method.getStorageString("clearCache")) {
this.$store.state.method.clearLocal(); this.$store.state.method.setStorage("clearCache", "")
this.$store.dispatch("saveUserInfo", this.userInfo);
$A.messageSuccess("清除成功"); $A.messageSuccess("清除成功");
} }
// //

View File

@ -298,9 +298,10 @@ export default {
*/ */
logout({state, dispatch}) { logout({state, dispatch}) {
state.method.clearLocal(); state.method.clearLocal();
dispatch("saveUserInfo", {}); dispatch("saveUserInfo", {}).then(() => {
const from = ["/", "/login"].includes(window.location.pathname) ? "" : encodeURIComponent(window.location.href); const from = ["/", "/login"].includes(window.location.pathname) ? "" : encodeURIComponent(window.location.href);
window.location.href = $A.urlAddParams(window.systemInformation.origin + "login", from ? {from: from} : {}) $A.goForward({name: 'login', query: from ? {from: from} : {}}, true);
});
}, },
/** /**
@ -310,8 +311,9 @@ export default {
*/ */
clearCache({state, dispatch}) { clearCache({state, dispatch}) {
state.method.clearLocal(); state.method.clearLocal();
state.method.setStorage("clearCache", $A.randomString(6))
dispatch("saveUserInfo", state.userInfo); dispatch("saveUserInfo", state.userInfo);
window.location.href = $A.urlAddParams(window.location.href, {'_cc': $A.randomString(6)}) window.location.reload()
}, },
/** *****************************************************************************************/ /** *****************************************************************************************/