Authored by htoooth

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	server/controllers/user.js
{"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/directives/index.js":{"size":0,"mtime":1491443244000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/directives/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/lint-commit.js":{"size":1883,"mtime":1492413976000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/lint-commit.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/app.js":{"size":458,"mtime":1492412724000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/app.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/util.js":{"size":152,"mtime":1492156059000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/util.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/webpack.base.conf.js":{"size":3335,"mtime":1492156392000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/webpack.base.conf.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/webpack.dev.conf.js":{"size":196,"mtime":1492155807000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/webpack.dev.conf.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/webpack.prod.conf.js":{"size":544,"mtime":1492410496000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/build/webpack.prod.conf.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/config/config.js":{"size":56,"mtime":1490951756000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/config/config.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/filters/index.js":{"size":102,"mtime":1491373576000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/filters/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/filters/money-short.js":{"size":209,"mtime":1491374592000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/filters/money-short.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/app.vue":{"size":170,"mtime":1492413914000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/app.vue","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/auth/index.js":{"size":54,"mtime":1492158379000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/auth/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/auth/login/index.js":{"size":166,"mtime":1492162219000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/auth/login/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/auth/login/login.vue":{"size":2701,"mtime":1492414013000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/auth/login/login.vue","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/dashboard/dashboard.vue":{"size":348,"mtime":1492163066000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/dashboard/dashboard.vue","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/dashboard/index.js":{"size":182,"mtime":1492162754000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/dashboard/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/index.js":{"size":111,"mtime":1492162620000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/overview/index.js":{"size":170,"mtime":1492412737000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/overview/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/index.js":{"size":266,"mtime":1492163177000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/layout.vue":{"size":3754,"mtime":1492162425000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/layout.vue","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/services/service.home.js":{"size":260,"mtime":1492406644000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/services/service.home.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/app.js":{"size":918,"mtime":1492410473000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/app.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/api.js":{"size":323,"mtime":1492412708000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/api.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/config.js":{"size":779,"mtime":1492135825000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/config.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/context.js":{"size":434,"mtime":1492412637000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/context.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/middleware.js":{"size":539,"mtime":1492136892000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/middleware.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/util.js":{"size":436,"mtime":1492136998000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/common/util.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/controllers/index.js":{"size":425,"mtime":1492136884000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/controllers/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/controllers/user.js":{"size":790,"mtime":1492155582000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/controllers/user.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/auth.js":{"size":328,"mtime":1492137531000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/auth.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/before.js":{"size":582,"mtime":1492138276000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/before.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/error.js":{"size":454,"mtime":1492137829000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/error.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/index.js":{"size":276,"mtime":1492135839000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/proxy.js":{"size":358,"mtime":1492138303000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/server/middleware/proxy.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/overview/overview.vue":{"size":391,"mtime":1492414048000,"hashOfConfig":"q2ce8q","results":{"filePath":"/Users/chenfeng/Documents/source/yoho/yoho-shop-manage/app/pages/home/overview/overview.vue","messages":[],"errorCount":0,"warningCount":0}}}
\ No newline at end of file
... ...
{
"env": {
"es6": true
},
"extends": "yoho",
"parserOptions": {
"sourceType": "module"
... ...
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
\ No newline at end of file
... ...
{
"extends": "stylelint-config-yoho",
"processors": ["stylelint-processor-html"],
"rules": {
"string-quotes": "double",
"no-empty-source": null
}
}
... ...
... ... @@ -21,4 +21,4 @@ webpackConfig.plugins.push(new OptimizeCSSPlugin({
}));
module.exports = webpackConfig;
\ No newline at end of file
module.exports = webpackConfig;
... ...
... ... @@ -9,4 +9,7 @@ export default {
</script>
<style lang="scss">
.tetst {
width: 100px;
}
</style>
... ...
... ... @@ -82,7 +82,7 @@ export default {
width: 350px;
margin: 200px auto;
}
.login-title {
width: 100%;
text-align: center;
... ... @@ -91,16 +91,18 @@ export default {
line-height: 50px;
padding-bottom: 20px;
}
.ivu-form {
width: 90%;
margin: 20px auto;
}
.login-btn {
text-align: right;
}
.login-card {
height: 250px;
}
}
</style>
... ...
body {
}
\ No newline at end of file
... ... @@ -9,42 +9,6 @@ const overviewFlow = (url, params) => {
});
};
const trend = (url, params) => {
return axios.get(`${config.apiURL}/${url}`, {
params
}).then(result => {
return result.data.data.content;
});
};
const resource_rank = (url, params) => {
return axios.get(`${config.apiURL}/${url}`, {
params
}).then(result => {
return result.data.data.content;
});
};
const action_rank = (url, params) => {
return axios.get(`${config.apiURL}/${url}`, {
params
}).then(result => {
return result.data.data.content;
});
};
const user_rank = (url, params) => {
return axios.get(`${config.apiURL}/${url}`, {
params
}).then(result => {
return result.data.data.content;
});
};
export {
overviewFlow,
trend,
resource_rank,
action_rank,
user_rank
overviewFlow
};
... ...
const shelljs = require('shelljs');
const path = require('path');
const changeFiles = {
js: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .js$', {silent: true}).stdout,
css: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .css$', {silent: true}).stdout,
vue: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .vue$', {silent: true}).stdout,
};
const lintPath = {
js: path.resolve('./node_modules/.bin/eslint'),
css: path.resolve('./node_modules/.bin/stylelint')
};
const lintResult = {
js: {},
css: {},
vueScript: {},
vueStyle: {}
};
const ext = process.platform === 'win32' ? '.cmd' : ''; // Windows 平台需要加后缀
// 在执行检查脚本的时候,不显示 NPM 错误日志
if (!shelljs.grep('npm run -s', path.resolve('./.git/hooks/pre-commit')).stdout.trim()) {
shelljs.sed('-i', 'npm run', 'npm run -s', path.resolve('./.git/hooks/pre-commit'));
}
if (changeFiles.js) {
changeFiles.js = changeFiles.js.replace(/\n/g, ' ');
lintResult.js = shelljs.exec(`${lintPath.js}${ext} -c .eslintrc --cache ${changeFiles.js}`);
}
if (changeFiles.css) {
changeFiles.css = changeFiles.css.replace(/\n/g, ' ');
lintResult.css = shelljs.exec(`${lintPath.css}${ext} --syntax scss --config .stylelintrc ${changeFiles.css}`);
}
if (changeFiles.vue) {
changeFiles.vue = changeFiles.vue.replace(/\n/g, ' ');
lintResult.vueScript = shelljs.exec(`${lintPath.js}${ext} -c .eslintrc --cache ${changeFiles.vue}`);
lintResult.vueStyle = shelljs.exec(`${lintPath.css}${ext} --syntax scss --extract --config .stylelintrc ${changeFiles.vue}`); // eslint-disable-line
}
const errorCode = lintResult.js.code || lintResult.css.code || lintResult.vueScript.code || lintResult.vueStyle.code;
if (errorCode) {
process.exit(errorCode); // eslint-disable-line
}
... ...
... ... @@ -7,7 +7,10 @@
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon server/app.js",
"static": "cd app && webpack-dev-server --config ./build/webpack.dev.conf.js",
"build": "cd app && webpack --config ./build/webpack.prod.conf.js"
"build": "cd app && webpack --config ./build/webpack.prod.conf.js",
"lint-js": "eslint --ext .js,.vue -c .eslintrc --cache app server",
"lint-css": "stylelint --syntax scss --extract --config .stylelintrc app/**/*.vue app/**/*.scss",
"precommit": "node lint-commit.js"
},
"dependencies": {
"axios": "^0.15.3",
... ... @@ -47,17 +50,24 @@
"eslint-config-yoho": "^1.0.8",
"eslint-friendly-formatter": "^2.0.7",
"eslint-loader": "^1.6.1",
"eslint-plugin-html": "^2.0.0",
"eslint-plugin-html": "^2.0.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eslint-plugin-vue": "^2.0.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.10.0",
"html-webpack-plugin": "^2.28.0",
"husky": "^0.13.3",
"node-sass": "^4.5.2",
"nodemon": "^1.11.0",
"optimize-css-assets-webpack-plugin": "^1.3.0",
"sass-loader": "^6.0.3",
"style-loader": "^0.16.1",
"stylelint": "^7.10.1",
"stylelint-config-yoho": "^1.2.8",
"stylelint-formatter-table": "^1.0.3",
"stylelint-processor-html": "^1.0.0",
"stylelint-webpack-plugin": "^0.7.0",
"url-loader": "^0.5.7",
"vue-loader": "^11.1.4",
"vue-style-loader": "^2.0.0",
... ...
... ... @@ -4,12 +4,16 @@ const Context = require('./context');
const request = require('request-promise');
class Api extends Context {
constructor(...args) {
super();
console.log(args);
}
get(url, data) {
console.log(this.ctx.req.header('host'))
console.log(this.ctx.req.header('host'));
return Promise.resolve(data);
}
post(url, data) {
console.log(this.ctx.req.header('host'))
console.log(this.ctx.req.header('host'));
return Promise.resolve(data);
}
}
... ...
... ... @@ -3,12 +3,18 @@
* @author: feng.chen<feng.chen@yoho.cn>
* @date: 2017/04/14
*/
const _ = require('lodash');
class Context {
setContext(ctx) {
this.ctx = ctx;
}
instance(Type) {
let cls = new Type();
instance(...args) {
if (args.length === 0) {
throw Error('实例化上下文参数错误');
}
let params = _.slice(args, 1, args.length);
let cls = new args[0](...params);
cls.setContext(this.ctx);
return cls;
... ...
... ... @@ -12,7 +12,7 @@ const middleware = require('../common/middleware');
let router = Express.Router(); // eslint-disable-line
router.post('/login', middleware(UserController, 'login'));
router.get('/login', middleware(UserController, 'login'));
router.post('/logout', middleware(UserController, 'logout'));
module.exports = router;
... ...
... ... @@ -20,6 +20,7 @@ class UserController extends Context {
}).catch(next);
}
logout(req, res) {
delete res.session.LOGIN_UID;
return res.json({
code: 200,
data: '登出成功'
... ...