Skip to content

wangcongmao/WHDMSS-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

989 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://github.com/wangcongmao/WHDMSS-frontend

环境: node.js: v18.16.0 pnpm:9.14.4

配置后端接口 1、文档 https://jeesite.com/docs/install-deploy/ 若已部署,请忽略。

2、打开 .env.development 文件,修改后台接口:

代理设置,可配置多个,不能换行,格式:[访问接口的根路径, 代理地址, 是否保持Host头]

VITE_PROXY = [["/js","https://vue.jeesite.com/js",true]]

VITE_PROXY = [["/js","http://127.0.0.1:8980/js",false]]

访问接口的根路径(例如:https://vue.jeesite.com)一般不需要填写

VITE_GLOB_API_URL =

访问接口的前缀,在根路径之后(对应后端 application.yml 中的 context-path 设置)

VITE_GLOB_API_URL_PREFIX = /js

启动运行服务 1、安装依赖

npm run bootstrap 2、运行方式1:开发环境(会加载文件较多,便于调试,请耐心等待,请开启浏览器缓存)

npm run dev

部署完成后访问 1、浏览器访问:http://127.0.0.1:3100(opens new window)

2、默认最高管理员账号:system 密码:admin weihaiAdmin 密码:admin

部署到正式服务器 1、打开 .env.production 文件,修改参数:

访问项目的根路径

VITE_PUBLIC_PATH = /

访问接口的根路径

VITE_GLOB_API_URL =

访问接口的前缀,在根路径之后

VITE_GLOB_API_URL_PREFIX = /js

路由模式(true: history、false: hash)

VITE_ROUTE_WEB_HISTORY = true 2、执行打包命令

npm run build 打包完成后,会在根目录生成 dist 文件夹,发布 nginx。

打包后支持动态配置:

打开 _app.config.js 文件,用于项目在打包后,需要动态修改配置的需求,如接口地址。不用重新进行打包,可在打包后修改 /dist/_app.config.js 内的变量,刷新即可更新代码内的局部变量。

// _app.config.js // 变量名命名规则 PRODUCTION__xxx_CONF xxx:为 .env 配置的 VITE_GLOB_APP_SHORT_NAME window.PRODUCTION__JEESITE__CONF = { VITE_GLOB_APP_TITLE: 'JeeSite快速开发平台', VITE_GLOB_APP_SHORT_NAME: 'jeesite', VITE_GLOB_API_URL: '/js', VITE_GLOB_API_URL_PREFIX: '', VITE_GLOB_UPLOAD_URL: '/upload', }; 系统默认开启了百度统计,可在 _app.config.js 中删除 var _hmt 后的代码,即关闭统计。

路由 history 模式:

路由如果采用 history 模式 (opens new window),您还需要辅助配置 nginx 如下:

nginx.conf 文件

server {

前端Vue页面

location / { root /jeesite-vue/dist; index index.html; try_files $uri $uri/ /index.html; }

如果 VITE_PUBLIC_PATH 设置为 /vue,配置如下:

#location /vue {

alias /jeesite-vue/dist;

index index.html;

try_files $uri $uri/ /vue/index.html;

#}

后端接口服务

location /js { proxy_pass http://127.0.0.1:8980/js; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }

About

威海浅海试验场数据管理与服务系统前端

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors