# Readme for English
## Technology stack
react@16.0 + redux@3.7.2 + react-router@3.2.0 + webpack@3.10.0 + axios@0.18.0 + less@2.7.1 + antd@3.1.3
## Project introduce
```
git clone --depth 1 https://github.com/duxianwei520/react.git
cd react
npm install
npm start
```
Open another node service to open the mock interface service,if you don't start the mock interface service, you won't login into the inner page
```
npm run mock
```
#### Notice
If you wan to experience the chatroom, you need to start socket service first, so you need to run another node service like this
```
npm run chat
```
and if you want to publish your app, use the following line of commands
```
npm run build
```
This is the basic structure of the data returned by the server.
```
{
data: {
totalCount: 100,
currentPage: 1,
pageSize: 10,
'list': [
],
},
msg: '',
status: 1,
}
```
All asynchronous request returns will be processed by 'ajax.js' in configs folder. If there is no problem with the request, the `status` return value is `1`;
If the request is wrong, such as a parameter error or other error, the `status` return value is `0`;
If the status value is `-1`, indicating that the login timed out, then the login will pop up.
These parameters can be adjusted according to the actual situation, and the error message or successful prompt information is returned in `msg`.
The current project integrates basic user management, role management, module management and other basic rights management functions. The small partners must start `npm run mock` at the same time to see
## Description
> development environment: win10 Chrome 63.0.3239.132 nodejs 8.7.0
> If you have any questions, please mention them directly in the Issues. I will answer in the first time, or you find that the problem has a very good solution, welcome PR
### Cancel http request example:
```
import axios from 'axios'
const axiosHandle = axios.CancelToken.source()
login(){
this.props.dispatch(fetchLogin(values, (res) => {},(error)=>{},axiosHandle)
setTimeout(() => {
axiosHandle.cancel('cancel handle')
}, 3000)
}
```
## Reatures list
- [√] The project is loaded by the routing module
- [√] login
- [√] logt out
- [√] welcome page
- [√] menu
- [√] redux demo
- [√] mockjs to mock interface
- [√] use flex to adapt page height
- [√] cors
- [√] webpack bundle analyzer
- [√] editor draftjs
- [√] chatroom
## screenshots
### login
<img src="https://github.com/duxianwei520/resource/blob/master/react/screenshots/login.gif" width="973" height="557"/>
### echart
<img src="https://github.com/duxianwei520/resource/blob/master/react/screenshots/echart.gif" width="973" height="557"/>
### chatroom
<img src="https://github.com/duxianwei520/resource/blob/master/react/screenshots/chat.gif" width="973" height="557"/>
### set center
<img src="https://github.com/duxianwei520/resource/blob/master/react/screenshots/set.gif" width="973" height="557"/>
### webpack bundle analysis
<img src="https://github.com/duxianwei520/resource/blob/master/react/screenshots/analysis.gif" width="973" height="557"/>
### build dist folder
<img src="https://github.com/duxianwei520/resource/blob/master/react/screenshots/dist.gif" width="973" height="557"/>
## License
[MIT](https://github.com/duxianwei520/react/blob/master/LICENSE)
## communication
If you want to communicate with other friends who use react,you can join the react QQ group I created:159697743~
---
# 中文readme
## 项目技术栈
react@16.0 + redux@3.7.2 + react-router@3.2.0 + webpack@3.10.0 + axios@0.18.0 + less@2.7.1 + antd@3.1.3
## 项目运行
```
git clone --depth 1 https://github.com/duxianwei520/react.git
cd react
npm install
npm start
```
#### 注意
如果不启动mock服务,那么登录不进去内页,所以务必再开启个node进程启动mockjs服务
```
npm run mock
```
想要体验聊天室功能 先开启socket服务 运行命令
```
npm run chat
```
最后的构建命令
```
npm run build (打包,部署)
```
对了,服务端返回的格式我们是这样子一个数据结构
```
{
data: {
totalCount: 100,
currentPage: 1,
pageSize: 10,
'list': [
],
},
msg: '',
status: 1,
}
```
所有异步请求返回都会经过configs里面的ajax.js做处理,如果请求没有任何问题,那status返回值是1;
如果请求错误,比如说参数错误或者其他报错之类的,那status返回值就是0;
如果status值是-1,表示登录超时,那么就会跳出登录。
这些参数都可以根据实际情况进行调整,报错或者成功的提示信息放在msg里面返回。
当前项目集成了完整的用户管理、角色管理、模块管理等基本的权限管理功能,小伙伴们一定要同时启动npm run mock才可以看到噢
这个react的项目我有在跟nodejs的express框架配合做接口的开发,可以不靠后端输出数据库真实的数据,仓库地址在
```
https://github.com/duxianwei520/express
```
还有一个原生的nodejs版本的,仓库库地址是
```
https://github.com/duxianwei520/node
```
基本功能差不多,目前实现了注册登录以及获取用户信息等3个接口的真实api
#### 注意:如果你更新代码发现登录界面进不去,而且没有用到真实的api,那就进入login.js里直接在handleSubmit方法里面把sessionStorage.setItem('token', 'dupi');hashHistory.push('/');这两行的注释打开,用户名密码界面不报错就可以登录跳转到内页
## 说明
> 开发环境 win10 Chrome 63.0.3239.132(正式版本) (32 位) nodejs 8.7.0
> 如果npm install太慢导致有些npm依赖包下载失败 你可以看控制台的报错信息,再手动npm install 具体的开发包,推荐使用淘宝的注册源,直接运行,
```
npm install -g cnpm --registry=https://registry.npm.taobao.org
```
> 如有问题请直接在 Issues 中提,或者您发现问题并有非常好的解决方案,欢迎 PR 👍
### 取消http请求示例:
```
import axios from 'axios'
const axiosHandle = axios.CancelToken.source()
login(){
this.props.dispatch(fetchLogin(values, (res) => {},(error)=>{},axiosHandle)
取消请求的操作
setTimeout(() => {
axiosHandle.cancel('手动取消。')
}, 3000)
}
```
## 功能一览
- [√] 项目按路由模块加载
- [√] 登录,以及登录权限控制
- [√] 退出
- [√] 欢迎主页
- [√] 左侧菜单,正常mini切换
- [√] redux完整示范
- [√] mockjs模拟后端返回接口
- [√] 页面高度flex自适应
- [√] fetch数据跨域的设置
- [√] 实时的webpack包大小预览,方便优化
- [√] draftjs编辑器
- [√] 聊天室
## 总结
1、这整个技术栈是我们公司前端部门在用的,写熟悉了之后,用来做后台管理系统类的实在是很方便,大家都表示再也不要用jQuery来做这样子的系统了
2、目前来说,不足的地方是在于没有很好的区分dev环境跟pro环境,这个后面弄好了再补充上来;mock数据现在还不是那么的方便,需要自己一个个的添加api的json文件
## License
[MIT](https://github.com/duxianwei520/react/blob/master/LICENSE)
## 交流
想跟其他的使用react的小伙伴们交流的话,
可以加入我创建的reactQQ群:5159697743~
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
























收起资源包目录





































































































共 192 条
- 1
- 2
资源评论


智达教育
- 粉丝: 2w+
- 资源: 279
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- ASL6328芯片规格说明书
- 基于Matlab实现智能体一阶有领导者仿真(源码+数据).rar
- 独立公众号版本微信社群人脉系统社群空间站最新源码+详细教程
- 森林图像数据集(2700张图片).rar
- 《基于Comsol仿真模拟的岩石损伤研究-水力压裂实验探究》,利用Comsol仿真模拟技术精确预测水力压裂过程中岩石损伤情况,comsol仿真模拟水力压裂岩石损伤 ,关键词:COMSOL仿真;水
- 自由方舟管理后台通用模板-基于TDesign二次优化
- 《学习CRUISE M热管理的视频教程及文档解说,无需模型,轻松入门》,CRUISE M热管理视频教程:无模型,文档解说,轻松学习掌握热管理知识,录的CRUISE M热管理视频,有文档解说,没有模型
- 洛杉矶犯罪数据集概览 (2020年至今),犯罪事件数据集,犯罪影响因素
- 电信客户流失数据集,运营商流失客户数据集
- FinalBurn Neo源代码
- 基于积分型滑模控制器的永磁同步电机FOC转速环设计及仿真模型参考,基于积分型滑模控制器的永磁同步电机FOC转速环设计及仿真模型参考,基于积分型滑模控制器的永磁同步电机FOC 1.转速环基于积分型滑模面
- 智能车辆模拟系统:深度探究多步泊车,平行泊车与垂直泊车的仿真应用,《深入探讨carsim仿真技术下的多步泊车策略:平行泊车与垂直泊车的实现与优化》,carsim仿真多步泊车,平行泊车和垂直泊车 ,核心
- BMS模块Simulink开发基于算法,基于Simulink开发的BMS算法:包含SOC计算、故障处理与状态监测的充放电控制策略图解,BMS Simulink 所有算法基于Simulink开发 BMS
- 犯罪率与社会经济因素数据集,探讨了犯罪率与各种社会经济因素之间的关系,如教育水平、就业率、中位收入、贫困率和人口密度涵盖了1000个地区的数据
- ASL6328芯片原理图-V1.1
- 精品源码Javaweb仓库管理系统项目源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
