优化清除缓存

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",
"version": "0.3.81",
"version": "0.3.89",
"description": "DooTask is task management system.",
"main": "main.js",
"license": "MIT",

View File

@ -1,6 +1,6 @@
{
"name": "DooTask",
"version": "0.3.88",
"version": "0.3.89",
"description": "DooTask is task management system.",
"scripts": {
"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() {
if ($A.getObject(this.$route.query, '_cc')) {
this.$store.state.method.clearLocal();
this.$store.dispatch("saveUserInfo", this.userInfo);
if (this.$store.state.method.getStorageString("clearCache")) {
this.$store.state.method.setStorage("clearCache", "")
$A.messageSuccess("清除成功");
}
//

View File

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