Commit 964e596f authored by “yiyousong”'s avatar “yiyousong”

perf: 优化

parent 833601d9
...@@ -185,18 +185,18 @@ export default { ...@@ -185,18 +185,18 @@ export default {
if (this.userData.admin || this.userData.id == 1) { if (this.userData.admin || this.userData.id == 1) {
event.preventDefault(); event.preventDefault();
let redirectUrl = ""; // let redirectUrl = "";
let hash = ""; // let hash = "";
let redirect = await this.getFinalRedirect(modelUrl); // let redirect = await this.getFinalRedirect(modelUrl);
if (!modelUrl.includes("http")) { // if (!modelUrl.includes("http")) {
let index = modelUrl.indexOf("/"); // let index = modelUrl.indexOf("/");
hash = modelUrl.slice(index + 1); // hash = modelUrl.slice(index + 1);
} // }
if (redirect) { // if (redirect) {
redirectUrl = redirect + hash; // redirectUrl = redirect + hash;
} else { // } else {
redirectUrl = modelUrl; // redirectUrl = modelUrl;
} // }
this.$notification.open({ this.$notification.open({
message: "跳转链接", message: "跳转链接",
...@@ -205,7 +205,7 @@ export default { ...@@ -205,7 +205,7 @@ export default {
description: ( description: (
<div> <div>
<div class="notif-name">{modelName}-完整链接:</div> <div class="notif-name">{modelName}-完整链接:</div>
<div>{redirectUrl + params}</div> <div>{modelUrl + params}</div>
<div class="notif-name">链接参数:</div> <div class="notif-name">链接参数:</div>
<div>{params}</div> <div>{params}</div>
</div> </div>
...@@ -275,19 +275,19 @@ export default { ...@@ -275,19 +275,19 @@ export default {
}, },
// 获取重定向地址 // 获取重定向地址
getFinalRedirect(url) { // getFinalRedirect(url) {
return fetch(url, { method: "GET", redirect: "follow" }) // return fetch(url, { method: "GET", redirect: "follow" })
.then((response) => { // .then((response) => {
if (!response.ok) { // if (!response.ok) {
throw new Error("Network response was not ok"); // throw new Error("Network response was not ok");
} // }
return response.url; // return response.url;
}) // })
.catch((error) => { // .catch((error) => {
console.error("Error:", error); // console.error("Error:", error);
return null; // return null;
}); // });
}, // },
}, },
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment