mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-13 01:28:11 +00:00
no message
This commit is contained in:
parent
ca7cd2372a
commit
9e449fa4ee
34
resources/assets/js/functions/common.js
vendored
34
resources/assets/js/functions/common.js
vendored
@ -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 第一个参数为连接符
|
||||
|
||||
@ -312,7 +312,7 @@ export default {
|
||||
setServerUrl(value) {
|
||||
if (value != this.cacheServerUrl) {
|
||||
$A.setStorage("cacheServerUrl", value)
|
||||
window.location.reload();
|
||||
$A.reloadUrl();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -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':
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user