zhengkaixin 2 年 前
コミット
7187da7f9e
5 ファイル変更97 行追加5 行削除
  1. 1 1
      apis/weixin.js
  2. 2 1
      pages/index/index.vue
  3. 1 2
      pages/user/message.vue
  4. 1 1
      utils/request.js
  5. 92 0
      vue.config.js

+ 1 - 1
apis/weixin.js

@@ -6,7 +6,7 @@ import Qs from 'qs';
 //根据code换取openid
 export function getDataByCode(code) {
 	return request({
-		url: '/wechat/findUserInfo/' + code,
+		url: '/wechat/findUserInfoByWechat/' + code,
 		params: {},
 		method: 'get',
 	})

+ 2 - 1
pages/index/index.vue

@@ -64,11 +64,12 @@
 <script>
 	import * as Api from '@/apis/index.js'
 	import * as Api_common from '@/apis/common.js'
+	var homeLogo=require('@/static/img/homeLogo.png')
 	
 	export default {
 		data() {
 			return {
-				homeLogo:'/static/img/homeLogo.png',
+				homeLogo:homeLogo,
  				memberQyshow:false,
 				memberQy:0,
 				memberQyColumns:[],

+ 1 - 2
pages/user/message.vue

@@ -59,8 +59,7 @@
 			return {
 				noticebar:["请勿随意泄露个人信息谨防诈骗,如合适请添加对方微信。"],
 				beMemberId:"",
-				src1: '/static/img/sexMan.png',
-				src2:'/static/img/sexWoman.png',
+			
 				form:{
 					
 				},

+ 1 - 1
utils/request.js

@@ -15,7 +15,7 @@ const request = (options) => {
 	 	return requestSon(options);
 	 }
 	 var openId=carhelp.getOpenId()
-	var  urlindex="/wechat/findUserInfo"
+	var  urlindex="/wechat/findUserInfoByWechat"
 	var k=options.url.indexOf(urlindex)==-1;
 	
 	 if(!openId&&k){

+ 92 - 0
vue.config.js

@@ -0,0 +1,92 @@
+if(process.env.NODE_ENV === "production"){
+
+const path = require('path');
+const webpack = require('webpack')
+
+const CompressionWebpackPlugin = require("compression-webpack-plugin")
+const productionGzipExtensions = ['js', 'css']
+
+function resolve(dir) {
+	return path.join(__dirname, dir)
+}
+
+const Timestamp = new Date().getTime();
+module.exports = {
+	publicPath: './',
+	outputDir: 'dist/' ,
+	assetsDir: 'static',
+	lintOnSave: false,
+	devServer: {
+		host: 'localhost',
+		port: 8080,
+		//解析缓存
+		disableHostCheck: true,
+		//支持gzip
+		compress: true,
+	},
+	//不输出map
+	productionSourceMap: false,
+	chainWebpack: (config) => {
+		config.entry.app = ['babel-polyfill', './src/main.js']
+		config.resolve.alias
+			.set('@', resolve('./static/'))
+
+		config.plugins.delete('preload-index');
+		config.plugins.delete('prefetch-index');
+		
+		config.module.rule('images')
+		           .test(/\.(png|jpe?g|gif|webp)(\?.*)?$/)
+		           .use('url-loader')
+		           .loader('file-loader')
+		           .options({
+		               name: 'static/img/[name].[hash:8].[ext]'
+		           })
+				
+		config.optimization.minimize(true);
+	},
+	configureWebpack: config => {
+		/* //开启gzip压缩,需要配置Nginx服务器gzip选项开启
+		config.plugins.push(
+			new CompressionWebpackPlugin({
+				filename: '[path].gz[query]',
+				algorithm: 'gzip',
+				test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
+				threshold: 10240,
+				minRatio: 0.8
+			})
+		); */
+
+			config.plugins.push(new webpack.ProgressPlugin(percentage => {
+				percentage === 1 ? console.log('编译完成:100.00%') : console.log(`编译进度:${(percentage * 100).toFixed(2)}%`)
+			}));
+		config.output.filename = `./static/js/[name].${Timestamp}.js`
+		config.output.chunkFilename = `./static/js/[name].${Timestamp}.js`
+
+		config.performance = {
+			hints: 'warning',
+			//入口起点的最大体积 整数类型(以字节为单位)
+			maxEntrypointSize: 50000000,
+			//生成文件的最大体积 整数类型(以字节为单位 300k)
+			maxAssetSize: 30000000,
+			//只给出 js 文件的性能提示
+			assetFilter: function(assetFilename) {
+				return assetFilename.endsWith('.js');
+			}
+		}
+	},
+	css: {
+		extract: {
+			filename: `./static/css/[name].${Timestamp}.css`,
+			chunkFilename: `./static/css/[name].${Timestamp}.css`
+		},
+		sourceMap: false,
+		loaderOptions: {
+			// 给 sass-loader 传递选项
+			sass: {
+				// @/ 是 src/ 的别名
+				// prependData: `@import "@/assets/scss/base.scss";`
+			}
+		}
+	}
+};
+}