Commit c2997fed by 小明

调整代码格式

parent a1ffacac
...@@ -14,60 +14,61 @@ module.exports = (options) => ({ ...@@ -14,60 +14,61 @@ module.exports = (options) => ({
}, options.output), // Merge with env dependent settings }, options.output), // Merge with env dependent settings
module: { module: {
rules: [ rules: [
{ {
test: /\.js$/, // Transform all .js files required somewhere with Babel test: /\.js$/, // Transform all .js files required somewhere with Babel
use: 'babel-loader', use: 'babel-loader',
exclude: /node_modules/, exclude: /node_modules/,
query: options.babelQuery, query: options.babelQuery,
}, },
{ {
// Do not transform vendor's CSS with CSS-modules // Do not transform vendor's CSS with CSS-modules
// The point is that they remain in global scope. // The point is that they remain in global scope.
// Since we require these CSS files in our JS or CSS files, // Since we require these CSS files in our JS or CSS files,
// they will be a part of our compilation either way. // they will be a part of our compilation either way.
// So, no need for ExtractTextPlugin here. // So, no need for ExtractTextPlugin here.
test: /\.css$/, test: /\.css$/,
include: /node_modules/, include: /node_modules/,
use: ['style-loader', 'css-loader'], use: ['style-loader', 'css-loader'],
}, },
{ {
test: /\.scss$/, test: /\.scss$/,
loader: ExtractTextPlugin.extract({ loader: ExtractTextPlugin.extract({
loader: ['css-loader?sourceMap', 'sass-loader?sourceMap'] loader: ['css-loader?sourceMap', 'sass-loader?sourceMap'],
// loader: ['css-loader?sourceMap', 'postcss-loader', 'sass-loader'] // loader: ['css-loader?sourceMap', 'postcss-loader', 'sass-loader']
}) }),
// use: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader'] // use: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader']
}, },
{ {
test: /\.(eot|svg|ttf|woff|woff2)$/, test: /\.(eot|svg|ttf|woff|woff2)$/,
use: 'file-loader', use: 'file-loader',
}, },
{ {
test: /\.(jpg|png|gif)$/, test: /\.(jpg|png|gif)$/,
use: [ use: [
'file-loader', 'file-loader',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}', 'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}',
], ],
}, },
{ {
test: /\.html$/, test: /\.html$/,
use: 'html-loader', use: 'html-loader',
}, },
{ {
test: /\.json$/, test: /\.json$/,
use: 'json-loader', use: 'json-loader',
}, },
{ {
test: /\.(mp4|webm)$/, test: /\.(mp4|webm)$/,
use: 'url-loader?limit=10000', use: 'url-loader?limit=10000',
}], },
],
}, },
plugins: options.plugins.concat([ plugins: options.plugins.concat([
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
......
// Important modules this config uses // Important modules this config uses
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OfflinePlugin = require('offline-plugin');
module.exports = require('./webpack.base.babel')({ module.exports = require('./webpack.base.babel')({
// In production, we skip all hot-reloading stuff // In production, we skip all hot-reloading stuff
...@@ -17,8 +15,9 @@ module.exports = require('./webpack.base.babel')({ ...@@ -17,8 +15,9 @@ module.exports = require('./webpack.base.babel')({
library: 'window', library: 'window',
libraryTarget: 'this', libraryTarget: 'this',
}, },
externals: { externals: {
react: 'React' react: 'React',
}, },
plugins: [ plugins: [
......
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
export default class HomePage extends PureComponent { // eslint-disable-line react/prefer-stateless-function export default class HomePage extends PureComponent { // eslint-disable-line react/prefer-stateless-function
constructor(props) {
super(props);
}
render() { render() {
return ( return (
<h1> <h1>
......
...@@ -238,7 +238,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe ...@@ -238,7 +238,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
{tab.title} {tab.title}
</p> </p>
</Col> </Col>
});} })}
</Row> </Row>
{outlet} {outlet}
</Col> </Col>
......
...@@ -20,6 +20,44 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref ...@@ -20,6 +20,44 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref
{type: 'inventory', name: '库存查询', path: '/mobile/inventories'}, {type: 'inventory', name: '库存查询', path: '/mobile/inventories'},
].chunk(4); ].chunk(4);
let outlet = null;
if (this.props.loading) {
if (this.props.logined) {
outlet = (<Icon type='loading' className='search-loading'/>);
}
} else {
if (this.props.documents.length > 0) {
outlet = (<Row>
<Col span='24'>
{props.documents.each((doc) =>{
let key = `${doc.type}_${doc.id}`;
<Document key={key} document={doc}></Document>
})}
</Col>
</Row>);
} else {
let column = (<div>
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
还没有单据哦,快去新增吧
</p>
</div>);
if (!props.hasPermission) {
column = (<div>
<svg className='file-color'>
<use xlinkHref={props.icons.document}/>
</svg>
<p className='ik-title-font ik-margin-top-20 ik-title-color'> 亲,你没有权限操作此功能哦</p>
</div>);
}
outlet = (<Row type='flex' justify='center' className='document-list ik-padding-bottom-20'>
<Col span='16' className='ik-text-center'>
{column}
</Col>
</Row>);
}
}
return (<Row> return (<Row>
<Row id="action-sheet-button-container"> <Row id="action-sheet-button-container">
<Col span='6' offset='18' className='ik-padding-top-20'> <Col span='6' offset='18' className='ik-padding-top-20'>
...@@ -71,41 +109,7 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref ...@@ -71,41 +109,7 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref
<p className='document-title'>最近的单据</p> <p className='document-title'>最近的单据</p>
</Col> </Col>
<Col span='24'> <Col span='24'>
{ if (this.props.loading) { {outlet}
if (this.props.logined) {
<Icon type='loading' className='search-loading'/>
}
} else {
if (this.props.documents.length > 0) {
<Row>
<Col span='24'>
{props.documents.each(doc){
<Document key=`${document.type}_${document.id}` document={doc}></Document>
}}
</Col>
</Row>
} else {
<Row type='flex' justify='center' className='document-list ik-padding-bottom-20'>
<Col span='16' className='ik-text-center'>
{if !(props.hasPermission) {
<div>
<svg className='file-color'>
<use xlinkHref={props.icons.document}/>
</svg>
</div>
<p className='ik-title-font ik-margin-top-20 ik-title-color'> 亲,你没有权限操作此功能哦</p>
} else {
<div>
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
还没有单据哦,快去新增吧
</p>
</div>
}}
</Col>
</Row>
}
}
}
</Col> </Col>
</Row> </Row>
</Row>) </Row>)
......
...@@ -33,6 +33,6 @@ export default function createRoutes(store) { ...@@ -33,6 +33,6 @@ export default function createRoutes(store) {
importModules.catch(errorLoading); importModules.catch(errorLoading);
}, },
} },
]; ];
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment