|
@@ -0,0 +1,516 @@
|
|
|
+<template>
|
|
|
+ <div class="three-model">
|
|
|
+ <loading ref="pageLoading"></loading>
|
|
|
+ <div class="map-3d" :style="'transform: rotate('+mapDeg+'deg);'">
|
|
|
+ <img :src="require('@assets/png/3dmap.png')" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="three-html-layer">
|
|
|
+ <div
|
|
|
+ class="three-html-dom fan-info"
|
|
|
+ :id="htmlLayer[0].id"
|
|
|
+ v-show="htmlLayer[0].show"
|
|
|
+ :style="'left: ' + htmlLayer[0].x + 'px; top: ' + htmlLayer[0].y + 'px;'"
|
|
|
+ >
|
|
|
+ <div class="fan-name">麻黄山</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="three-html-dom fan-info"
|
|
|
+ :id="htmlLayer[1].id"
|
|
|
+ v-show="htmlLayer[1].show"
|
|
|
+ :style="'left: ' + htmlLayer[1].x + 'px; top: ' + htmlLayer[1].y + 'px;'"
|
|
|
+ >
|
|
|
+ <div class="fan-name">牛首山</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="three-html-dom fan-info"
|
|
|
+ :id="htmlLayer[2].id"
|
|
|
+ v-show="htmlLayer[2].show"
|
|
|
+ :style="'left: ' + htmlLayer[2].x + 'px; top: ' + htmlLayer[2].y + 'px;'"
|
|
|
+ >
|
|
|
+ <div class="fan-name">青山</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="three-html-dom fan-info"
|
|
|
+ :id="htmlLayer[3].id"
|
|
|
+ v-show="htmlLayer[3].show"
|
|
|
+ :style="'left: ' + htmlLayer[3].x + 'px; top: ' + htmlLayer[3].y + 'px;'"
|
|
|
+ >
|
|
|
+ <div class="fan-name">石板泉</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="three-html-dom fan-info"
|
|
|
+ :id="htmlLayer[4].id"
|
|
|
+ v-show="htmlLayer[4].show"
|
|
|
+ :style="'left: ' + htmlLayer[4].x + 'px; top: ' + htmlLayer[4].y + 'px;'"
|
|
|
+ >
|
|
|
+ <div class="fan-name">香山</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import loading from "@com/coms/loading/loading.vue";
|
|
|
+import * as THREE from "three";
|
|
|
+import { GLTFLoader } from "@node/three/examples/jsm/loaders/GLTFLoader.js";
|
|
|
+import { OrbitControls } from "@node/three/examples/jsm/controls/OrbitControls.js";
|
|
|
+import { GeometryUtils } from "@node/three/examples/jsm/utils/GeometryUtils.js";
|
|
|
+let camera, scene, renderer, controls;
|
|
|
+let mixers = [];
|
|
|
+let clock = new THREE.Clock();
|
|
|
+let fanAnimates = [];
|
|
|
+let fans = [];
|
|
|
+let cylinder = null;
|
|
|
+export default {
|
|
|
+ // 名称
|
|
|
+ name: "ThreeModel1",
|
|
|
+ // 使用组件
|
|
|
+ components: {
|
|
|
+ loading,
|
|
|
+ },
|
|
|
+ // 传入参数
|
|
|
+ props: {},
|
|
|
+ // 自定义事件
|
|
|
+ emits: {
|
|
|
+ when: null,
|
|
|
+ },
|
|
|
+ // 数据
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pointer: false,
|
|
|
+ htmlLayer: [
|
|
|
+ { // 麻黄山
|
|
|
+ id: "fan-mhs",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 50,
|
|
|
+ oy: 10,
|
|
|
+ position: null,
|
|
|
+ },
|
|
|
+ { // 牛首山
|
|
|
+ id: "fan-nss",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 35,
|
|
|
+ oy: 0,
|
|
|
+ position: null,
|
|
|
+ },
|
|
|
+ { // 青山
|
|
|
+ id: "fan-qs",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 60,
|
|
|
+ oy: 10,
|
|
|
+ position: null,
|
|
|
+ },
|
|
|
+ { // 石板泉
|
|
|
+ id: "fan-sbq",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 45,
|
|
|
+ oy: 0,
|
|
|
+ position: null,
|
|
|
+ },
|
|
|
+ { // 香山
|
|
|
+ id: "fan-qs",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 25,
|
|
|
+ oy: 20,
|
|
|
+ position: null,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ circleXY: [
|
|
|
+ { x: -(200*Math.sin(0/180*Math.PI)), y: -(200*Math.cos(0/180*Math.PI)) },
|
|
|
+ { x: -(200*Math.sin(-30/180*Math.PI)), y: -(200*Math.cos(-30/180*Math.PI)) },
|
|
|
+ { x: -(200*Math.sin(-60/180*Math.PI)), y: -(200*Math.cos(-60/180*Math.PI)) },
|
|
|
+ { x: -(200*Math.sin(-90/180*Math.PI)), y: -(200*Math.cos(-90/180*Math.PI)) },
|
|
|
+ { x: -(200*Math.sin(-120/180*Math.PI)), y: -(200*Math.cos(-120/180*Math.PI)) },
|
|
|
+ { x: -(200*Math.sin(-150/180*Math.PI)), y: -(200*Math.cos(-150/180*Math.PI)) },
|
|
|
+ { x: -(200*Math.sin(-180/180*Math.PI)), y: -(200*Math.cos(-180/180*Math.PI)) },
|
|
|
+ ],
|
|
|
+ colors: [
|
|
|
+ { colorName: 'green', state: 'dj', stateName: '待机', color: 0x05bb4c, },
|
|
|
+ { colorName: 'blue', state: 'yx', stateName: '运行', color: 0x4b55ae, },
|
|
|
+ { colorName: 'pink', state: 'xd', stateName: '限电', color: 0xc531c7, },
|
|
|
+ { colorName: 'red', state: 'gz', stateName: '故障', color: 0xBA3237, },
|
|
|
+ { colorName: 'orange', state: 'jx', stateName: '检修', color: 0xe17e23, },
|
|
|
+ { colorName: 'gray', state: 'lx', stateName: '离线', color: 0x606769, },
|
|
|
+ { colorName: 'white', state: 'sl', stateName: '受累', color: 0xffffff, },
|
|
|
+ ],
|
|
|
+ fanName: "",
|
|
|
+ playAnimation: true,
|
|
|
+ mapDeg: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 函数
|
|
|
+ methods: {
|
|
|
+ // Vector3 to screen
|
|
|
+ vector3ToScreen: function(position) {
|
|
|
+ const centerX = this.$el.scrollWidth / 2;
|
|
|
+ const centerY = this.$el.scrollHeight / 2;
|
|
|
+ const v3 = new THREE.Vector3(position.x, position.y, position.z);
|
|
|
+ const standardVec = v3.project(camera);
|
|
|
+ const screenX = Math.round(centerX * standardVec.x + centerX);
|
|
|
+ const screenY = Math.round(-centerY * standardVec.y + centerY);
|
|
|
+ return { x: screenX, y: screenY };
|
|
|
+ },
|
|
|
+ // 场景
|
|
|
+ initScene: function() {
|
|
|
+ scene = new THREE.Scene();
|
|
|
+ // scene.background = new THREE.Color(0xa0a0a0);
|
|
|
+ },
|
|
|
+ // 相机
|
|
|
+ initCamera: function() {
|
|
|
+ camera = new THREE.PerspectiveCamera(45, this.$el.scrollWidth / this.$el.scrollHeight, 0.1, 10000);
|
|
|
+ camera.position.set(50, 50, 50);
|
|
|
+ },
|
|
|
+ // 坐标轴
|
|
|
+ initAxesHelper: function() {
|
|
|
+ const axesHelper = new THREE.AxesHelper(150);
|
|
|
+ scene.add(axesHelper);
|
|
|
+ axesHelper.position.set(0, 0, 0);
|
|
|
+ },
|
|
|
+ // 渲染器
|
|
|
+ initRender: function() {
|
|
|
+ renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
|
|
|
+ // renderer.setClearAlpha(0);
|
|
|
+ renderer.setSize(this.$el.scrollWidth, this.$el.scrollHeight);
|
|
|
+ this.$el.append(renderer.domElement);
|
|
|
+ },
|
|
|
+ // 灯光
|
|
|
+ initLight: function() {
|
|
|
+ // let light = new THREE.PointLight(0xffffff, 2);
|
|
|
+ let light = new THREE.AmbientLight(0xffffff, 1);
|
|
|
+ // light.position.set(50, 50, 50);
|
|
|
+ scene.add(light);
|
|
|
+ },
|
|
|
+ // 控制器
|
|
|
+ initControls: function() {
|
|
|
+ controls = new OrbitControls(camera, renderer.domElement);
|
|
|
+ controls.enablePan = false;
|
|
|
+ controls.maxPolarAngle = 45 / 180 * Math.PI;
|
|
|
+ controls.minPolarAngle = 45 / 180 * Math.PI;
|
|
|
+ controls.maxAzimuthAngle = 45 / 180 * Math.PI;
|
|
|
+ controls.minAzimuthAngle = 45 / 180 * Math.PI;
|
|
|
+ controls.enableKeys = false;
|
|
|
+ controls.enableZoom = false;
|
|
|
+ controls.update();
|
|
|
+ // controls.maxAzimuthAngle = 50 / 180 * Math.PI;
|
|
|
+ // controls.minAzimuthAngle = 40 / 180 * Math.PI;
|
|
|
+ // controls.addEventListener("change", () => {
|
|
|
+ // let cDeg = controls.getAzimuthalAngle() / Math.PI * 180;
|
|
|
+ // this.mapDeg = cDeg - 40 - 5;
|
|
|
+ // this.setEveryHTML();
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ // 初始化一个风机动画
|
|
|
+ initFanAnimate: function(obj) {
|
|
|
+ let fanAnimateObj = {
|
|
|
+ speed: 0.05,
|
|
|
+ rotate: 0,
|
|
|
+ fan: obj.getObjectByName(`${obj.name}_leaf`),
|
|
|
+ fan1: obj.getObjectByName(`${obj.name}_leaf_1`),
|
|
|
+ fan2: obj.getObjectByName(`${obj.name}_leaf_2`),
|
|
|
+ fan3: obj.getObjectByName(`${obj.name}_leaf_3`),
|
|
|
+ };
|
|
|
+ let fanAnimateFunction = function() {
|
|
|
+ // fanAnimateObj.fan.rotateOnAxis(new THREE.Vector3(0, 1, 0), fanAnimateObj.speed);
|
|
|
+ fanAnimateObj.fan.rotateY(-fanAnimateObj.speed);
|
|
|
+ // fanAnimateObj.fan1.rotateZ(fanAnimateObj.speed);
|
|
|
+ // fanAnimateObj.fan2.rotateZ(fanAnimateObj.speed);
|
|
|
+ // fanAnimateObj.fan3.rotateZ(fanAnimateObj.speed);
|
|
|
+ // fanAnimateObj.rotate += fanAnimateObj.speed;
|
|
|
+ // if (fanAnimateObj.rotate >= 360) {
|
|
|
+ // fanAnimateObj.rotate = 0;
|
|
|
+ // }
|
|
|
+ fanAnimateObj.animateId = window.requestAnimationFrame(fanAnimateFunction);
|
|
|
+ };
|
|
|
+ fanAnimateObj.stop = function() {
|
|
|
+ window.cancelAnimationFrame(fanAnimateObj.animateId);
|
|
|
+ };
|
|
|
+ fanAnimateObj.start = function() {
|
|
|
+ fanAnimateFunction();
|
|
|
+ };
|
|
|
+ fanAnimateFunction();
|
|
|
+ fanAnimates.push(fanAnimateObj);
|
|
|
+ return fanAnimateObj;
|
|
|
+ },
|
|
|
+ // 清空风机动画
|
|
|
+ clearFanAnimate: function() {
|
|
|
+ while (fanAnimates.length > 0) {
|
|
|
+ let fanAnimateObj = fanAnimates.shift();
|
|
|
+ fanAnimateObj.stop();
|
|
|
+ }
|
|
|
+ this.playAnimation = false;
|
|
|
+ },
|
|
|
+ // 开始风机动画
|
|
|
+ startFanAnimate: function () {
|
|
|
+ fans.forEach(fan => {
|
|
|
+ this.initFanAnimate(fan);
|
|
|
+ });
|
|
|
+ this.playAnimation = true;
|
|
|
+ },
|
|
|
+ // 内容
|
|
|
+ initContent: function() {
|
|
|
+ // 加载3D地面
|
|
|
+ let loaderGround = new GLTFLoader(); /*实例化加载器*/
|
|
|
+ loaderGround.load(
|
|
|
+ "static/3d/fanvar.gltf",
|
|
|
+ (gltf) => {
|
|
|
+ gltf.scene.position.set(17, 10, -12);
|
|
|
+ console.log(gltf);
|
|
|
+ scene.add(gltf.scene);
|
|
|
+ let rootNode = gltf.scene.children[0];
|
|
|
+ let fan = gltf.scene.children[0].children[0];
|
|
|
+ rootNode.remove(fan);
|
|
|
+ this.setFanPosition(rootNode, fan);
|
|
|
+ scene.onAfterRender = () => {
|
|
|
+ this.$emit("when");
|
|
|
+ this.$refs.pageLoading.hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ (xhr) => {},
|
|
|
+ function(error) {
|
|
|
+ console.error("load error!" + error.getWebGLErrorMessage());
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 改变元素底盘的颜色(带底盘的)
|
|
|
+ changeObjectColor: function (obj, colorName) {
|
|
|
+ let chassis = obj.getObjectByName(`${obj.name}_chassis`);
|
|
|
+ let color = this.colors.find(t => t.colorName == colorName || t.state == colorName || t.stateName == colorName).color;
|
|
|
+ chassis.material = new THREE.MeshBasicMaterial({
|
|
|
+ color: color,
|
|
|
+ opacity: 0.8,
|
|
|
+ transparent: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 设置风机name
|
|
|
+ setFanName: function (obj, name) {
|
|
|
+ obj.name = name;
|
|
|
+ obj.userData.name = name;
|
|
|
+ let fanBig1_1 = obj.getObjectByName("Box719");
|
|
|
+ let fanBig1_2 = obj.getObjectByName("Box720");
|
|
|
+ let fanBig1_3 = obj.getObjectByName("Box721");
|
|
|
+ fanBig1_1.name = `${name}_leaf_1`;
|
|
|
+ fanBig1_1.userData.name = `${name}_leaf_1`;
|
|
|
+ fanBig1_2.name = `${name}_leaf_2`;
|
|
|
+ fanBig1_2.userData.name = `${name}_leaf_2`;
|
|
|
+ fanBig1_3.name = `${name}_leaf_3`;
|
|
|
+ fanBig1_3.userData.name = `${name}_leaf_3`;
|
|
|
+ obj.children[obj.children.length - 1].name = `${name}_chassis`;
|
|
|
+ obj.children[obj.children.length - 1].userData.name = `${name}_chassis`;
|
|
|
+ obj.remove(fanBig1_1, fanBig1_2, fanBig1_3);
|
|
|
+ var group = new THREE.Group();
|
|
|
+ // var group = new THREE.Mesh(new THREE.BoxGeometry(0.01, 0.01, 0.01),
|
|
|
+ // new THREE.MeshBasicMaterial({
|
|
|
+ // color: 0xff0000
|
|
|
+ // })
|
|
|
+ // );
|
|
|
+ group.position.set(group.position.x + 0.0067, group.position.y, group.position.z + 0.01);
|
|
|
+ fanBig1_1.position.set(fanBig1_1.position.x - 0.0067, fanBig1_1.position.y , fanBig1_1.position.z- 0.01);
|
|
|
+ fanBig1_2.position.set(fanBig1_2.position.x - 0.0067, fanBig1_2.position.y, fanBig1_2.position.z- 0.01);
|
|
|
+ fanBig1_3.position.set(fanBig1_3.position.x - 0.0067, fanBig1_3.position.y, fanBig1_3.position.z- 0.01);
|
|
|
+ group.add(fanBig1_1, fanBig1_2, fanBig1_3);
|
|
|
+ obj.add(group);
|
|
|
+ group.name = `${name}_leaf`;
|
|
|
+ },
|
|
|
+ // 设置风机位置 颜色
|
|
|
+ setFanPosition: function (rootNode, obj) {
|
|
|
+ // 麻黄山
|
|
|
+ let fan_mhs = obj.clone(true);
|
|
|
+ fan_mhs.position.set(8, 5, -3);
|
|
|
+ this.setFanName(fan_mhs, "fan_mhs");
|
|
|
+ rootNode.add(fan_mhs);
|
|
|
+ // this.initCylinderGeometry(fan_mhs.position);
|
|
|
+ this.htmlLayer[0].position = fan_mhs.position;
|
|
|
+ // 牛首山
|
|
|
+ let fan_nss = obj.clone(true);
|
|
|
+ fan_nss.position.set(-4, 4, -15);
|
|
|
+ this.setFanName(fan_nss, "fan_nss");
|
|
|
+ rootNode.add(fan_nss);
|
|
|
+ // this.initCylinderGeometry(fan_nss.position);
|
|
|
+ this.htmlLayer[1].position = fan_nss.position;
|
|
|
+ // 青山
|
|
|
+ let fan_qs = obj.clone(true);
|
|
|
+ fan_qs.position.set(12, 5, -11);
|
|
|
+ this.setFanName(fan_qs, "fan_qs");
|
|
|
+ rootNode.add(fan_qs);
|
|
|
+ // this.initCylinderGeometry(fan_qs.position);
|
|
|
+ this.htmlLayer[2].position = fan_qs.position;
|
|
|
+ // 石板泉
|
|
|
+ let fan_sbq = obj.clone(true);
|
|
|
+ fan_sbq.position.set(4, 5, -15);
|
|
|
+ this.setFanName(fan_sbq, "fan_sbq");
|
|
|
+ rootNode.add(fan_sbq);
|
|
|
+ // this.initCylinderGeometry(fan_sbq.position);
|
|
|
+ this.htmlLayer[3].position = fan_sbq.position;
|
|
|
+ // 香山
|
|
|
+ let fan_xs = obj.clone(true);
|
|
|
+ fan_xs.position.set(-9, 7, 21);
|
|
|
+ this.setFanName(fan_xs, "fan_xs");
|
|
|
+ rootNode.add(fan_xs);
|
|
|
+ // this.initCylinderGeometry(fan_xs.position);
|
|
|
+ this.htmlLayer[4].position = fan_xs.position;
|
|
|
+
|
|
|
+ // 改一下颜色
|
|
|
+ this.changeObjectColor(fan_mhs, 'green'); // 麻黄山
|
|
|
+ this.changeObjectColor(fan_nss, 'xd'); // 牛首山
|
|
|
+ this.changeObjectColor(fan_qs, '检修'); // 青山
|
|
|
+ this.changeObjectColor(fan_sbq, 'white'); // 石板泉
|
|
|
+ this.changeObjectColor(fan_xs, '运行'); // 香山
|
|
|
+
|
|
|
+ // 风机存入数组
|
|
|
+ fans.push(fan_mhs);
|
|
|
+ fans.push(fan_nss);
|
|
|
+ fans.push(fan_qs);
|
|
|
+ fans.push(fan_sbq);
|
|
|
+ fans.push(fan_xs);
|
|
|
+
|
|
|
+ // 开始风机动画
|
|
|
+ this.startFanAnimate();
|
|
|
+
|
|
|
+ // 设置位置
|
|
|
+ this.setEveryHTML();
|
|
|
+ },
|
|
|
+ // 创建一个圆柱
|
|
|
+ initCylinderGeometry: function(position, cr=2) {
|
|
|
+ let geometry = new THREE.CylinderGeometry(cr, cr, 7, 64);
|
|
|
+ //加载纹理
|
|
|
+ let texture = new THREE.TextureLoader().load("static/3d/beam-texture.png");
|
|
|
+ texture.wrapS = texture.wrapT = THREE.RepeatWrapping; //每个都重复
|
|
|
+ texture.repeat.set(1, 1);
|
|
|
+ texture.needsUpdate = true;
|
|
|
+ let materials = [
|
|
|
+ //圆柱侧面材质,使用纹理贴图
|
|
|
+ new THREE.MeshBasicMaterial({
|
|
|
+ map: texture,
|
|
|
+ side: THREE.DoubleSide,
|
|
|
+ transparent: true,
|
|
|
+ }),
|
|
|
+ //圆柱顶材质
|
|
|
+ new THREE.MeshBasicMaterial({
|
|
|
+ transparent: true,
|
|
|
+ opacity: 0,
|
|
|
+ side: THREE.DoubleSide,
|
|
|
+ }),
|
|
|
+ //圆柱底材质
|
|
|
+ new THREE.MeshBasicMaterial({
|
|
|
+ transparent: true,
|
|
|
+ opacity: 0,
|
|
|
+ side: THREE.DoubleSide,
|
|
|
+ }),
|
|
|
+ ];
|
|
|
+ cylinder = new THREE.Mesh(geometry, materials);
|
|
|
+ cylinder.position.set(position.x + 5.75, position.y + 8, position.z);
|
|
|
+ scene.add(cylinder);
|
|
|
+ },
|
|
|
+ // 设置每一个html的位置
|
|
|
+ setEveryHTML: function() {
|
|
|
+ this.htmlLayer.forEach(value => {
|
|
|
+ if (value.show && value.position) {
|
|
|
+ const screen = this.vector3ToScreen(value.position);
|
|
|
+ value.x = screen.x + value.ox;
|
|
|
+ value.y = screen.y + value.oy;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 初始化云
|
|
|
+ initCloud: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+ // 初始化
|
|
|
+ initThree: function() {
|
|
|
+ this.initScene();
|
|
|
+ // this.initAxesHelper();
|
|
|
+ this.initCamera();
|
|
|
+ this.initRender();
|
|
|
+ this.initLight();
|
|
|
+ this.initControls();
|
|
|
+ this.initContent();
|
|
|
+ this.initCloud();
|
|
|
+ renderer.setAnimationLoop(this.animate);
|
|
|
+ },
|
|
|
+ // 动画
|
|
|
+ animate: function() {
|
|
|
+ renderer.render(scene, camera);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 生命周期钩子
|
|
|
+ beforeCreate() {
|
|
|
+ // 创建前
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // 创建后
|
|
|
+ },
|
|
|
+ beforeMount() {
|
|
|
+ // 渲染前
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // 渲染后
|
|
|
+ this.initThree();
|
|
|
+ },
|
|
|
+ beforeUpdate() {
|
|
|
+ // 数据更新前
|
|
|
+ },
|
|
|
+ updated() {
|
|
|
+ // 数据更新后
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ // 销毁前
|
|
|
+ renderer.setAnimationLoop(null);
|
|
|
+ camera = null;
|
|
|
+ scene = null;
|
|
|
+ renderer = null;
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.three-model {
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .map-3d {
|
|
|
+ position: absolute;
|
|
|
+ width: 1118px;
|
|
|
+ height: 678px;
|
|
|
+ left: calc(50% - 559px);
|
|
|
+ top: calc(50% - 339px);
|
|
|
+ z-index: -1;
|
|
|
+
|
|
|
+ map {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .three-html-layer {
|
|
|
+
|
|
|
+ .three-html-dom {
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
+
|
|
|
+ .fan-name {
|
|
|
+ display: inline-block;
|
|
|
+ height: 22px;
|
|
|
+ background: #222632;
|
|
|
+ border: 1px solid #646464;
|
|
|
+ border-radius: 10px;
|
|
|
+ padding: 0 10px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #FFFFFF;
|
|
|
+ line-height: 22px;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|