Commit fe722845 authored by “yiyousong”'s avatar “yiyousong”

feat: 站点模块添加admin右键查看跳转信息

parent 9bc51810
......@@ -19,8 +19,6 @@ Vue.use(GlobalComponents);
import common from "./utils/commin";
Vue.use(common);
import VScaleScreen from "v-scale-screen";
Vue.use(VScaleScreen);
// 公共样式
import "@/assets/css/normalize.css";
import "@/assets/css/reset.css";
......
......@@ -45,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"
......@@ -91,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"
......@@ -157,7 +165,8 @@ export default {
this.siteModelList = data;
}
},
openWindow(row) {
async openWindow(event, row, type) {
let _this = this;
let siteid = Storage.get(2, "siteId") || 0;
let siteName = Storage.get(2, "siteName") || "";
let userInfo = JSON.stringify({
......@@ -167,12 +176,42 @@ 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(
siteName
)}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`,
"_blank"
);
let params = `?token=${this.token}&siteid=${siteid}&siteName=${encodeURI(
siteName
)}&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 redirect = await this.getFinalRedirect(modelUrl);
if (redirect) {
redirectUrl = redirect;
} else {
redirectUrl = modelUrl;
}
this.$notification.open({
message: "跳转链接",
key: 1,
duration: null,
description: (
<div>
<div class="notif-name">完整链接:</div>
<div id="FullUrl">{redirectUrl + params}</div>
<div class="notif-name">链接参数:</div>
<div id="Params">{params}</div>
</div>
),
style: {
"word-break": "break-all",
},
onClick: _this.copyContent,
icon: <a-icon type="smile" style="color: #108ee9" />,
});
}
},
handleJoin() {
......@@ -230,15 +269,65 @@ export default {
}
return false;
},
// 复制链接内容
copyContent(dom) {
let target = dom.target.id;
if (target === "FullUrl") {
this.copy("FullUrl");
} else if (target === "Params") {
this.copy("Params");
}
},
copy(element) {
let _this = this;
let dom = document.getElementById(element);
let textToCopy = dom.innerText;
// let range = document.createRange();
// range.selectNodeContents(dom);
// let selection = window.getSelection();
// selection.removeAllRanges();
// selection.addRange(range);
navigator.clipboard
.writeText(textToCopy)
.then(function () {
_this.$message.success("复制成功");
})
.catch(function (err) {
_this.$message.error("复制失败");
});
},
// 获取重定向地址
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_2.png") no-repeat;
background-size: 100% 100%;
overflow: hidden;
.del-box {
width: 100%;
height: 150px;
......
......@@ -21,6 +21,7 @@
v-model="userform.searchVal"
style="width: 250px"
placeholder="请输入关键字搜索"
@pressEnter="handleSearch"
>
<a-icon slot="prefix" type="search" />
</a-input>
......@@ -36,7 +37,7 @@
>{{ v }}</a-select-option
>
</a-select>
<a-button type="primary" class="addclass" @click="getUserList"
<a-button type="primary" class="addclass" @click="handleSearch"
>搜索</a-button
>
<a-button @click="resetList">重置</a-button>
......@@ -202,6 +203,12 @@ export default {
this.getUserList();
},
// 搜索
handleSearch() {
this.tablePagination.current = 1;
this.getUserList();
},
// 获取用户列表
async getUserList() {
this.tableLoading = true;
......
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