mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-26 20:48:12 +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}
|
* @returns {number}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
Time(v) {
|
Time(v = undefined) {
|
||||||
let time
|
let time
|
||||||
if (typeof v === "string" && this.strExists(v, "-")) {
|
if (typeof v === "string" && this.strExists(v, "-")) {
|
||||||
v = v.replace(/-/g, '/');
|
v = v.replace(/-/g, '/');
|
||||||
@ -702,6 +702,38 @@
|
|||||||
return this.rightDelete(url.replace("?&", "?"), '?');
|
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 第一个参数为连接符
|
* @param value 第一个参数为连接符
|
||||||
|
|||||||
@ -312,7 +312,7 @@ export default {
|
|||||||
setServerUrl(value) {
|
setServerUrl(value) {
|
||||||
if (value != this.cacheServerUrl) {
|
if (value != this.cacheServerUrl) {
|
||||||
$A.setStorage("cacheServerUrl", value)
|
$A.setStorage("cacheServerUrl", value)
|
||||||
window.location.reload();
|
$A.reloadUrl();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -773,9 +773,9 @@ export default {
|
|||||||
case 'clearCache':
|
case 'clearCache':
|
||||||
this.$store.dispatch("handleClearCache", null).then(() => {
|
this.$store.dispatch("handleClearCache", null).then(() => {
|
||||||
$A.setStorage("clearCache", $A.randomString(6))
|
$A.setStorage("clearCache", $A.randomString(6))
|
||||||
window.location.reload()
|
$A.reloadUrl()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
window.location.reload()
|
$A.reloadUrl()
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case 'logout':
|
case 'logout':
|
||||||
|
|||||||
@ -117,9 +117,9 @@ export default {
|
|||||||
case 'clearCache':
|
case 'clearCache':
|
||||||
this.$store.dispatch("handleClearCache", null).then(() => {
|
this.$store.dispatch("handleClearCache", null).then(() => {
|
||||||
$A.setStorage("clearCache", $A.randomString(6))
|
$A.setStorage("clearCache", $A.randomString(6))
|
||||||
window.location.reload()
|
$A.reloadUrl()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
window.location.reload()
|
$A.reloadUrl()
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user