Forráskód Böngészése

refactor: 修改文件便于部署

fanyanpeng 1 éve
szülő
commit
104cbca63e

+ 14 - 0
Dockerfile

@@ -0,0 +1,14 @@
+FROM node:lts-alpine as build-stage
+MAINTAINER fanyanpeng fanyanpeng@smail.nju.edu.cn
+WORKDIR /app
+ENV TZ Asia/Shanghai
+COPY package*.json ./
+RUN npm config set registry https://registry.npm.taobao.org
+RUN npm install
+COPY . .
+RUN npm run build
+
+FROM nginx:stable-alpine as production-stage
+COPY --from=build-stage /app/dist /usr/share/nginx/html
+EXPOSE 80
+CMD ["nginx", "-g", "daemon off;"]

+ 17 - 0
nginx.conf

@@ -0,0 +1,17 @@
+
+    upstream backend{
+        server 192.168.80.1:8070;
+    }
+
+    server {
+            listen 81;
+            listen [::]:81;
+            root /usr/share/nginx/html;
+            server_name _;
+      location ~ / {
+        if ($request_uri ~* (api)) {
+            proxy_pass http://backend;
+        }
+        try_files $uri $uri/ /index.html;
+      }
+    }

+ 1 - 1
src/apis/axios.config.ts

@@ -3,7 +3,7 @@ import axios from "axios";
 // const BASEURL = 'http://47.111.23.171:8081'
 // const BASEURL = 'http://47.111.23.171:8081'
 // const BASEURL = 'http://localhost:8080'
 // const BASEURL = 'http://localhost:8080'
 // const BASEURL = 'http://8.130.126.86:8080'
 // const BASEURL = 'http://8.130.126.86:8080'
-const BASEURL = 'http://139.196.252.184:8070'
+const BASEURL = ''
 
 
 const axiosInstance = axios.create({
 const axiosInstance = axios.create({
     baseURL: BASEURL,
     baseURL: BASEURL,

+ 1 - 1
src/components/WordEditor/WordEditor.vue

@@ -63,7 +63,7 @@
     editorConfig: {
     editorConfig: {
       lang: 'zh-CN',
       lang: 'zh-CN',
       //不要用localhost和127.0.0.1访问,用局域网IP访问
       //不要用localhost和127.0.0.1访问,用局域网IP访问
-      callbackUrl: 'http://139.196.252.184:8070/api/onlyoffice/callback',
+      callbackUrl: '/api/onlyoffice/callback',
       customization: {
       customization: {
         autosave: false,
         autosave: false,
         comments: false,
         comments: false,

+ 2 - 2
src/views/CourseSquare/component/CourseDetails/component/CourseHomeworkTable.vue

@@ -64,7 +64,7 @@
       <el-form-item label="描述文件" v-if="dialogConfig.type == 'edit'">
       <el-form-item label="描述文件" v-if="dialogConfig.type == 'edit'">
         <el-upload
         <el-upload
             ref="uploadDescribeRef"
             ref="uploadDescribeRef"
-            action= "http://139.196.252.184:8070/api/file"
+            action= "/api/file"
             multiple
             multiple
             v-model:file-list="describeFileList"
             v-model:file-list="describeFileList"
             :limit="1"
             :limit="1"
@@ -86,7 +86,7 @@
       <el-form-item label="附件" v-if="dialogConfig.type == 'edit'">
       <el-form-item label="附件" v-if="dialogConfig.type == 'edit'">
         <el-upload
         <el-upload
             ref="uploadPictureRef"
             ref="uploadPictureRef"
-            action= "http://139.196.252.184:8070/api/file"
+            action= "/api/file"
             multiple
             multiple
             v-model:file-list="pictureFileList"
             v-model:file-list="pictureFileList"
             :limit="1"
             :limit="1"

+ 1 - 1
src/views/CourseSquare/component/CourseDetails/index.vue

@@ -77,7 +77,7 @@
         <el-upload
         <el-upload
             ref="uploadRef"
             ref="uploadRef"
             drag
             drag
-            action="http://139.196.252.184:8070/api/file"
+            action="/api/file"
             multiple
             multiple
             v-model:file-list="fileList"
             v-model:file-list="fileList"
             :limit="1"
             :limit="1"

+ 4 - 1
vite.config.ts

@@ -15,6 +15,9 @@ export default defineConfig({
   },
   },
   server: {
   server: {
     host: '127.0.0.1',
     host: '127.0.0.1',
-    port: 4000
+    port: 4000,
+    proxy: {
+      '/api': 'http://localhost:8090'
+    }
   }
   }
 })
 })