Commit c2997fed by 小明

调整代码格式

parent a1ffacac
......@@ -14,60 +14,61 @@ module.exports = (options) => ({
}, options.output), // Merge with env dependent settings
module: {
rules: [
{
test: /\.js$/, // Transform all .js files required somewhere with Babel
use: 'babel-loader',
exclude: /node_modules/,
query: options.babelQuery,
},
{
test: /\.js$/, // Transform all .js files required somewhere with Babel
use: 'babel-loader',
exclude: /node_modules/,
query: options.babelQuery,
},
{
// Do not transform vendor's CSS with CSS-modules
// The point is that they remain in global scope.
// Since we require these CSS files in our JS or CSS files,
// they will be a part of our compilation either way.
// So, no need for ExtractTextPlugin here.
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
// Do not transform vendor's CSS with CSS-modules
// The point is that they remain in global scope.
// Since we require these CSS files in our JS or CSS files,
// they will be a part of our compilation either way.
// So, no need for ExtractTextPlugin here.
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
loader: ['css-loader?sourceMap', 'sass-loader?sourceMap']
// loader: ['css-loader?sourceMap', 'postcss-loader', 'sass-loader']
})
// use: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader']
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
loader: ['css-loader?sourceMap', 'sass-loader?sourceMap'],
// loader: ['css-loader?sourceMap', 'postcss-loader', 'sass-loader']
}),
// use: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader']
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
use: 'file-loader',
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
use: 'file-loader',
},
{
test: /\.(jpg|png|gif)$/,
use: [
'file-loader',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}',
],
},
{
test: /\.(jpg|png|gif)$/,
use: [
'file-loader',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}',
],
},
{
test: /\.html$/,
use: 'html-loader',
},
{
test: /\.html$/,
use: 'html-loader',
},
{
test: /\.json$/,
use: 'json-loader',
},
{
test: /\.json$/,
use: 'json-loader',
},
{
test: /\.(mp4|webm)$/,
use: 'url-loader?limit=10000',
}],
{
test: /\.(mp4|webm)$/,
use: 'url-loader?limit=10000',
},
],
},
plugins: options.plugins.concat([
new webpack.ProvidePlugin({
......
// Important modules this config uses
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OfflinePlugin = require('offline-plugin');
module.exports = require('./webpack.base.babel')({
// In production, we skip all hot-reloading stuff
......@@ -17,8 +15,9 @@ module.exports = require('./webpack.base.babel')({
library: 'window',
libraryTarget: 'this',
},
externals: {
react: 'React'
react: 'React',
},
plugins: [
......
......@@ -12,10 +12,6 @@
import React, { PureComponent } from 'react';
export default class HomePage extends PureComponent { // eslint-disable-line react/prefer-stateless-function
constructor(props) {
super(props);
}
render() {
return (
<h1>
......
......@@ -238,7 +238,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
{tab.title}
</p>
</Col>
});}
})}
</Row>
{outlet}
</Col>
......
......@@ -20,6 +20,44 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref
{type: 'inventory', name: '库存查询', path: '/mobile/inventories'},
].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>
<Row id="action-sheet-button-container">
<Col span='6' offset='18' className='ik-padding-top-20'>
......@@ -71,41 +109,7 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref
<p className='document-title'>最近的单据</p>
</Col>
<Col span='24'>
{ if (this.props.loading) {
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>
}
}
}
{outlet}
</Col>
</Row>
</Row>)
......
......@@ -33,6 +33,6 @@ export default function createRoutes(store) {
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