├── .gitignore ├── README.md ├── config ├── env.js ├── jest │ ├── cssTransform.js │ └── fileTransform.js ├── paths.js ├── polyfills.js ├── webpack.config.dev.js ├── webpack.config.prod.js └── webpackDevServer.config.js ├── docs ├── MongodDB-env.md ├── README.md └── snapshot │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png ├── mock └── README.md ├── package.json ├── public ├── css │ └── README.md ├── favicon.ico ├── fonts │ └── README.md ├── index.html └── manifest.json ├── scripts ├── build.js ├── start.js └── test.js ├── server ├── README.md ├── model.js ├── server.js └── user.js ├── src ├── App.css ├── App.js ├── actions │ ├── chat.js │ ├── chatuser.js │ ├── index.js │ └── user.js ├── components │ ├── AuthRoute │ │ └── index.js │ ├── AvatarSelector │ │ ├── icon │ │ │ ├── boy.png │ │ │ ├── bull.png │ │ │ ├── chick.png │ │ │ ├── crab.png │ │ │ ├── girl.png │ │ │ ├── hedgehog.png │ │ │ ├── hippo.png │ │ │ ├── koala.png │ │ │ ├── lemur.png │ │ │ ├── man.png │ │ │ ├── pig.png │ │ │ ├── tiger.png │ │ │ ├── whale.png │ │ │ ├── woman.png │ │ │ └── zebra.png │ │ └── index.js │ ├── Boss │ │ └── index.js │ ├── Chat │ │ └── index.js │ ├── DashBoard │ │ └── index.js │ ├── Genius │ │ └── index.js │ ├── Logo │ │ ├── index.js │ │ ├── job.png │ │ └── logo.css │ ├── Msg │ │ └── index.js │ ├── NavFooter │ │ ├── img │ │ │ ├── boss-active.png │ │ │ ├── boss.png │ │ │ ├── job-active.png │ │ │ ├── job.png │ │ │ ├── msg-active.png │ │ │ ├── msg.png │ │ │ ├── user-active.png │ │ │ └── user.png │ │ └── index.js │ ├── UserCard │ │ ├── img │ │ │ ├── boy.png │ │ │ ├── bull.png │ │ │ ├── chick.png │ │ │ ├── crab.png │ │ │ ├── girl.png │ │ │ ├── hedgehog.png │ │ │ ├── hippo.png │ │ │ ├── koala.png │ │ │ ├── lemur.png │ │ │ ├── man.png │ │ │ ├── pig.png │ │ │ ├── tiger.png │ │ │ ├── whale.png │ │ │ ├── woman.png │ │ │ └── zebra.png │ │ └── index.js │ └── UserCenter │ │ └── index.js ├── config │ ├── README.md │ └── index.js ├── constants │ └── index.js ├── containers │ ├── BossInfo │ │ └── index.js │ ├── GeniusInfo │ │ └── index.js │ ├── Login │ │ └── index.js │ ├── Register │ │ └── index.js │ └── Root.js ├── index.css ├── index.js ├── logo.svg ├── reduers │ ├── chat.js │ ├── chatUser.js │ ├── index.js │ └── user.js ├── routers │ └── index.js ├── store │ ├── configureStore.dev.js │ ├── configureStore.js │ └── configureStore.prod.js └── utils │ ├── README.md │ ├── getChatId.js │ └── getDirectPath.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # testing 7 | coverage/ 8 | 9 | # production 10 | build/ 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | boss 2 | --- 3 | > `React`全家桶+`express`+`sock.io`+`mongodb`开发招聘应用 4 | 5 | 技术栈 6 | --- 7 | 8 | - `React16` 9 | - `redux` 管理状态 10 | - `react-router4` 路由 11 | - `antd-mobile` 蚂蚁金服UI组件库 12 | - `express` 构建服务 13 | - `mongodb` 存储数据 14 | - `socket.io` 15 | 16 | Usage 17 | --- 18 | 19 | > 启动mongodDB服务,[环境搭建](docs/MongodDB-env.md) 20 | 21 | ```bash 22 | npm install 23 | 24 | #启动程序 25 | npm start 26 | 27 | #开启服务 28 | npm run server 29 | ``` 30 | 31 | 项目分支 32 | --- 33 | > 项目的各个部分功能分解 34 | 35 | ```bash 36 | # 使用方法 37 | # 如:git clone -b login-register https://github.com/poetries/boss.git 38 | 39 | git clone -b [分支名] https://github.com/poetries/boss.git 40 | ``` 41 | 42 | - [登录和注册分支](https://github.com/poetries/boss/tree/login-register) 43 | - [boss信息和牛人信息分支](https://github.com/poetries/boss/tree/bossinfo-geniusinfo) 44 | - [Boss、牛人列表及个人中心分支](https://github.com/poetries/boss/tree/boss-genius-usercenter) 45 | 46 | 47 | 项目结构 48 | --- 49 | 50 |
51 | ├── config // react开发环境配置 52 | ├── docs // 项目开发文档 53 | ├── mock // 项目开发中的mock数据 54 | ├── package.json // 项目配置文件 55 | ├── server // express服务 56 | │ ├── server.js // express服务启动入口 57 | │ ├── model.js // 用户model 58 | │ ├── user.js // 用户信息接口 59 | ├── script // webpack配置 60 | │ ├── build.js // 打包相关 61 | │ ├── start.js // 本地开发 62 | │ ├── test.js // 测试 63 | ├── public // 打包后的静态资源 64 | ├── src // 生产目录 65 | │ ├── actions // redux action相关操作 66 | │ │ └── chatuser.js // 用户列表 67 | │ │ └── index.js // user、chatuser入口 68 | │ │ └── user.js // 用户信息 69 | │ ├── components // 展示组件 70 | │ │ └── Authroute // 授权路由组件,判断用户登录信息 71 | │ │ └── AvatarSelector // 头像选择组件 72 | │ │ └── Boss // Boss组件 73 | │ │ └── Genius // 牛人组件 74 | │ │ └── Chat // 聊天组件 75 | │ │ └── DashBoard // 信息管理面板 76 | │ │ └── Logo // Logo组件 77 | │ │ └── Msg // 消息组件 78 | │ │ └── FooterNav // 底部导航组件 79 | │ │ └── UserCenter // 用户中心组件 80 | │ │ └── UserCard // 用户信息组件 81 | │ ├── config // 配置文件 82 | │ │ └── index.js // axios全局拦截配置 83 | │ └── constants // actionType常量 84 | │ └── container // 容器组件 85 | │ │ └── BossInfo // Boss信息完善页 86 | │ │ └── GeniusInfo // 牛人信息完善页 87 | │ │ └── Login // 登录页 88 | │ │ └── Register // 注册页 89 | │ │ └── Root.js // 页面入口配置 90 | │ └── reducers // 处理action的逻辑 91 | │ │ └── chatuser.js // 获取用户列表 92 | │ │ └── index.js // reducer入口 93 | │ │ └── user.js // 处理user信息action的reducer 94 | │ └── routers // 配置路由 95 | │ └── store // redux store仓库 96 | │ │ └── configureStore.dev.js // 开发中的store配置 97 | │ │ └── configureStore.js // store入口判断 98 | │ │ └── configureStore.prod.js // 生产环境入口 99 | │ └── index.css // 全局样式 100 | │ └── utils // 工具函数 101 | │ │ └── getDirectPath.js // 根据用户信息,返回跳转地址 102 | │ └── App.js // 主页面 103 | │ └── App.css // 主页面样式 104 | │ └── index.html // 项目入口页面 105 | │ └── index.js // Webpack 预编译入口 106 | |__ 107 |108 | 109 | 110 | 111 | 拓展阅读 112 | --- 113 | 114 | - [React 技术栈系列教程-阮一峰](http://www.ruanyifeng.com/blog/2016/09/react-technology-stack.html) 115 | - [awesome-react](https://github.com/enaqx/awesome-react) 116 | - [redux中文文档](http://www.redux.org.cn/) 117 | - [React在线编辑器](https://codesandbox.io) 118 | -------------------------------------------------------------------------------- /config/env.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const paths = require('./paths'); 6 | 7 | // Make sure that including paths.js after env.js will read .env variables. 8 | delete require.cache[require.resolve('./paths')]; 9 | 10 | const NODE_ENV = process.env.NODE_ENV; 11 | if (!NODE_ENV) { 12 | throw new Error( 13 | 'The NODE_ENV environment variable is required but was not specified.' 14 | ); 15 | } 16 | 17 | // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use 18 | var dotenvFiles = [ 19 | `${paths.dotenv}.${NODE_ENV}.local`, 20 | `${paths.dotenv}.${NODE_ENV}`, 21 | // Don't include `.env.local` for `test` environment 22 | // since normally you expect tests to produce the same 23 | // results for everyone 24 | NODE_ENV !== 'test' && `${paths.dotenv}.local`, 25 | paths.dotenv, 26 | ].filter(Boolean); 27 | 28 | // Load environment variables from .env* files. Suppress warnings using silent 29 | // if this file is missing. dotenv will never modify any environment variables 30 | // that have already been set. 31 | // https://github.com/motdotla/dotenv 32 | dotenvFiles.forEach(dotenvFile => { 33 | if (fs.existsSync(dotenvFile)) { 34 | require('dotenv').config({ 35 | path: dotenvFile, 36 | }); 37 | } 38 | }); 39 | 40 | // We support resolving modules according to `NODE_PATH`. 41 | // This lets you use absolute paths in imports inside large monorepos: 42 | // https://github.com/facebookincubator/create-react-app/issues/253. 43 | // It works similar to `NODE_PATH` in Node itself: 44 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders 45 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. 46 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. 47 | // https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 48 | // We also resolve them to make sure all tools using them work consistently. 49 | const appDirectory = fs.realpathSync(process.cwd()); 50 | process.env.NODE_PATH = (process.env.NODE_PATH || '') 51 | .split(path.delimiter) 52 | .filter(folder => folder && !path.isAbsolute(folder)) 53 | .map(folder => path.resolve(appDirectory, folder)) 54 | .join(path.delimiter); 55 | 56 | // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be 57 | // injected into the application via DefinePlugin in Webpack configuration. 58 | const REACT_APP = /^REACT_APP_/i; 59 | 60 | function getClientEnvironment(publicUrl) { 61 | const raw = Object.keys(process.env) 62 | .filter(key => REACT_APP.test(key)) 63 | .reduce( 64 | (env, key) => { 65 | env[key] = process.env[key]; 66 | return env; 67 | }, 68 | { 69 | // Useful for determining whether we’re running in production mode. 70 | // Most importantly, it switches React into the correct mode. 71 | NODE_ENV: process.env.NODE_ENV || 'development', 72 | // Useful for resolving the correct path to static assets in `public`. 73 | // For example,