# pay-ui
**Repository Path**: StevenBlake/pay-ui
## Basic Information
- **Project Name**: pay-ui
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-10-29
- **Last Updated**: 2021-10-29
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## 开发
```bash
# 克隆项目
git clone http://172.16.189.209:8080/web/wood-ui.git
# 进入项目目录
cd wood-ui
# 安装依赖
npm install
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# 启动服务
npm run dev
```
打开浏览器,输入:(http://localhost:80 (opens new window)) 默认账户/密码 admin/admin123)
若能正确展示登录页面,并能成功登录,菜单及页面展示正常,则表明环境搭建成功
## 发布
```bash
# 构建测试环境
npm run build:stage
# 构建生产环境
npm run build:prod
构建打包成功之后,会在根目录生成 dist 文件夹,里面就是构建打包好的文件,通常是 ***.js 、***.css、index.html 等静态文件。
通常情况下 dist 文件夹的静态文件发布到你的 nginx 或者静态服务器即可,其中的 index.html 是后台服务的入口页面。
```
> **outputDir 提示**
如果需要自定义构建,比如指定 dist 目录等,则需要通过 config (opens new window)的 outputDir 进行配置。
> **publicPath 提示**
部署时改变页面js 和 css 静态引入路径 ,只需修改 vue.config.js 文件资源路径即可。
>
> ```javascript
> publicPath: './' //请根据自己路径来配置更改
> ```
>
> ```javascript
> export default new Router({
> mode: 'hash', // hash模式
> })
> ```
## 环境变量
所有测试环境或者正式环境变量的配置都在 .env.development (opens new window)等 .env.xxxx文件中。
它们都会通过 webpack.DefinePlugin 插件注入到全局。
> 注意!!!
>
> 环境变量必须以VUE_APP_为开头。如:VUE_APP_API、VUE_APP_TITLE
>
> 你在代码中可以通过如下方式获取:
> ```javascript
> console.log(process.env.VUE_APP_xxxx)
> ```
## Nginx配置
```markdown
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /home/ruoyi/projects/ruoyi-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
```
## Nginx建议开启Gzip压缩
在http.server中加入如下代码对相应的资源进行压缩,可以减少文件体积和加快网页访问速度。
```markdown
# 开启gzip压缩
gzip on;
# 不压缩临界值,大于1K的才压缩,一般不用改
gzip_min_length 1k;
# 压缩缓冲区
gzip_buffers 16 64K;
# 压缩版本(默认1.1,前端如果是squid2.5请使用1.0)
gzip_http_version 1.1;
# 压缩级别,1-10,数字越大压缩的越好,时间也越长
gzip_comp_level 5;
# 进行压缩的文件类型
gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
# 跟Squid等缓存服务有关,on的话会在Header里增加"Vary: Accept-Encoding"
gzip_vary on;
# IE6对Gzip不怎么友好,不给它Gzip了
gzip_disable "MSIE [1-6]\.";
```
## 常见问题
1. 如果使用Mac需要修改application.yml文件路径profile
2. 如果使用Linux 提示表不存在,设置大小写敏感配置在/etc/my.cnf添加lower_case_table_names=1,重启MYSQL服务
3. 如果提示当前权限不足,无法写入文件请检查application.yml中的profile路径或logback.xml中的log.path路径是否有可读可写操作权限