|
@@ -21,10 +21,10 @@ import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader";
|
|
|
// import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
|
|
|
// import { LineSegments2 } from "three/examples/jsm/lines/LineSegments2.js";
|
|
|
// import { Line2 } from "three/examples/jsm/lines/Line2.js";
|
|
|
-import {
|
|
|
- showFullScreenLoading,
|
|
|
- tryHideFullScreenLoading,
|
|
|
-} from "../../../axios/filter";
|
|
|
+// import {
|
|
|
+// showFullScreenLoading,
|
|
|
+// tryHideFullScreenLoading,
|
|
|
+// } from "../../../axios/filter";
|
|
|
import { mapState } from "vuex";
|
|
|
import CoordinateAxes from "../common/coordinateAxes";
|
|
|
|
|
@@ -60,6 +60,8 @@ export default {
|
|
|
ogt: null,
|
|
|
// scale: 2, // 物体加载换算倍数
|
|
|
// rate: 20, // 坐标换算倍数
|
|
|
+ isLoading: false, // 判断是否正在记载车辆
|
|
|
+ lastCarModel: "", // 记录上一次加载的carModel
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -190,7 +192,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
carModel(newVal, oldVal) {
|
|
|
- if (newVal && newVal != oldVal) {
|
|
|
+ if (newVal != oldVal && !this.isLoading) {
|
|
|
+ this.lastCarModel = newVal;
|
|
|
this.initCar(newVal);
|
|
|
}
|
|
|
},
|
|
@@ -770,7 +773,10 @@ export default {
|
|
|
// background: "rgba(0, 0, 0, 0.2)",
|
|
|
// });
|
|
|
|
|
|
- showFullScreenLoading();
|
|
|
+ // showFullScreenLoading();
|
|
|
+
|
|
|
+ this.$emit('loadingDone', 'carStart');
|
|
|
+ this.isLoading = true;
|
|
|
|
|
|
var that = this;
|
|
|
var loader = new GLTFLoader(); //创建一个FBX加载器
|
|
@@ -788,7 +794,7 @@ export default {
|
|
|
model,
|
|
|
function (obj) {
|
|
|
// loading.close();
|
|
|
- tryHideFullScreenLoading();
|
|
|
+ // tryHideFullScreenLoading();
|
|
|
// console.log(obj);
|
|
|
|
|
|
/* for (let i = 0; i < obj.children.length; i++) {
|
|
@@ -827,6 +833,10 @@ export default {
|
|
|
// that.scene.add(obj);
|
|
|
that.scene.add(obj.scene);
|
|
|
that.car = obj.scene;
|
|
|
+
|
|
|
+ that.$emit('loadingDone', 'carDone');
|
|
|
+ that.isLoading = false;
|
|
|
+ that.needCar();
|
|
|
},
|
|
|
(xhr) => {
|
|
|
// console.log(xhr);
|
|
@@ -834,7 +844,10 @@ export default {
|
|
|
},
|
|
|
(error) => {
|
|
|
// loading.close();
|
|
|
- tryHideFullScreenLoading();
|
|
|
+ // tryHideFullScreenLoading();
|
|
|
+ that.$emit('loadingDone', 'carDone');
|
|
|
+ that.isLoading = false;
|
|
|
+ that.needCar();
|
|
|
console.error(error);
|
|
|
}
|
|
|
);
|
|
@@ -1106,6 +1119,13 @@ export default {
|
|
|
}
|
|
|
}); */
|
|
|
},
|
|
|
+ // 判断是否继续加载car,为了应对上一个car正在加载中的时候,用户选择了新的car
|
|
|
+ needCar() {
|
|
|
+ if (this.carModel != this.lastCarModel) {
|
|
|
+ this.lastCarModel = this.carModel;
|
|
|
+ this.initCar(this.carModel);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 初始化
|
|
|
init() {
|
|
|
this.initScene();
|