change config

This commit is contained in:
Pan 2017-04-23 22:43:05 +08:00
parent a7b09a2a01
commit e0695d422a
8 changed files with 37 additions and 39 deletions

View file

@ -1,8 +1,7 @@
require('./check-versions')(); // 检查 Node 和 npm 版本 require('./check-versions')(); // 检查 Node 和 npm 版本
var config = require('../config'); var config = require('../config');
if (!process.env.NODE_ENV) { if (!process.env.NODE_ENV) {
process.env.NODE_ENV = config.dev.env; process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
// process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
} }
var opn = require('opn') var opn = require('opn')

View file

@ -6,14 +6,7 @@ var vueLoaderConfig = require('./vue-loader.conf');
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, '..', dir) return path.join(__dirname, '..', dir)
} }
var src = path.resolve(__dirname, '../src'); var src = path.resolve(__dirname, '../src');
var env = process.env.NODE_ENV
// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
// various preprocessor loaders added to vue-loader at the end of this file
var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
var cssSourceMapProd = (env === 'production||sit' && config.build.productionSourceMap)
var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
module.exports = { module.exports = {
entry: { entry: {
@ -22,7 +15,7 @@ module.exports = {
output: { output: {
path: config.build.assetsRoot, path: config.build.assetsRoot,
filename: '[name].js', filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production||sit' ? config.build.assetsPublicPath : config.dev.assetsPublicPath publicPath: process.env.NODE_ENV !== 'development' ? config.build.assetsPublicPath: config.dev.assetsPublicPath
}, },
resolve: { resolve: {
extensions: ['.js', '.vue', '.json'], extensions: ['.js', '.vue', '.json'],

View file

@ -8,8 +8,8 @@ module.exports = {
index: path.resolve(__dirname, '../dist/index.html'), index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'), assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: '', assetsSubDirectory: '',
assetsPublicPath: '/', assetsPublicPath: './',
staticPath:'', staticPath:'./',
productionSourceMap: true, productionSourceMap: true,
// Gzip off by default as many popular static hosts such as // Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you. // Surge or Netlify already gzip all static assets for you.
@ -28,8 +28,8 @@ module.exports = {
port: 9527, port: 9527,
autoOpenBrowser: true, autoOpenBrowser: true,
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
staticPath:'/static',
assetsPublicPath: '/', assetsPublicPath: '/',
staticPath:'/static/',
proxyTable: {}, proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy" // CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README // with this option, according to the CSS-Loader README

View file

@ -1,5 +1,5 @@
module.exports = { module.exports = {
NODE_ENV: '"production"', NODE_ENV: '"production"',
BASE_API: '"https://api-prod', BASE_API: '"https://api-prod"',
APP_ORIGIN: '"https://wallstreetcn.com"' APP_ORIGIN: '"https://wallstreetcn.com"'
}; };

View file

@ -8,8 +8,8 @@
<title>Juicy</title> <title>Juicy</title>
</head> </head>
<body> <body>
<script src=<%= htmlWebpackPlugin.options.path %>/jquery.min.js></script> <script src=<%= htmlWebpackPlugin.options.path %>jquery.min.js></script>
<script src=<%= htmlWebpackPlugin.options.path %>/tinymce1.3/tinymce.min.js></script> <script src=<%= htmlWebpackPlugin.options.path %>tinymce1.3/tinymce.min.js></script>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>

View file

@ -67,7 +67,7 @@ const Form2 = resolve => require(['../views/example/form2'], resolve);
Vue.use(Router); Vue.use(Router);
export default new Router({ export default new Router({
mode: 'history', // mode: 'history', //后端支持可开
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: [ routes: [
{ path: '/login', component: Login, hidden: true }, { path: '/login', component: Login, hidden: true },

View file

@ -2,17 +2,23 @@
<div class="components-container"> <div class="components-container">
<div class='component-item'> <div class='component-item'>
<MDinput name="name" v-model="title" required :maxlength="100"> <MDinput name="name" v-model="title" required :maxlength="100">
标题 标题
</MDinput> </MDinput>
<code class='code-part'>Material Design 的input</code> <code class='code-part'>Material Design 的input</code>
</div> </div>
<div class='component-item'> <div class='component-item'>
<PanThumb image='https://wpimg.wallstcn.com/577965b9-bb9e-4e02-9f0c-095b41417191'> <PanThumb image='https://wpimg.wallstcn.com/577965b9-bb9e-4e02-9f0c-095b41417191'>
上海花裤衩 上海花裤衩
</PanThumb> </PanThumb>
<code class='code-part'>图片hover效果</code> <code class='code-part'>图片hover效果</code>
</div> </div>
<div class='component-item'>
<el-button v-waves type="primary">水波纹效果</el-button>
<code class='code-part'>水波纹 v-directive</code>
</div>
</div> </div>
</template> </template>
<script> <script>

View file

@ -97,29 +97,29 @@
}); });
}, },
afterQRScan() { afterQRScan() {
const hash = window.location.hash.slice(1); // const hash = window.location.hash.slice(1);
const hashObj = getQueryObject(hash); // const hashObj = getQueryObject(hash);
const originUrl = window.location.origin; // const originUrl = window.location.origin;
history.replaceState({}, '', originUrl); // history.replaceState({}, '', originUrl);
const codeMap = { // const codeMap = {
wechat: 'code', // wechat: 'code',
tencent: 'code' // tencent: 'code'
}; // };
const codeName = hashObj[codeMap[this.auth_type]]; // const codeName = hashObj[codeMap[this.auth_type]];
if (!codeName) { // if (!codeName) {
alert('第三方登录失败'); // alert('');
} else { // } else {
this.$store.dispatch('LoginByThirdparty', codeName).then(() => { // this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
this.$router.push({ path: '/' }); // this.$router.push({ path: '/' });
}); // });
} // }
} }
}, },
created() { created() {
window.addEventListener('hashchange', this.afterQRScan); // window.addEventListener('hashchange', this.afterQRScan);
}, },
destroyed() { destroyed() {
window.removeEventListener('hashchange', this.afterQRScan); // window.removeEventListener('hashchange', this.afterQRScan);
} }
} }
</script> </script>