From 8b7745b478e7299621d80037c785e65184c58903 Mon Sep 17 00:00:00 2001 From: LOG1997 <2694233102@qq.com> Date: Tue, 16 Dec 2025 23:03:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?hotfix:=20=F0=9F=9A=91=EF=B8=8F=20=E6=B8=85?= =?UTF-8?q?=E7=90=86=E5=8A=A8=E7=94=BB=E5=BE=AA=E7=8E=AFrequestAnimationFr?= =?UTF-8?q?ame=E8=A7=A3=E5=86=B3=E5=A4=9A=E6=AC=A1=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=90=8E=E9=A1=B5=E9=9D=A2=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20#117=20(#118)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home/index.vue | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/views/Home/index.vue b/src/views/Home/index.vue index 9351c44..c3be3db 100644 --- a/src/views/Home/index.vue +++ b/src/views/Home/index.vue @@ -37,6 +37,7 @@ const ballRotationY = ref(0) const containerRef = ref() const canOperate = ref(true) const cameraZ = ref(3000) +const animationFrameId = ref(null) const scene = ref() const camera = ref() @@ -119,29 +120,33 @@ function init() { const number = document.createElement('div') number.className = 'card-id' number.textContent = tableData.value[i].uid - if(isShowAvatar.value) number.style.display = 'none' + if (isShowAvatar.value) + number.style.display = 'none' element.appendChild(number) const symbol = document.createElement('div') symbol.className = 'card-name' symbol.textContent = tableData.value[i].name - if(isShowAvatar.value) symbol.className = 'card-name card-avatar-name' + if (isShowAvatar.value) + symbol.className = 'card-name card-avatar-name' element.appendChild(symbol) const detail = document.createElement('div') detail.className = 'card-detail' detail.innerHTML = `${tableData.value[i].department}
${tableData.value[i].identity}` - if(isShowAvatar.value) detail.style.display = 'none' + if (isShowAvatar.value) + detail.style.display = 'none' element.appendChild(detail) - const avatar = document.createElement('img'); - avatar.className = 'card-avatar'; - avatar.src = tableData.value[i].avatar; - avatar.alt = 'avatar'; - avatar.style.width = '140px'; - avatar.style.height = '140px'; - if(!isShowAvatar.value) avatar.style.display = 'none' - element.appendChild(avatar); + const avatar = document.createElement('img') + avatar.className = 'card-avatar' + avatar.src = tableData.value[i].avatar + avatar.alt = 'avatar' + avatar.style.width = '140px' + avatar.style.height = '140px' + if (!isShowAvatar.value) + avatar.style.display = 'none' + element.appendChild(avatar) element = useElementStyle(element, tableData.value[i], i, patternList.value, patternColor.value, cardColor.value, cardSize.value, textSize.value) const object = new CSS3DObject(element) @@ -286,7 +291,7 @@ function animation() { } // 设置自动旋转 // 设置相机位置 - requestAnimationFrame(animation) + animationFrameId.value = requestAnimationFrame(animation) } // // 旋转的动画 @@ -635,7 +640,14 @@ function listenKeyboard(e: any) { } function cleanup() { -// animationRunning.value = false + // 停止所有Tween动画 + TWEEN.removeAll() + + // 清理动画循环 + if ((window as any).cancelAnimationFrame) { + (window as any).cancelAnimationFrame(animationFrameId.value) + } + // animationRunning.value = false clearInterval(intervalTimer.value) intervalTimer.value = null if (scene.value) { From 2218caf713630f11cd8feee7dce9984a61524426 Mon Sep 17 00:00:00 2001 From: log1997 <2694233102@qq.com> Date: Fri, 19 Dec 2025 16:07:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?build:=20=F0=9F=8F=97=EF=B8=8F=20docker=20a?= =?UTF-8?q?ction=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 1 + .github/workflows/docker.yml | 53 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 15 +++++----- Dockerfile | 37 +++++++++++++----------- 4 files changed, 82 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.dockerignore b/.dockerignore index f06235c..be08974 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ node_modules dist +src-tauri \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..a2019a1 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,53 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Publish Docker image + +on: + push: + tags: + - 'v*' + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: log-lottery + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: index.docker.io/${{ secrets.DOCKER_USERNAME }}/log-lottery + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 002c943..2f12dfe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,16 @@ name: Build and Release on: - push: - tags: - - 'v*' + pull_request: + branches: [main] jobs: build-and-release: runs-on: ubuntu-latest - + permissions: contents: write - + steps: - name: Checkout code uses: actions/checkout@v3 @@ -26,8 +25,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '22.x' - cache: 'pnpm' + node-version: 22.x + cache: pnpm - name: Install dependencies run: pnpm install @@ -59,4 +58,4 @@ jobs: dist-file.tar.gz draft: true prerelease: false - generate_release_notes: true \ No newline at end of file + generate_release_notes: true diff --git a/Dockerfile b/Dockerfile index 2f8dcc6..8e6b707 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,42 @@ # 使用官方的 Node 镜像作为基础镜像 -FROM node:20.12.2 +FROM node:22 # 设置工作目录 WORKDIR /usr/src/app -# 将本地的 Vite 项目文件复制到工作目录 +# 将本地的项目文件复制到工作目录 COPY . . -# 安装依赖 - +# 安装 pnpm RUN npm install pnpm -g +# 安装依赖 RUN pnpm install -# 执行 Vite 构建命令,生成 dist 目录 +# 执行构建命令,生成 dist 目录 RUN pnpm build # 使用 Nginx 镜像作为运行时镜像 FROM nginx:1.26 -# 修改nginx配置 -# 向 #error_page 前添加内容 -# location /log-lottery { -# alias /usr/share/nginx/log-lottery; -# index index.html index.htm; -# try_files $uri $uri/ /log-lottery/index.html; -# } -RUN sed -i 's/#error_page/location \/log-lottery {\n alias \/usr\/share\/nginx\/log-lottery;\n index index.html index.htm;\n try_files $uri $uri\/ \/log-lottery\/index.html;\n }\n#error_page/' /etc/nginx/conf.d/default.conf +# 复制自定义 nginx 配置 +COPY --from=0 /usr/src/app/dist /usr/share/nginx/html/log-lottery -# 将 Vite 项目的 dist 目录复制到 Nginx 的默认静态文件目录 -COPY --from=0 /usr/src/app/dist /usr/share/nginx/log-lottery +# 创建自定义 nginx 配置 +RUN echo "server {\ + listen 80;\ + server_name localhost;\ + location / {\ + return 301 /log-lottery/;\ + }\ + location /log-lottery {\ + alias /usr/share/nginx/html/log-lottery;\ + index index.html index.htm;\ + try_files \$uri \$uri/ /log-lottery/index.html;\ + }\ +}" > /etc/nginx/conf.d/default.conf # 暴露容器的 80 端口 EXPOSE 80 -# Nginx 会在容器启动时自动运行,无需手动设置 CMD +# Nginx 会在容器启动时自动运行,无需手动设置 CMD \ No newline at end of file From 5445e3f545e4a9a6339e3fb69a1461cb0d4e8b21 Mon Sep 17 00:00:00 2001 From: log1997 <2694233102@qq.com> Date: Fri, 19 Dec 2025 16:27:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?build:=20=F0=9F=8F=97=EF=B8=8F=20docker?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a2019a1..684598e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,6 +23,9 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -33,7 +36,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: log-lottery + images: ${{ secrets.DOCKER_USERNAME }}/log-lottery - name: Build and push Docker image id: push From f952607ca5c0a600613b17c6cf76f135f2ce9491 Mon Sep 17 00:00:00 2001 From: log1997 <2694233102@qq.com> Date: Fri, 19 Dec 2025 16:44:31 +0800 Subject: [PATCH 4/4] =?UTF-8?q?build(release):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2f12dfe..bf370da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ name: Build and Release on: - pull_request: - branches: [main] + push: + tags: + - 'v*' jobs: build-and-release: