projectName
1. 业务简介
projectName是一个后台管理系统,是供应链(TS)生态中的一环
2. 开发语言
- typescript
- less
- html
3. 特性
- react 组件化开发
- typescript 强类型语言
- git submodule 维护公共模块
- antDesign 规范的后台交互视觉风格
- webpack 打包工具
4.支持环境
- chrome 49及以上
- node 建议最新稳定版本
5. 如何运行
5.1 本地运行
- 拉取代码
git clone http://gitlab.sftcwl.com/speed/fe-speed.git
- 拉取git子模块代码
git submodule init
git submodule updat
- 切换至git子模块依赖分支
cd common-base
git checkout --track origin/speed_dev_zhangjing
cd ..
- 安装依赖
npm install
- 配置接口代理
// src/config/proxy.conf.js
// 前端根据接口文档模拟的数据地址
const mock = 'http://gz-loc-development00.gz.sftcwl.com:7300/mock/5cc17532cf3b914cf60a6043/management';
// 后端提供的可联调环境
const rdName = 'http://gz-loc-development00.gz.sftcwl.com:9991';
module.exports = {
'/user': mock, // 匹配到以/user开头的url,代理到mock域名
'/management': rdName, // 匹配到以/management开头的url,代理到rdName域名
};
- 启动本地服务器
npm run start
5.2 后端联调
- 打包项目
npm run build
- 配置推送地址
// src/config/deploy.conf.js
const deployCfg = {
rdName: {
receiver: 'http://10.188.40.14:9444/receiver.php',
root: '/home/rdName/odp_speed/',
},
};
module.exports = deployCfg;
- 推送项目
npm run deploy rdName
6. 目录结构
├── common-base 公共模块(不可修改)
├── pass 前端登陆服务模块
├── dist 打包生成
├── src 业务开发模块
├── ├── components UI类组件
├── ├── config 配置文件
├── ├── containers 容器类组件(对component的组合)
├── ├── state 公共状态管理
├── ├── static 静态资源
├── ├── theme 全局样式
├── ├── translations 国际化语言
├── ├── utils 工具函数
7. 主要依赖的第三方库
react相关
- react
- react-redux : 数据状态管理
- redux-saga : 复杂异步管理
- reselect : 把 state tree 从 UI tree 解耦并逐步细化, 是可组合的 getter 函数组
- react-router-dom(替代react-router-redux注入路由进props)
UI库
- ant-design
国际化语言
- intl
工具库
- moment
- lodash
不可变对象
- immutable