Files
hcframe-doc/docs/01.指南/02.快速开始.md
2021-02-03 17:01:33 +08:00

126 lines
3.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 快速开始
date: 2021-02-03 09:26:32
permalink: /pages/b0b86c/
---
# 快速上手
::: warning 前提条件
编译器安装好 Lombok 插件jdk环境1.8需要最新的LTS版本的 [Node.js](https://nodejs.org/en/)
运行工具推荐使用 [Yarn](https://yarn.bootcss.com/)
请clone代码时尽量从Tags中选择Tags中的代码皆为稳定版存在bug较少。
:::
本文会帮助你从头搭建并运行简单版本的通用框架前后端。
## 后台搭建
1. 从git仓库clone后台代码
``` bash
# 此处clone后台代码为dameng1.0版本的代码mysql请下载mysql对应版本
git clone -b dameng-1.0 http://taixingyiji.synology.me:1010/common-frame/common.git
```
2. 引入编译器等待maven下载好依赖
3. 创建数据库,并运行 `src>main>resources>common.sql` 文件
4. 修改yml文件目录为 `src>main>resources>application.yml`
**配置数据库数据源:**
``` yaml
datasource:
type: com.alibaba.druid.pool.DruidDataSource
# 将此处修改成你的数据库地址
url: jdbc:dm://192.168.10.3:5236/COMMON?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
# 将此处修改你的数据库用户名
username: COMMON
# 将此处修改成你的数据库密码
password: 123456789
# 指定数据库驱动
driver-class-name: dm.jdbc.driver.DmDriver
```
**配置token存证是否存入redis**
``` yaml
spring:
# 若不使用redis需要注释掉此类信息
redis:
database: 0
# redis地址
host: 192.168.100.145
# redis端口号
port: 6379
# redis 密码
password: root
lettuce:
pool:
# 连接池中的最大空闲连接 默认8
max-idle: 8
# 连接池中的最小空闲连接 默认0
min-idle: 0
# 连接池最大连接数 默认8 ,负数表示没有限制
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认-1
max-wait: -1
timeout: 30000
# 是否开启redis 用户登录若开启此项需要配置redis节点及相关配置若不开启需要注释掉redis相关配置信息
isRedisLogin: false
```
**配置分页插件:**
``` yaml
# 分页插件设置成达梦数据库支持,若不是达梦数据库需要注释掉此部分
pagehelper:
helperDialect: dm
reasonable: true
supportMethodsArguments: true
pageSizeZero: true
params: count=countSql
```
5. 通过启动类启动后台项目 `src>main>java>com.commmon.common>CommonApplication.java`
现在你的后台项目已经配置完成,且已经启动,接下来需要配置前端项目。
## 前端搭建
1. 通过git下载前端项目
``` bash
# 此处clone前端代码为dameng1.0版本的代码mysql请下载mysql对应版本
git clone -b dameng-1.0 http://taixingyiji.synology.me:1010/common-frame/common-web.git
```
2. 安装依赖
```bash
yarn install
```
3. 修改配置文件 `./vue.config.js`
``` js
'/common': {
// 此处修改成你的后台服务器地址及端口,其余配置不变
target: 'http://127.0.0.1:8081' ,
changeOrigin: true, // needed for virtual hosted sites
ws: true, // proxy websockets
pathRewrite: {
// '^/common': ''
}
}
```
4. 启动本地开发环境(自带热启动)
```bash
yarn serve
```
5. 通过浏览器访问
```http request
http://localhost:9527
```