diff --git a/package.json b/package.json index 99fe6bc..6b386c7 100644 --- a/package.json +++ b/package.json @@ -51,11 +51,11 @@ }, "scripts": { "build": "webpack --progress --colors --display-error-details", - "prod": "NODE_ENV=production webpack --progress --colors --config webpack.config.prod.js -p --display-error-details", + "prod": "set NODE_ENV=production&&webpack --progress --colors --config webpack.config.prod.js -p --display-error-details", "clean": "rd /s /q dist", "dev": "webpack-dev-server --devtool eval --progress --colors --content-base dist --hot --inline --display-error-details", "eslint": "eslint --ext .js,.jsx src/view", "stylelint": "stylelint \"src/**/*.css\"", "lesshint": "lesshint src/" } -} \ No newline at end of file +} diff --git a/src/config.js b/src/config.js index 50d3db8..2258764 100644 --- a/src/config.js +++ b/src/config.js @@ -13,6 +13,7 @@ module.exports = { logoText:'Ant Design', debug: true, // 是否开启debug模式, 不会请求后端接口, 使用mock的数据 logLevel: 'debug', // 日志级别, 目前支持debug/info/warn/error 4种级别 + needLogin:false, api: { host: 'http://localhost', // 调用ajax接口的地址, 默认值空, 如果是跨域的, 服务端要支持CORS diff --git a/src/view/index.js b/src/view/index.js index 4451cb4..a06d6ad 100644 --- a/src/view/index.js +++ b/src/view/index.js @@ -13,11 +13,15 @@ const logger = Logger.getLogger('App') const App = React.createClass({ getInitialState() { + let loading=false, + login=true + if (config.needLogin){ + loading=true + login=false + } return { - loading: true, - login: false, - // loading: false, - // login: true, + loading, + login, userName: '未登录', collapse: false, } diff --git a/webpack.config.js b/webpack.config.js index 8265e78..48375ef 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -38,13 +38,6 @@ module.exports = { loaders: ['react-hot', 'babel-loader?' + JSON.stringify(babelLoaderConfig)], exclude: /node_modules/, }, - // { - // test: /\.css$/, - // loader: 'style!css', - // }, { - // test: /\.less$/, - // loader: 'style!css!less', - // }, { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") diff --git a/webpack.config.prod.js b/webpack.config.prod.js index bf1d92f..7376467 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -30,13 +30,6 @@ module.exports = { loaders: ['babel-loader?' + JSON.stringify(babelLoaderConfig), 'strip-loader?strip[]=logger.debug,strip[]=console.log,strip[]=console.debug'], exclude: /node_modules/, }, - // { - // test: /\.css$/, - // loader: 'style!css', - // }, { - // test: /\.less$/, - // loader: 'style!css!less', - // }, { test: /\.(png|jpg|svg)$/, loader: 'url?limit=25000',