From 878b25fbb72f60a8f841f5640c1aca4ce23f049e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=BC=E6=97=8F=E5=B0=8F=E7=8B=88?= <1340641314@qq.com> Date: Thu, 8 Dec 2016 00:21:59 +0800 Subject: [PATCH 01/12] Update webpack.config.js --- webpack.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 50edaad..94fc554 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,7 @@ var plugins = []; if (process.argv.indexOf('-p') > -1) { //生产环境 plugins.push(new webpack.DefinePlugin({ //编译成生产版本 'process.env': { - NODE_ENV: JSON.stringify('production') + NODE_ENV: JSON.stringify('"production"') } })); publicPath = '/react-cnode/dist/'; @@ -66,4 +66,4 @@ module.exports = { resolve: { extensions: ['', '.js', '.jsx'], //后缀名自动补全 } -}; \ No newline at end of file +}; From 3189011a79b39223d618f4828a81f7977b932626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=BC=E6=97=8F=E5=B0=8F=E7=8B=88?= <1340641314@qq.com> Date: Sun, 11 Dec 2016 23:50:10 +0800 Subject: [PATCH 02/12] Update webpack.config.js --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 94fc554..6c31074 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -38,7 +38,7 @@ module.exports = { { test: /\.js$/, exclude: /^node_modules$/, - loader: 'babel?presets=es2015' + loader: 'babel?presets=es2015&compact=false', }, { test: /\.css$/, exclude: /^node_modules$/, From 547a39fd12a1c29a5fbadee6122ef601d3cb21cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=BC=E6=97=8F=E5=B0=8F=E7=8B=88?= <1340641314@qq.com> Date: Fri, 13 Jan 2017 17:10:00 +0800 Subject: [PATCH 03/12] Update webpack.config.js --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 6c31074..01b9f34 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,7 @@ var plugins = []; if (process.argv.indexOf('-p') > -1) { //生产环境 plugins.push(new webpack.DefinePlugin({ //编译成生产版本 'process.env': { - NODE_ENV: JSON.stringify('"production"') + NODE_ENV: JSON.stringify('production') } })); publicPath = '/react-cnode/dist/'; From 1a016ec54a088e043386ed5c7c5cd2f1269a1e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=A1=E9=91=AB-King?= <45808948@qq.com> Date: Sun, 7 May 2017 08:15:21 +0800 Subject: [PATCH 04/12] add: .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9ab0a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +.idea +.vscode +yarn.lock \ No newline at end of file From cdb72dc506e2247a1fcf6e33c770836117a91076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=AE=87=E4=BB=91?= <308813800@qq.com> Date: Fri, 19 May 2017 14:06:14 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E5=8D=87=E7=BA=A7react,react-router4,web?= =?UTF-8?q?pack2=E7=AD=89=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 36 +++++++----- server.js | 17 +++--- src/App.jsx | 8 ++- src/Component/IndexList.jsx | 13 +++-- src/Component/MyMessages.jsx | 6 +- src/Component/Signin.jsx | 9 +-- src/Component/Signout.jsx | 9 +-- src/Component/Topic.jsx | 16 +++--- src/Component/TopicCreate.jsx | 9 +-- src/Component/UserView.jsx | 18 +++--- src/Component/common/GetData.jsx | 7 ++- src/Component/common/GetNextPage.jsx | 7 ++- src/Component/common/index.jsx | 12 ++-- src/Config/Route.jsx | 85 +++++++++++++++++++++------- webpack.config.js | 75 +++++++++++++++++++++--- 15 files changed, 226 insertions(+), 101 deletions(-) diff --git a/package.json b/package.json index eb64f9b..4e5f5a5 100644 --- a/package.json +++ b/package.json @@ -18,35 +18,43 @@ }, "homepage": "https://github.com/lzxb/react-cnode#readme", "dependencies": { - "flex.css": "1.0.1", + "es6-promise": "^4.1.0", + "flex.css": "^1.1.6", "get-next-page": "1.0.0", "github-markdown-css": "^2.4.0", - "normalize.css": "^4.1.1", + "normalize.css": "7.0.0", "obj-merged": "^1.0.5", + "prop-types": "^15.5.10", + "query-string": "^4.3.4", "react": "^15.0.1", "react-dom": "^15.0.1", - "react-redux": "^4.4.5", - "react-router": "^2.3.0", - "redux": "^3.5.2", - "redux-thunk": "^2.1.0" + "react-redux": "^5.0.4", + "react-router": "^4.1.1", + "react-router-dom": "^4.1.1", + "redux": "3.6.0", + "redux-thunk": "2.2.0" }, "devDependencies": { + "autoprefixer": "^7.1.1", "autoprefixer-loader": "^3.2.0", "babel-core": "^6.18.0", - "babel-loader": "^6.2.4", + "babel-loader": "^7.0.0", + "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-preset-es2015": "^6.6.0", "babel-preset-react": "^6.5.0", "body-parser": "^1.15.1", - "css-loader": "^0.23.1", - "extract-text-webpack-plugin": "^1.0.1", - "file-loader": "^0.8.5", + "css-loader": "^0.28.1", + "extract-text-webpack-plugin": "2.1.0", + "file-loader": "^0.11.1", "html-webpack-plugin": "^2.22.0", "jsx-loader": "^0.13.2", "less": "^2.6.1", - "less-loader": "^2.2.3", - "style-loader": "^0.13.1", + "less-loader": "^4.0.3", + "postcss-loader": "^2.0.5", + "style-loader": "^0.17.0", + "sugarss": "^1.0.0", "url-loader": "^0.5.7", - "webpack": "^1.13.0", - "webpack-dev-server": "1.14.1" + "webpack": "2.5.1", + "webpack-dev-server": "2.4.5" } } diff --git a/server.js b/server.js index 094a077..bba5adb 100644 --- a/server.js +++ b/server.js @@ -2,17 +2,16 @@ var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var config = require('./webpack.config'); -// 相当于通过本地node服务代理请求到了http://cnodejs.org/api -var proxy = [{ - path: '/api/*', - target: 'https://cnodejs.org', - host: 'cnodejs.org' -}]; - //启动服务 var server = new WebpackDevServer(webpack(config), { publicPath: config.output.publicPath, - proxy: proxy, + // 相当于通过本地node服务代理请求到了http://cnodejs.org/api + proxy: { + "/api/*": { + target: "https://cnodejs.org", + secure: false + } + }, stats: { colors: true }, @@ -23,4 +22,4 @@ server.app.get('*', function (req, res) { res.sendFile(__dirname + '/index.html') }); -server.listen(3000); +server.listen(3002); diff --git a/src/App.jsx b/src/App.jsx index 649dbcc..4dbd1e5 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import 'es6-promise/auto'; +import React, { Component } from 'react'; import ReactDOM, { render } from 'react-dom'; import { Provider } from 'react-redux'; import route from './Config/Route'; //路由配置 @@ -6,7 +7,8 @@ import store from './Config/Store'; import 'normalize.css'; //重置浏览器默认样式 -import 'flex.css'; //flex布局 +// import 'flex.css'; //flex布局 +import 'flex.css/dist/data-flex.css'; //flex布局 import './Style/style.less'; //加载公共样式 import './Iconfont/iconfont.css'; //字体图标 import 'github-markdown-css'; //markdown css @@ -18,7 +20,7 @@ store.subscribe(function () { render( - {route} + {route} , document.body.appendChild(document.createElement('div')) ); \ No newline at end of file diff --git a/src/Component/IndexList.jsx b/src/Component/IndexList.jsx index 882fcf2..a62ffff 100644 --- a/src/Component/IndexList.jsx +++ b/src/Component/IndexList.jsx @@ -1,9 +1,11 @@ -import React, { Component, PropTypes } from 'react'; -import { Router, Route, IndexRoute, browserHistory, Link } from 'react-router'; +import React, {Component} from 'react'; +// import { Router, Route, IndexRoute, browserHistory, Link } from 'react-router'; +import {NavLink as Link } from 'react-router-dom'; import { connect } from 'react-redux'; import action from '../Action/Index'; import { Tool, merged } from '../Tool'; import { DataLoad, Footer, UserHeadImg, TabIcon, GetNextPage } from './common/index'; +import queryString from 'query-string'; /** @@ -97,7 +99,6 @@ class ListItem extends Component { return false; } } - /** * (导出组件) * @@ -111,7 +112,9 @@ class Main extends Component { } render() { var {data, loadAnimation, loadMsg} = this.props.state; - var tab = this.props.location.query.tab || 'all'; + debugger; + var tab = queryString.parse(this.props.location.search).tab || 'all'; + debugger; return (