Skip to content

Commit

Permalink
react redux搭建完毕,支持异步加载组件,支持异步Action
Browse files Browse the repository at this point in the history
  • Loading branch information
刘珅 committed Apr 2, 2017
1 parent 4180ef2 commit 8f4b29e
Show file tree
Hide file tree
Showing 31 changed files with 372 additions and 363 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ dist
.idea
*.swp
.bashrc
debug
debug
client/javascripts/admin1
client/javascripts/admin2
75 changes: 21 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

## 技术选型
### 前端
* 前端框架: vue
* UI库: element-ui
* 主站框架集: vue, vuex, vue-router
* 后台管理框架集: react, redux, react-router-redux
* 主站UI组件库: vux
* 后台管理UI组件库: antd
* 数据可视化: echarts
* 富文本编辑器: ueditor
* 打包工具: webpack
* 构建工具: gulp
* 构建工具: gulp

### 后端
### 后台
* web服务器: nginx
* 后台: node.js
* 框架: express
* 静态文件服务器: node.js(本地开发时使用)
* 框架: iris
* 模板引擎: handlebars
* 持久层: bookshelf
* 持久层: gorm
* 数据库: mysql

## 项目环境搭建
Expand All @@ -36,33 +38,25 @@ npm install --registry=https://registry.npm.taobao.org
```

3 **配置nginx**
将文件`local.zhifuted.conf`拷贝到nginx的虚拟主机目录下
>local.zhifuted.conf所在位置为, 项目目录/nginx/local.zhifuted.conf
将文件`www.wemall.com.conf`拷贝到nginx的虚拟主机目录下
>www.wemall.com.conf所在位置为, 项目目录/nginx/www.wemall.com.conf
4 **创建数据库**
4 **配置hosts**
127.0.0.1 www.wemall.com

5 **创建数据库**
先创建数据库如`wemall`,再use wemall,然后导入sql目录下的sql文件到数据库
>注意: 本地开发模式下,数据库是`wemall`,用户是`root`,密码是`test1234`
>可以在`.env`文件中进行修改
5 **运行后台程序**
6 **启动静态文件服务器**

```
npm start
```

6 **启动静态服务器**

```
npm run staticServ
```

```
go get -u github.com/jinzhu/gorm
```
7 **运行后台程序**
进入项目目录下,运行`go run main.go`

```
go get github.com/go-sql-driver/mysql
```
## 项目结构
| 目录或文件 | 子目录 | 功能 |
|:--------|:--------|:-------:|
Expand All @@ -75,43 +69,16 @@ go get github.com/go-sql-driver/mysql
| server | | 后台代码目录|
| | config | 配置|
| | controller | 控制器|
| | helpers | 后端模板引擎的helper|
| | model | 数据模型|
| | route | 路由|
| | utils | 实用工具|
| | views | 后端视图|
| sql | | sql文件目录|
| test | | 单元测试|
| .babelrc | | 设置babel转码的规则和插件|
| .env | | 本地开发使用的环境变量|
| app.js | | 后台应用服务器入口|
| main.go | | 后台程序入口|
| staticServ.js | | 静态文件服务器(开发时使用)|
| webpack.config.dev.js | | 开发模式webapck的配置|
| webpack.config.prod.js | | 产品模式webapck的配置|




## 前端开发规范
### 代码规范

### 样式规范

## 后端开发规范
| webpack.config.js | | 开发模式下webapck的配置|
| webpack.config.prod.js | | 产品模式下webapck的配置|

## 测试

### 单元测试
mocha
### 集成测试
phantomjs, casperjs
### 功能测试

## 日志
log4js

## 部署
系统: centos
容器: docker
进程管理器: pm2
## 监控
22 changes: 0 additions & 22 deletions client/javascripts/admin/actions/index.js

This file was deleted.

24 changes: 24 additions & 0 deletions client/javascripts/admin/actions/requestUserAnalyze.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {
REQUEST_USER_ANALYZE
} from '../constants';

function receiveUserAnalyze(json) {
return {
type: REQUEST_USER_ANALYZE,
userAnalyze: {
todayNewUser : json.todayNewUser,
yesterdayNewUser : json.yesterdayNewUser,
todayPurchaseUser : json.todayPurchaseUser,
yesterdayPurchaseUser : json.yesterdayPurchaseUser
}
};
}

export default function() {
return dispatch => {
var url = config.sitePath + '/admin/user/analyze';
return fetch(url)
.then(response => response.json())
.then(json => dispatch(receiveUserAnalyze(json.data)))
};
}
Empty file.
14 changes: 0 additions & 14 deletions client/javascripts/admin/components/App.js

This file was deleted.

22 changes: 0 additions & 22 deletions client/javascripts/admin/components/Footer.js

This file was deleted.

26 changes: 0 additions & 26 deletions client/javascripts/admin/components/Link.js

This file was deleted.

20 changes: 0 additions & 20 deletions client/javascripts/admin/components/Todo.js

This file was deleted.

25 changes: 0 additions & 25 deletions client/javascripts/admin/components/TodoList.js

This file was deleted.

25 changes: 25 additions & 0 deletions client/javascripts/admin/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const SET_TODAY_ORDER_COUNT = 'setTodayOrderCount';

export const SET_TODAY_TOTAL_SALE = 'setTodayTotalSale';

export const SET_TOTAL_ORDER_COUNT = 'setTotalOrderCount';

export const SET_TOTAL_SALE = 'setTotalSale';

export const SET_WEMALL_VERSION = 'setWemallVersion';

export const SET_WEMALL_NEW_VERSION = 'setWemallNewVersion';

export const SET_SYSTEM_TIME = 'setSysTemTime';

export const SET_WEMALL_OFFICIAL = 'setWemallOfficial';

export const SET_TODAY_NEW_USER = 'setTodayNewUser';

export const REQUEST_USER_ANALYZE = 'requestUserAnalyze';






30 changes: 0 additions & 30 deletions client/javascripts/admin/containers/AddTodo.js

This file was deleted.

13 changes: 13 additions & 0 deletions client/javascripts/admin/containers/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, { Component } from 'react';

class App extends Component {
render() {
return (
<div>
{this.props.children}
</div>
);
}
}

export default App;
24 changes: 0 additions & 24 deletions client/javascripts/admin/containers/FilterLink.js

This file was deleted.

Loading

0 comments on commit 8f4b29e

Please sign in to comment.