Commit 386a65bf authored by “yiyousong”'s avatar “yiyousong”

perf: 修改站点跳转admin账号右键获取跳转信息

parent f84a6112
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
class="img-title mb-[42px]" class="img-title mb-[42px]"
src="@/assets/images/siteArrange/title.png" src="@/assets/images/siteArrange/title.png"
/> --> /> -->
<h1 class="slogan_title">{{ sloganTitle }}</h1>
<div class="slogan">建设高效便民、智慧泛在的智慧政务大厅</div> <div class="slogan">建设高效便民、智慧泛在的智慧政务大厅</div>
</div> </div>
<!-- 站点 --> <!-- 站点 -->
...@@ -46,7 +45,11 @@ ...@@ -46,7 +45,11 @@
v-for="(v, i) in collectList" v-for="(v, i) in collectList"
:key="'' + v.id + i" :key="'' + v.id + i"
> >
<div class="item-logo cursor-pointer" @click="openWindow(v)"> <div
class="item-logo cursor-pointer"
@click="openWindow($event, v, 'click')"
@contextmenu="openWindow($event, v)"
>
<img <img
class="w-full h-full object-contain" class="w-full h-full object-contain"
:src="api + v.modelIcon" :src="api + v.modelIcon"
...@@ -92,7 +95,11 @@ ...@@ -92,7 +95,11 @@
v-for="item in v.list" v-for="item in v.list"
:key="item.id" :key="item.id"
> >
<div class="item-logo cursor-pointer" @click="openWindow(item)"> <div
class="item-logo cursor-pointer"
@click="openWindow(($event, item, 'click'))"
@contextmenu="openWindow($event, item)"
>
<img <img
class="w-full h-full object-contain" class="w-full h-full object-contain"
:src="api + item.modelIcon" :src="api + item.modelIcon"
...@@ -118,7 +125,6 @@ import { mapState } from "vuex"; ...@@ -118,7 +125,6 @@ import { mapState } from "vuex";
export default { export default {
data() { data() {
return { return {
sloganTitle:'',
api: process.env.VUE_APP_API_IMG_URL, api: process.env.VUE_APP_API_IMG_URL,
siteId: Storage.get(2, "siteId"), siteId: Storage.get(2, "siteId"),
arr: [], arr: [],
...@@ -137,7 +143,6 @@ export default { ...@@ -137,7 +143,6 @@ export default {
}, },
created() { created() {
this.sloganTitle=localStorage.getItem('sloganTitle')
this.getCollect(); this.getCollect();
this.appsListInterface(); this.appsListInterface();
}, },
...@@ -160,7 +165,7 @@ export default { ...@@ -160,7 +165,7 @@ export default {
this.siteModelList = data; this.siteModelList = data;
} }
}, },
openWindow(row) { async openWindow(event, row, type) {
let siteid = Storage.get(2, "siteId") || 0; let siteid = Storage.get(2, "siteId") || 0;
let siteName = Storage.get(2, "siteName") || ""; let siteName = Storage.get(2, "siteName") || "";
let userInfo = JSON.stringify({ let userInfo = JSON.stringify({
...@@ -170,12 +175,47 @@ export default { ...@@ -170,12 +175,47 @@ export default {
let { modelUrl, modelName, modelIcon } = row; let { modelUrl, modelName, modelIcon } = row;
let path = this.$route.path; let path = this.$route.path;
modelName = encodeURI(modelName); modelName = encodeURI(modelName);
window.open( let params = `?token=${this.token}&siteid=${siteid}&siteName=${encodeURI(
`${modelUrl}?token=${this.token}&siteid=${siteid}&siteName=${encodeURI( siteName
siteName )}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`;
)}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`, if (type === "click") {
"_blank" window.open(`${modelUrl}${params}`, "_blank");
); return;
}
if (this.userData.admin || this.userData.id == 1) {
event.preventDefault();
let redirectUrl = "";
let hash = "";
let redirect = await this.getFinalRedirect(modelUrl);
if (!modelUrl.includes("http")) {
let index = modelUrl.indexOf("/");
hash = modelUrl.slice(index + 1);
}
if (redirect) {
redirectUrl = redirect + hash;
} else {
redirectUrl = modelUrl;
}
this.$notification.open({
message: "跳转链接",
key: 1,
duration: null,
description: (
<div>
<div class="notif-name">完整链接:</div>
<div>{redirectUrl + params}</div>
<div class="notif-name">链接参数:</div>
<div>{params}</div>
</div>
),
style: {
"word-break": "break-all",
},
icon: <a-icon type="smile" style="color: #108ee9" />,
});
}
}, },
handleJoin() { handleJoin() {
...@@ -233,15 +273,36 @@ export default { ...@@ -233,15 +273,36 @@ export default {
} }
return false; return false;
}, },
// 获取重定向地址
getFinalRedirect(url) {
return fetch(url, { method: "GET", redirect: "follow" })
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.url;
})
.catch((error) => {
console.error("Error:", error);
return null;
});
},
}, },
}; };
</script> </script>
<style>
.notif-name {
font-size: 14px;
font-weight: 600;
}
</style>
<style lang="less" scoped> <style lang="less" scoped>
.station { .station {
background: url("@/assets/images/siteArrange/bg_3.jpg") no-repeat; background: url("@/assets/images/siteArrange/bg_3.jpg") no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
overflow: hidden; overflow: hidden;
.del-box { .del-box {
width: 100%; width: 100%;
height: 150px; height: 150px;
...@@ -260,13 +321,6 @@ export default { ...@@ -260,13 +321,6 @@ export default {
top: 0px; top: 0px;
} }
.title { .title {
.slogan_title {
font-size: 65px;
font-family: Source Han Sans CN;
font-weight: 600;
color: #ffffff;
margin-bottom: 30px;
}
.slogan { .slogan {
font-size: 39px; font-size: 39px;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
......
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