Commit a55df700 authored by 张伯涛's avatar 张伯涛

大屏问题修改,以及ar插件引入

parent f9c91904
This diff is collapsed.
<template>
<div id="panel">
<div id="ar-div" class="panel-child"></div>
<div v-if="outTime" class="errorContent">
<h-empty>
<template #img>
<h-empty-error-control />
</template>
<template #description>
<p v-if="!connectError && outTime">
正在尝试第 {{ outTime }}次建立连接
</p>
<p v-else-if="connectError&&loginFailure">
{{ loginFailedText }}
</p>
<p v-else-if="connectError">
连接失败! 请检查客户端是否安装并开启
<el-button type="link" @click="jumpTo">
去下载
</el-button>
</p>
</template>
</h-empty>
<p></p>
</div>
</div>
</template>
<script>
import ARWebControl from "./arWebControl.debug";
// 该接口为vlmas组件ui接口,如果是在copas中调用,可以使用vlmas wiki中提供的api接口,如果是组件中使用,需要对应组件参照wiki提供相应接口
import { getClientInfo } from "@/api/index";
export default {
name: "OpenClient",
components: {},
props: {},
data() {
return {
control: null,
ip: "",
port: "",
protocolType: "",
userInfo: null,
domainId: "",
outTime: 0,
connectError: false,
loginFailure: false,
loginFailedText: ""
};
},
mounted() {
document.title = "AR车间";
console.log("----state----", this.$store.state, document.title);
this.ip = window.location.hostname;
this.protocolType = window.location.protocol.replace(':', '')
if (window.location.port) {
this.port = window.location.port;
} else {
this.port = this.protocolType === "https" ? "443" : "80";
}
this.getClientInfo();
},
beforeDestroy() {
if (this.control) {
this.control.setWindowStatus(0);
this.control = null;
}
},
beforeRouteLeave(to, from, next) {
// 导航离开该组件的对应路由时调用
// 可以访问组件实例 `this`
document.title = "vlmas";
next();
},
methods: {
init() {
// 初始化
if (this.control) {
this.control.setWindowStatus(0);
this.control = null;
}
const loginType = 3;
const ip = this.ip;
const port = this.port;
const userName = this.userInfo.userId;
const credential = this.userInfo.tgc;
const indexCode = "";
const wsPort = "7789";
const domainId = this.domainId;
const protocolType = this.protocolType
this.control = new ARWebControl(
"ar-div",
loginType,
ip,
port,
userName,
credential,
indexCode,
wsPort,
domainId,
protocolType
);
console.log("params--", {
loginType,
ip,
port,
userName,
credential,
domainId
});
window.addEventListener("ar_loaded", event => {
if (event.detail.loadingStatus) {
this.outTime = 0;
this.connectError = false;
console.log("ms3d已加载");
}
});
window.addEventListener("ar_custom_message", event => {
console.log(event.detail.data);
});
window.addEventListener("ar_keydown", event => {
console.log(event.detail.data);
});
// 次数
window.addEventListener("ar_websocket_link_times", event => {
this.outTime = event.detail.time;
});
// 超时
window.addEventListener("ar_websocket_link_time_out", event => {
this.connectError = event.detail.flag;
});
// 登录失败
window.addEventListener("ar_login_failure", event => {
this.loginFailure = true;
this.connectError = true;
this.loginFailedText = event.detail || "登录失败!";
});
// 启动
this.control.setupControl();
},
async getClientInfo() {
try {
const { code, data } = await getClientInfo();
if (code === "0") {
this.userInfo = data.currentUser || {};
this.domainId = data.domainId;
this.init();
}
} catch (error) {
console.log(error);
}
},
jumpTo() {
window.open("/portal/ui/download/attachment");
}
}
};
</script>
<style scoped>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#panel {
height: 100%;
display: flex;
flex-direction: row;
border-right: 1px solid #000;
}
.panel-child {
width: 100%;
height: 100%;
}
.errorContent {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
</style>
...@@ -1009,6 +1009,11 @@ export default defineComponent({ ...@@ -1009,6 +1009,11 @@ export default defineComponent({
_this.voideShow = true; _this.voideShow = true;
}); });
}); });
popupButtons2.addEventListener("dblclick", function (event) {
if (markerId.includes("marker3")) {
console.log('ggggggggggggggggggggggggggggggggggggggggggggggggggggggg')
}
})
popupButtons2.addEventListener("click", function (event) { popupButtons2.addEventListener("click", function (event) {
if (markerId.includes("marker1")) { if (markerId.includes("marker1")) {
console.log('1111111111111111111111111111111111111111111111111111111111111',centerId) console.log('1111111111111111111111111111111111111111111111111111111111111',centerId)
...@@ -3073,12 +3078,18 @@ export default defineComponent({ ...@@ -3073,12 +3078,18 @@ export default defineComponent({
this.queryParams = JSON.stringify(videoList) this.queryParams = JSON.stringify(videoList)
}else { }else {
// ElMessage({ if(num + 1 < this.transferList.length) {
// message: res.data, num += 1
// type: 'warning' this.getVideoAPI(num)
// }) }else {
num += 1 this.stationName = this.transferList[num].stationName
this.getVideoAPI(num) this.videoLoading = false
ElMessage({
message: res.data,
type: 'warning'
})
}
} }
}) })
}, },
......
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