Authored by 陈峰

Merge branch 'release/1.0'

app/build/*
\ No newline at end of file
build/*
\ No newline at end of file
... ...
... ... @@ -7,4 +7,6 @@ node_modules/
.eslintcache
app/bundle
public/
.vscode/
\ No newline at end of file
.vscode/
.happypack/
build/dll/
\ No newline at end of file
... ...
... ... @@ -6,8 +6,6 @@ import yohoPluginAuth from './plugins/yoho-plugin-auth';
import './filters';
import './directives';
import 'iview/dist/styles/iview.css';
import './fonts/iconfont.css';
Vue.use(yohoPluginCore);
Vue.use(yohoPluginRouter);
... ...
... ... @@ -110,7 +110,7 @@
maxSortId: fts.sort.first.model,
middleSortId: fts.sort.second.model,
smallSortId: fts.sort.third.model,
isPublished: fts.publishStatus.model,
isPublished: fts.publishStatus.model !== -1 ? fts.publishStatus.model : null,
brandId: fts.brand.model !== -1 ? fts.brand.model : null,
auditStatus: fts.verifyStatus.model !== -1 ? fts.verifyStatus.model : null,
stock: fts.stockStatus.model !== -1 ? this.filters.stockStatus.model : null
... ...
... ... @@ -4,7 +4,7 @@
* @date: 2017/04/13
*/
const auditStatus = {
0: '无状态',
0: '新品未上架',
1: '上架待审核',
2: '上架驳回',
3: '已下架'
... ... @@ -129,7 +129,7 @@ export default () => {
},
{
value: 0,
label: '从未发布'
label: '新品未上架'
},
{
value: 1,
... ...
... ... @@ -62,6 +62,10 @@ export default () => {
{
value: 3,
label: '收货完成'
},
{
value: 4,
label: '已取消'
}
]
}
... ... @@ -150,7 +154,8 @@ export default () => {
const txtMap = {
1: '已处理',
2: '已处理(超时)',
3: '收货完成'
3: '收货完成',
4: '已取消'
};
ot = ot === 'N' ? true : false;
... ... @@ -158,8 +163,8 @@ export default () => {
type = 2;
}
if (status === 3) {
type = 3;
if (status !== 2) {
type = status;
}
return `<span v-if="${ot}">${txtMap[type]}</span>
... ...
... ... @@ -78,7 +78,7 @@
const params = {
pageNo: 1,
pageSize: 20,
statusList: [2, 3]
statusList: [2, 3, 4]
};
this.productList(params);
... ... @@ -88,7 +88,7 @@
let data = {
pageNo: 1,
pageSize: 20,
statusList: [2, 3]
statusList: [2, 3, 4]
};
if (!this.useFilterSign) {
... ... @@ -151,7 +151,7 @@
}
if (status === -1) {
values.statusList = [2, 3];
values.statusList = [2, 3, 4];
} else if (status === -2) {
values.statusList = [2];
} else {
... ...
... ... @@ -96,7 +96,7 @@
};
const mapKeys = {
expressNumber: 'expressNo',
sknFactoryCode: 'prodCode',
productSkn: 'prodCode',
skuFactoryCode: 'prodBarCode',
proReqFormId: 'orderNo'
};
... ... @@ -118,8 +118,8 @@
return;
}
if (typeof data.sknFactoryCode !== 'undefined' &&
!_.isFinite(+data.sknFactoryCode)) {
if (typeof data.productSkn !== 'undefined' &&
!_.isFinite(+data.productSkn)) {
this.$Message.error('SKN编码只能是数字', 3);
return;
}
... ...
... ... @@ -4,6 +4,12 @@
import Router from 'vue-router';
import Promise from 'promise-polyfill';
import iView from 'iview';
import 'iview/dist/styles/iview.css';
import 'iview/dist/styles/fonts/ionicons.eot';
import 'iview/dist/styles/fonts/ionicons.svg';
import 'iview/dist/styles/fonts/ionicons.ttf';
import 'iview/dist/styles/fonts/ionicons.woff';
import '../fonts/iconfont.css';
import store from 'yoho-store';
import cookie from 'yoho-cookie';
import components from '../components/global';
... ...
process.env.NODE_ENV = 'production'
var ora = require('ora')
var rm = require('rimraf')
var path = require('path')
var chalk = require('chalk')
... ... @@ -8,13 +7,10 @@ var webpack = require('webpack')
var config = require('./config')
var webpackConfig = require('./webpack.prod.conf')
var spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot), err => {
if (err) throw err
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
... ...
var path = require('path');
var pkg = require("../../package.json");
var pkg = require("../package.json");
module.exports = {
build: {
env: {
NODE_ENV: '"production"'
},
index: path.resolve(__dirname, `../../public/dist/${pkg.name}/${pkg.version}/index.html`),
assetsRoot: path.resolve(__dirname, `../../public/dist/${pkg.name}/`),
index: path.resolve(__dirname, `../public/dist/${pkg.name}/${pkg.version}/index.html`),
assetsRoot: path.resolve(__dirname, `../public/dist/${pkg.name}/`),
assetsSubDirectory: 'static',
assetsPublicPath: '//cdn.yoho.cn/yoho-shop-manage/',
productionSourceMap: true,
... ...
... ... @@ -3,7 +3,6 @@ require('eventsource-polyfill')
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
hotClient.subscribe(function (event) {
console.log(event)
if (event.action === 'reload') {
window.location.reload()
}
... ...
... ... @@ -5,6 +5,7 @@ if (!process.env.NODE_ENV) {
var opn = require('opn')
var path = require('path')
const compression = require('compression');
var express = require('express')
var webpack = require('webpack')
var proxyMiddleware = require('http-proxy-middleware')
... ... @@ -40,6 +41,7 @@ compiler.plugin('compilation', function (compilation) {
})
})
app.use(compression());
// proxy api requests
Object.keys(proxyTable).forEach(function (context) {
var options = proxyTable[context]
... ...
... ... @@ -3,10 +3,12 @@ var config = require('./config')
var isProduction = process.env.NODE_ENV === 'production'
module.exports = {
loaders: utils.cssLoaders({
loaders: Object.assign(utils.cssLoaders({
sourceMap: isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap,
extract: isProduction
}), {
js: 'happypack/loader?id=js'
})
}
... ...
let webpack = require('webpack');
let utils = require('./utils');
let _ = require('lodash');
const os = require('os');
var path = require('path');
let config = require('./config')
let vueLoaderConfig = require('./vue-loader.conf')
const HappyPack = require('happypack');
let vueLoaderConfig = require('./vue-loader.conf');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
let bundleConfig = require('./dll/bundle-config.json');
const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line
size: os.cpus().length
});
function resolve (dir) {
return path.join(__dirname, '..', dir)
return path.join(__dirname, '../app', dir)
}
let assets = _.map(bundleConfig.vendor, (asset, name) => {
return {
filepath: require.resolve(`./dll/${asset}`),
outputPath: utils.assetsPath(name),
typeOfAsset: name,
publicPath: (process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath) + utils.assetsPath(name)
}
})
module.exports = {
entry: {
app: './app.js'
app: './app/app.js'
},
output: {
path: config.build.assetsRoot,
filename: 'js/[name].js',
chunkFilename: 'js/[name].js',
filename: utils.assetsPath('js/[name].js'),
chunkFilename: utils.assetsPath('js/[name].js'),
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
... ... @@ -37,7 +56,7 @@ module.exports = {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
loader: 'happypack/loader?id=js',
exclude: /node_modules/
},
{
... ... @@ -62,5 +81,22 @@ module.exports = {
options: vueLoaderConfig
}
]
}
},
plugins: [
new HappyPack({
id: 'js',
threadPool: happyThreadPool,
loaders: ['babel-loader?cacheDirectory=true'],
}),
new HappyPack({
id: 'vue',
threadPool: happyThreadPool,
loaders: ['vue-loader'],
}),
new AddAssetHtmlPlugin(assets),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./dll/manifest.json'),
})
]
};
... ...
... ... @@ -7,6 +7,8 @@ let HtmlWebpackPlugin = require('html-webpack-plugin');
let baseConfig = require('./webpack.base.conf.js');
let FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
Object.keys(baseConfig.entry).forEach(function (name) {
baseConfig.entry[name] = ['./build/dev-client'].concat(baseConfig.entry[name])
})
... ... @@ -24,27 +26,10 @@ module.exports = merge(baseConfig, {
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new HtmlWebpackPlugin({
filename: 'index.html',
template: '../index.html',
template: './index.html',
inject: true
}),
new FriendlyErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module, count) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../../node_modules')
) === 0
)
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
}),
]
})
... ...
const webpack = require('webpack');
var path = require('path');
let utils = require('./utils');
let config = require('./config')
const AssetsPlugin = require('assets-webpack-plugin');
let ExtractTextPlugin = require('extract-text-webpack-plugin');
const vendors = [
'vue/dist/vue.esm.js',
'lodash',
'axios',
'vue-router',
'promise-polyfill/promise',
'iview',
'yoho-store',
'yoho-cookie',
'moment',
'buffer',
'bn.js',
'cryptico',
'iview/dist/styles/iview.css'
];
module.exports = {
output: {
path: path.join(__dirname, '/dll'),
filename: '[name].[chunkhash:7].js',
library: '[name]_[chunkhash]',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
devtool: config.build.productionSourceMap ? '#source-map' : false,
entry: {
vendor: vendors,
},
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true
}).concat([
{
test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
loader: 'ignore-file-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}])
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, '/dll/manifest.json'),
name: '[name]_[chunkhash]',
context: __dirname,
}),
new webpack.DefinePlugin({
'process.env': config.build.env
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
sourceMap: true
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new AssetsPlugin({
filename: 'bundle-config.json',
prettyPrint: true,
path: path.join(__dirname, '/dll/')
}),
new ExtractTextPlugin({
filename: '[name].[contenthash:7].css'
})
],
};
\ No newline at end of file
... ...
... ... @@ -3,11 +3,15 @@ var path = require('path');
let config = require('./config')
let utils = require('./utils');
let merge = require('webpack-merge')
const UglifyJsparallelPlugin = require('webpack-uglify-parallel');
const os = require('os');
let OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
let ExtractTextPlugin = require('extract-text-webpack-plugin');
let HtmlWebpackPlugin = require('html-webpack-plugin');
let baseConfig = require('./webpack.base.conf.js');
var webpackConfig = merge(baseConfig, {
module: {
rules: utils.styleLoaders({
... ... @@ -24,10 +28,13 @@ var webpackConfig = merge(baseConfig, {
new webpack.DefinePlugin({
'process.env': config.build.env
}),
new webpack.optimize.UglifyJsPlugin({
new UglifyJsparallelPlugin({
workers: os.cpus().length,
mangle: true,
compress: {
warnings: false
},
comments: false,
sourceMap: true
}),
new ExtractTextPlugin({
... ... @@ -40,32 +47,13 @@ var webpackConfig = merge(baseConfig, {
}),
new HtmlWebpackPlugin({
filename: config.build.index,
template: '../index.html',
template: './index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
},
chunksSortMode: 'dependency'
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module, count) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../../node_modules')
) === 0
)
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
})
]
});
... ... @@ -77,4 +65,4 @@ if (config.build.bundleAnalyzerReport) {
module.exports = webpackConfig;
\ No newline at end of file
module.exports = webpackConfig;
... ...
... ... @@ -4,10 +4,11 @@
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon --watch server server/app.js",
"static": "cd app && node ./build/dev-server.js",
"build": "cd app && node ./build/build.js",
"static": "node ./build/dev-server.js",
"dist": "node ./build/build.js",
"build": "npm run build:dll && node ./build/build.js",
"build:dll": "rimraf build/dll && webpack --config build/webpack.dll.conf.js",
"lint-js": "eslint --ext .js,.vue -c .eslintrc --cache app server",
"lint-css": "stylelint --syntax scss --extract --config .stylelintrc **/*.vue",
"precommit": "node lint-commit.js"
... ... @@ -48,6 +49,8 @@
"yoho-store": "^1.3.20"
},
"devDependencies": {
"add-asset-html-webpack-plugin": "^2.0.1",
"assets-webpack-plugin": "git://github.com/kossnocorp/assets-webpack-plugin",
"autoprefixer": "^6.7.2",
"autoprefixer-loader": "^3.2.0",
"babel-core": "^6.22.1",
... ... @@ -79,8 +82,10 @@
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.10.0",
"friendly-errors-webpack-plugin": "^1.6.1",
"happypack": "^3.1.0",
"html-webpack-plugin": "^2.28.0",
"husky": "^0.13.3",
"ignore-file-loader": "^1.0.0",
"node-sass": "^4.5.2",
"nodemon": "^1.11.0",
"optimize-css-assets-webpack-plugin": "^1.3.0",
... ... @@ -102,7 +107,8 @@
"webpack-dev-server": "^2.4.2",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0",
"webpack-px-to-rem": "^0.1.0"
"webpack-px-to-rem": "^0.1.0",
"webpack-uglify-parallel": "^0.1.3"
},
"author": "",
"license": "ISC"
... ...