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

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

parent f84a6112
......@@ -19,7 +19,6 @@
class="img-title mb-[42px]"
src="@/assets/images/siteArrange/title.png"
/> -->
<h1 class="slogan_title">{{ sloganTitle }}</h1>
<div class="slogan">建设高效便民、智慧泛在的智慧政务大厅</div>
</div>
<!-- 站点 -->
......@@ -46,7 +45,11 @@
v-for="(v, i) in collectList"
: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
class="w-full h-full object-contain"
:src="api + v.modelIcon"
......@@ -92,7 +95,11 @@
v-for="item in v.list"
: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
class="w-full h-full object-contain"
:src="api + item.modelIcon"
......@@ -118,7 +125,6 @@ import { mapState } from "vuex";
export default {
data() {
return {
sloganTitle:'',
api: process.env.VUE_APP_API_IMG_URL,
siteId: Storage.get(2, "siteId"),
arr: [],
......@@ -137,7 +143,6 @@ export default {
},
created() {
this.sloganTitle=localStorage.getItem('sloganTitle')
this.getCollect();
this.appsListInterface();
},
......@@ -160,7 +165,7 @@ export default {
this.siteModelList = data;
}
},
openWindow(row) {
async openWindow(event, row, type) {
let siteid = Storage.get(2, "siteId") || 0;
let siteName = Storage.get(2, "siteName") || "";
let userInfo = JSON.stringify({
......@@ -170,12 +175,47 @@ export default {
let { modelUrl, modelName, modelIcon } = row;
let path = this.$route.path;
modelName = encodeURI(modelName);
window.open(
`${modelUrl}?token=${this.token}&siteid=${siteid}&siteName=${encodeURI(
let params = `?token=${this.token}&siteid=${siteid}&siteName=${encodeURI(
siteName
)}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`,
"_blank"
);
)}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`;
if (type === "click") {
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() {
......@@ -233,15 +273,36 @@ export default {
}
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>
<style>
.notif-name {
font-size: 14px;
font-weight: 600;
}
</style>
<style lang="less" scoped>
.station {
background: url("@/assets/images/siteArrange/bg_3.jpg") no-repeat;
background-size: 100% 100%;
overflow: hidden;
.del-box {
width: 100%;
height: 150px;
......@@ -260,13 +321,6 @@ export default {
top: 0px;
}
.title {
.slogan_title {
font-size: 65px;
font-family: Source Han Sans CN;
font-weight: 600;
color: #ffffff;
margin-bottom: 30px;
}
.slogan {
font-size: 39px;
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