fix: BUG修改

This commit is contained in:
kun 2024-03-08 11:39:24 +08:00
parent 639fa42153
commit d4a369a987
7 changed files with 248 additions and 44 deletions

View File

@ -122,6 +122,21 @@
<!-- webrtc播放器视频文件 -->
<script type="text/javascript" src="/adapter.min.js"></script>
<script type="text/javascript" src="/webrtcstreamer.js"></script>
<!-- bimBase相关引入 -->
<script
src="https://api.cloud.pkpm.cn/bimviewer/viewer/v5/obv.js"
type="text/javascript"
></script>
<link
rel="stylesheet"
href="https://api.cloud.pkpm.cn/bimviewer/viewer/v5/obv.css"
type="text/css"
/>
<link
href="https://api.cloud.pkpm.cn/bimviewer/viewer/v4/locale/locale.properties"
rel="resource"
type="application/l10n"
/>
<script>
// 禁用鼠标滚动事件
document.addEventListener(

View File

@ -14,3 +14,8 @@ export const selectUserVideoListApi = (params: {}) => {
export const getSafeHatSessionApi = (params: {}) => {
return http.post(BASEURL + `/xmgl/projectApi/getSafeyHatSession`, params);
};
// 查询模型工程列表
export const getProgressListApi = (params: {}) => {
return http.post(BASEURL + `/xmgl/taskProgressRt/getParentChildPage`, params);
};

View File

@ -51,7 +51,6 @@ router.beforeEach(async (to, from, next) => {
const title = import.meta.env.VITE_GLOB_APP_TITLE;
// document.title = to.meta.title ? `${to.meta.title} - ${title}` : title;
document.title = to.meta.title ? `${to.meta.title} ` : title;
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由并放行到登陆页
if (to.path === LOGIN_URL) {
console.log("判断是访问登陆页,有:", from.fullPath);

View File

@ -8,7 +8,7 @@
<span :class="activeTab == 1 ? 'active-span' : ''" @click="changeActive(1)">3D模型</span>
</div>
<div class="href-content" v-if="activeTab == 0">
<el-carousel indicator-position="none" height="450px">
<!-- <el-carousel indicator-position="none" height="450px">
<el-carousel-item v-for="(item, index) in videoList" :key="item.id">
<div style="width: 100%; height: 100%">
<ckplayerComp
@ -20,10 +20,13 @@
></ckplayerComp>
</div>
</el-carousel-item>
</el-carousel>
</el-carousel> -->
</div>
<div class="href-content" v-if="activeTab == 1">
<iframe :src="iframeUrl" frameborder="0" style="width: 100%; height: 100%"></iframe>
<el-select v-model="projectSelect" placeholder="请选择" size="small">
<el-option v-for="item in projectList" :key="item.id" :label="item.taskName" :value="item.id" />
</el-select>
<div id="viewer" style="width: 100%; height: 100%;margin-top: 10px;" class="my-obv-viewer"></div>
</div>
</div>
</template>
@ -31,14 +34,202 @@
<script lang="ts" setup>
import { GlobalStore } from "@/stores";
import { ref, watch, onMounted, getCurrentInstance } from "vue";
import { selectProjectVideoListApi } from "@/api/modules/video";
import { selectProjectVideoListApi, getProgressListApi } from "@/api/modules/video";
import ckplayerComp from "../videoManagement/ckplayerComp.vue";
const emits = defineEmits(["openDialog"]);
const store = GlobalStore();
const rtcPlayer = ref();
const videoList = ref([] as any);
const activeTab = ref(0);
const iframeUrl = ref("http://jxj.zhgdyun.com:8082/bim/rt-video/srs/srs.html");
const iframeUrl = ref("");
const iframeRef = ref();
const projectSelect = ref();
const projectList = ref([] as any);
const configValue = ref({
viewToken: "",
urn: "",
hideArr: [],
colorArr: []
});
const firstEnter = ref(0);
const searchParams = ref({} as any);
const postDataVal = ref();
const main = async () => {
// serviceConfig getAccessToken
const applicationOptions = {
// OBV BIMServerAPI origin使
getAccessToken: getAccessToken,
refreshAccessToken: getAccessToken,
serviceConfig: {
origin: "https://api.cloud.pkpm.cn",
apiContextPath: "/bimserver/viewing/v3"
}
};
// urn
let urn = configValue.value.urn;
// Builder
const builder = new OBV.Api.ObvBuilder();
// Application
const application = await builder.buildApplication(applicationOptions);
// document
const obvDocument = await builder.loadDocument(application, urn);
// viewer , API
const obvApi = await builder.buildViewer3d(application, document.getElementById("viewer"));
//
const viewer3dItems = obvDocument.get3dGeometryItems();
//
builder.load3dModels(obvApi, {
obvDocument: obvDocument,
viewer3dItem: viewer3dItems[0]
});
//
obvApi.addEventListener(OBV.ViewerEventTypes.V3dCameraChangeEvent, (event: any) => {
console.log("V3dCameraChangeEvent", event);
if (firstEnter.value == 0) {
//
//
renderConfigModel(obvApi);
}
});
//
obvApi.addEventListener(OBV.ViewerEventTypes.V3dSelectionChangedEvent, (event: any) => {
emits("openDialog",{...postDataVal.value,title: '风险提示数据'})
});
};
// 访 getAccessToken expiresIn
const getAccessToken = (callBack: any) => {
callBack(configValue.value.viewToken);
};
const renderConfigModel = (obvApi: any) => {
console.log(obvApi);
firstEnter.value = firstEnter.value + 1; //
//
if (configValue.value.hideArr.length > 0) {
obvApi.hide(configValue.value.hideArr);
}
//
if (configValue.value.colorArr.length > 0) {
configValue.value.colorArr.map((item: any) => {
if (item.modelId) {
let firstIndex = item.color.indexOf(",");
let secondIndex = item.color.indexOf(",", firstIndex + 1);
let thirdIndex = item.color.indexOf(")", -1);
//
obvApi.setObjectsColor(
[item],
item.color.substring(4, firstIndex),
item.color.substring(firstIndex + 2, secondIndex),
item.color.substring(secondIndex + 2, thirdIndex),
1
);
}
});
}
};
const requestTokenFunction = async () => {
//1.
const xhr = new XMLHttpRequest();
// 2. url
xhr.open(
"GET",
`http://101.43.164.214:11111/xmgl/gouliPkpmModel/getBimTokenByProjectSn?projectSn=${searchParams.value.projectSn}`
);
//3.
xhr.send();
// onreadystatechange:
xhr.onreadystatechange = function () {
console.log(xhr);
//
if (xhr.readyState === 4) {
// 200 404 403 401 500
if (xhr.status == 200) {
//
console.log(JSON.parse(xhr.response), "11111111111");
// console.log(xhr.status); //
// console.log(xhr.statusText); //
// console.log(xhr.getAllResponseHeaders()); //
// console.log(xhr.response); //
configValue.value.viewToken = JSON.parse(xhr.response).result;
requestInfoFunction();
}
}
};
};
const requestInfoFunction = async () => {
//1.
const xhr = new XMLHttpRequest();
// 2. url
xhr.open("GET", `http://101.43.164.214:11111/xmgl/gouliPkpmModel/queryById?id=${searchParams.value.gouliPkpmModelId}`);
//3.
xhr.send();
// onreadystatechange:
xhr.onreadystatechange = function () {
console.log(xhr);
//
if (xhr.readyState === 4) {
// 200 404 403 401 500
if (xhr.status == 200) {
//
console.log(JSON.parse(xhr.response), "2222222222");
// console.log(xhr.status); //
// console.log(xhr.statusText); //
// console.log(xhr.getAllResponseHeaders()); //
// console.log(xhr.response); //
configValue.value.urn = JSON.parse(xhr.response).result.urn;
requestComponentIdFunction();
}
}
};
};
const requestComponentIdFunction = async () => {
//1.
const xhr = new XMLHttpRequest();
// 2. url
xhr.open("GET", `http://101.43.164.214:11111/xmgl/taskProgressRt/queryById?id=${searchParams.value.id}`);
//3.
xhr.send();
// onreadystatechange:
xhr.onreadystatechange = function () {
console.log(xhr);
//
if (xhr.readyState === 4) {
// 200 404 403 401 500
if (xhr.status == 200) {
//
console.log(JSON.parse(xhr.response), "33333333333");
// console.log(xhr.status); //
// console.log(xhr.statusText); //
// console.log(xhr.getAllResponseHeaders()); //
// console.log(xhr.response); //
postDataVal.value = JSON.parse(xhr.response).result
if (JSON.parse(xhr.response).result.hiddenComponentId) {
configValue.value.hideArr = JSON.parse(JSON.parse(xhr.response).result.hiddenComponentId);
} else {
configValue.value.hideArr = [];
}
if (JSON.parse(xhr.response).result.componentColorJson) {
configValue.value.colorArr = JSON.parse(JSON.parse(xhr.response).result.componentColorJson);
} else {
configValue.value.colorArr = [];
}
main();
}
}
};
};
//
const getProjectList = async () => {
const res: any = await getProgressListApi({ projectSn: store.sn });
projectList.value = res.result.records;
if (projectList.value.length > 0) {
projectSelect.value = projectList.value[0].id;
}
};
const getVideoList = async () => {
let res: any = await selectProjectVideoListApi({
projectSn: store.sn,
@ -60,40 +251,15 @@ const getVideoList = async () => {
};
const changeActive = (activeIndex: any) => {
activeTab.value = activeIndex;
iframeUrl.value =
activeIndex == 0 ? "http://jxj.zhgdyun.com:8082/bim/rt-video/srs/srs.html" : "http://jxjzw.zhgdyun.com:8082/rt-3dmx";
if (activeIndex == 1) {
let item = projectList.value.find((item: any) => item.id == projectSelect.value);
searchParams.value = item;
requestTokenFunction();
}
};
// watch(
// () => activeTab.value,
// newVal => {
// if (newVal == 0) {
// getVideoList();
// }
// },
// {
// immediate: true
// }
// );
onMounted(() => {
//
// window.addEventListener("message", (event:any) => {
// console.log(event)
// },false);
window.addEventListener(
"message",
async event => {
console.log(event)
const { type, data } = event.data;
//
if (type === "modelClick") {
console.log(data);
emits("openDialog",{...data,title:'风险提示'})
}
},
false
);
getVideoList();
onMounted(async () => {
await getVideoList();
await getProjectList();
});
</script>
@ -143,4 +309,21 @@ onMounted(() => {
margin-top: 10px;
}
}
// element
:deep() {
.el-input__wrapper {
background-color: transparent;
}
.el-input__inner {
color: white;
}
.view3d-viewer {
width: 850px !important;
height: 450px !important;
.obv-viewer3d-main-canvas{
width: 850px !important;
height: 450px !important;
}
}
}
</style>

View File

@ -7,10 +7,10 @@
<i>{{ postData.title || '' }}</i>
</div>
</div>
<!-- <div class="political-outlook" v-if="!postData.projectSn">
<div class="political-outlook" v-if="!postData.projectSn">
<memberMoreList ref="historyList" :dataObj="postData"></memberMoreList>
</div> -->
<div class="political-outlook">
</div>
<div class="political-outlook" v-if="postData.projectSn">
<riskTipDialog ref="riskTipDialog" :dataObj="postData"></riskTipDialog>
</div>
<div class="close-icon" @click="showDialog = false">

View File

@ -7,7 +7,7 @@
<div class="leftBottom"><LeftBottom /></div>
</div>
<div class="center">
<div class="centerTop" @openDialog="openPeopleCountDialog"><CenterTop/></div>
<div class="centerTop"><CenterTop @openDialog="openPeopleCountDialog"/></div>
<div class="centerBottom"><CenterBottom /></div>
</div>
<div class="right">
@ -34,6 +34,7 @@ import { ref } from "vue";
//
const partyBuildRef = ref();
const openPeopleCountDialog = (type:any) => {
console.log(type)
partyBuildRef.value.openDialog(type);
// console.log(partyBuildRef.value);
};

View File

@ -7,7 +7,7 @@
<span :class="activeTab == 2 ? 'active-span' : ''" @click="changeActive(2)">施工要点</span>
</div>
<div class="text-content">
{{ activeTab == 0?props.dataObj.dangerPointIdentification:activeTab == 1?props.dataObj.riskControlMeasure:activeTab == 2?props.dataObj.constructionKeyPoint:'' }}
</div>
</div>
</div>
@ -35,6 +35,7 @@ const getCompanyList = async () => {
}
};
onMounted(async () => {
console.log(props.dataObj)
await getCompanyList();
});
</script>