当前位置: 首页 > news >正文

开源问卷平台DWSurvey开发配置记录

后端目录及配置​

后端目录​

后端目录

. ├─ src # 工作目录 │ ├─ main │ ├─ ├─ java │ ├─ ├─ ├─ net │ ├─ ├─ ├─ ├─ diaowen │ ├─ ├─ ├─ ├─ ├─ common # 公共类目录,如LOGIN、SMS、Storage... │ ├─ ├─ ├─ ├─ ├─ dwsurvey │ ├─ ├─ ├─ ├─ ├─ ├─ common # 调问公共类目录 │ ├─ ├─ ├─ ├─ ├─ ├─ config # springboot配置目录 │ ├─ ├─ ├─ ├─ ├─ ├─ controller 控制层目录 │ ├─ ├─ ├─ ├─ ├─ ├─ dao 数据层目录 │ ├─ ├─ ├─ ├─ ├─ ├─ entity 实体类目录 │ ├─ ├─ ├─ ├─ ├─ ├─ service 业务层目录 │ ├─ ├─ resource # 配置文件目录 │ ├─ ├─ ├─ application.yml # 配置入口 │ ├─ ├─ ├─ application-dev.yml # 开发环境配置 │ ├─ ├─ ├─ application-prod.yml # 生产环境配置 │ ├─ ├─ ├─ application-test.yml # 测试环境配置 └─ pom.xml # maven包管理

后端配置​

通常配置哪些

此处只介绍几处可能会修改的关键配置 通常情况下你只需要修改 mysql 及 elasticsearch 连接信息

不配置 elasticsearch 影响

如果体验预览可以不配置 elasticsearch,但这会使得统计报告无法使用,不影响系统其它功能。

src/main/resources/application-dev.yml

yml

dwsurvey: # 用户模式切换,暂且保持默认 local, test,demo site: "local" # 服务占用的端口号 server: port: 8080 tomcat: max-http-form-post-size: -1 # Spring相关配置 spring: # 数据库配置 datasource: #type: com.alibaba.druid.pool.DruidDataSource # 连接URL url: jdbc:mysql://localhost:3306/dwsurvey?useUnicode=true&characterEncoding=utf8 # 连接账号 username: root # 连接密码 password: 123456,. ... # 日志配置 # elasticsearch 配置,不配置不会影响正常设计问卷及答卷,但无法使用统计报告 elasticsearch: username: elastic passwd: A0ThxyWi1gMNJzv7iU7M apikey: == hosts: 127.0.0.1:9200 # 多个IP逗号隔开 cert-name: http_ca.crt # 后加的ES参数 # 协议方式,使用证书这里改成https scheme: http # 索引统一前缀,默认为空不加前缀, 如果加建议格式如:dw_ index-prev: oss_ # 认证方式 noPwd, pwd, cert security: noPwd

前端目录及配置​

前端目录​

社区版目录企业版目录

. ├─ build # 构建配置 ├─ config # 项目配置 │ ├─ dev.env.js # 开发环境配置 │ ├─ index.js # 主配置 │ ├─ prod.env.js # 生产环境配置 │ └─ test.env.js # 测试环境配置 ├─ src │ ├─ api # 接口API │ ├─ assets # 资源 │ ├─ components # 项目组件 │ ├─ ├─ common # 公共组件 │ ├─ ├─ dw-survey-comp # 问卷相关组件 │ ├─ ├─ ├─ dw-answer-comp # 回答问卷组件 │ ├─ ├─ ├─ dw-data-comp # 问卷数据组件 │ ├─ ├─ ├─ dw-design-comp # 设计问卷组件 │ ├─ ├─ ├─ dw-utils # 一些帮助文件 │ ├─ ├─ layouts # 系统布局组件 │ └─ router # 系统路由配置 │ └─ theme # 系统主题配置 │ └─ utils # 系统工具文件 │ └─ views # 系统页面文件 └─ package.json # 包管理

前端配置​

社区版​

TIP

开发环境如果使用 localhost 访问不需要修改, 只用修改config/index.js里的dev.proxyTable.target地址为后端地址

TIP

如果生产打开请修改 config/prod.env.js 修改为前端实现访问地址,然后配置 nginx 转发

config/dev.env.js

js

