Browse Source

【看板展示】【调整form数据解析错误问题、table滚屏间隔参数传入】

zhuth 8 years ago
parent
commit
f0eccfc88d

+ 5 - 0
kanban-client/README.md

@@ -14,6 +14,11 @@
 ##### 20170914
 * build目录内容全部由webpack打包生成(除了echarts.min.js需要手动引用,未找到自动引入的方案)
 * 继续优化打包文件,减小文件体积
+##### 20170918
+* 调整form数据解析错误问题
+* 新增本地测试用的webpack.dev.config.js,调整package.json运行参数
+* table滚屏间隔参数支持自定义,修改默认间隔算法为行数(>=5),(单位 秒 )
+
 #### 运行
 * 本地运行
 ```

+ 1 - 1
kanban-client/app/component/Table.jsx

@@ -132,7 +132,7 @@ class TableModel extends React.Component {
 				intervalFunction: function() {
 					this.changeData();
 				}.bind(this),
-				intervalTime: 2000
+				intervalTime: this.newProps.refreshInterval * 1000 || (this.rowCount > 5 ? this.rowCount * 1000 : 5000)
 			});
 		}
 	}

+ 1 - 1
kanban-client/package.json

@@ -5,7 +5,7 @@
   "main": "main.js",
   "scripts": {
     "start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
-    "start:dev": "webpack-dev-server --port 8100 --inline --content-base build/boardshow.html ",
+    "start:dev": "webpack-dev-server --port 8100 --inline --content-base build/ --config webpack.dev.config",
     "start:prod": "webpack && node server.js"
   },
   "keywords": [

+ 91 - 0
kanban-client/webpack.dev.config.js

@@ -0,0 +1,91 @@
+var path = require('path');
+var webpack = require('webpack');
+var ExtractTextPlugin = require('extract-text-webpack-plugin');
+var HtmlWebpackPlugin = require('html-webpack-plugin');
+
+module.exports = {
+    entry: {
+        'src/whatwg-fetch': 'whatwg-fetch',
+        'src/main': './app/main.js',
+        'src/title': './app/src/Title/Title.jsx',
+        'src/table': './app/component/Table.jsx',
+        'src/form': './app/src/Form/index.js',
+        'src/chart': './app/src/Charts/ECharts.js',
+        vendor: ['react', 'react-dom']
+    },
+    output: {
+        path: path.resolve(__dirname, './build'),
+        filename: '[name].bundle.js',
+        chunkFilename: "[name].[chunkHash:8].js"
+    },
+    module: {
+        loaders: [
+            {
+                test: /\.js$/,
+                exclude: /node_modules/,
+                loader: 'babel-loader'
+            },
+            {
+                test: /\.jsx?$/,
+                loader: 'babel-loader'
+            },
+            {
+                test: /\.(less|css)$/,
+                exclude: /node_modules/,
+                // loader: 'style-loader!css-loader!less-loader',
+                use: ExtractTextPlugin.extract({
+                    fallback: 'style-loader',
+                    use: ['css-loader', 'less-loader']
+                })
+            },
+            {
+                test: /\.json$/,
+                exclude: /node_modules/,
+                loader: 'json-loader'
+            },
+            {
+                test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192&name=images/[hash:8].[name].[ext]'
+            }
+        ]
+    },
+    plugins: [
+        // webapck配置
+        new webpack.LoaderOptionsPlugin({
+            options: {
+                devServer: {
+                    historyApiFallback: true,
+                    inline: true
+                }
+            }
+        }),
+        // 生产环境
+        // new webpack.DefinePlugin({
+        //     "process.env": {
+        //         NODE_ENV: JSON.stringify("production")
+        //     }
+        // }),
+        // 样式分离打包
+        new ExtractTextPlugin({
+            filename: (getPath) => {
+                return getPath('css/[name].css').replace('src/', '').replace('css/js', 'css');
+            },
+            allChunks: true
+        }),
+        // 公共模块打包
+        new webpack.optimize.CommonsChunkPlugin({ 
+            names: ['vendor', 'manifest']
+        }),
+        // 生成入口html
+        new HtmlWebpackPlugin({                        //根据模板插入css/js等生成最终HTML
+            favicon:'./app/assets/images/favicon.ico', //favicon路径
+            filename:'./boardshow.html',    //生成的html存放路径,相对于 path
+            template:'./app/index.html',    //html模板路径
+            inject:true,    //允许插件修改哪些内容,包括head与body
+            hash:true,    //为静态资源生成hash值
+            minify:{    //压缩HTML文件
+                removeComments:true,    //移除HTML中的注释
+                collapseWhitespace:false    //删除空白符与换行符
+            }
+        })
+    ]
+};