Commit 43853cf7 by 小明

调整式作台代码符合jsx可编译文法,增加构建测试环境

parent ea6d8909
......@@ -6,9 +6,9 @@ const OfflinePlugin = require('offline-plugin');
module.exports = require('./webpack.base.babel')({
// In production, we skip all hot-reloading stuff
entry: [
path.join(process.cwd(), 'src/app.js'),
],
entry: {
main: path.join(process.cwd(), 'src/app.js'),
},
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output: {
......
// 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
entry: {
main: path.join(process.cwd(), 'src/app.js'),
},
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].chunk.js',
library: 'window',
libraryTarget: 'this',
},
externals: {
react: 'React'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
children: true,
minChunks: 2,
async: true,
}),
// Merge all duplicate modules
new webpack.optimize.DedupePlugin(),
],
});
......@@ -21,6 +21,7 @@
"postinstall": "npm run build:dll",
"prebuild": "npm run build:clean && npm run test",
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress",
"temp": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.temp.babel.js --color --progress",
"build:clean": "npm run test:clean && rimraf ./build",
"build:dll": "node ./internals/scripts/dependencies.js",
"start": "cross-env NODE_ENV=development node server",
......
......@@ -102,3 +102,5 @@ if (!window.Intl) {
// we do not want it installed
import { install } from 'offline-plugin/runtime';
install();
System.import('main.js');
import React, { Component } from 'react';
export default class TestPage extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (<p>Hello World!</p>);
}
}
......@@ -8,17 +8,58 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
render() {
const allShortcuts = [
{type: 'purchase', title: '采购列表'},
{type: 'sale', title: '销售列表'},
{type: 'other', title: '其他列表'},
{type: 'document', title: '单据查询'},
{type: 'customer', title: '客户列表'},
{type: 'supplier', title: '供应商列表'},
{type: 'product', title: '产品列表'},
{type: 'inventory', title: '库存查询'}
{ type: 'purchase', title: '采购列表' },
{ type: 'sale', title: '销售列表' },
{ type: 'other', title: '其他列表' },
{ type: 'document', title: '单据查询' },
{ type: 'customer', title: '客户列表' },
{ type: 'supplier', title: '供应商列表' },
{ type: 'product', title: '产品列表' },
{ type: 'inventory', title: '库存查询' }
].chunk(4);
const props = $.extend({}, this.props);
let outlet = null;
if (this.props.loading) {
outlet = (<Icon type='loading' className='search-loading' />);
} else {
if (props[`${props.activeTab}Documents`].length > 0) {
outlet = (<Row>
<Col span='24'>
{props[`${props.activeTab}Documents`].each((doc) => {
let key = `${doc.type}_${doc.id}`;
<Document
key={key}
document={doc}
type='approving' />
})}
</Col>
</Row>);
} else {
let column = (<p className='ik-title-font ik-margin-top-20 ik-title-color'>还没有审批通过的单据哦~</p>);
if (props.activeTab ==='noapproval') {
column = (<div>
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
还没有单据哦,快去新增吧
</p>
</div>);
} else if (props.activeTab === 'approving') {
column = (<p className='ik-title-font ik-margin-top-20 ik-title-color'>
真棒!所有单据都审批完了
</p>);
} else if(!props.hasPermission) {
column = (<p className='ik-title-font ik-margin-top-20 ik-title-color'>
亲,你没有权限操作此功能哦
</p>);
}
outlet = (<Row type='flex' justify='center' className='ik-width-percent-100 ik-padding-bottom-20'>
<Col span='16' className='ik-text-center'>
{column}
</Col>
</Row>);
}
}
return (
<Row className='ik-container-background'>
<Row id='action-sheet-button-container'>
......@@ -38,7 +79,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
onSearch={props.handleSearch}/>
</div>
<Col span='24'>
//采购
<Row className='ik-background-white'>
<Col span='12' className='statistic-container ik-padding-vertical-20'>
<Col span='8'>
......@@ -58,7 +98,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
<Col span='12' className='statistic-container ik-padding-vertical-20'>
<Col span='8'>
<svg className='purchase-color'>
<use, xlinkHref={props.icons.purchase} />
<use xlinkHref={props.icons.purchase} />
</svg>
</Col>
<Col span='16'>
......@@ -71,7 +111,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
</Col>
</Col>
</Row>
//销售
<Row className='ik-background-white'>
<Col span='12' className='statistic-container ik-padding-vertical-20'>
<Col span='8'>
......@@ -104,7 +143,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
</Col>
</Col>
</Row>
//库存
<Row className='ik-background-white'>
<Col span='12' className='statistic-container ik-padding-vertical-20'>
<Col span='8'>
......@@ -137,7 +175,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
</Col>
</Col>
</Row>
//欠款
<Row className='ik-background-white'>
<Col span='12' className='statistic-container ik-padding-vertical-20'>
<Col span='8'>
......@@ -170,7 +207,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
</Col>
</Col>
</Row>
<Row className='shortcut-wrapper'>
{allShortcuts.each((shortcuts) => {
shortcuts.each((shortcut) => {
......@@ -188,64 +224,23 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
});
})}
</Row>
<Row className='document-header'>
{props.titles.each((tab)=> {
let active = '';
if (props.activeTab == tab.type) {
active = 'active';
let active = 'document-header-item';
if (props.activeTab === tab.type) {
active = 'document-header-item active';
}
<Col
span={(24 / props.titles.length)}
className=`document-header-item ${active}`,
className={active}
onClick={props.toggleTab.bind(null, tab.type)}>
<p className='document-title'>
tab.title
{tab.title}
</p>
</Col>
})}
});}
</Row>
{if (this.props.loading) {
<Icon type='loading' className='search-loading' />
} else {
if (props[`${props.activeTab}Documents`].length > 0) {
<Row>
<Col span='24'>
{props[`${props.activeTab}Documents`].each(() => {
<Document
key=`${document.type}_${document.id}`
document={doc}
type='approving' />
})}
</Col>
</Row>
} else {
<Row type='flex' justify='center' className='ik-width-percent-100 ik-padding-bottom-20'>
<Col span='16' className='ik-text-center'>
{ if (props.activeTab =='noapproval') {
<div>
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
还没有单据哦,快去新增吧
</p>
</div>
} else if (props.activeTab == 'approving') {
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
真棒!所有单据都审批完了
</p>
} else if(!props.hasPermission) {
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
亲,你没有权限操作此功能哦
</p>
} else {
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
还没有审批通过的单据哦~
</p>
}}
</Col>
</Row>
}
}}
{outlet}
</Col>
</Row>
);
......
......@@ -11,7 +11,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
const store = IKDataStore.namespace(this.props.namespace);
this.setState({
logined: store.get('logined') || this.props.logined,
is_admin: store.get('is_admin') || this.props.is_admin || false.
is_admin: store.get('is_admin') || this.props.is_admin || false,
icons: store.get('icons') || this.props.icons || [],
new_buttons: store.get('new_buttons')|| this.props.new_buttons || [], //新增按钮
purchase_buttons: store.get('purchase_buttons') || this.props.purchase_buttons || [], //采购列表按钮
......@@ -44,7 +44,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
case 'other':
case 'new':
this.setState({
current_buttons: @state[`${type}_buttons`],
current_buttons: this.state[`${type}_buttons`],
actionSheetVisible: true
});
break;
......@@ -69,11 +69,11 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
if (getCurrentMember().token) {
if (this.state.is_admin) {
$.getJSON '/api/dashboard/statistic', (response) => {
$.getJSON('/api/dashboard/statistic', (response) => {
globalHandleResponse(response, ()=> {
this.setState({statistic: response.statistic});
});
}
});
$.getJSON('/api/documents', { approving: true }, (response) => {
globalHandleResponse(response, () => {
......@@ -114,7 +114,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
documents: response.documents,
loading: false,
});
}
});
});
}
}
......@@ -125,7 +125,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
}
componentDidMount() {
if !(Cookies.get('checked_latest_notice')) {
if (!Cookies.get('checked_latest_notice')) {
$.getJSON('/api/upgrades/get_latest', (response) => {
if (response.status.code == 200) {
Cookies.set('checked_latest_notice', 'checked');
......@@ -186,16 +186,17 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
'biz.util.previewImage',
'biz.chat.pickConversation',
'biz.ding.post',
'biz.telephone.call', 'biz.util.scan'
'biz.telephone.call',
'biz.util.scan',
'biz.contact.choose',
'biz.contact.complexChoose',
'biz.contact.createGroup',
'biz.navigation.setLeft '
'biz.navigation.setLeft',
'biz.navigation.setRight',
'biz.navigation.setTitle',
'biz.navigation.close',
'biz.navigation.setIcon',
'biz.util.openLink'
'biz.util.openLink',
]
const configParams = {
agentId: config.agent_id,
......@@ -233,7 +234,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
setCurrentMember(data.token, data.uid)
if !(isVipNocticeShown(data.org_id)) {
if (!isVipNocticeShown(data.org_id)) {
showVipNotice(data.org_id)
}
......
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