刘冰洁 1 year ago
parent
commit
4935ec0cd5
8 changed files with 68 additions and 4 deletions
  1. 1 1
      .gitignore
  2. 4 0
      .vscode/settings.json
  3. 5 0
      Dockerfile
  4. 29 0
      Jenkinsfile
  5. 15 0
      default.conf
  6. 11 0
      docker-compose.yaml
  7. 2 2
      src/service/request/instance.ts
  8. 1 1
      src/typings/system.d.ts

+ 1 - 1
.gitignore

@@ -15,7 +15,7 @@ dist.zip
 coverage
 *.local
 stats.html
-
+target
 /cypress/videos/
 /cypress/screenshots/
 

+ 4 - 0
.vscode/settings.json

@@ -43,7 +43,11 @@
   "terminal.integrated.fontWeight": 500,
   "terminal.integrated.tabs.enabled": true,
   "workbench.iconTheme": "material-icon-theme",
+<<<<<<< HEAD
   "workbench.colorTheme": "蓝色空间——浅色🌷",
+=======
+  "workbench.colorTheme": "Default Light Modern",
+>>>>>>> e655156db19c1cc943d461cfb76a471eabc7b982
   "[html]": {
     "editor.defaultFormatter": "esbenp.prettier-vscode"
   },

+ 5 - 0
Dockerfile

@@ -0,0 +1,5 @@
+FROM nginx
+EXPOSE 80
+RUN rm -v /etc/nginx/conf.d/default.conf
+ADD default.conf /etc/nginx/conf.d/
+COPY ./dist /usr/share/nginx/html

+ 29 - 0
Jenkinsfile

@@ -0,0 +1,29 @@
+pipeline {
+    agent any
+    environment {
+        BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
+    }
+    stages {
+        stage('Build') {
+            steps {
+                sh 'docker-compose down'
+                nodejs('16.19.0') {
+                    sh 'npm install --registry https://registry.npm.taobao.org'
+                    sh 'npm run build:dev'
+                }
+                sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
+            }
+        }
+        stage('Test') {
+            steps {
+                echo 'Testing..'
+            }
+        }
+        stage('Deploy') {
+            steps {
+                echo 'Deploying....'
+                sh 'docker-compose up -d'
+            }
+        }
+    }
+}

+ 15 - 0
default.conf

@@ -0,0 +1,15 @@
+server {
+    #red
+    listen       80;
+    server_name  localhost;
+
+    location / {
+        root   /usr/share/nginx/html;
+        index  index.html index.htm;
+    }
+
+    location /api/ {
+        proxy_pass http://192.168.18.13:8182/;
+    }
+
+}

+ 11 - 0
docker-compose.yaml

@@ -0,0 +1,11 @@
+version: "3"
+services:
+  post-project-ui:
+    image: ${BRANCH_NAME}:${BUILD_NUMBER}
+    ports:
+      - 9682:80
+    networks:
+      - local_public
+networks:
+  local_public:
+    external: true

+ 2 - 2
src/service/request/instance.ts

@@ -30,8 +30,8 @@ export default class CustomAxiosInstance {
     backendConfig: Service.BackendResultConfig = {
       codeKey: 'code',
       dataKey: 'data',
-      msgKey: 'message',
-      successCode: 200
+      msgKey: 'status',
+      successCode: true
     }
   ) {
     this.backendConfig = backendConfig;

+ 1 - 1
src/typings/system.d.ts

@@ -27,7 +27,7 @@ declare namespace Service {
     /** 表示后端消息的属性字段 */
     msgKey: string;
     /** 后端业务上定义的成功请求的状态 */
-    successCode: number | string;
+    successCode: boolean;
   }
 
   /** 自定义的请求成功结果 */