diff --git a/dinting-test/Dockerfile b/dinting-test/Dockerfile new file mode 100644 index 0000000..5733190 --- /dev/null +++ b/dinting-test/Dockerfile @@ -0,0 +1,24 @@ +# 使用官方的 Java 17 JDK 镜像 +FROM openjdk:17-jdk-slim + +# 安装 Maven +RUN apt-get update && \ + apt-get install -y maven && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# 设置工作目录 +WORKDIR /app + +# 复制 Maven 项目文件 +COPY pom.xml . +COPY src ./src + +# 构建项目 +RUN mvn install -DskipTests + +# 暴露应用程序运行的端口 +EXPOSE 8888 + +# 运行应用程序 +ENTRYPOINT ["java", "-jar", "target/dinting-test-0.0.1.jar"] \ No newline at end of file diff --git a/diting-doc/.env.development b/diting-doc/.env.development new file mode 100644 index 0000000..d91b694 --- /dev/null +++ b/diting-doc/.env.development @@ -0,0 +1 @@ +VITE_API_BASE_URL=/api \ No newline at end of file diff --git a/diting-doc/.env.production b/diting-doc/.env.production new file mode 100644 index 0000000..d5027e9 --- /dev/null +++ b/diting-doc/.env.production @@ -0,0 +1 @@ +VITE_API_BASE_URL=https://diting-server-97557-9-1325155828.sh.run.tcloudbase.com \ No newline at end of file diff --git a/diting-doc/docs/.vitepress/theme/components/SensitiveWordTool.vue b/diting-doc/docs/.vitepress/theme/components/SensitiveWordTool.vue index ab7a887..cf3fab3 100644 --- a/diting-doc/docs/.vitepress/theme/components/SensitiveWordTool.vue +++ b/diting-doc/docs/.vitepress/theme/components/SensitiveWordTool.vue @@ -70,20 +70,19 @@ export default { alert("请输入文本"); return; } - this.loading = true; - try { + const apiBaseUrl = import.meta.env.VITE_API_BASE_URL; let response; if (this.selectedAction === "find") { // 调用发现敏感词的接口 - response = await axios.post("/api/sensitive-words/find", { + response = await axios.post(`${apiBaseUrl}/sensitive-words/find`, { text: this.inputText, }); this.highlightSensitiveWords(response.data.matchedWords); } else if (this.selectedAction === "find-and-desensitize") { // 调用发现并脱敏的接口 - response = await axios.post("/api/sensitive-words/find-and-desensitize", { + response = await axios.post(`${apiBaseUrl}/sensitive-words/find-and-desensitize`, { text: this.inputText, desensitizationType: this.desensitizationType, });