Commit 067509eb authored by 张伯涛's avatar 张伯涛

AR模块修改

parent 3db2e857
...@@ -36,6 +36,7 @@ axios.interceptors.response.use((res) => { ...@@ -36,6 +36,7 @@ axios.interceptors.response.use((res) => {
return Promise.resolve(res); return Promise.resolve(res);
}, (error) => { }, (error) => {
closeLoading(); closeLoading();
alert(error)
let httpMessage = ''; let httpMessage = '';
if (error.response) { if (error.response) {
if (error.response.status == '401') { if (error.response.status == '401') {
...@@ -327,4 +328,4 @@ ajax.post = function (url, param, success, errror) { ...@@ -327,4 +328,4 @@ ajax.post = function (url, param, success, errror) {
ajax.get = function (url, param, success, errror) { ajax.get = function (url, param, success, errror) {
ajax({ url: url, param: param, success: success, error: errror, type: 'get' }) ajax({ url: url, param: param, success: success, error: errror, type: 'get' })
} }
export default { post, get, download, ajax, ipAddress, changeIP } export default { post, get, download, ajax, ipAddress, changeIP }
\ No newline at end of file
This diff is collapsed.
...@@ -2,25 +2,25 @@ ...@@ -2,25 +2,25 @@
<div id="panel"> <div id="panel">
<div id="ar-div" class="panel-child"></div> <div id="ar-div" class="panel-child"></div>
<div v-if="outTime" class="errorContent"> <div v-if="outTime" class="errorContent">
<h-empty> <!-- <h-empty>-->
<template #img> <!-- <template #img>-->
<h-empty-error-control /> <!-- <h-empty-error-control />-->
</template> <!-- </template>-->
<template #description> <!-- <template #description>-->
<p v-if="!connectError && outTime"> <!-- <p v-if="!connectError && outTime">-->
正在尝试第 {{ outTime }}次建立连接 <!-- 正在尝试第 {{ outTime }}次建立连接-->
</p> <!-- </p>-->
<p v-else-if="connectError&&loginFailure"> <!-- <p v-else-if="connectError&&loginFailure">-->
{{ loginFailedText }} <!-- {{ loginFailedText }}-->
</p> <!-- </p>-->
<p v-else-if="connectError"> <!-- <p v-else-if="connectError">-->
连接失败! 请检查客户端是否安装并开启 <!-- 连接失败! 请检查客户端是否安装并开启-->
<el-button type="link" @click="jumpTo"> <!-- <el-button type="link" @click="jumpTo">-->
去下载 <!-- 去下载-->
</el-button> <!-- </el-button>-->
</p> <!-- </p>-->
</template> <!-- </template>-->
</h-empty> <!-- </h-empty>-->
<p></p> <p></p>
</div> </div>
</div> </div>
...@@ -36,6 +36,7 @@ export default { ...@@ -36,6 +36,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
raData: {},
control: null, control: null,
ip: "", ip: "",
port: "", port: "",
...@@ -80,34 +81,34 @@ export default { ...@@ -80,34 +81,34 @@ export default {
this.control = null; this.control = null;
} }
const loginType = 3; const loginType = 3;
const ip = this.ip; const ip = '111.160.132.74';
const port = this.port; const port = this.raData.port;
const userName = this.userInfo.userId; const userName = this.raData.username;
const credential = this.userInfo.tgc; const loginKey = this.raData.tgc;
const indexCode = ""; const left = '10';
const wsPort = "7789"; const top = '100';
const domainId = this.domainId; const width = '1900';
const protocolType = this.protocolType const height = '953';
// const protocolType = this.protocolType
const protocolType = 'https'
const domainId = 103
const title = 'AR车间'
this.control = new ARWebControl( this.control = new ARWebControl(
"ar-div", "ar-div",
loginType, loginType,
ip, ip,
port, port,
userName, userName,
credential, loginKey,
indexCode, left,
wsPort, top,
width,
height,
protocolType,
domainId, domainId,
protocolType title,
); );
console.log("params--", { console.log('this.control',this.control)
loginType,
ip,
port,
userName,
credential,
domainId
});
window.addEventListener("ar_loaded", event => { window.addEventListener("ar_loaded", event => {
if (event.detail.loadingStatus) { if (event.detail.loadingStatus) {
this.outTime = 0; this.outTime = 0;
...@@ -141,10 +142,13 @@ export default { ...@@ -141,10 +142,13 @@ export default {
}, },
async getClientInfo() { async getClientInfo() {
try { try {
const { code, data } = await getLoginTgc(); const { status, data } = await getLoginTgc();
if (code === "0") { console.log('data',JSON.parse(data))
this.userInfo = data.currentUser || {}; if (status === 0) {
this.domainId = data.domainId; // this.userInfo = data.currentUser || {};
// this.domainId = data.domainId;
this.raData = JSON.parse(data).data
console.log('this.raData',this.raData)
this.init(); this.init();
} }
} catch (error) { } catch (error) {
......
...@@ -509,7 +509,11 @@ import store from "@/store/index.js"; ...@@ -509,7 +509,11 @@ import store from "@/store/index.js";
* @param ip{String} 平台ip * @param ip{String} 平台ip
* @param port{String} 平台端口 * @param port{String} 平台端口
* @param userName{String} 用户名 * @param userName{String} 用户名
* @param credentials{String} 登录凭据(密码/SG/TGT) * @param loginKey
* @param left
* @param top
* @param width
* @param height
* @param arIndexCode{String} 默认显示场景IndexCode * @param arIndexCode{String} 默认显示场景IndexCode
* @param webSocketPort{String} 默认显示场景IndexCode * @param webSocketPort{String} 默认显示场景IndexCode
* @param domainId{String} 默认显示场景IndexCode * @param domainId{String} 默认显示场景IndexCode
...@@ -523,11 +527,15 @@ import store from "@/store/index.js"; ...@@ -523,11 +527,15 @@ import store from "@/store/index.js";
ip, ip,
port, port,
userName, userName,
credentials, loginKey,
left,
top,
width,
height,
protocolType,
domainId,
arIndexCode, arIndexCode,
webSocketPort, webSocketPort,
domainId,
protocolType
) { ) {
// var arIndexCode = // var arIndexCode =
// arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '' // arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ''
...@@ -549,11 +557,11 @@ import store from "@/store/index.js"; ...@@ -549,11 +557,11 @@ import store from "@/store/index.js";
this.arControlVisibility = false this.arControlVisibility = false
this.arDivVisibility = true this.arDivVisibility = true
var _this$_getDomPosition = this._getDomPosition(), // var _this$_getDomPosition = this._getDomPosition(),
left = _this$_getDomPosition.left, // left = _this$_getDomPosition.left,
top = _this$_getDomPosition.top, // top = _this$_getDomPosition.top,
width = _this$_getDomPosition.width, // width = _this$_getDomPosition.width,
height = _this$_getDomPosition.height // height = _this$_getDomPosition.height
this.controlSetupDom = document.createElement('a') this.controlSetupDom = document.createElement('a')
var title = window.top.document.title var title = window.top.document.title
...@@ -567,15 +575,17 @@ import store from "@/store/index.js"; ...@@ -567,15 +575,17 @@ import store from "@/store/index.js";
// } // }
if (loginType == 0 || loginType == 1) { if (loginType == 0 || loginType == 1) {
this.controlSetupDom.href = `PCCloudVideoLabel://UP --ip ${ip} --port ${port} --user-name ${userName} --login-key ${credentials} --start-plan-id ${arIndexCode} --left ${left} --top ${top} --width ${width} --height ${height} --login-method password --domain-id ${domainId} --protocolType ${protocolType} --title ${title}` this.controlSetupDom.href = `PCCloudVideoLabel://UP --ip ${ip} --port ${port} --user-name ${userName} --login-key ${loginKey} --start-plan-id ${arIndexCode} --left ${left} --top ${top} --width ${width} --height ${height} --login-method password --domain-id ${domainId} --protocolType ${protocolType} --title ${title}`
} else if (loginType == 2) { } else if (loginType == 2) {
this.controlSetupDom.href = `PCCloudVideoLabel://UP --ip ${ip} --port ${port} --user-name ${userName} --login-key ${credentials} --start-plan-id ${arIndexCode} --left ${left} --top ${top} --width ${width} --height ${height} --login-method sg --domain-id ${domainId} --protocolType ${protocolType} --title ${title}` this.controlSetupDom.href = `PCCloudVideoLabel://UP --ip ${ip} --port ${port} --user-name ${userName} --login-key ${loginKey} --start-plan-id ${arIndexCode} --left ${left} --top ${top} --width ${width} --height ${height} --login-method sg --domain-id ${domainId} --protocolType ${protocolType} --title ${title}`
} else if (loginType == 3) { } else if (loginType == 3) {
this.controlSetupDom.href = `PCCloudVideoLabel://UP --ip ${ip} --port ${port} --user-name ${userName} --login-key ${credentials} --start-plan-id ${arIndexCode} --left ${left} --top ${top} --width ${width} --height ${height} --login-method tgc --domain-id ${domainId} --protocolType ${protocolType} --title ${title}` const href = `PCCloudVideoLabel://UP --ip ${ip} --port ${port} --user-name ${userName} --login-key ${loginKey} --left ${left} --top ${top} --width ${width} --height ${height} --login-method tgc --domain-id ${domainId} --protocolType ${protocolType} --title ${title}`
console.log('hrefaaaaaaaaaaaaaaaaaaaaaa',href)
this.controlSetupDom.href = encodeURI(href)
} }
console.log('href------', this.controlSetupDom.href) console.log('href------', this.controlSetupDom.href)
this.webSocketPort = webSocketPort this.webSocketPort = '7789'
this.lastPosition = { this.lastPosition = {
x: left, x: left,
y: top, y: top,
...@@ -612,10 +622,10 @@ import store from "@/store/index.js"; ...@@ -612,10 +622,10 @@ import store from "@/store/index.js";
canRun = false canRun = false
setTimeout(function() { setTimeout(function() {
var _this$_getDomPosition2 = _this._getDomPosition(), var _this$_getDomPosition2 = _this._getDomPosition(),
left = _this$_getDomPosition2.left, left = '103',
top = _this$_getDomPosition2.top, top = '103',
width = _this$_getDomPosition2.width, width = '1919',
height = _this$_getDomPosition2.height height = '937'
_this.setPosition(left, top, width, height) _this.setPosition(left, top, width, height)
...@@ -728,10 +738,10 @@ import store from "@/store/index.js"; ...@@ -728,10 +738,10 @@ import store from "@/store/index.js";
this.timer = setInterval(function() { this.timer = setInterval(function() {
var _this$_getDomPosition3 = _this._getDomPosition(), var _this$_getDomPosition3 = _this._getDomPosition(),
left = _this$_getDomPosition3.left, left = '103',
top = _this$_getDomPosition3.top, top = '103',
width = _this$_getDomPosition3.width, width = '1919',
height = _this$_getDomPosition3.height height = '937'
if ( if (
_this.lastPosition.x != left || _this.lastPosition.x != left ||
...@@ -798,6 +808,7 @@ import store from "@/store/index.js"; ...@@ -798,6 +808,7 @@ import store from "@/store/index.js";
if (this.arStartedFlag) { if (this.arStartedFlag) {
console.warn('已启动AR实例,请勿重复启动实例') console.warn('已启动AR实例,请勿重复启动实例')
} else { } else {
console.log('11111111111111111111111111111111')
this.controlSetupDom.click() this.controlSetupDom.click()
this._initWebSocket() this._initWebSocket()
...@@ -861,7 +872,6 @@ import store from "@/store/index.js"; ...@@ -861,7 +872,6 @@ import store from "@/store/index.js";
key: '_initWebSocket', key: '_initWebSocket',
value: function _initWebSocket() { value: function _initWebSocket() {
var _this2 = this var _this2 = this
this.ws = new WebSocket(ConstantConfig.WEBSOCKET_URL + ':' + this.webSocketPort) this.ws = new WebSocket(ConstantConfig.WEBSOCKET_URL + ':' + this.webSocketPort)
this.ws.onopen = function() { this.ws.onopen = function() {
......
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