diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..0e61d40a --- /dev/null +++ b/deploy.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# --- 配置 --- +USER="webdev" +IP="112.124.21.102" # 服务器 IP +BASE_PATH="/www/wwwroot/web" # 请修改为您的项目在服务器上的存放路径 +RELEASE_NAME="v$(date +'%Y%m%d_%H%M%S')" # 生成版本号:如 v20260328_1445 +LOCAL_DIST="./dist" + +# SSH 密钥提示:请确保本地已将 id_ed25519.pub 添加到服务器的 ~/.ssh/authorized_keys +# 密钥内容:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJtwa+MFLQEgkEbcGQ6dkQOiFydRvjVeidJ/7uBsF2e 3313488199@qq.com + +echo "🚀 开始发布版本: $RELEASE_NAME" + +# 1. 本地打包 +npm run build + +# 2. 压缩并上传 +tar -czf dist.tar.gz -C $LOCAL_DIST . +ssh $USER@$IP "mkdir -p $BASE_PATH/releases/$RELEASE_NAME" +scp dist.tar.gz $USER@$IP:$BASE_PATH/releases/$RELEASE_NAME + +# 3. 远程解压、更新软链接、清理旧版本 +ssh $USER@$IP << EOF + cd $BASE_PATH/releases/$RELEASE_NAME + tar -xzf dist.tar.gz + rm dist.tar.gz + + # 原子化更新软链接:先创建临时链接再重命名(防止切换瞬间服务中断) + ln -sfn $BASE_PATH/releases/$RELEASE_NAME $BASE_PATH/current_new + mv -Tf $BASE_PATH/current_new $BASE_PATH/current + + # 只保留最近 5 个版本,删除更旧的 + cd $BASE_PATH/releases && ls -t | tail -n +6 | xargs rm -rf +EOF + +echo "✨ 发布成功!当前版本: $RELEASE_NAME" \ No newline at end of file diff --git a/dist.tar.gz b/dist.tar.gz new file mode 100644 index 00000000..3d57e683 Binary files /dev/null and b/dist.tar.gz differ diff --git a/package-lock.json b/package-lock.json index d2dc74b4..c32d3025 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "@types/node": "^24.11.0", "@types/path-browserify": "^1.0.3", "@types/spark-md5": "^3.0.5", + "@types/three": "^0.183.1", "@vitejs/plugin-vue": "^6.0.4", "@vue/tsconfig": "^0.8.1", "eslint-plugin-vue": "^10.8.0", @@ -516,6 +517,13 @@ "node": ">=10" } }, + "node_modules/@dimforge/rapier3d-compat": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", + "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/@element-plus/icons-vue": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@element-plus/icons-vue/-/icons-vue-2.3.2.tgz", @@ -1980,6 +1988,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@tweenjs/tween.js": { + "version": "23.1.3", + "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", + "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/esrecurse": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", @@ -2060,6 +2075,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/stats.js": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz", + "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/svgo": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/@types/svgo/-/svgo-2.6.4.tgz", @@ -2070,12 +2092,35 @@ "@types/node": "*" } }, + "node_modules/@types/three": { + "version": "0.183.1", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.183.1.tgz", + "integrity": "sha512-f2Pu5Hrepfgavttdye3PsH5RWyY/AvdZQwIVhrc4uNtvF7nOWJacQKcoVJn0S4f0yYbmAE6AR+ve7xDcuYtMGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@dimforge/rapier3d-compat": "~0.12.0", + "@tweenjs/tween.js": "~23.1.3", + "@types/stats.js": "*", + "@types/webxr": ">=0.5.17", + "@webgpu/types": "*", + "fflate": "~0.8.2", + "meshoptimizer": "~1.0.1" + } + }, "node_modules/@types/web-bluetooth": { "version": "0.0.21", "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz", "integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==", "license": "MIT" }, + "node_modules/@types/webxr": { + "version": "0.5.24", + "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", + "integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==", + "dev": true, + "license": "MIT" + }, "node_modules/@vitejs/plugin-vue": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.4.tgz", @@ -2449,6 +2494,13 @@ "vue": "^3.5.0" } }, + "node_modules/@webgpu/types": { + "version": "0.1.69", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.69.tgz", + "integrity": "sha512-RPmm6kgRbI8e98zSD3RVACvnuktIja5+yLgDAkTmxLr90BEwdTXRQWNLF3ETTTyH/8mKhznZuN5AveXYFEsMGQ==", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/acorn": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", @@ -4507,6 +4559,13 @@ } } }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "dev": true, + "license": "MIT" + }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -6054,6 +6113,13 @@ "node": ">= 8" } }, + "node_modules/meshoptimizer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-1.0.1.tgz", + "integrity": "sha512-Vix+QlA1YYT3FwmBBZ+49cE5y/b+pRrcXKqGpS5ouh33d3lSp2PoTpCw19E0cKDFWalembrHnIaZetf27a+W2g==", + "dev": true, + "license": "MIT" + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", diff --git a/package.json b/package.json index 156dffc4..54a3f32f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "build": "run-p type-check \"build-only {@}\" --", "preview": "vite preview", "build-only": "vite build", - "type-check": "vue-tsc --build" + "type-check": "vue-tsc --build", + "deploy": "sh deploy.sh", + "rollback": "sh rollback.sh" }, "dependencies": { "@element-plus/icons-vue": "^2.3.2", @@ -39,6 +41,7 @@ "@types/node": "^24.11.0", "@types/path-browserify": "^1.0.3", "@types/spark-md5": "^3.0.5", + "@types/three": "^0.183.1", "@vitejs/plugin-vue": "^6.0.4", "@vue/tsconfig": "^0.8.1", "eslint-plugin-vue": "^10.8.0", diff --git a/rollback.sh b/rollback.sh new file mode 100644 index 00000000..cc109dbf --- /dev/null +++ b/rollback.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +USER="root" +IP="1.2.3.4" # 请修改为您的服务器实际 IP +BASE_PATH="/www/wwwroot/my-project" # 请修改为您的项目在服务器上的存放路径 + +# SSH 密钥提示:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJtwa+MFLQEgkEbcGQ6dkQOiFydRvjVeidJ/7uBsF2e 3313488199@qq.com + +echo "⏪ 正在回滚到上一个版本..." + +ssh $USER@$IP << EOF + # 获取 releases 目录下按时间排序的倒数第二个版本 + PREVIOUS_VERSION=$(ls -dt $BASE_PATH/releases/*/ | sed -n '2p') + + if [ -z "$PREVIOUS_VERSION" ]; then + echo "❌ 找不到可回滚的历史版本" + exit 1 + fi + + ln -sfn $PREVIOUS_VERSION $BASE_PATH/current + echo "✅ 已回滚至: $PREVIOUS_VERSION" +EOF \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts index b262de42..d79b98b0 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -65,6 +65,21 @@ export function changeRole(data: Record) { data, isSystemApi: true } as SystemApiRequestConfig>); +} + +export function getLoginWechatCode(params?: { clientCode?: string }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'user.getLoginWechatCode', + v: '1.0', + timestamp: new Date().getTime() + }, + data: params || {}, + timeout: params?.clientCode ? 75000 : undefined, + isSystemApi: true, + } as SystemApiRequestConfig) } export function logout(data?: Record) { diff --git a/src/lang/en-US.ts b/src/lang/en-US.ts index 43372156..d47adbc6 100644 --- a/src/lang/en-US.ts +++ b/src/lang/en-US.ts @@ -75,7 +75,19 @@ export default { "registerSuccess": "Registration successful", "toLogin": "Back to Login", "noAccount": "Don't have an account?", - "hasAccount": "Already have an account?" + "hasAccount": "Already have an account?", + "email": "Email", + "emailPlaceholder": "Please enter email", + "realNamePlaceholder": "Please enter real name (optional)", + "accountLogin": "Account Login", + "qrcodeLogin": "QR Code Login", + "wechatQrcode": "WeChat QR Code Login", + "qrcodeDesc": "Open WeChat and scan the QR code to login", + "qrcodeExpired": "QR code expired", + "qrcodeRefresh": "Click to refresh", + "qrcodeWaiting": "Waiting for scan...", + "qrcodeScanned": "Scanned, please confirm on your phone", + "qrcodeLoading": "Loading..." }, "dashboard": { "expressDistribution": "Express Distribution", diff --git a/src/lang/zh-CN.ts b/src/lang/zh-CN.ts index 3c80377e..ab1952b5 100644 --- a/src/lang/zh-CN.ts +++ b/src/lang/zh-CN.ts @@ -75,7 +75,19 @@ export default { "registerSuccess": "注册成功", "toLogin": "返回登录", "noAccount": "还没有账号?", - "hasAccount": "已有账号?" + "hasAccount": "已有账号?", + "email": "邮箱", + "emailPlaceholder": "请输入邮箱", + "realNamePlaceholder": "请输入真实姓名(选填)", + "accountLogin": "账号登录", + "qrcodeLogin": "扫码登录", + "wechatQrcode": "微信扫码登录", + "qrcodeDesc": "打开微信,扫描二维码登录", + "qrcodeExpired": "二维码已过期", + "qrcodeRefresh": "点击刷新", + "qrcodeWaiting": "等待扫码...", + "qrcodeScanned": "扫码成功,请在手机上确认", + "qrcodeLoading": "加载中..." }, "dashboard": { "expressDistribution": "快递分布", diff --git a/src/layout/index.vue b/src/layout/index.vue index d744d49f..22f0cf6d 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -9,7 +9,7 @@
-
+
diff --git a/src/utils/overlookControls.ts b/src/utils/overlookControls.ts deleted file mode 100644 index 7fee0e36..00000000 --- a/src/utils/overlookControls.ts +++ /dev/null @@ -1,405 +0,0 @@ -//src/utils/overlookControls.ts - -import * as THREE from 'three' - -// 辅助函数:厘米转Three.js单位(1单位=1cm) -const cm = (value: number) => value // Three.js中直接使用厘米为单位 - -type AreaBoundary = { - boundary: THREE.Object3D - areaId: any - areaName?: string - areaType?: any -} - -export class OverlookControls { - camera: THREE.Camera - domElement: HTMLElement - scene: THREE.Scene - enabled: boolean - - cameraAngle: number - cameraPitch: number - targetHeight: number - - cameraHeight: number - minHeight: number - maxHeight: number - - target: THREE.Vector3 - - boundaryMinX: number - boundaryMaxX: number - boundaryMinZ: number - boundaryMaxZ: number - - moveSpeed: { keyboard: number; drag: number } - - isDragging: boolean - dragStart: THREE.Vector2 - dragCurrent: THREE.Vector2 - lastDragPos: THREE.Vector2 - - raycaster: THREE.Raycaster - mouse: THREE.Vector2 - groundObjects: THREE.Object3D[] - - keys: { w: boolean; a: boolean; s: boolean; d: boolean; up: boolean; left: boolean; down: boolean; right: boolean } - - areaBoundaries: AreaBoundary[] - onAreaClick: ((areaId: any, areaName?: string, areaType?: any) => void) | null - - eventHandlers: any - handleClick: ((e: MouseEvent) => void) | null - clickMarker: THREE.Object3D | null - - constructor(camera: THREE.Camera, domElement: HTMLElement, scene: THREE.Scene, config: Record = {}) { - this.camera = camera - this.domElement = domElement - this.scene = scene - this.enabled = true - - // 2.5D视角固定参数 - this.cameraAngle = Math.PI / 4 // 45度固定角度 - this.cameraPitch = 70 // 70度俯仰角(LOL风格) - this.targetHeight = cm(0) // 目标在地面 - - // 相机高度(缩放) - this.cameraHeight = cm(8000) // 初始高度80米 - this.minHeight = cm(4000) // 最小高度40米 - this.maxHeight = cm(20000) // 最大高度200米 - - // 目标位置(镜头中心点) - this.target = new THREE.Vector3(0, 0, 0) - - // 视野边界参数(类似LOL地图边界) - this.boundaryMinX = config.boundaryMinX || cm(-30000) - this.boundaryMaxX = config.boundaryMaxX || cm(30000) - this.boundaryMinZ = config.boundaryMinZ || cm(-30000) - this.boundaryMaxZ = config.boundaryMaxZ || cm(30000) - - // 移动速度(厘米/秒)- 键盘速度加速2倍 - this.moveSpeed = { - keyboard: cm(1600), // 键盘移动速度(原800 * 2) - drag: cm(0.5) // 拖拽灵敏度系数 - } - - // 鼠标拖拽控制 - this.isDragging = false - this.dragStart = new THREE.Vector2() - this.dragCurrent = new THREE.Vector2() - this.lastDragPos = new THREE.Vector2() - - // 点击地面检测 - this.raycaster = new THREE.Raycaster() - this.mouse = new THREE.Vector2() - this.groundObjects = [] - - // 键盘控制状态 - this.keys = { w: false, a: false, s: false, d: false, up: false, left: false, down: false, right: false } - - // 区域边界检测 - this.areaBoundaries = [] - this.onAreaClick = null - - this.eventHandlers = null - this.handleClick = null - this.clickMarker = null - - // 初始化 - this.initControls() - this.updateCameraPosition() - } - - initControls() { - const canvas = this.domElement - - // 鼠标按下开始拖拽 - const onMouseDown = (e: MouseEvent) => { - if (!this.enabled || e.button !== 0) return // 只响应左键 - - e.preventDefault() - this.isDragging = true - this.dragStart.set((e as MouseEvent).clientX, (e as MouseEvent).clientY) - this.lastDragPos.set((e as MouseEvent).clientX, (e as MouseEvent).clientY) - canvas.style.cursor = 'grabbing' - } - - // 鼠标移动处理拖拽 - const onMouseMove = (e: MouseEvent) => { - if (!this.enabled) return - - this.dragCurrent.set(e.clientX, e.clientY) - - if (this.isDragging) { - const deltaX = this.dragCurrent.x - this.lastDragPos.x - const deltaY = this.dragCurrent.y - this.lastDragPos.y - - // 根据拖拽距离移动视角 - const moveX = -deltaX * this.moveSpeed.drag - const moveZ = -deltaY * this.moveSpeed.drag - - // 根据固定45度角度旋转移动方向 - const angle = -this.cameraAngle - const cos = Math.cos(angle) - const sin = Math.sin(angle) - - const worldMoveX = (moveX * cos - moveZ * sin) - const worldMoveZ = (moveX * sin + moveZ * cos) - - this.setTargetPosition(this.target.x + worldMoveX, this.target.z + worldMoveZ) - - this.lastDragPos.set(e.clientX, e.clientY) - } - } - - // 鼠标释放停止拖拽 - const onMouseUp = (e: MouseEvent) => { - if (!this.enabled || e.button !== 0) return - - this.isDragging = false - canvas.style.cursor = 'grab' - - // 检查是否是点击(移动距离很小) - const dx = this.dragCurrent.x - this.dragStart.x - const dy = this.dragCurrent.y - this.dragStart.y - const dragDistance = Math.sqrt(dx * dx + dy * dy) - - if (dragDistance < 5) { - this.handleClick && this.handleClick(e as MouseEvent) - } - } - - // 鼠标滚轮缩放 - const onWheel = (e: WheelEvent) => { - if (!this.enabled) return - - e.preventDefault() - const delta = e.deltaY > 0 ? 1.2 : 0.8 - const newHeight = this.cameraHeight * delta - this.cameraHeight = THREE.MathUtils.clamp(newHeight, this.minHeight, this.maxHeight) - this.updateCameraPosition() - } - - // 点击检测 - const handleClick = (e: MouseEvent) => { - const rect = canvas.getBoundingClientRect() - this.mouse.x = ((e.clientX - rect.left) / rect.width) * 2 - 1 - this.mouse.y = -((e.clientY - rect.top) / rect.height) * 2 + 1 - - this.raycaster.setFromCamera(this.mouse, this.camera) - - // 1. 先检测是否点击了区域边界 - let areaClicked = false - for (const area of this.areaBoundaries) { - const intersects = this.raycaster.intersectObject(area.boundary) - if (intersects.length > 0) { - if (this.onAreaClick) { - this.onAreaClick(area.areaId, area.areaName, area.areaType) - } - areaClicked = true - break - } - } - - // 2. 如果没有点击区域,检测地面(仅显示标记,不移动) - if (!areaClicked) { - const intersects = this.raycaster.intersectObjects(this.groundObjects) - if (intersects.length > 0) { - const point = intersects[0].point - this.showClickMarker(point) - } - } - } - - // 键盘事件 - const onKeyDown = (e: KeyboardEvent) => { - if (!this.enabled) return - - switch (e.key.toLowerCase()) { - case 'w': case 'arrowup': this.keys.w = this.keys.up = true; break - case 'a': case 'arrowleft': this.keys.a = this.keys.left = true; break - case 's': case 'arrowdown': this.keys.s = this.keys.down = true; break - case 'd': case 'arrowright': this.keys.d = this.keys.right = true; break - } - } - - const onKeyUp = (e: KeyboardEvent) => { - switch (e.key.toLowerCase()) { - case 'w': case 'arrowup': this.keys.w = this.keys.up = false; break - case 'a': case 'arrowleft': this.keys.a = this.keys.left = false; break - case 's': case 'arrowdown': this.keys.s = this.keys.down = false; break - case 'd': case 'arrowright': this.keys.d = this.keys.right = false; break - } - } - - // 添加事件监听器 - canvas.addEventListener('mousedown', onMouseDown) - canvas.addEventListener('mousemove', onMouseMove) - canvas.addEventListener('mouseup', onMouseUp) - canvas.addEventListener('wheel', onWheel) - - // 键盘事件监听在window上 - window.addEventListener('keydown', onKeyDown) - window.addEventListener('keyup', onKeyUp) - - // 鼠标离开画布时停止拖拽 - canvas.addEventListener('mouseleave', () => { - if (this.isDragging) { - this.isDragging = false - canvas.style.cursor = 'grab' - } - }) - - // 初始化光标样式 - canvas.style.cursor = 'grab' - - // 保存事件处理器以便清理 - this.eventHandlers = { onMouseDown, onMouseMove, onMouseUp, onWheel, onKeyDown, onKeyUp, handleClick } - this.handleClick = handleClick - } - - setTargetPosition(x: number, z: number) { - // 限制目标位置在边界内 - const clampedX = THREE.MathUtils.clamp(x, this.boundaryMinX, this.boundaryMaxX) - const clampedZ = THREE.MathUtils.clamp(z, this.boundaryMinZ, this.boundaryMaxZ) - - this.target.x = clampedX - this.target.z = clampedZ - - this.updateCameraPosition() - } - - updateCameraPosition() { - // 固定2.5D视角计算 - const phi = THREE.MathUtils.degToRad(90 - this.cameraPitch) - const theta = this.cameraAngle - - const x = this.target.x + this.cameraHeight * Math.sin(phi) * Math.cos(theta) - const y = this.target.y + this.cameraHeight * Math.cos(phi) - const z: number = this.target.z + this.cameraHeight * Math.sin(phi) * Math.sin(theta) - - (this.camera.position as THREE.Vector3).set(x, y, z) - this.camera.lookAt(this.target) - } - - update(deltaTime?: number) { - if (!this.enabled) return - - // 键盘控制(速度加倍) - let moveX = 0, moveZ = 0 - if (this.keys.w || this.keys.up) moveZ += 1 - if (this.keys.s || this.keys.down) moveZ -= 1 - if (this.keys.a || this.keys.left) moveX -= 1 - if (this.keys.d || this.keys.right) moveX += 1 - - if (moveX !== 0 || moveZ !== 0) { - const speed = deltaTime ? this.moveSpeed.keyboard * deltaTime * 0.16 : this.moveSpeed.keyboard * 0.066 - - // 根据固定45度角度旋转移动方向 - const angle = -this.cameraAngle - const cos = Math.cos(angle) - const sin = Math.sin(angle) - - const worldMoveX = (moveX * cos - moveZ * sin) * speed - const worldMoveZ = (moveX * sin + moveZ * cos) * speed - - this.setTargetPosition(this.target.x + worldMoveX, this.target.z + worldMoveZ) - } - } - - showClickMarker(position: THREE.Vector3) { - // 移除旧的标记 - if (this.clickMarker) { - this.scene.remove(this.clickMarker) - } - - // 创建新的标记(圆形标记) - const markerGeometry = new THREE.RingGeometry(cm(50), cm(70), 32) - const markerMaterial = new THREE.MeshBasicMaterial({ - color: 0x00ffff, - side: THREE.DoubleSide, - transparent: true, - opacity: 0.7 - }) - const marker = new THREE.Mesh(markerGeometry, markerMaterial) - marker.position.copy(position) - marker.position.y += cm(5) // 稍微高于地面 - marker.rotation.x = -Math.PI / 2 // 水平放置 - - this.scene.add(marker) - this.clickMarker = marker - - // 2秒后淡出移除 - setTimeout(() => { - if (this.clickMarker === marker) { - const fadeOut = () => { - markerMaterial.opacity -= 0.05 - if (markerMaterial.opacity > 0) { - requestAnimationFrame(fadeOut) - } else { - this.scene.remove(marker) - if (this.clickMarker === marker) { - this.clickMarker = null - } - } - } - fadeOut() - } - }, 2000) - } - - // 设置边界 - setBoundary(minX: number, maxX: number, minZ: number, maxZ: number) { - this.boundaryMinX = cm(minX) - this.boundaryMaxX = cm(maxX) - this.boundaryMinZ = cm(minZ) - this.boundaryMaxZ = cm(maxZ) - - // 确保当前目标在边界内 - this.setTargetPosition(this.target.x, this.target.z) - } - - // 添加区域边界(用于区域点击检测) - addAreaBoundary(boundaryMesh: THREE.Object3D, areaId: any, areaName?: string, areaType?: any) { - this.areaBoundaries.push({ boundary: boundaryMesh, areaId, areaName, areaType }) - } - - // 设置区域点击回调 - setOnAreaClick(callback: (areaId: any, areaName?: string, areaType?: any) => void) { - this.onAreaClick = callback - } - - addGroundObject(object: THREE.Object3D) { - this.groundObjects.push(object) - } - - // 重置视角到指定位置 - resetView(x = 0, z = 0) { - this.setTargetPosition(x, z) - this.cameraHeight = cm(8000) - this.updateCameraPosition() - } - - dispose() { - const canvas = this.domElement - const handlers = this.eventHandlers - - if (canvas && handlers) { - canvas.removeEventListener('mousedown', handlers.onMouseDown) - canvas.removeEventListener('mousemove', handlers.onMouseMove) - canvas.removeEventListener('mouseup', handlers.onMouseUp) - canvas.removeEventListener('wheel', handlers.onWheel) - - window.removeEventListener('keydown', handlers.onKeyDown) - window.removeEventListener('keyup', handlers.onKeyUp) - - canvas.style.cursor = 'default' - } - - if (this.clickMarker) { - this.scene.remove(this.clickMarker) - this.clickMarker = null - } - } -} diff --git a/src/views/404.vue b/src/views/404.vue index 70acc752..d1220b99 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -1,6 +1,303 @@ - \ No newline at end of file + + + + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 0e10ddfa..9de69886 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,89 +1,23 @@