Explorar el Código

开心灵工腾讯验证码

wangxin hace 5 años
padre
commit
977e37a13c
Se han modificado 3 ficheros con 22 adiciones y 5 borrados
  1. 3 2
      package.json
  2. 8 0
      src/router.js
  3. 11 3
      vue.config.js

+ 3 - 2
package.json

@@ -28,12 +28,13 @@
     "@vue/eslint-config-standard": "^4.0.0",
     "babel-eslint": "^10.0.1",
     "babel-plugin-import": "^1.12.0",
+    "compression-webpack-plugin": "^4.0.0",
     "eslint": "^5.16.0",
     "eslint-plugin-vue": "^5.1.0",
     "less": "^3.8.1",
     "less-loader": "^5.0.0",
-    "vue-template-compiler": "^2.6.10",
-    "postcss-pxtorem": "^4.0.1"
+    "postcss-pxtorem": "^4.0.1",
+    "vue-template-compiler": "^2.6.10"
   },
   "eslintConfig": {
     "root": true,

+ 8 - 0
src/router.js

@@ -12,6 +12,14 @@ const routes = [
             title: '获取验证码'
         }
     },
+    {
+        path: '*',
+        name: 'login',
+        component: () => import('./view/captcha/captcha'),
+        meta: {
+            title: '获取验证码'
+        }
+    },
 ];
 
 // add route path

+ 11 - 3
vue.config.js

@@ -1,7 +1,7 @@
 const path = require('path');
 const autoprefixer = require('autoprefixer');
 const pxtorem = require('postcss-pxtorem');
-
+const CompressionWebpackPlugin = require('compression-webpack-plugin')
 
 function resolve(dir) {
     return path.join(__dirname, dir)
@@ -10,7 +10,15 @@ function resolve(dir) {
 module.exports = {
     outputDir: 'dist',
     publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
-
+    configureWebpack: config => {
+        config.plugins.push(
+            new CompressionWebpackPlugin({
+                test: /\.js$|\.html$|\.css$/,
+                // 超过4kb压缩
+                threshold: 4096
+            })
+        )
+    },
     chainWebpack: (config) => {
         config.resolve.alias
             .set('@$', resolve('src'))
@@ -23,7 +31,7 @@ module.exports = {
         port: 8082,
         proxy: {
             '/happy-boot': {
-                target: 'http://hw.hap-job.com', //请求本地 需要happyjob后台项目
+                target: 'http://yz.hap-job.com', //请求本地 需要happyjob后台项目
                 ws: false,
                 changeOrigin: true
             },