|
|
@@ -11,19 +11,52 @@
|
|
|
<!-- 工具栏 -->
|
|
|
<tools-bar :option="toolsOption" v-if="isReady"></tools-bar>
|
|
|
<!-- 操作面板 -->
|
|
|
- <dv-border-box-7 :color="['rgba(0,0,0,0.5)','rgba(230, 160, 9, 0.5)']" backgroundColor="rgba(0,0,0,0.5)" v-if="handlePanelShow" class="handle-panel">
|
|
|
- <div class="full">
|
|
|
+ <dv-border-box-7 :color="['rgba(0,0,0,0.5)','rgba(230, 160, 9, 0.5)']" backgroundColor="rgba(0,0,0,0.5)" v-if="handlePanelShow" :class="{
|
|
|
+ 'handle-panel-1': toolsPanelType=='building',
|
|
|
+ 'handle-panel-2': toolsPanelType=='camera'
|
|
|
+ }">
|
|
|
+ <!-- 楼栋控制面板 -->
|
|
|
+ <div v-if="toolsPanelType=='building'" class="full" >
|
|
|
<div class="center" style="width: 100%;height: 70px;">
|
|
|
<div class="center" style="width: 60%;height: 100%;">
|
|
|
- <el-input v-model="searchText" placeholder="请输入关键字"></el-input>
|
|
|
+ <el-input v-model="searchText" placeholder="请输入关键字" @change="handleSearch"></el-input>
|
|
|
</div>
|
|
|
- <div @click="handleNext(-1)" class="click" style="width: 15%;height: 100%;" :style="{background: 'url(/img/left.png) no-repeat center/50%'}"></div>
|
|
|
- <div @click="handleNext(1)" class="click" style="width: 15%;height: 100%;" :style="{background: 'url(/img/right.png) no-repeat center/50%'}"></div>
|
|
|
+ <div @click="handleNext(-1,buildingObj)" class="click" style="width: 15%;height: 100%;" :style="{background: 'url(/img/left.png) no-repeat center/50%'}"></div>
|
|
|
+ <div @click="handleNext(1,buildingObj)" class="click" style="width: 15%;height: 100%;" :style="{background: 'url(/img/right.png) no-repeat center/50%'}"></div>
|
|
|
</div>
|
|
|
<div class="search-body" >
|
|
|
<div class="full" v-if="searchType=='building'">
|
|
|
- <div class="search-item" v-for="(item,index) of buildings">
|
|
|
- <div @click="toBuilding(index)" class="center full building-click" style="color: white;font-size: 20px;letter-spacing: 3px;">{{item.text}}</div>
|
|
|
+ <div class="search-item" v-for="(item,index) of buildingsRes">
|
|
|
+ <div @click="toBuilding(index,buildingObj)" class="center full building-click" style="color: white;font-size: 20px;letter-spacing: 3px;">{{item.text}}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="search-footer center">
|
|
|
+ <!-- <div class="center click" style="width: 30%;height: 100%;">上一页</div> -->
|
|
|
+ <div @click="quitToolPanel" class="center click" style="width: 40%;height: 100%;">退出</div>
|
|
|
+ <!-- <div class="center click" style="width: 30%;height: 100%;">下一页</div> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 摄像头控制面板 -->
|
|
|
+ <div v-if="toolsPanelType=='camera'" class="full" >
|
|
|
+ <div class="center" style="width: 100%;height: 70px;">
|
|
|
+ <div class="center" style="width: 60%;height: 100%;">
|
|
|
+ <el-input v-model="searchText" placeholder="请输入关键字" @change="handleSearch"></el-input>
|
|
|
+ </div>
|
|
|
+ <div @click="handleNext(-1,cameraObj)" class="click" style="width: 15%;height: 100%;" :style="{background: 'url(/img/left.png) no-repeat center/50%'}"></div>
|
|
|
+ <div @click="handleNext(1,cameraObj)" class="click" style="width: 15%;height: 100%;" :style="{background: 'url(/img/right.png) no-repeat center/50%'}"></div>
|
|
|
+ </div>
|
|
|
+ <div class="center" style="width: 100%;height: 80px;">
|
|
|
+ <el-select v-model="searchCameraType" style="width: 90%;padding: 10px">
|
|
|
+ <el-option label="全部" value="全部" ></el-option>
|
|
|
+ <el-option label="枪机" value="枪机" ></el-option>
|
|
|
+ <el-option label="球机" value="球机" ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="search-body" >
|
|
|
+ <div class="full">
|
|
|
+ <div class="search-item" v-for="(item,index) of cameraRes">
|
|
|
+ <div @click="toBuilding(index,cameraObj)" class="center full building-click" style="color: white;font-size: 20px;letter-spacing: 3px;">{{item.name+'--'+item.number}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -54,19 +87,24 @@ export default {
|
|
|
return{
|
|
|
mesh: {},
|
|
|
searchText: "",
|
|
|
+ searchCameraType: "",
|
|
|
searchType: "building",
|
|
|
searchIndex: 0,
|
|
|
isReady: false,
|
|
|
handlePanelShow: false,
|
|
|
+ toolsPanelType: "building",
|
|
|
toolsOption:[
|
|
|
{ icon: '/data/round.png',name: '旋转',event:this.round},
|
|
|
{ icon: '/data/full.png',name: '全屏',event:this.handleFull},
|
|
|
- { icon: '/img/building.png',name: '建筑信息',event:()=>{this.showBox(this.buildingObj)}},
|
|
|
- { icon: '/img/camera.png',name: '摄像头',event:()=>{this.showCamera()}},
|
|
|
+ { icon: '/data/reset.png',name: '复位',event:this.reset},
|
|
|
+ { icon: '/img/building.png',name: '建筑信息',event:()=>{this.showBox(this.buildingObj,"building")}},
|
|
|
+ { icon: '/img/camera.png',name: '摄像头',event:()=>{this.showBox(this.cameraObj,"camera")}},
|
|
|
{ icon: '/img/infobox.png',name: '信息框',event:()=>{this.$refs['data-panel'].infoBoxShow()}},
|
|
|
],
|
|
|
finishNum: 0,
|
|
|
loadingSchedule: 0,
|
|
|
+ buildingsRes: [],
|
|
|
+ cameraRes:[],
|
|
|
objs: [],
|
|
|
gltf: [
|
|
|
'/gltf/7_8/20H.gltf',
|
|
|
@@ -94,7 +132,7 @@ export default {
|
|
|
cameraOptions: {
|
|
|
position: [5000,5000,1000],
|
|
|
near: 0.01,
|
|
|
- far: 5000,
|
|
|
+ far: 50000,
|
|
|
lookAt: [1300,0,1300],
|
|
|
},
|
|
|
obj: [
|
|
|
@@ -122,10 +160,12 @@ export default {
|
|
|
{ text: '软件园D栋',position: [-120,105,-20]},
|
|
|
],
|
|
|
cameraList: [
|
|
|
- { number: 'HK-nm51658186',position: [100,0,200],src: '/video/video1.mp4'},
|
|
|
- { number: 'HK-nm51658186',position: [50,0,70],src: '/video/video2.mp4'},
|
|
|
- { number: 'HK-nm51658186',position: [-100,0,100],src: '/video/video3.mp4'},
|
|
|
- { number: 'HK-nm51658186',position: [100,0,20],src: '/video/video4.mp4'},
|
|
|
+ { number: 'HK-nm51658186',position: [100,0,200],src: '/video/video1.mp4',name: "设备1",type: "枪机"},
|
|
|
+ { number: 'HK-nm51658186',position: [50,0,70],src: '/video/video2.mp4',name: "设备2",type: "枪机"},
|
|
|
+ { number: 'HK-nm51658186',position: [-100,0,100],src: '/video/video3.mp4',name: "设备3",type: "枪机"},
|
|
|
+ { number: 'HK-nm51658186',position: [100,0,20],src: '/video/video4.mp4',name: "设备4",type: "枪机"},
|
|
|
+ { number: 'HK-nm51658186',position: [200,0,50],src: '/video/video4.mp4',name: "设备4",type: "球机"},
|
|
|
+ { number: 'HK-nm51658186',position: [75,0,10],src: '/video/video4.mp4',name: "设备4",type: "球机"},
|
|
|
],
|
|
|
cameraObj: {},
|
|
|
buildingObj: {},
|
|
|
@@ -137,15 +177,30 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.buildingsRes = this.buildings;
|
|
|
+ this.cameraRes = this.cameraList;
|
|
|
this.$refs['loading'].showLoading();
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ searchCameraType(){
|
|
|
+ this.cameraRes = this.searchCameraType=="全部"? this.cameraList:this.cameraList.filter(item=> item.type==this.searchCameraType)
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
- handleNext(num){
|
|
|
- this.searchIndex=(this.searchIndex+num)%this.buildings.length;
|
|
|
+ reset(){
|
|
|
+ this.$refs['scene'].camera.position.z = this.cameraOptions.position[0];
|
|
|
+ this.$refs['scene'].camera.position.x = this.cameraOptions.position[1];
|
|
|
+ this.$refs['scene'].camera.position.y = this.cameraOptions.position[2];
|
|
|
+ this.$refs['scene'].camera.lookAt(...this.cameraOptions.lookAt);
|
|
|
+ this.$refs['scene'].controls.target.set(0,0,0);
|
|
|
+ this.$refs['data-panel'].infoBoxShow(true);
|
|
|
+ },
|
|
|
+ handleNext(num,list){
|
|
|
+ this.searchIndex=(this.searchIndex+num)%list.children.length;
|
|
|
if(this.searchIndex<0){
|
|
|
- this.searchIndex=this.buildingObj.children.length+this.searchIndex;
|
|
|
+ this.searchIndex=list.children.length+this.searchIndex;
|
|
|
}
|
|
|
- this.buildingObj.children.forEach((item,index) => {
|
|
|
+ list.children.forEach((item,index) => {
|
|
|
console.log(this.searchIndex,index);
|
|
|
if(index==this.searchIndex){
|
|
|
this.$refs['scene'].flyto(item.position);
|
|
|
@@ -179,8 +234,8 @@ export default {
|
|
|
// this.$refs['scene'].controls.autoRotate = true;
|
|
|
|
|
|
},
|
|
|
- toBuilding(objIndex){
|
|
|
- this.buildingObj.children.forEach((item,index)=>{
|
|
|
+ toBuilding(objIndex,list){
|
|
|
+ list.children.forEach((item,index)=>{
|
|
|
if(objIndex==index){
|
|
|
this.searchIndex = index;
|
|
|
this.$refs['scene'].flyto(item.position);
|
|
|
@@ -190,39 +245,15 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // async addObj(){
|
|
|
- // for (const item of this.obj) {
|
|
|
- // await this.$refs['scene'].addObj(item.mtlUrl,item.objUrl,
|
|
|
- // (loadedMesh)=>{
|
|
|
- // // 加载完obj文件是一个场景组,遍历它的子元素,赋值纹理并且更新面和点的发现了
|
|
|
- // loadedMesh.children.forEach( (child) => {
|
|
|
- // if (child instanceof Three.Mesh) {
|
|
|
- // child.material.side = Three.DoubleSide;
|
|
|
- // child.material.color = (new Three.Color("rgb(255,255,255)"))
|
|
|
- // if(child.name=='TiKuai'){
|
|
|
- // child.material.color = (new Three.Color("rgb(200,200,200)"))
|
|
|
- // }
|
|
|
- // }
|
|
|
- // loadedMesh.castShadow = true;
|
|
|
- // });
|
|
|
- // loadedMesh.scale.set(15, 15, 15);
|
|
|
- // this.objs.push(loadedMesh);
|
|
|
- // this.$refs['scene'].scene.add(loadedMesh);
|
|
|
- // },
|
|
|
- // (xhr)=>
|
|
|
- // {
|
|
|
- // this.loadingSchedule = (Math.floor((xhr.loaded/xhr.total)*1000)*0.1+'').substring(0,4);
|
|
|
- // if(this.loadingSchedule=='100'){
|
|
|
- // this.finishNum++;
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // },
|
|
|
quitToolPanel(){
|
|
|
this.handlePanelShow = false;
|
|
|
this.buildingObj.children.forEach(item => {
|
|
|
item.visible = false;
|
|
|
})
|
|
|
+ this.cameraObj.children.forEach(item => {
|
|
|
+ item.visible = false;
|
|
|
+ })
|
|
|
+ this.reset();
|
|
|
},
|
|
|
async addGltf(){
|
|
|
this.gltf.forEach(item => {
|
|
|
@@ -294,8 +325,9 @@ export default {
|
|
|
dirLight.castShadow = true ;
|
|
|
this.$refs['scene'].scene.add(dirLight);
|
|
|
},
|
|
|
- showBox(list){
|
|
|
+ showBox(list,type){
|
|
|
this.$refs['scene'].controls.autoRotate = false;
|
|
|
+ this.toolsPanelType = type;
|
|
|
this.handlePanelShow = true;
|
|
|
this.searchIndex = 0;
|
|
|
if(list.children.length>0){
|
|
|
@@ -312,17 +344,20 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleFull(){
|
|
|
- fullscreenToggel();
|
|
|
+ fullscreenToggel();
|
|
|
},
|
|
|
round() {
|
|
|
this.$refs['scene'].controls.autoRotate=! this.$refs['scene'].controls.autoRotate;
|
|
|
},
|
|
|
+ handleSearch(){
|
|
|
+ this.buildingsRes = this.buildings.filter(item => item.text.indexOf(this.searchText)>-1)
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
- .handle-panel{
|
|
|
+ .handle-panel-1{
|
|
|
width: 20%;
|
|
|
height: 430px;
|
|
|
/* background: rgba(230, 160, 9, 0.5); */
|
|
|
@@ -330,6 +365,14 @@ export default {
|
|
|
top: 200px;
|
|
|
left: 3%;
|
|
|
}
|
|
|
+ .handle-panel-2{
|
|
|
+ width: 20%;
|
|
|
+ height: 510px;
|
|
|
+ /* background: rgba(230, 160, 9, 0.5); */
|
|
|
+ position: absolute;
|
|
|
+ top: 200px;
|
|
|
+ left: 3%;
|
|
|
+ }
|
|
|
.search-body{
|
|
|
overflow-y: scroll;
|
|
|
width: 100%;height: 300px;
|