feat: add types

This commit is contained in:
Qiuxia Fan 2021-12-08 20:21:08 +08:00
parent ffcdd1939a
commit a174b18c23
8 changed files with 16 additions and 12 deletions

View File

@ -62,7 +62,7 @@
"parserOptions": {
"ecmaVersion": 2020
},
"rules": {},
"rules": {"@typescript-eslint/no-explicit-any": ["off"]},
"overrides": [
{
"files": [

View File

@ -103,6 +103,6 @@ export const appStore = defineStore({
},
},
});
export function useAppStoreWithOut() {
export function useAppStoreWithOut(): any {
return appStore(store);
}

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable */
import axios from "axios";
const CancelToken = axios.CancelToken;

View File

@ -141,7 +141,7 @@ class Vec3 extends Float32Array {
return this;
}
/** Copy in vector data */
copy(v: any[] | Float32Array): Vec3 {
copy(v: number[] | Float32Array): Vec3 {
this[0] = v[0];
this[1] = v[1];
this[2] = v[2];

View File

@ -79,7 +79,7 @@ import timeFormat from "@/utils/timeFormat";
import { ElSwitch } from "element-plus";
const { t, locale } = useI18n();
const state = reactive<{ timer: any }>({
const state = reactive<{ timer: ReturnType<typeof setInterval> | null }>({
timer: null,
});
const lang = ref<boolean>(locale.value === "zh" ? false : true);
@ -105,14 +105,18 @@ const handleAuto = (status: boolean) => {
handleReload();
state.timer = setInterval(handleReload, autoTime.value * 1000);
} else {
clearInterval(state.timer);
if (state.timer) {
clearInterval(state.timer);
}
}
};
const changeAutoTime = () => {
if (autoTime.value < 1) {
return;
}
clearInterval(state.timer);
if (state.timer) {
clearInterval(state.timer);
}
if (auto.value) {
handleReload();
state.timer = setInterval(handleReload, autoTime.value * 1000);

View File

@ -16,7 +16,7 @@ limitations under the License. -->
<div class="infrastructure-box">
<div ref="mapRef" class="map"></div>
<div class="info-box" v-show="showInfo">
{{ nodeTypes[type] }} Information
{{ NodeTypes[type] }} Information
</div>
</div>
</template>
@ -37,7 +37,6 @@ const animateCallbacks: Array<() => void> = [];
const showInfo = ref<boolean>(false);
const objSelected = ref<any>(null);
const meshColors = ref([0xa1cffb, 0x333333, 0x333840, 0x999999]); //[0xa489b2, 0xf2bfd0, 0xf0eaea, 0xef6775, 0xfbc580];
const nodeTypes = ref(NodeTypes);
const type = ref<number>(0);
const width = ref<number>(1920);
const height = ref<number>(900);
@ -89,7 +88,7 @@ function init(dom: HTMLDivElement): void {
const helper = new THREE.GridHelper(10000, 40, 0x04002c, 0x04002c);
helper.position.y = -1000;
// this.scene.add(helper);
const axis = new THREE.AxesHelper(15000);
// const axis = new THREE.AxesHelper(15000);
// this.scene.add(axis);
// add mesh
createInfrastructure();

View File

@ -74,7 +74,7 @@ class HexagonPillar {
const poly = createPolygon(radius, 6, pointyUp ? (30 * Math.PI) / 180 : 0); // Create Base Shape
toVec3(rtn, poly);
const vertices = [];
const vertices: any[] = [];
for (let i = 0; i < rtn.vertices.length / 3; i++) {
vertices.push(
new Vec3(
@ -90,7 +90,7 @@ class HexagonPillar {
}
// Create the basic 2d polygon shape
function createPolygon(radius: number, sides = 6, offset = 0) {
const poly = [];
const poly: number[] = [];
let i, rad;
for (i = 0; i < sides; i++) {
rad = Math.PI * 2 * (i / sides);
@ -180,7 +180,7 @@ function polyCapBevel(
) {
// eslint-disable-next-line
const v: any = new Vec2();
const lerp = [];
const lerp: any[] = [];
let pivot, top, pnt, i, vlen, tlen;
offset = offset || [0, 0, 0];