diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 383a244..df3a4e8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,18 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml index dfc8d74..6c2404d 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -1,6 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 712ab9d..7b09891 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -1,19 +1,33 @@ + + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index fbbf7a0..59ed853 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,14 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 6bfd09c..5a52f1c 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -1,8 +1,14 @@ + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/.idea/sqlDataSources.xml b/.idea/sqlDataSources.xml index ef01b1c..f745691 100644 --- a/.idea/sqlDataSources.xml +++ b/.idea/sqlDataSources.xml @@ -1,8 +1,13 @@ + + + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml index 56782ca..d68cd16 100644 --- a/.idea/sqldialects.xml +++ b/.idea/sqldialects.xml @@ -1,6 +1,9 @@ + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml index 2b63946..965d691 100644 --- a/.idea/uiDesigner.xml +++ b/.idea/uiDesigner.xml @@ -1,123 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/src/main/java/lsgwr/exam/controller/UploadDownloadController.java b/backend/src/main/java/lsgwr/exam/controller/UploadDownloadController.java index 35c7cc2..fca3f8e 100644 --- a/backend/src/main/java/lsgwr/exam/controller/UploadDownloadController.java +++ b/backend/src/main/java/lsgwr/exam/controller/UploadDownloadController.java @@ -1,28 +1,37 @@ -package lsgwr.exam.controller; - -import lsgwr.exam.qo.DownloadQo; -import lsgwr.exam.qo.UploadModel; -import lsgwr.exam.qo.UploadModel2; -import lsgwr.exam.utils.FileTransUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.core.io.InputStreamResource; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import java.io.IOException; - -/*********************************************************** - * @note : 文件上传下载的接口,由于Swagger的问题导致在SwaggerUI - * 里测试不成功,实际上前端是完全没有问题的 - * @author : 梁山广 - * * 为了支持Ajax请求和响应,最简单的解决方案返回一个ResponseEntity。 - * * 以下示例演示了上传文件的三种可能方式: - * * 1. 单文件上传 - `MultipartFile` - * * 2. 多文件上传 - `MultipartFile []` - * * 3. 将文件上传到模型 - `@ModelAttribute` + + + + + + + + + + + + + + + + + + +3. 将文件上传到模型 - `@ModelAttribute` * @version : V1.0 at 2018/7/16 20:43 ***********************************************************/ @RestController diff --git a/doc/deploy/nginx.conf b/doc/deploy/nginx.conf index def426e..ece47ae 100644 --- a/doc/deploy/nginx.conf +++ b/doc/deploy/nginx.conf @@ -1,44 +1,58 @@ events { + # 工作进程的最大连接数 worker_connections 1024; } - - + + http { + # 包含mime.types文件 include mime.types; + # 默认文件类型 default_type application/octet-stream; + # 开启sendfile功能 sendfile on; - + + # 保持连接超时时间 keepalive_timeout 65; - + + # 定义一个server server { + # 监听80端口 listen 80; + # 服务器名称 server_name localhost; - + # 404页面跳转 location / { + # 如果请求的文件不存在,则尝试加载index.html try_files $uri /index.html; } - + # 静态资源目录,即vue打包后的dist里的静态资源 root /usr/share/nginx/html/; + # 默认首页 index index.html index.htm; - + # 后端服务的配置 location /api/ { - proxy_redirect off; + # 关闭代理重定向 + proxy_redirect off; + # 设置代理请求头 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 后端服务地址 proxy_pass http://localhost:9527/api/; } - - + + + # 错误页面 error_page 500 502 503 504 /50x.html; + # 错误页面路径 location = /50x.html { root html; } } -} +} \ No newline at end of file diff --git a/frontend/jest.config.js b/frontend/jest.config.js index de432a0..6eebe73 100644 --- a/frontend/jest.config.js +++ b/frontend/jest.config.js @@ -1,23 +1,34 @@ +// 导出配置文件 module.exports = { + // 模块文件扩展名 moduleFileExtensions: [ 'js', 'jsx', 'json', 'vue' ], + // 转换规则 transform: { + // 将.vue文件转换为jest可识别的格式 '^.+\\.vue$': 'vue-jest', + // 将.css、.styl、.less、.sass、.scss、.svg、.png、.jpg、.ttf、.woff、.woff2文件转换为stub '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', + // 将.jsx、.js文件转换为babel可识别的格式 '^.+\\.jsx?$': 'babel-jest' }, + // 模块名称映射 moduleNameMapper: { + // 将../替换为/src/ '^../(.*)$': '/src/$1' }, + // 快照序列化器 snapshotSerializers: [ 'jest-serializer-vue' ], + // 测试匹配规则 testMatch: [ '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' ], + // 测试URL testURL: 'http://localhost/' -} +} \ No newline at end of file diff --git a/frontend/vue.config.js b/frontend/vue.config.js index cb98aee..a9e8b31 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,6 +1,7 @@ const path = require('path') const webpack = require('webpack') +// 定义一个函数,用于拼接路径 function resolve (dir) { return path.join(__dirname, dir) } @@ -21,10 +22,12 @@ module.exports = { } }, */ + // 配置webpack configureWebpack: { plugins: [ - // Ignore all locale files of moment.js + // 忽略moment.js的所有locale文件 new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + // 提供全局变量 new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' @@ -32,7 +35,9 @@ module.exports = { ] }, + // 链式调用webpack配置 chainWebpack: (config) => { + // 设置路径别名 config.resolve.alias .set('@$', resolve('src')) .set('@api', resolve('src/api')) @@ -43,6 +48,7 @@ module.exports = { .set('@static', resolve('src/static')) .set('jquery', resolve('node_modules/jquery/src/jquery')) + // 配置svg规则 const svgRule = config.module.rule('svg') svgRule.uses.clear() svgRule @@ -73,6 +79,7 @@ module.exports = { */ }, + // 配置css css: { loaderOptions: { less: { @@ -90,15 +97,16 @@ module.exports = { } }, + // 配置开发服务器 devServer: { - // development server port 8000 + // 开发服务器端口 port: 8000, proxy: 'http://localhost:9527' }, - // disable source map in production + // 生产环境下禁用source map productionSourceMap: false, lintOnSave: undefined, - // babel-loader no-ignore node_modules/* + // babel-loader不忽略node_modules/* transpileDependencies: [] -} +} \ No newline at end of file diff --git a/frontend/webstorm.config.js b/frontend/webstorm.config.js index cb1fc8c..03048aa 100644 --- a/frontend/webstorm.config.js +++ b/frontend/webstorm.config.js @@ -1,16 +1,23 @@ 'use strict' +// 引入path模块 const path = require('path') +// 定义resolve函数,用于拼接路径 function resolve (dir) { return path.join(__dirname, '.', dir) } +// 导出配置对象 module.exports = { + // 设置上下文路径 context: path.resolve(__dirname, './'), + // 设置解析规则 resolve: { + // 设置文件后缀名 extensions: ['.js', '.vue', '.json'], + // 设置别名 alias: { '@': resolve('src') } } -} +} \ No newline at end of file