/** * 注意:开发环境不需要修改这里 * 只需要修改 index.js dev.proxyTable.target地址为后端地址 */ "use strict"; const merge = require("webpack-merge"); const prodEnv = require("./prod.env"); module.exports = merge(prodEnv, { NODE_ENV: '"development"', // 本地开发环境后端API地址不需要在这个文件配置,在config/index.js里面配置target DW_API_URL: '"http://localhost:8081"', //开发环境不需要修改,只需要 config/index.js target DW_WEB_URL: '"http://localhost:8081"', //开发环境不需要修改,只需要 config/index.js target DW_RESOURCE_URL: '"http://localhost:8080"', });

config/index.js

js

"use strict"; // Template version: 1.3.1 // see http://vuejs-templates.github.io/webpack for documentation. const path = require("path"); module.exports = { dev: { // Paths assetsSubDirectory: "static", assetsPublicPath: "/", proxyTable: { "/api": { target: "http://localhost:8080/", // 本地开发环境只需要修改这个配置,修改为后端服务地址即可 changeOrigin: true, //如果需要跨域 pathRewrite: { "^/api": "/api", }, }, }, ... }, ... };

企业版​

config/.env.development

js

/** * 注意:修改这里为后端实现地址, * 也可以不修改这个,只修改 vite.config server.proxy.target 地址为后端地址 */ NODE_ENV = "development"; VITE_DW_API_URL = "http://localhost:5173"; VITE_DW_WEB_URL = "http://localhost:5173"; VITE_DW_RESOURCE_URL = "http://localhost:5173";

nginx 配置​

token 认证方式​

conf.d目录下面新建dwsurvey.conf,并配置如下内容

conf.d/dwsurvey.conf

conf

server { listen 80; server_name _; root /www/sf/dist; index index.html; location / { index index.html index.htm; try_files $uri $uri/ /index.html; } location /api { # rewrite ^/api/(.*) /$1 break; proxy_pass http://localhost:8899; } location /file { # rewrite ^/api/(.*) /$1 break; proxy_pass http://localhost:8899; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }

编辑nginx.conf的配置引用include /etc/nginx/conf.d/dwsurvey.conf;如下所示

include /etc/nginx/conf.d/*.conf;

效果如图

session 认证方式​

conf.d目录下面新建dwsurvey.conf,并配置如下内容

conf.d/dwsurvey.conf

conf

server { listen 80; server_name _; root /www/sf/dist; index index.html; location / { index index.html index.htm; try_files $uri $uri/ /index.html; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }

编辑nginx.conf的配置引用include /etc/nginx/conf.d/dwsurvey.conf;如下所示

include /etc/nginx/conf.d/*.conf;

效果如图

http://www.jsqmd.com/news/212515/

相关文章:

  • 前后端分离甘肃非物质文化网站系统|SpringBoot+Vue+MyBatis+MySQL完整源码+部署教程
  • 教师工作量管理系统信息管理系统源码-SpringBoot后端+Vue前端+MySQL【可直接运行】
  • 通用语——基于实体感知的机器翻译方法,用于知识图谱上的问答
  • 【Java 开发日记】我们来说一下 synchronized 与 ReentrantLock 的
  • 引导内存分配器 Buddy 分配器的关系
  • Buddy分配器
  • AI模型容器化部署实战
  • Slab,不连续页,buddy分配器与内存映射
  • Linux内存映射
  • 物理内存组织架构与Buddy分配器关系分析
  • 【数据分享】2025年全国范围各城市的公交路线及站点数据(分省/分城市)
  • 期货反向跟单—从小白到高手进阶历程 六十三(研究人性不是重点)
  • Agent2Agent (A2A) Protocol( A2A 协议)简介、组件
  • 系列教程十三 | 探索阿里云 Wan 2.1:零基础入门文本生成视频教程
  • 系列教程十四 | 基于CosyVoice 2.0实现语音风格迁移
  • 外包开发三年
  • 【360浏览器】取消360画报,不显示屏保
  • 解析ASTM D4169:运输包装性能测试的核心标准有哪些
  • 提示工程的认知架构设计:架构师的深度思考
  • Java Web 企业客户管理系统系统源码-SpringBoot2+Vue3+MyBatis-Plus+MySQL8.0【含文档】
  • 网上超市设计与实现信息管理系统源码-SpringBoot后端+Vue前端+MySQL【可直接运行】
  • Java SpringBoot+Vue3+MyBatis 在线文档管理系统系统源码|前后端分离+MySQL数据库
  • 大数据诊断性分析:从入门到精通的完整指南
  • 【2025最新】基于SpringBoot+Vue的甘肃非物质文化网站管理系统源码+MyBatis+MySQL
  • 快速排序 - 原理、时空分析、优化
  • Java SpringBoot+Vue3+MyBatis 教师工作量管理系统系统源码|前后端分离+MySQL数据库
  • 企业级企业客户管理系统管理系统源码|SpringBoot+Vue+MyBatis架构+MySQL数据库【完整版】
  • 2. 假新闻检测 - 《FakingRecipe: Detecting Fake News on Short Video Platforms from the Perspective of ...》
  • Java SpringBoot+Vue3+MyBatis 网上超市设计与实现系统源码|前后端分离+MySQL数据库
  • 1. 假新闻检测 - 《Modality Perception Learning-Based Determinative Factor Discovery ...》