no message

This commit is contained in:
kuaifan 2022-05-17 14:57:48 +08:00
parent ca7cd2372a
commit 9e449fa4ee
4 changed files with 38 additions and 6 deletions

View File

@ -238,7 +238,7 @@
* @returns {number}
* @constructor
*/
Time(v) {
Time(v = undefined) {
let time
if (typeof v === "string" && this.strExists(v, "-")) {
v = v.replace(/-/g, '/');
@ -702,6 +702,38 @@
return this.rightDelete(url.replace("?&", "?"), '?');
},
/**
* 刷新当前地址
* @param url
* @param key
* @returns {string}
*/
reloadUrl(url = undefined, key = undefined) {
url = key || window.location.href;
key = (key || '_') + '='
let reg = new RegExp(key + '\\d+');
let timestamp = this.Time();
if (url.indexOf(key) > -1) {
url = url.replace(reg, key + timestamp);
} else {
if (url.indexOf('\?') > -1) {
let urlArr = url.split('\?');
if (urlArr[1]) {
url = urlArr[0] + '?' + key + timestamp + '&' + urlArr[1];
} else {
url = urlArr[0] + '?' + key + timestamp;
}
} else {
if (url.indexOf('#') > -1) {
url = url.split('#')[0] + '?' + key + timestamp + location.hash;
} else {
url = url + '?' + key + timestamp;
}
}
}
window.location.href = url
},
/**
* 链接字符串
* @param value 第一个参数为连接符

View File

@ -312,7 +312,7 @@ export default {
setServerUrl(value) {
if (value != this.cacheServerUrl) {
$A.setStorage("cacheServerUrl", value)
window.location.reload();
$A.reloadUrl();
}
},

View File

@ -773,9 +773,9 @@ export default {
case 'clearCache':
this.$store.dispatch("handleClearCache", null).then(() => {
$A.setStorage("clearCache", $A.randomString(6))
window.location.reload()
$A.reloadUrl()
}).catch(() => {
window.location.reload()
$A.reloadUrl()
});
return;
case 'logout':

View File

@ -117,9 +117,9 @@ export default {
case 'clearCache':
this.$store.dispatch("handleClearCache", null).then(() => {
$A.setStorage("clearCache", $A.randomString(6))
window.location.reload()
$A.reloadUrl()
}).catch(() => {
window.location.reload()
$A.reloadUrl()
});
break;