许成详 6 years ago
parent
commit
5e21b59049
61 changed files with 6714 additions and 1263 deletions
  1. 3
    16
      .babelrc
  2. 0
    5
      .eslintignore
  3. 0
    29
      .eslintrc.js
  4. 17
    0
      .gitattributes
  5. 2
    15
      .gitignore
  6. 0
    10
      .postcssrc.js
  7. 21
    0
      README.md
  8. 28
    34
      build/build.js
  9. 0
    54
      build/check-versions.js
  10. 9
    0
      build/dev-client.js
  11. 71
    0
      build/dev-server.js
  12. 31
    71
      build/utils.js
  13. 0
    22
      build/vue-loader.conf.js
  14. 67
    64
      build/webpack.base.conf.js
  15. 59
    84
      build/webpack.dev.conf.js
  16. 72
    93
      build/webpack.prod.conf.js
  17. 2
    3
      config/dev.env.js
  18. 17
    67
      config/index.js
  19. 0
    1
      config/prod.env.js
  20. 0
    7
      config/test.env.js
  21. 0
    13
      index.html
  22. 5657
    0
      package-lock.json
  23. 34
    81
      package.json
  24. 0
    25
      src/App.vue
  25. BIN
      src/assets/img/card.png
  26. BIN
      src/assets/img/coffee-tab.png
  27. BIN
      src/assets/img/discounts.png
  28. BIN
      src/assets/img/index-tab.png
  29. BIN
      src/assets/img/userCenter-tab.png
  30. BIN
      src/assets/img/vip.png
  31. BIN
      src/assets/img/失败1@3x.png
  32. BIN
      src/assets/img/失败@3x.png
  33. BIN
      src/assets/img/等待@3x.png
  34. 461
    0
      src/common/css/reset.css
  35. 53
    0
      src/components/Hello/Hello.vue
  36. 0
    21
      src/main.js
  37. 29
    0
      src/module/detail/App.vue
  38. 11
    0
      src/module/detail/detail.html
  39. 9
    0
      src/module/detail/detail.js
  40. BIN
      src/module/detail/images/logo.png
  41. 12
    0
      src/module/index.html
  42. 0
    0
      src/module/index.js
  43. 29
    0
      src/module/index/App.vue
  44. BIN
      src/module/index/images/logo.png
  45. 11
    0
      src/module/index/index.html
  46. 9
    0
      src/module/index/index.js
  47. 0
    36
      src/page/test/test.vue
  48. 0
    16
      src/router/index.js
  49. 0
    12
      src/style/base.scss
  50. 0
    169
      src/style/main.scss
  51. 0
    53
      src/style/mixin.scss
  52. 0
    60
      src/util/ajax.js
  53. 0
    11
      src/util/api.js
  54. 0
    27
      test/e2e/custom-assertions/elementCount.js
  55. 0
    46
      test/e2e/nightwatch.conf.js
  56. 0
    48
      test/e2e/runner.js
  57. 0
    19
      test/e2e/specs/test.js
  58. 0
    7
      test/unit/.eslintrc
  59. 0
    30
      test/unit/jest.conf.js
  60. 0
    3
      test/unit/setup.js
  61. 0
    11
      test/unit/specs/HelloWorld.spec.js

+ 3
- 16
.babelrc View File

@@ -1,18 +1,5 @@
1 1
 {
2
-  "presets": [
3
-    ["env", {
4
-      "modules": false,
5
-      "targets": {
6
-        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7
-      }
8
-    }],
9
-    "stage-2"
10
-  ],
11
-  "plugins": ["transform-vue-jsx", "transform-runtime"],
12
-  "env": {
13
-    "test": {
14
-      "presets": ["env", "stage-2"],
15
-      "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
16
-    }
17
-  }
2
+  "presets": ["es2015", "stage-2"],
3
+  "plugins": ["transform-runtime"],
4
+  "comments": false
18 5
 }

+ 0
- 5
.eslintignore View File

@@ -1,5 +0,0 @@
1
-/build/
2
-/config/
3
-/dist/
4
-/*.js
5
-/test/unit/coverage/

+ 0
- 29
.eslintrc.js View File

@@ -1,29 +0,0 @@
1
-// https://eslint.org/docs/user-guide/configuring
2
-
3
-module.exports = {
4
-  root: true,
5
-  parserOptions: {
6
-    parser: 'babel-eslint'
7
-  },
8
-  env: {
9
-    browser: true,
10
-  },
11
-  extends: [
12
-    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13
-    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14
-    'plugin:vue/essential', 
15
-    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
16
-    'standard'
17
-  ],
18
-  // required to lint *.vue files
19
-  plugins: [
20
-    'vue'
21
-  ],
22
-  // add your custom rules here
23
-  rules: {
24
-    // allow async-await
25
-    'generator-star-spacing': 'off',
26
-    // allow debugger during development
27
-    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
28
-  }
29
-}

+ 17
- 0
.gitattributes View File

@@ -0,0 +1,17 @@
1
+# Auto detect text files and perform LF normalization
2
+* text=auto
3
+
4
+# Custom for Visual Studio
5
+*.cs     diff=csharp
6
+
7
+# Standard to msysgit
8
+*.doc	 diff=astextplain
9
+*.DOC	 diff=astextplain
10
+*.docx diff=astextplain
11
+*.DOCX diff=astextplain
12
+*.dot  diff=astextplain
13
+*.DOT  diff=astextplain
14
+*.pdf  diff=astextplain
15
+*.PDF	 diff=astextplain
16
+*.rtf	 diff=astextplain
17
+*.RTF	 diff=astextplain

+ 2
- 15
.gitignore View File

@@ -1,17 +1,4 @@
1 1
 .DS_Store
2 2
 node_modules/
3
-/dist/
4
-npm-debug.log*
5
-yarn-debug.log*
6
-yarn-error.log*
7
-/test/unit/coverage/
8
-/test/e2e/reports/
9
-selenium-debug.log
10
-
11
-# Editor directories and files
12
-.idea
13
-.vscode
14
-*.suo
15
-*.ntvs*
16
-*.njsproj
17
-*.sln
3
+dist/
4
+npm-debug.log

+ 0
- 10
.postcssrc.js View File

@@ -1,10 +0,0 @@
1
-// https://github.com/michael-ciniawsky/postcss-load-config
2
-
3
-module.exports = {
4
-  "plugins": {
5
-    "postcss-import": {},
6
-    "postcss-url": {},
7
-    // to edit target browsers: use "browserslist" field in package.json
8
-    "autoprefixer": {}
9
-  }
10
-}

+ 21
- 0
README.md View File

@@ -0,0 +1,21 @@
1
+# vue-cli多页面应用
2
+> A Vue.js project
3
+
4
+### 文章地址:http://www.cnblogs.com/fengyuqing/p/vue_cli_webpack.html
5
+
6
+## Build Setup
7
+
8
+``` bash
9
+# install dependencies
10
+npm install
11
+
12
+# serve with hot reload at localhost:8080
13
+npm run dev
14
+
15
+# build for production with minification
16
+npm run build
17
+```
18
+#### 针对在webstorm里面不能hot reload的问题大家可以按如下步骤设置一下就行:
19
+> Please try turning 'Safe write' option ( Settings | Appearance & Behavior | System Settings | Use "safe write" (save changes to temporary file first)) off
20
+
21
+For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

+ 28
- 34
build/build.js View File

@@ -1,41 +1,35 @@
1
-'use strict'
2
-require('./check-versions')()
1
+// https://github.com/shelljs/shelljs
2
+require('shelljs/global')
3
+env.NODE_ENV = 'production'
3 4
 
4
-process.env.NODE_ENV = 'production'
5
+var path = require('path')
6
+var config = require('../config')
7
+var ora = require('ora')
8
+var webpack = require('webpack')
9
+var webpackConfig = require('./webpack.prod.conf')
5 10
 
6
-const ora = require('ora')
7
-const rm = require('rimraf')
8
-const path = require('path')
9
-const chalk = require('chalk')
10
-const webpack = require('webpack')
11
-const config = require('../config')
12
-const webpackConfig = require('./webpack.prod.conf')
11
+console.log(
12
+  '  Tip:\n' +
13
+  '  Built files are meant to be served over an HTTP server.\n' +
14
+  '  Opening index.html over file:// won\'t work.\n'
15
+)
13 16
 
14
-const spinner = ora('building for production...')
17
+var spinner = ora('building for production...')
15 18
 spinner.start()
16 19
 
17
-rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18
-  if (err) throw err
19
-  webpack(webpackConfig, (err, stats) => {
20
-    spinner.stop()
21
-    if (err) throw err
22
-    process.stdout.write(stats.toString({
23
-      colors: true,
24
-      modules: false,
25
-      children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26
-      chunks: false,
27
-      chunkModules: false
28
-    }) + '\n\n')
29
-
30
-    if (stats.hasErrors()) {
31
-      console.log(chalk.red('  Build failed with errors.\n'))
32
-      process.exit(1)
33
-    }
20
+var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
21
+rm('-rf', assetsPath)
22
+mkdir('-p', assetsPath)
23
+cp('-R', 'static/*', assetsPath)
34 24
 
35
-    console.log(chalk.cyan('  Build complete.\n'))
36
-    console.log(chalk.yellow(
37
-      '  Tip: built files are meant to be served over an HTTP server.\n' +
38
-      '  Opening index.html over file:// won\'t work.\n'
39
-    ))
40
-  })
25
+webpack(webpackConfig, function (err, stats) {
26
+  spinner.stop()
27
+  if (err) throw err
28
+  process.stdout.write(stats.toString({
29
+    colors: true,
30
+    modules: false,
31
+    children: false,
32
+    chunks: false,
33
+    chunkModules: false
34
+  }) + '\n')
41 35
 })

+ 0
- 54
build/check-versions.js View File

@@ -1,54 +0,0 @@
1
-'use strict'
2
-const chalk = require('chalk')
3
-const semver = require('semver')
4
-const packageConfig = require('../package.json')
5
-const shell = require('shelljs')
6
-
7
-function exec (cmd) {
8
-  return require('child_process').execSync(cmd).toString().trim()
9
-}
10
-
11
-const versionRequirements = [
12
-  {
13
-    name: 'node',
14
-    currentVersion: semver.clean(process.version),
15
-    versionRequirement: packageConfig.engines.node
16
-  }
17
-]
18
-
19
-if (shell.which('npm')) {
20
-  versionRequirements.push({
21
-    name: 'npm',
22
-    currentVersion: exec('npm --version'),
23
-    versionRequirement: packageConfig.engines.npm
24
-  })
25
-}
26
-
27
-module.exports = function () {
28
-  const warnings = []
29
-
30
-  for (let i = 0; i < versionRequirements.length; i++) {
31
-    const mod = versionRequirements[i]
32
-
33
-    if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34
-      warnings.push(mod.name + ': ' +
35
-        chalk.red(mod.currentVersion) + ' should be ' +
36
-        chalk.green(mod.versionRequirement)
37
-      )
38
-    }
39
-  }
40
-
41
-  if (warnings.length) {
42
-    console.log('')
43
-    console.log(chalk.yellow('To use this template, you must update following to modules:'))
44
-    console.log()
45
-
46
-    for (let i = 0; i < warnings.length; i++) {
47
-      const warning = warnings[i]
48
-      console.log('  ' + warning)
49
-    }
50
-
51
-    console.log()
52
-    process.exit(1)
53
-  }
54
-}

+ 9
- 0
build/dev-client.js View File

@@ -0,0 +1,9 @@
1
+/* eslint-disable */
2
+require('eventsource-polyfill')
3
+var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4
+
5
+hotClient.subscribe(function (event) {
6
+  if (event.action === 'reload') {
7
+    window.location.reload()
8
+  }
9
+})

+ 71
- 0
build/dev-server.js View File

@@ -0,0 +1,71 @@
1
+var config = require('../config')
2
+if (!process.env.NODE_ENV) process.env.NODE_ENV = config.dev.env
3
+var path = require('path')
4
+var express = require('express')
5
+var webpack = require('webpack')
6
+var opn = require('opn')
7
+var proxyMiddleware = require('http-proxy-middleware')
8
+var webpackConfig = require('./webpack.dev.conf')
9
+
10
+// default port where dev server listens for incoming traffic
11
+var port = process.env.PORT || config.dev.port
12
+// Define HTTP proxies to your custom API backend
13
+// https://github.com/chimurai/http-proxy-middleware
14
+var proxyTable = config.dev.proxyTable
15
+
16
+var app = express()
17
+var compiler = webpack(webpackConfig)
18
+
19
+var devMiddleware = require('webpack-dev-middleware')(compiler, {
20
+  publicPath: webpackConfig.output.publicPath,
21
+  stats: {
22
+    colors: true,
23
+    chunks: false
24
+  }
25
+})
26
+
27
+var hotMiddleware = require('webpack-hot-middleware')(compiler)
28
+// force page reload when html-webpack-plugin template changes
29
+compiler.plugin('compilation', function (compilation) {
30
+  compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
31
+    hotMiddleware.publish({ action: 'reload' })
32
+    cb()
33
+  })
34
+})
35
+
36
+// proxy api requests
37
+Object.keys(proxyTable).forEach(function (context) {
38
+  var options = proxyTable[context]
39
+  if (typeof options === 'string') {
40
+    options = { target: options }
41
+  }
42
+  app.use(proxyMiddleware(context, options))
43
+})
44
+
45
+// handle fallback for HTML5 history API
46
+app.use(require('connect-history-api-fallback')())
47
+
48
+// serve webpack bundle output
49
+app.use(devMiddleware)
50
+
51
+// enable hot-reload and state-preserving
52
+// compilation error display
53
+app.use(hotMiddleware)
54
+
55
+// serve pure static assets
56
+var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
57
+app.use(staticPath, express.static('./static'))
58
+
59
+app.get('/', function (req, res) {
60
+  res.send('Hello world!');
61
+});
62
+
63
+module.exports = app.listen(port, function (err) {
64
+  if (err) {
65
+    console.log(err)
66
+    return
67
+  }
68
+  var uri = 'http://localhost:' + port
69
+  console.log('Listening at ' + uri + '\n')
70
+  opn(uri)
71
+})

+ 31
- 71
build/utils.js View File

@@ -1,101 +1,61 @@
1
-'use strict'
2
-const path = require('path')
3
-const config = require('../config')
4
-const ExtractTextPlugin = require('extract-text-webpack-plugin')
5
-const packageConfig = require('../package.json')
1
+var path = require('path')
2
+var config = require('../config')
3
+var ExtractTextPlugin = require('extract-text-webpack-plugin')
6 4
 
7 5
 exports.assetsPath = function (_path) {
8
-  const assetsSubDirectory = process.env.NODE_ENV === 'production'
6
+  var assetsSubDirectory = process.env.NODE_ENV === 'production'
9 7
     ? config.build.assetsSubDirectory
10 8
     : config.dev.assetsSubDirectory
11
-
12 9
   return path.posix.join(assetsSubDirectory, _path)
13 10
 }
14 11
 
15 12
 exports.cssLoaders = function (options) {
16 13
   options = options || {}
17
-
18
-  const cssLoader = {
19
-    loader: 'css-loader',
20
-    options: {
21
-      sourceMap: options.sourceMap
22
-    }
23
-  }
24
-
25
-  const postcssLoader = {
26
-    loader: 'postcss-loader',
27
-    options: {
28
-      sourceMap: options.sourceMap
29
-    }
30
-  }
31
-
32 14
   // generate loader string to be used with extract text plugin
33
-  function generateLoaders (loader, loaderOptions) {
34
-    const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35
-
36
-    if (loader) {
37
-      loaders.push({
38
-        loader: loader + '-loader',
39
-        options: Object.assign({}, loaderOptions, {
40
-          sourceMap: options.sourceMap
41
-        })
42
-      })
43
-    }
15
+  function generateLoaders (loaders) {
16
+    var sourceLoader = loaders.map(function (loader) {
17
+      var extraParamChar
18
+      if (/\?/.test(loader)) {
19
+        loader = loader.replace(/\?/, '-loader?')
20
+        extraParamChar = '&'
21
+      } else {
22
+        loader = loader + '-loader'
23
+        extraParamChar = '?'
24
+      }
25
+      return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
26
+    }).join('!')
44 27
 
45 28
     // Extract CSS when that option is specified
46 29
     // (which is the case during production build)
47 30
     if (options.extract) {
48
-      return ExtractTextPlugin.extract({
49
-        use: loaders,
50
-        fallback: 'vue-style-loader'
51
-      })
31
+      return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
52 32
     } else {
53
-      return ['vue-style-loader'].concat(loaders)
33
+      return ['vue-style-loader', sourceLoader].join('!')
54 34
     }
55 35
   }
56 36
 
57
-  // https://vue-loader.vuejs.org/en/configurations/extract-css.html
37
+  // http://vuejs.github.io/vue-loader/configurations/extract-css.html
58 38
   return {
59
-    css: generateLoaders(),
60
-    postcss: generateLoaders(),
61
-    less: generateLoaders('less'),
62
-    sass: generateLoaders('sass', { indentedSyntax: true }),
63
-    scss: generateLoaders('sass'),
64
-    stylus: generateLoaders('stylus'),
65
-    styl: generateLoaders('stylus')
39
+    css: generateLoaders(['css']),
40
+    postcss: generateLoaders(['css']),
41
+    less: generateLoaders(['css', 'less']),
42
+    sass: generateLoaders(['css', 'sass?indentedSyntax']),
43
+    scss: generateLoaders(['css', 'sass']),
44
+    stylus: generateLoaders(['css', 'stylus']),
45
+    styl: generateLoaders(['css', 'stylus'])
66 46
   }
67 47
 }
68 48
 
69 49
 // Generate loaders for standalone style files (outside of .vue)
70 50
 exports.styleLoaders = function (options) {
71
-  const output = []
72
-  const loaders = exports.cssLoaders(options)
73
-
74
-  for (const extension in loaders) {
75
-    const loader = loaders[extension]
51
+  var output = []
52
+  var loaders = exports.cssLoaders(options)
53
+  for (var extension in loaders) {
54
+    var loader = loaders[extension]
76 55
     output.push({
77 56
       test: new RegExp('\\.' + extension + '$'),
78
-      use: loader
57
+      loader: loader
79 58
     })
80 59
   }
81
-
82 60
   return output
83 61
 }
84
-
85
-exports.createNotifierCallback = () => {
86
-  const notifier = require('node-notifier')
87
-
88
-  return (severity, errors) => {
89
-    if (severity !== 'error') return
90
-
91
-    const error = errors[0]
92
-    const filename = error.file && error.file.split('!').pop()
93
-
94
-    notifier.notify({
95
-      title: packageConfig.name,
96
-      message: severity + ': ' + error.name,
97
-      subtitle: filename || '',
98
-      icon: path.join(__dirname, 'logo.png')
99
-    })
100
-  }
101
-}

+ 0
- 22
build/vue-loader.conf.js View File

@@ -1,22 +0,0 @@
1
-'use strict'
2
-const utils = require('./utils')
3
-const config = require('../config')
4
-const isProduction = process.env.NODE_ENV === 'production'
5
-const sourceMapEnabled = isProduction
6
-  ? config.build.productionSourceMap
7
-  : config.dev.cssSourceMap
8
-
9
-module.exports = {
10
-  loaders: utils.cssLoaders({
11
-    sourceMap: sourceMapEnabled,
12
-    extract: isProduction
13
-  }),
14
-  cssSourceMap: sourceMapEnabled,
15
-  cacheBusting: config.dev.cacheBusting,
16
-  transformToRequire: {
17
-    video: ['src', 'poster'],
18
-    source: 'src',
19
-    img: 'src',
20
-    image: 'xlink:href'
21
-  }
22
-}

+ 67
- 64
build/webpack.base.conf.js View File

@@ -1,96 +1,99 @@
1
-'use strict'
2
-const path = require('path')
3
-const utils = require('./utils')
4
-const config = require('../config')
5
-const vueLoaderConfig = require('./vue-loader.conf')
1
+var path = require('path')
2
+var config = require('../config')
3
+var utils = require('./utils')
4
+var projectRoot = path.resolve(__dirname, '../')
5
+var glob = require('glob');
6
+var entries = getEntry(['./src/module/*.js', './src/module/**/*.js']); // 获得入口js文件
6 7
 
7
-function resolve (dir) {
8
-  return path.join(__dirname, '..', dir)
9
-}
10
-
11
-const createLintingRule = () => ({
12
-  test: /\.(js|vue)$/,
13
-  loader: 'eslint-loader',
14
-  enforce: 'pre',
15
-  include: [resolve('src'), resolve('test')],
16
-  options: {
17
-    formatter: require('eslint-friendly-formatter'),
18
-    emitWarning: !config.dev.showEslintErrorsInOverlay
19
-  }
20
-})
8
+var env = process.env.NODE_ENV
9
+// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
10
+// various preprocessor loaders added to vue-loader at the end of this file
11
+var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
12
+var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
13
+var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
21 14
 
22 15
 module.exports = {
23
-  context: path.resolve(__dirname, '../'),
24
-  entry: {
25
-    app: './src/main.js'
26
-  },
16
+  entry: entries,
27 17
   output: {
28 18
     path: config.build.assetsRoot,
29
-    filename: '[name].js',
30
-    publicPath: process.env.NODE_ENV === 'production'
31
-      ? config.build.assetsPublicPath
32
-      : config.dev.assetsPublicPath
19
+    publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
20
+    filename: '[name].js'
33 21
   },
34 22
   resolve: {
35
-    extensions: ['.js', '.vue', '.json'],
23
+    extensions: ['', '.js', '.vue'],
24
+    fallback: [path.join(__dirname, '../node_modules')],
36 25
     alias: {
37
-      'vue$': 'vue/dist/vue.esm.js',
38
-      '@': resolve('src'),
26
+      'vue$': 'vue/dist/vue',
27
+      'src': path.resolve(__dirname, '../src'),
28
+      'common': path.resolve(__dirname, '../src/common'),
29
+      'components': path.resolve(__dirname, '../src/components')
39 30
     }
40 31
   },
32
+  resolveLoader: {
33
+    fallback: [path.join(__dirname, '../node_modules')]
34
+  },
41 35
   module: {
42
-    rules: [
43
-      ...(config.dev.useEslint ? [createLintingRule()] : []),
44
-      {
36
+    loaders: [{
45 37
         test: /\.vue$/,
46
-        loader: 'vue-loader',
47
-        options: vueLoaderConfig
38
+        loader: 'vue'
48 39
       },
49 40
       {
50 41
         test: /\.js$/,
51
-        loader: 'babel-loader',
52
-        include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
42
+        loader: 'babel',
43
+        include: projectRoot,
44
+        exclude: /node_modules/
53 45
       },
54 46
       {
55
-        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
56
-        loader: 'url-loader',
57
-        options: {
58
-          limit: 10000,
59
-          name: utils.assetsPath('img/[name].[hash:7].[ext]')
60
-        }
47
+        test: /\.json$/,
48
+        loader: 'json'
61 49
       },
62 50
       {
63
-        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
64
-        loader: 'url-loader',
65
-        options: {
51
+        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
52
+        loader: 'url',
53
+        query: {
66 54
           limit: 10000,
67
-          name: utils.assetsPath('media/[name].[hash:7].[ext]')
55
+          name: utils.assetsPath('img/[name].[hash:7].[ext]')
68 56
         }
69 57
       },
70
-      {
71
-        test: /\.scss$/,
72
-        loaders: ["style", "css", "sass"]
73
-      },
74 58
       {
75 59
         test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
76
-        loader: 'url-loader',
77
-        options: {
60
+        loader: 'url',
61
+        query: {
78 62
           limit: 10000,
79 63
           name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
80 64
         }
81 65
       }
82 66
     ]
83 67
   },
84
-  node: {
85
-    // prevent webpack from injecting useless setImmediate polyfill because Vue
86
-    // source contains it (although only uses it if it's native).
87
-    setImmediate: false,
88
-    // prevent webpack from injecting mocks to Node native modules
89
-    // that does not make sense for the client
90
-    dgram: 'empty',
91
-    fs: 'empty',
92
-    net: 'empty',
93
-    tls: 'empty',
94
-    child_process: 'empty'
68
+  vue: {
69
+    loaders: utils.cssLoaders({
70
+      sourceMap: useCssSourceMap
71
+    }),
72
+    postcss: [
73
+      require('autoprefixer')({
74
+        browsers: ['last 2 versions']
75
+      })
76
+    ]
95 77
   }
96 78
 }
79
+
80
+function getEntry(globPath) {
81
+  var entries = {},
82
+    basename, tmp, pathname;
83
+  if (typeof (globPath) != "object") {
84
+    globPath = [globPath]
85
+  }
86
+  globPath.forEach((itemPath) => {
87
+    glob.sync(itemPath).forEach(function (entry) {
88
+      basename = path.basename(entry, path.extname(entry));
89
+      if (entry.split('/').length > 4) {
90
+        tmp = entry.split('/').splice(-3);
91
+        pathname = tmp.splice(0, 1) + '/' + basename; // 正确输出js和html的路径
92
+        entries[pathname] = entry;
93
+      } else {
94
+        entries[basename] = entry;
95
+      }
96
+    });
97
+  });
98
+  return entries;
99
+}

+ 59
- 84
build/webpack.dev.conf.js View File

@@ -1,95 +1,70 @@
1
-'use strict'
2
-const utils = require('./utils')
3
-const webpack = require('webpack')
4
-const config = require('../config')
5
-const merge = require('webpack-merge')
6
-const path = require('path')
7
-const baseWebpackConfig = require('./webpack.base.conf')
8
-const CopyWebpackPlugin = require('copy-webpack-plugin')
9
-const HtmlWebpackPlugin = require('html-webpack-plugin')
10
-const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
11
-const portfinder = require('portfinder')
12
-
13
-const HOST = process.env.HOST
14
-const PORT = process.env.PORT && Number(process.env.PORT)
15
-
16
-const devWebpackConfig = merge(baseWebpackConfig, {
1
+var path = require('path');
2
+var config = require('../config')
3
+var webpack = require('webpack')
4
+var merge = require('webpack-merge')
5
+var utils = require('./utils')
6
+var baseWebpackConfig = require('./webpack.base.conf')
7
+var HtmlWebpackPlugin = require('html-webpack-plugin')
8
+var glob = require('glob')
9
+// add hot-reload related code to entry chunks
10
+Object.keys(baseWebpackConfig.entry).forEach(function (name) {
11
+  baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
12
+})
13
+module.exports = merge(baseWebpackConfig, {
17 14
   module: {
18
-    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
19
-  },
20
-  // cheap-module-eval-source-map is faster for development
21
-  devtool: config.dev.devtool,
22
-
23
-  // these devServer options should be customized in /config/index.js
24
-  devServer: {
25
-    clientLogLevel: 'warning',
26
-    historyApiFallback: {
27
-      rewrites: [
28
-        { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
29
-      ],
30
-    },
31
-    hot: true,
32
-    contentBase: false, // since we use CopyWebpackPlugin.
33
-    compress: true,
34
-    host: HOST || config.dev.host,
35
-    port: PORT || config.dev.port,
36
-    open: config.dev.autoOpenBrowser,
37
-    overlay: config.dev.errorOverlay
38
-      ? { warnings: false, errors: true }
39
-      : false,
40
-    publicPath: config.dev.assetsPublicPath,
41
-    proxy: config.dev.proxyTable,
42
-    quiet: true, // necessary for FriendlyErrorsPlugin
43
-    watchOptions: {
44
-      poll: config.dev.poll,
45
-    }
15
+    loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
46 16
   },
17
+  // eval-source-map is faster for development
18
+  devtool: '#eval-source-map',
47 19
   plugins: [
48 20
     new webpack.DefinePlugin({
49
-      'process.env': require('../config/dev.env')
21
+      'process.env': config.dev.env
50 22
     }),
23
+    // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
24
+    new webpack.optimize.OccurenceOrderPlugin(),
51 25
     new webpack.HotModuleReplacementPlugin(),
52
-    new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
53
-    new webpack.NoEmitOnErrorsPlugin(),
54
-    // https://github.com/ampedandwired/html-webpack-plugin
55
-    new HtmlWebpackPlugin({
56
-      filename: 'index.html',
57
-      template: 'index.html',
58
-      inject: true
59
-    }),
60
-    // copy custom static assets
61
-    new CopyWebpackPlugin([
62
-      {
63
-        from: path.resolve(__dirname, '../static'),
64
-        to: config.dev.assetsSubDirectory,
65
-        ignore: ['.*']
66
-      }
67
-    ])
26
+    new webpack.NoErrorsPlugin()
68 27
   ]
69 28
 })
70 29
 
71
-module.exports = new Promise((resolve, reject) => {
72
-  portfinder.basePort = process.env.PORT || config.dev.port
73
-  portfinder.getPort((err, port) => {
74
-    if (err) {
75
-      reject(err)
76
-    } else {
77
-      // publish the new Port, necessary for e2e tests
78
-      process.env.PORT = port
79
-      // add port to devServer config
80
-      devWebpackConfig.devServer.port = port
30
+function getEntry(globPath) {
31
+  var entries = {},
32
+    basename, tmp, pathname;
33
+  if (typeof (globPath) != "object") {
34
+    globPath = [globPath]
35
+  }
36
+  globPath.forEach((itemPath) => {
37
+    glob.sync(itemPath).forEach(function (entry) {
38
+      basename = path.basename(entry, path.extname(entry));
39
+      if (entry.split('/').length > 4) {
40
+        tmp = entry.split('/').splice(-3);
41
+        pathname = tmp.splice(0, 1) + '/' + basename; // 正确输出js和html的路径
42
+        entries[pathname] = entry;
43
+      } else {
44
+        entries[basename] = entry;
45
+      }
46
+    });
47
+  });
48
+  return entries;
49
+}
81 50
 
82
-      // Add FriendlyErrorsPlugin
83
-      devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
84
-        compilationSuccessInfo: {
85
-          messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
86
-        },
87
-        onErrors: config.dev.notifyOnErrors
88
-        ? utils.createNotifierCallback()
89
-        : undefined
90
-      }))
51
+var pages = getEntry(['./src/module/*.html','./src/module/**/*.html']);
91 52
 
92
-      resolve(devWebpackConfig)
93
-    }
94
-  })
95
-})
53
+for (var pathname in pages) {
54
+  // 配置生成的html文件,定义路径等
55
+  var conf = {
56
+    filename: pathname + '.html',
57
+    template: pages[pathname],   // 模板路径
58
+    inject: true,              // js插入位置
59
+    // necessary to consistently work with multiple chunks via CommonsChunkPlugin
60
+    chunksSortMode: 'dependency'
61
+
62
+  };
63
+
64
+  if (pathname in module.exports.entry) {
65
+    conf.chunks = ['manifest', 'vendor', pathname];
66
+    conf.hash = true;
67
+  }
68
+
69
+  module.exports.plugins.push(new HtmlWebpackPlugin(conf));
70
+}

+ 72
- 93
build/webpack.prod.conf.js View File

@@ -1,91 +1,52 @@
1
-'use strict'
2
-const path = require('path')
3
-const utils = require('./utils')
4
-const webpack = require('webpack')
5
-const config = require('../config')
6
-const merge = require('webpack-merge')
7
-const baseWebpackConfig = require('./webpack.base.conf')
8
-const CopyWebpackPlugin = require('copy-webpack-plugin')
9
-const HtmlWebpackPlugin = require('html-webpack-plugin')
10
-const ExtractTextPlugin = require('extract-text-webpack-plugin')
11
-const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12
-const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
1
+var path = require('path')
2
+var config = require('../config')
3
+var utils = require('./utils')
4
+var webpack = require('webpack')
5
+var merge = require('webpack-merge')
6
+var baseWebpackConfig = require('./webpack.base.conf')
7
+var ExtractTextPlugin = require('extract-text-webpack-plugin')
8
+var HtmlWebpackPlugin = require('html-webpack-plugin')
9
+var CleanPlugin = require('clean-webpack-plugin')//webpack插件,用于清除目录文件
10
+var glob = require('glob');
11
+var env = config.build.env
13 12
 
14
-const env = process.env.NODE_ENV === 'testing'
15
-  ? require('../config/test.env')
16
-  : require('../config/prod.env')
17
-
18
-const webpackConfig = merge(baseWebpackConfig, {
13
+var webpackConfig = merge(baseWebpackConfig, {
19 14
   module: {
20
-    rules: utils.styleLoaders({
21
-      sourceMap: config.build.productionSourceMap,
22
-      extract: true,
23
-      usePostCSS: true
24
-    })
15
+    loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true })
25 16
   },
26
-  devtool: config.build.productionSourceMap ? config.build.devtool : false,
17
+  devtool: config.build.productionSourceMap ? '#source-map' : false,
27 18
   output: {
28 19
     path: config.build.assetsRoot,
29 20
     filename: utils.assetsPath('js/[name].[chunkhash].js'),
30 21
     chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
31 22
   },
23
+  vue: {
24
+    loaders: utils.cssLoaders({
25
+      sourceMap: config.build.productionSourceMap,
26
+      extract: true
27
+    })
28
+  },
32 29
   plugins: [
33
-    // http://vuejs.github.io/vue-loader/en/workflow/production.html
30
+    // http://vuejs.github.io/vue-loader/workflow/production.html
34 31
     new webpack.DefinePlugin({
35 32
       'process.env': env
36 33
     }),
37
-    new UglifyJsPlugin({
38
-      uglifyOptions: {
39
-        compress: {
40
-          warnings: false
41
-        }
42
-      },
43
-      sourceMap: config.build.productionSourceMap,
44
-      parallel: true
34
+    new webpack.optimize.UglifyJsPlugin({
35
+      compress: {
36
+        warnings: false
37
+      }
45 38
     }),
39
+    new CleanPlugin(['../dist']), //清空生成目录
40
+    new webpack.optimize.OccurenceOrderPlugin(),
46 41
     // extract css into its own file
47
-    new ExtractTextPlugin({
48
-      filename: utils.assetsPath('css/[name].[contenthash].css'),
49
-      // Setting the following option to `false` will not extract CSS from codesplit chunks.
50
-      // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
51
-      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 
52
-      // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
53
-      allChunks: true,
54
-    }),
55
-    // Compress extracted CSS. We are using this plugin so that possible
56
-    // duplicated CSS from different components can be deduped.
57
-    new OptimizeCSSPlugin({
58
-      cssProcessorOptions: config.build.productionSourceMap
59
-        ? { safe: true, map: { inline: false } }
60
-        : { safe: true }
61
-    }),
42
+    new ExtractTextPlugin(utils.assetsPath('css/[name].[contenthash].css')),
62 43
     // generate dist index.html with correct asset hash for caching.
63 44
     // you can customize output by editing /index.html
64 45
     // see https://github.com/ampedandwired/html-webpack-plugin
65
-    new HtmlWebpackPlugin({
66
-      filename: process.env.NODE_ENV === 'testing'
67
-        ? 'index.html'
68
-        : config.build.index,
69
-      template: 'index.html',
70
-      inject: true,
71
-      minify: {
72
-        removeComments: true,
73
-        collapseWhitespace: true,
74
-        removeAttributeQuotes: true
75
-        // more options:
76
-        // https://github.com/kangax/html-minifier#options-quick-reference
77
-      },
78
-      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
79
-      chunksSortMode: 'dependency'
80
-    }),
81
-    // keep module.id stable when vendor modules does not change
82
-    new webpack.HashedModuleIdsPlugin(),
83
-    // enable scope hoisting
84
-    new webpack.optimize.ModuleConcatenationPlugin(),
85 46
     // split vendor js into its own file
86 47
     new webpack.optimize.CommonsChunkPlugin({
87 48
       name: 'vendor',
88
-      minChunks (module) {
49
+      minChunks: function (module, count) {
89 50
         // any required modules inside node_modules are extracted to vendor
90 51
         return (
91 52
           module.resource &&
@@ -100,31 +61,13 @@ const webpackConfig = merge(baseWebpackConfig, {
100 61
     // prevent vendor hash from being updated whenever app bundle is updated
101 62
     new webpack.optimize.CommonsChunkPlugin({
102 63
       name: 'manifest',
103
-      minChunks: Infinity
104
-    }),
105
-    // This instance extracts shared chunks from code splitted chunks and bundles them
106
-    // in a separate chunk, similar to the vendor chunk
107
-    // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
108
-    new webpack.optimize.CommonsChunkPlugin({
109
-      name: 'app',
110
-      async: 'vendor-async',
111
-      children: true,
112
-      minChunks: 3
113
-    }),
114
-
115
-    // copy custom static assets
116
-    new CopyWebpackPlugin([
117
-      {
118
-        from: path.resolve(__dirname, '../static'),
119
-        to: config.build.assetsSubDirectory,
120
-        ignore: ['.*']
121
-      }
122
-    ])
64
+      chunks: ['vendor']
65
+    })
123 66
   ]
124 67
 })
125 68
 
126 69
 if (config.build.productionGzip) {
127
-  const CompressionWebpackPlugin = require('compression-webpack-plugin')
70
+  var CompressionWebpackPlugin = require('compression-webpack-plugin')
128 71
 
129 72
   webpackConfig.plugins.push(
130 73
     new CompressionWebpackPlugin({
@@ -141,9 +84,45 @@ if (config.build.productionGzip) {
141 84
   )
142 85
 }
143 86
 
144
-if (config.build.bundleAnalyzerReport) {
145
-  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
146
-  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
87
+module.exports = webpackConfig
88
+
89
+function getEntry(globPath) {
90
+  var entries = {},
91
+    basename, tmp, pathname;
92
+  if (typeof (globPath) != "object") {
93
+    globPath = [globPath]
94
+  }
95
+  globPath.forEach((itemPath) => {
96
+    glob.sync(itemPath).forEach(function (entry) {
97
+      basename = path.basename(entry, path.extname(entry));
98
+      if (entry.split('/').length > 4) {
99
+        tmp = entry.split('/').splice(-3);
100
+        pathname = tmp.splice(0, 1) + '/' + basename; // 正确输出js和html的路径
101
+        entries[pathname] = entry;
102
+      } else {
103
+        entries[basename] = entry;
104
+      }
105
+    });
106
+  });
107
+  return entries;
147 108
 }
148 109
 
149
-module.exports = webpackConfig
110
+var pages = getEntry(['./src/module/*.html','./src/module/**/*.html']);
111
+
112
+for (var pathname in pages) {
113
+  // 配置生成的html文件,定义路径等
114
+  var conf = {
115
+    filename: pathname + '.html',
116
+    template: pages[pathname],   // 模板路径
117
+    inject: true,              // js插入位置
118
+    // necessary to consistently work with multiple chunks via CommonsChunkPlugin
119
+    chunksSortMode: 'dependency'
120
+  };
121
+
122
+  if (pathname in module.exports.entry) {
123
+    conf.chunks = ['manifest', 'vendor', pathname];
124
+    conf.hash = true;
125
+  }
126
+
127
+  module.exports.plugins.push(new HtmlWebpackPlugin(conf));
128
+}

+ 2
- 3
config/dev.env.js View File

@@ -1,6 +1,5 @@
1
-'use strict'
2
-const merge = require('webpack-merge')
3
-const prodEnv = require('./prod.env')
1
+var merge = require('webpack-merge')
2
+var prodEnv = require('./prod.env')
4 3
 
5 4
 module.exports = merge(prodEnv, {
6 5
   NODE_ENV: '"development"'

+ 17
- 67
config/index.js View File

@@ -1,82 +1,32 @@
1
-'use strict'
2
-// Template version: 1.3.1
3 1
 // see http://vuejs-templates.github.io/webpack for documentation.
4
-
5
-const path = require('path')
2
+var path = require('path')
6 3
 
7 4
 module.exports = {
8
-  dev: {
9
-    // Paths
10
-    assetsSubDirectory: 'static',
11
-    assetsPublicPath: '/',
12
-    proxyTable: {
13
-      '/api': {
14
-        target: 'https://dp.huiju360.com.cn/hj_operations',
15
-        // target: 'http://192.168.0.62:8080/api',
16
-        changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
17
-        pathRewrite: {
18
-          '^/api': ''
19
-        },
20
-      },
21
-    },
22
-    // Various Dev Server settings
23
-    host: '0.0.0.0', // can be overwritten by process.env.HOST
24
-    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
25
-    autoOpenBrowser: false,
26
-    errorOverlay: true,
27
-    notifyOnErrors: true,
28
-    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
29
-
30
-    // Use Eslint Loader?
31
-    // If true, your code will be linted during bundling and
32
-    // linting errors and warnings will be shown in the console.
33
-    useEslint: true,
34
-    // If true, eslint errors and warnings will also be shown in the error overlay
35
-    // in the browser.
36
-    showEslintErrorsInOverlay: false,
37
-
38
-    /**
39
-     * Source Maps
40
-     */
41
-
42
-    // https://webpack.js.org/configuration/devtool/#development
43
-    devtool: 'cheap-module-eval-source-map',
44
-
45
-    // If you have problems debugging vue-files in devtools,
46
-    // set this to false - it *may* help
47
-    // https://vue-loader.vuejs.org/en/options.html#cachebusting
48
-    cacheBusting: true,
49
-    cssSourceMap: true
50
-  },
51
-
52 5
   build: {
53
-    // Template for index.html
6
+    env: require('./prod.env'),
54 7
     index: path.resolve(__dirname, '../dist/index.html'),
55
-
56
-    // Paths
57 8
     assetsRoot: path.resolve(__dirname, '../dist'),
58 9
     assetsSubDirectory: 'static',
59
-    assetsPublicPath: '/',
60
-
61
-    /**
62
-     * Source Maps
63
-     */
64
-
10
+    assetsPublicPath: '../',
65 11
     productionSourceMap: true,
66
-    // https://webpack.js.org/configuration/devtool/#production
67
-    devtool: '#source-map',
68
-
69 12
     // Gzip off by default as many popular static hosts such as
70 13
     // Surge or Netlify already gzip all static assets for you.
71 14
     // Before setting to `true`, make sure to:
72 15
     // npm install --save-dev compression-webpack-plugin
73 16
     productionGzip: false,
74
-    productionGzipExtensions: ['js', 'css'],
75
-
76
-    // Run the build command with an extra argument to
77
-    // View the bundle analyzer report after build finishes:
78
-    // `npm run build --report`
79
-    // Set to `true` or `false` to always turn it on or off
80
-    bundleAnalyzerReport: process.env.npm_config_report
17
+    productionGzipExtensions: ['js', 'css']
18
+  },
19
+  dev: {
20
+    env: require('./dev.env'),
21
+    port: 8080,
22
+    assetsSubDirectory: 'static',
23
+    assetsPublicPath: '/',
24
+    proxyTable: {},
25
+    // CSS Sourcemaps off by default because relative paths are "buggy"
26
+    // with this option, according to the CSS-Loader README
27
+    // (https://github.com/webpack/css-loader#sourcemaps)
28
+    // In our experience, they generally work as expected,
29
+    // just be aware of this issue when enabling this option.
30
+    cssSourceMap: false
81 31
   }
82 32
 }

+ 0
- 1
config/prod.env.js View File

@@ -1,4 +1,3 @@
1
-'use strict'
2 1
 module.exports = {
3 2
   NODE_ENV: '"production"'
4 3
 }

+ 0
- 7
config/test.env.js View File

@@ -1,7 +0,0 @@
1
-'use strict'
2
-const merge = require('webpack-merge')
3
-const devEnv = require('./dev.env')
4
-
5
-module.exports = merge(devEnv, {
6
-  NODE_ENV: '"testing"'
7
-})

+ 0
- 13
index.html View File

@@ -1,13 +0,0 @@
1
-<!DOCTYPE html>
2
-<html>
3
-  <head>
4
-    <meta charset="utf-8">
5
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
6
-    <link rel="stylesheet" href="//at.alicdn.com/t/font_775069_gqyqpakvbzi.css">
7
-    <title>城的空间</title>
8
-  </head>
9
-  <body>
10
-    <div id="app"></div>
11
-    <!-- built files will be auto injected -->
12
-  </body>
13
-</html>

+ 5657
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 34
- 81
package.json View File

@@ -1,92 +1,45 @@
1 1
 {
2
-  "name": "spaceofcheng",
2
+  "name": "vue-multipage",
3 3
   "version": "1.0.0",
4 4
   "description": "A Vue.js project",
5
-  "author": "xuchengxiang <xcx18267901393@dingtalk.com>",
5
+  "author": "breezefeng",
6 6
   "private": true,
7 7
   "scripts": {
8
-    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9
-    "start": "npm run dev",
10
-    "unit": "jest --config test/unit/jest.conf.js --coverage",
11
-    "e2e": "node test/e2e/runner.js",
12
-    "test": "npm run unit && npm run e2e",
13
-    "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
8
+    "dev": "node build/dev-server.js",
14 9
     "build": "node build/build.js"
15 10
   },
16 11
   "dependencies": {
17
-    "axios": "^0.18.0",
18
-    "vant": "^1.1.15",
19
-    "vue": "^2.5.2",
20
-    "vue-router": "^3.0.1"
12
+    "vue": "^2.0.1"
21 13
   },
22 14
   "devDependencies": {
23
-    "autoprefixer": "^7.1.2",
24
-    "babel-core": "^6.22.1",
25
-    "babel-eslint": "^8.2.1",
26
-    "babel-helper-vue-jsx-merge-props": "^2.0.3",
27
-    "babel-jest": "^21.0.2",
28
-    "babel-loader": "^7.1.1",
29
-    "babel-plugin-dynamic-import-node": "^1.2.0",
30
-    "babel-plugin-import": "^1.8.0",
31
-    "babel-plugin-syntax-jsx": "^6.18.0",
32
-    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
33
-    "babel-plugin-transform-runtime": "^6.22.0",
34
-    "babel-plugin-transform-vue-jsx": "^3.5.0",
35
-    "babel-preset-env": "^1.3.2",
36
-    "babel-preset-stage-2": "^6.22.0",
37
-    "babel-register": "^6.22.0",
38
-    "chalk": "^2.0.1",
39
-    "chromedriver": "^2.27.2",
40
-    "copy-webpack-plugin": "^4.0.1",
41
-    "cross-spawn": "^5.0.1",
42
-    "css-loader": "^0.28.0",
43
-    "eslint": "^4.15.0",
44
-    "eslint-config-standard": "^10.2.1",
45
-    "eslint-friendly-formatter": "^3.0.0",
46
-    "eslint-loader": "^1.7.1",
47
-    "eslint-plugin-import": "^2.7.0",
48
-    "eslint-plugin-node": "^5.2.0",
49
-    "eslint-plugin-promise": "^3.4.0",
50
-    "eslint-plugin-standard": "^3.0.1",
51
-    "eslint-plugin-vue": "^4.0.0",
52
-    "extract-text-webpack-plugin": "^3.0.0",
53
-    "file-loader": "^1.1.4",
54
-    "friendly-errors-webpack-plugin": "^1.6.1",
55
-    "html-webpack-plugin": "^2.30.1",
56
-    "jest": "^22.0.4",
57
-    "jest-serializer-vue": "^0.3.0",
58
-    "nightwatch": "^0.9.12",
59
-    "node-notifier": "^5.1.2",
60
-    "node-sass": "^4.8.3",
61
-    "optimize-css-assets-webpack-plugin": "^3.2.0",
62
-    "ora": "^1.2.0",
63
-    "portfinder": "^1.0.13",
64
-    "postcss-import": "^11.0.0",
65
-    "postcss-loader": "^2.0.8",
66
-    "postcss-url": "^7.2.1",
67
-    "rimraf": "^2.6.0",
68
-    "sass-loader": "^7.1.0",
69
-    "selenium-server": "^3.0.1",
70
-    "semver": "^5.3.0",
71
-    "shelljs": "^0.7.6",
72
-    "uglifyjs-webpack-plugin": "^1.1.1",
73
-    "url-loader": "^0.5.8",
74
-    "vue-jest": "^1.0.2",
75
-    "vue-loader": "^13.3.0",
76
-    "vue-style-loader": "^3.0.1",
77
-    "vue-template-compiler": "^2.5.2",
78
-    "webpack": "^3.6.0",
79
-    "webpack-bundle-analyzer": "^2.9.0",
80
-    "webpack-dev-server": "^2.9.1",
81
-    "webpack-merge": "^4.1.0"
82
-  },
83
-  "engines": {
84
-    "node": ">= 6.0.0",
85
-    "npm": ">= 3.0.0"
86
-  },
87
-  "browserslist": [
88
-    "> 1%",
89
-    "last 2 versions",
90
-    "not ie <= 8"
91
-  ]
15
+    "autoprefixer": "^6.4.0",
16
+    "babel-core": "^6.0.0",
17
+    "babel-loader": "^6.0.0",
18
+    "babel-plugin-transform-runtime": "^6.0.0",
19
+    "babel-preset-es2015": "^6.0.0",
20
+    "babel-preset-stage-2": "^6.0.0",
21
+    "babel-register": "^6.0.0",
22
+    "clean-webpack-plugin": "^0.1.13",
23
+    "connect-history-api-fallback": "^1.1.0",
24
+    "css-loader": "^0.25.0",
25
+    "eventsource-polyfill": "^0.9.6",
26
+    "express": "^4.13.3",
27
+    "extract-text-webpack-plugin": "^1.0.1",
28
+    "file-loader": "^0.9.0",
29
+    "function-bind": "^1.0.2",
30
+    "glob": "^7.1.1",
31
+    "html-webpack-plugin": "^2.8.1",
32
+    "http-proxy-middleware": "^0.17.2",
33
+    "json-loader": "^0.5.4",
34
+    "opn": "^4.0.2",
35
+    "ora": "^0.3.0",
36
+    "shelljs": "^0.7.4",
37
+    "url-loader": "^0.5.7",
38
+    "vue-loader": "^9.4.0",
39
+    "vue-style-loader": "^1.0.0",
40
+    "webpack": "^1.13.2",
41
+    "webpack-dev-middleware": "^1.8.3",
42
+    "webpack-hot-middleware": "^2.12.2",
43
+    "webpack-merge": "^0.14.1"
44
+  }
92 45
 }

+ 0
- 25
src/App.vue View File

@@ -1,25 +0,0 @@
1
-<template>
2
-  <div id="app">
3
-    <router-view/>
4
-  </div>
5
-</template>
6
-
7
-<script>
8
-export default {
9
-  name: 'App'
10
-}
11
-</script>
12
-
13
-<style>
14
-@import 'style/main.scss';
15
-#app {
16
-  font-family: 'Avenir', Helvetica, Arial, sans-serif;
17
-  -webkit-font-smoothing: antialiased;
18
-  -moz-osx-font-smoothing: grayscale;
19
-  text-align: center;
20
-  color: #2c3e50;
21
-  width: 100%;
22
-  height: 100%;
23
-  position: relative;
24
-}
25
-</style>

BIN
src/assets/img/card.png View File


BIN
src/assets/img/coffee-tab.png View File


BIN
src/assets/img/discounts.png View File


BIN
src/assets/img/index-tab.png View File


BIN
src/assets/img/userCenter-tab.png View File


BIN
src/assets/img/vip.png View File


BIN
src/assets/img/失败1@3x.png View File


BIN
src/assets/img/失败@3x.png View File


BIN
src/assets/img/等待@3x.png View File


+ 461
- 0
src/common/css/reset.css View File

@@ -0,0 +1,461 @@
1
+/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
2
+
3
+/**
4
+ * 1. Change the default font family in all browsers (opinionated).
5
+ * 2. Correct the line height in all browsers.
6
+ * 3. Prevent adjustments of font size after orientation changes in
7
+ *    IE on Windows Phone and in iOS.
8
+ */
9
+
10
+/* Document
11
+   ========================================================================== */
12
+
13
+html {
14
+  font-family: sans-serif; /* 1 */
15
+  line-height: 1.15; /* 2 */
16
+  -ms-text-size-adjust: 100%; /* 3 */
17
+  -webkit-text-size-adjust: 100%; /* 3 */
18
+}
19
+
20
+/* Sections
21
+   ========================================================================== */
22
+
23
+/**
24
+ * Remove the margin in all browsers (opinionated).
25
+ */
26
+
27
+body {
28
+  margin: 0;
29
+}
30
+
31
+/**
32
+ * Add the correct display in IE 9-.
33
+ */
34
+
35
+article,
36
+aside,
37
+footer,
38
+header,
39
+nav,
40
+section {
41
+  display: block;
42
+}
43
+
44
+/**
45
+ * Correct the font size and margin on `h1` elements within `section` and
46
+ * `article` contexts in Chrome, Firefox, and Safari.
47
+ */
48
+
49
+h1 {
50
+  font-size: 2em;
51
+  margin: 0.67em 0;
52
+}
53
+
54
+/* Grouping content
55
+   ========================================================================== */
56
+
57
+/**
58
+ * Add the correct display in IE 9-.
59
+ * 1. Add the correct display in IE.
60
+ */
61
+
62
+figcaption,
63
+figure,
64
+main { /* 1 */
65
+  display: block;
66
+}
67
+
68
+/**
69
+ * Add the correct margin in IE 8.
70
+ */
71
+
72
+figure {
73
+  margin: 1em 40px;
74
+}
75
+
76
+/**
77
+ * 1. Add the correct box sizing in Firefox.
78
+ * 2. Show the overflow in Edge and IE.
79
+ */
80
+
81
+hr {
82
+  box-sizing: content-box; /* 1 */
83
+  height: 0; /* 1 */
84
+  overflow: visible; /* 2 */
85
+}
86
+
87
+/**
88
+ * 1. Correct the inheritance and scaling of font size in all browsers.
89
+ * 2. Correct the odd `em` font sizing in all browsers.
90
+ */
91
+
92
+pre {
93
+  font-family: monospace, monospace; /* 1 */
94
+  font-size: 1em; /* 2 */
95
+}
96
+
97
+/* Text-level semantics
98
+   ========================================================================== */
99
+
100
+/**
101
+ * 1. Remove the gray background on active links in IE 10.
102
+ * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
103
+ */
104
+
105
+a {
106
+  background-color: transparent; /* 1 */
107
+  -webkit-text-decoration-skip: objects; /* 2 */
108
+}
109
+
110
+/**
111
+ * Remove the outline on focused links when they are also active or hovered
112
+ * in all browsers (opinionated).
113
+ */
114
+
115
+a:active,
116
+a:hover {
117
+  outline-width: 0;
118
+}
119
+
120
+/**
121
+ * 1. Remove the bottom border in Firefox 39-.
122
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
123
+ */
124
+
125
+abbr[title] {
126
+  border-bottom: none; /* 1 */
127
+  text-decoration: underline; /* 2 */
128
+  text-decoration: underline dotted; /* 2 */
129
+}
130
+
131
+/**
132
+ * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
133
+ */
134
+
135
+b,
136
+strong {
137
+  font-weight: inherit;
138
+}
139
+
140
+/**
141
+ * Add the correct font weight in Chrome, Edge, and Safari.
142
+ */
143
+
144
+b,
145
+strong {
146
+  font-weight: bolder;
147
+}
148
+
149
+/**
150
+ * 1. Correct the inheritance and scaling of font size in all browsers.
151
+ * 2. Correct the odd `em` font sizing in all browsers.
152
+ */
153
+
154
+code,
155
+kbd,
156
+samp {
157
+  font-family: monospace, monospace; /* 1 */
158
+  font-size: 1em; /* 2 */
159
+}
160
+
161
+/**
162
+ * Add the correct font style in Android 4.3-.
163
+ */
164
+
165
+dfn {
166
+  font-style: italic;
167
+}
168
+
169
+/**
170
+ * Add the correct background and color in IE 9-.
171
+ */
172
+
173
+mark {
174
+  background-color: #ff0;
175
+  color: #000;
176
+}
177
+
178
+/**
179
+ * Add the correct font size in all browsers.
180
+ */
181
+
182
+small {
183
+  font-size: 80%;
184
+}
185
+
186
+/**
187
+ * Prevent `sub` and `sup` elements from affecting the line height in
188
+ * all browsers.
189
+ */
190
+
191
+sub,
192
+sup {
193
+  font-size: 75%;
194
+  line-height: 0;
195
+  position: relative;
196
+  vertical-align: baseline;
197
+}
198
+
199
+sub {
200
+  bottom: -0.25em;
201
+}
202
+
203
+sup {
204
+  top: -0.5em;
205
+}
206
+
207
+/* Embedded content
208
+   ========================================================================== */
209
+
210
+/**
211
+ * Add the correct display in IE 9-.
212
+ */
213
+
214
+audio,
215
+video {
216
+  display: inline-block;
217
+}
218
+
219
+/**
220
+ * Add the correct display in iOS 4-7.
221
+ */
222
+
223
+audio:not([controls]) {
224
+  display: none;
225
+  height: 0;
226
+}
227
+
228
+/**
229
+ * Remove the border on images inside links in IE 10-.
230
+ */
231
+
232
+img {
233
+  border-style: none;
234
+}
235
+
236
+/**
237
+ * Hide the overflow in IE.
238
+ */
239
+
240
+svg:not(:root) {
241
+  overflow: hidden;
242
+}
243
+
244
+/* Forms
245
+   ========================================================================== */
246
+
247
+/**
248
+ * 1. Change the font styles in all browsers (opinionated).
249
+ * 2. Remove the margin in Firefox and Safari.
250
+ */
251
+
252
+button,
253
+input,
254
+optgroup,
255
+select,
256
+textarea {
257
+  font-family: sans-serif; /* 1 */
258
+  font-size: 100%; /* 1 */
259
+  line-height: 1.15; /* 1 */
260
+  margin: 0; /* 2 */
261
+}
262
+
263
+/**
264
+ * Show the overflow in IE.
265
+ * 1. Show the overflow in Edge.
266
+ */
267
+
268
+button,
269
+input { /* 1 */
270
+  overflow: visible;
271
+}
272
+
273
+/**
274
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
275
+ * 1. Remove the inheritance of text transform in Firefox.
276
+ */
277
+
278
+button,
279
+select { /* 1 */
280
+  text-transform: none;
281
+}
282
+
283
+/**
284
+ * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
285
+ *    controls in Android 4.
286
+ * 2. Correct the inability to style clickable types in iOS and Safari.
287
+ */
288
+
289
+button,
290
+html [type="button"], /* 1 */
291
+[type="reset"],
292
+[type="submit"] {
293
+  -webkit-appearance: button; /* 2 */
294
+}
295
+
296
+/**
297
+ * Remove the inner border and padding in Firefox.
298
+ */
299
+
300
+button::-moz-focus-inner,
301
+[type="button"]::-moz-focus-inner,
302
+[type="reset"]::-moz-focus-inner,
303
+[type="submit"]::-moz-focus-inner {
304
+  border-style: none;
305
+  padding: 0;
306
+}
307
+
308
+/**
309
+ * Restore the focus styles unset by the previous rule.
310
+ */
311
+
312
+button:-moz-focusring,
313
+[type="button"]:-moz-focusring,
314
+[type="reset"]:-moz-focusring,
315
+[type="submit"]:-moz-focusring {
316
+  outline: 1px dotted ButtonText;
317
+}
318
+
319
+/**
320
+ * Change the border, margin, and padding in all browsers (opinionated).
321
+ */
322
+
323
+fieldset {
324
+  border: 1px solid #c0c0c0;
325
+  margin: 0 2px;
326
+  padding: 0.35em 0.625em 0.75em;
327
+}
328
+
329
+/**
330
+ * 1. Correct the text wrapping in Edge and IE.
331
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
332
+ * 3. Remove the padding so developers are not caught out when they zero out
333
+ *    `fieldset` elements in all browsers.
334
+ */
335
+
336
+legend {
337
+  box-sizing: border-box; /* 1 */
338
+  color: inherit; /* 2 */
339
+  display: table; /* 1 */
340
+  max-width: 100%; /* 1 */
341
+  padding: 0; /* 3 */
342
+  white-space: normal; /* 1 */
343
+}
344
+
345
+/**
346
+ * 1. Add the correct display in IE 9-.
347
+ * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
348
+ */
349
+
350
+progress {
351
+  display: inline-block; /* 1 */
352
+  vertical-align: baseline; /* 2 */
353
+}
354
+
355
+/**
356
+ * Remove the default vertical scrollbar in IE.
357
+ */
358
+
359
+textarea {
360
+  overflow: auto;
361
+}
362
+
363
+/**
364
+ * 1. Add the correct box sizing in IE 10-.
365
+ * 2. Remove the padding in IE 10-.
366
+ */
367
+
368
+[type="checkbox"],
369
+[type="radio"] {
370
+  box-sizing: border-box; /* 1 */
371
+  padding: 0; /* 2 */
372
+}
373
+
374
+/**
375
+ * Correct the cursor style of increment and decrement buttons in Chrome.
376
+ */
377
+
378
+[type="number"]::-webkit-inner-spin-button,
379
+[type="number"]::-webkit-outer-spin-button {
380
+  height: auto;
381
+}
382
+
383
+/**
384
+ * 1. Correct the odd appearance in Chrome and Safari.
385
+ * 2. Correct the outline style in Safari.
386
+ */
387
+
388
+[type="search"] {
389
+  -webkit-appearance: textfield; /* 1 */
390
+  outline-offset: -2px; /* 2 */
391
+}
392
+
393
+/**
394
+ * Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
395
+ */
396
+
397
+[type="search"]::-webkit-search-cancel-button,
398
+[type="search"]::-webkit-search-decoration {
399
+  -webkit-appearance: none;
400
+}
401
+
402
+/**
403
+ * 1. Correct the inability to style clickable types in iOS and Safari.
404
+ * 2. Change font properties to `inherit` in Safari.
405
+ */
406
+
407
+::-webkit-file-upload-button {
408
+  -webkit-appearance: button; /* 1 */
409
+  font: inherit; /* 2 */
410
+}
411
+
412
+/* Interactive
413
+   ========================================================================== */
414
+
415
+/*
416
+ * Add the correct display in IE 9-.
417
+ * 1. Add the correct display in Edge, IE, and Firefox.
418
+ */
419
+
420
+details, /* 1 */
421
+menu {
422
+  display: block;
423
+}
424
+
425
+/*
426
+ * Add the correct display in all browsers.
427
+ */
428
+
429
+summary {
430
+  display: list-item;
431
+}
432
+
433
+/* Scripting
434
+   ========================================================================== */
435
+
436
+/**
437
+ * Add the correct display in IE 9-.
438
+ */
439
+
440
+canvas {
441
+  display: inline-block;
442
+}
443
+
444
+/**
445
+ * Add the correct display in IE.
446
+ */
447
+
448
+template {
449
+  display: none;
450
+}
451
+
452
+/* Hidden
453
+   ========================================================================== */
454
+
455
+/**
456
+ * Add the correct display in IE 10-.
457
+ */
458
+
459
+[hidden] {
460
+  display: none;
461
+}

+ 53
- 0
src/components/Hello/Hello.vue View File

@@ -0,0 +1,53 @@
1
+<template>
2
+  <div class="hello">
3
+    <h1>{{ msg }}</h1>
4
+    <h2>Essential Links</h2>
5
+    <ul>
6
+      <li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
7
+      <li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
8
+      <li><a href="https://gitter.im/vuejs/vue" target="_blank">Gitter Chat</a></li>
9
+      <li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
10
+      <br>
11
+      <li><a href="http://vuejs-templates.github.io/webpack/" target="_blank">Docs for This Template</a></li>
12
+    </ul>
13
+    <h2>Ecosystem</h2>
14
+    <ul>
15
+      <li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li>
16
+      <li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li>
17
+      <li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
18
+      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
19
+    </ul>
20
+  </div>
21
+</template>
22
+
23
+<script>
24
+export default {
25
+  name: 'hello',
26
+  data () {
27
+    return {
28
+      msg: 'Welcome to Your Vue.js App'
29
+    }
30
+  }
31
+}
32
+</script>
33
+
34
+<!-- Add "scoped" attribute to limit CSS to this component only -->
35
+<style scoped>
36
+h1, h2 {
37
+  font-weight: normal;
38
+}
39
+
40
+ul {
41
+  list-style-type: none;
42
+  padding: 0;
43
+}
44
+
45
+li {
46
+  display: inline-block;
47
+  margin: 0 10px;
48
+}
49
+
50
+a {
51
+  color: #42b983;
52
+}
53
+</style>

+ 0
- 21
src/main.js View File

@@ -1,21 +0,0 @@
1
-// The Vue build version to load with the `import` command
2
-// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3
-import Vue from 'vue'
4
-import App from './App'
5
-import router from './router'
6
-import Vant from 'vant'
7
-import 'vant/lib/vant-css/index.css'
8
-import Ajax from './util/ajax'
9
-import api from './util/api'
10
-
11
-Vue.use(Vant)
12
-Vue.config.productionTip = false
13
-Vue.prototype.$api = api
14
-Vue.prototype.$ajax = Ajax
15
-/* eslint-disable no-new */
16
-new Vue({
17
-  el: '#app',
18
-  router,
19
-  components: { App },
20
-  template: '<App/>'
21
-})

+ 29
- 0
src/module/detail/App.vue View File

@@ -0,0 +1,29 @@
1
+<template>
2
+  <div id="app">
3
+    <img src="./images/logo.png">
4
+    <div>详情内容</div>
5
+  </div>
6
+</template>
7
+
8
+<script>
9
+  import 'common/css/reset.css';
10
+  import Hello from 'components/Hello/Hello'
11
+
12
+  export default {
13
+    name: 'app',
14
+    components: {
15
+      Hello
16
+    }
17
+  }
18
+</script>
19
+
20
+<style>
21
+  #app {
22
+    font-family: 'Avenir', Helvetica, Arial, sans-serif;
23
+    -webkit-font-smoothing: antialiased;
24
+    -moz-osx-font-smoothing: grayscale;
25
+    text-align: center;
26
+    color: #2c3e50;
27
+    margin-top: 60px;
28
+  }
29
+</style>

+ 11
- 0
src/module/detail/detail.html View File

@@ -0,0 +1,11 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <meta charset="utf-8">
5
+  <title>detail</title>
6
+</head>
7
+<body>
8
+<div id="app"></div>
9
+<!-- built files will be auto injected -->
10
+</body>
11
+</html>

+ 9
- 0
src/module/detail/detail.js View File

@@ -0,0 +1,9 @@
1
+import Vue from 'vue'
2
+import App from './App'
3
+
4
+/* eslint-disable no-new */
5
+new Vue({
6
+  el: '#app',
7
+  template: '<App/>',
8
+  components: { App }
9
+})

BIN
src/module/detail/images/logo.png View File


+ 12
- 0
src/module/index.html View File

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <title></title>
6
+</head>
7
+<body>
8
+    <script>
9
+        location.href = "module/index.html";
10
+    </script>
11
+</body>
12
+</html>

+ 0
- 0
src/module/index.js View File


+ 29
- 0
src/module/index/App.vue View File

@@ -0,0 +1,29 @@
1
+<template>
2
+  <div id="app">
3
+    <img src="./images/logo.png">
4
+    <hello></hello>
5
+  </div>
6
+</template>
7
+
8
+<script>
9
+  import 'common/css/reset.css';
10
+  import Hello from 'components/Hello/Hello'
11
+
12
+  export default {
13
+    name: 'app',
14
+    components: {
15
+      Hello
16
+    }
17
+  }
18
+</script>
19
+
20
+<style>
21
+  #app {
22
+    font-family: 'Avenir', Helvetica, Arial, sans-serif;
23
+    -webkit-font-smoothing: antialiased;
24
+    -moz-osx-font-smoothing: grayscale;
25
+    text-align: center;
26
+    color: #2c3e50;
27
+    margin-top: 60px;
28
+  }
29
+</style>

BIN
src/module/index/images/logo.png View File


+ 11
- 0
src/module/index/index.html View File

@@ -0,0 +1,11 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <meta charset="utf-8">
5
+  <title>vue-demo</title>
6
+</head>
7
+<body>
8
+<div id="app"></div>
9
+<!-- built files will be auto injected -->
10
+</body>
11
+</html>

+ 9
- 0
src/module/index/index.js View File

@@ -0,0 +1,9 @@
1
+import Vue from 'vue'
2
+import App from './App'
3
+
4
+/* eslint-disable no-new */
5
+new Vue({
6
+  el: '#app',
7
+  template: '<App/>',
8
+  components: { App }
9
+})

+ 0
- 36
src/page/test/test.vue View File

@@ -1,36 +0,0 @@
1
-<template>
2
-    <div>
3
-        <van-button type="default">默认按钮</van-button>
4
-        <van-button type="primary">主要按钮</van-button>
5
-        <van-button type="warning">警告按钮</van-button>
6
-        <van-button type="danger">危险按钮</van-button>
7
-    </div>
8
-</template>
9
-
10
-<script>
11
-export default {
12
-  data () {
13
-    return {
14
-      a: '1'
15
-    }
16
-  },
17
-  mounted () {
18
-    console.log(this)
19
-    this.$ajax(this.$api.test.area.url, {
20
-      method: this.$api.test.area.method,
21
-      data: {
22
-        caseid: 1,
23
-        id: 2
24
-      }
25
-    })
26
-      .then(res => {
27
-        console.log(res)
28
-      }).catch(msg => {
29
-        return false
30
-      })
31
-  }
32
-}
33
-</script>
34
-
35
-<style lang="scss" scoped>
36
-</style>

+ 0
- 16
src/router/index.js View File

@@ -1,16 +0,0 @@
1
-import Vue from 'vue'
2
-import Router from 'vue-router'
3
-const test = () =>
4
-  import(/* webpackChunkName: "test" */
5
-    '../page/test/test')
6
-Vue.use(Router)
7
-
8
-export default new Router({
9
-  routes: [
10
-    {
11
-      path: '/test',
12
-      name: 'test',
13
-      component: test
14
-    }
15
-  ]
16
-})

+ 0
- 12
src/style/base.scss View File

@@ -1,12 +0,0 @@
1
-// 公用css样式
2
-$baseURl: '../../assets/images'; 
3
-$globalBg: #ffffff;
4
-$partialBg: #ffffff;
5
-$globalColor: #000000;
6
-$globalFont: 14px;
7
-$health: #68CAB0;
8
-$education: #51BBFF;
9
-$sport: #68CAB0;
10
-$healthT:  linear-gradient(-225deg, #68CAB0 0%, #C3EAD2 100%);
11
-$educationT: linear-gradient(-225deg, #4DB9FF 0%, rgba(127,194,247,0.59) 100%);
12
-$sportT: linear-gradient(-225deg, #68CAB0 0%, #C3EAD2 100%);

+ 0
- 169
src/style/main.scss View File

@@ -1,169 +0,0 @@
1
-@charset "utf-8";
2
-
3
-html,body {
4
-    width: 100%;
5
-    height: 100%;
6
-    -webkit-text-size-adjust: 100%;
7
-    position: relative;
8
-    color: #333;
9
-    overflow-x: hidden;
10
-    font-size: 100px;
11
-}
12
-
13
-@media screen and (max-width:320px) {
14
-    html,body {
15
-        font-size: 85px;
16
-    }
17
-}
18
-
19
-@media screen and (min-width:375px) {
20
-    html,body {
21
-        font-size: 100px;
22
-    }
23
-}
24
-
25
-@media screen and (min-width:414px) {
26
-    html,body {
27
-        font-size: 110px;
28
-    }
29
-}
30
-
31
-* {
32
-    margin: 0;
33
-    padding: 0;
34
-    font-family: "微软雅黑";
35
-    -webkit-tap-highlight-color: rgba(255,0,0,0);
36
-    -webkit-font-smoothing: antialiased;
37
-}
38
-
39
-body * {
40
-    font-size: .14rem;
41
-}
42
-
43
-a {
44
-    text-decoration: none;
45
-}
46
-
47
-a:hover {
48
-    cursor: pointer;
49
-}
50
-
51
-em {
52
-    font-style: normal;
53
-}
54
-
55
-li {
56
-    list-style: none;
57
-}
58
-
59
-img {
60
-    border: 0;
61
-    vertical-align: middle;
62
-}
63
-
64
-table {
65
-    border-collapse: collapse;
66
-    border-spacing: 0;
67
-}
68
-
69
-p {
70
-    word-wrap: break-word;
71
-}
72
-
73
-b {
74
-    font-weight: normal;
75
-}
76
-
77
-input,textarea {
78
-    border: 0;
79
-    -webkit-appearance: none;
80
-}
81
-
82
-input[type=input] {
83
-    -webkit-appearance: none;
84
-}
85
-
86
-input[type=checkbox] {
87
-    -webkit-appearance: checkbox;
88
-}
89
-
90
-.text-overflow-ellipsis {
91
-    overflow: hidden;
92
-    white-space: nowrap;
93
-    text-overflow: ellipsis;
94
-}
95
-
96
-.centerLabel {
97
-    display: block;
98
-    position: absolute;
99
-    left: 50%;
100
-    top: 50%;
101
-    transform: translate(-50%,-50%);
102
-    -webkit-transform: translate(-50%,-50%);
103
-}
104
-
105
-.flex-h {
106
-    display: flex;
107
-    display: -webkit-flex;
108
-}
109
-
110
-.flex-v {
111
-    display: flex;
112
-    display: -webkit-flex;
113
-    flex-direction: column;
114
-    -webkit-flex-direction: column;
115
-}
116
-
117
-.flex-item {
118
-    flex: 1;
119
-    -webkit-flex: 1;
120
-    position: relative;
121
-    overflow: hidden;
122
-}
123
-
124
-*[class*="text-overflowEllipsis-line"] {
125
-    overflow: hidden;
126
-    text-overflow: ellipsis;
127
-    display: -webkit-box;
128
-    -webkit-box-orient: vertical;
129
-}
130
-
131
-.text-overflowEllipsis-line2 {
132
-    -webkit-line-clamp: 2;
133
-}
134
-
135
-.text-overflowEllipsis-line3 {
136
-    -webkit-line-clamp: 3;
137
-}
138
-
139
-.text-overflowEllipsis-line4 {
140
-    -webkit-line-clamp: 4;
141
-}
142
-
143
-*[class*="overflow-scroll-y"] {
144
-    overflow-x: hidden;
145
-    overflow-y: scroll;
146
-    -webkit-overflow-scrolling: touch;
147
-}
148
-
149
-*[class*="overflow-scroll-x"] {
150
-    overflow-y: hidden;
151
-    overflow-x: scroll;
152
-    -webkit-overflow-scrolling: touch;
153
-}
154
-
155
-.overflow-scroll-y-3d,.overflow-scroll-x-3d {
156
-    transform: translateZ(0);
157
-    -webkit-transform: translateZ(0);
158
-}
159
-
160
-.overflow-scroll-x::-webkit-scrollbar,.overflow-scroll-x-3d::-webkit-scrollbar {
161
-    width: 0;
162
-    height: 0;
163
-    color: transparent;
164
-    display: none;
165
-}
166
-
167
-input:focus,textarea:focus,select:focus {
168
-    outline: none;
169
-}

+ 0
- 53
src/style/mixin.scss View File

@@ -1,53 +0,0 @@
1
-// 圆角
2
-@mixin BorderRadius($radius: 50%) {
3
-    border-radius: $radius;
4
-}
5
-
6
-// 阴影
7
-@mixin layoutBoxShadaw($x: 2px, $y: 2px, $blur: 14px, $color: #ABABAB) {
8
-    box-shadow: $x $y $blur $color;
9
-}
10
-
11
-// 定位
12
-@mixin absoluteCenter($left: 50%, $top: 50%, $x: -50%, $y: -50%) {
13
-    position: absolute;
14
-    left: $left;
15
-    top: $top;
16
-    transform: translate($x, $y)
17
-}
18
-
19
-// 浮动布局
20
-@mixin float($float:left) {
21
-    float: $float;
22
-}
23
-
24
-// flex布局
25
-@mixin flexLayout ($jc: center, $ai: center, $ff: row nowrap) {
26
-    display: flex;
27
-    justify-content: $jc;
28
-    align-items: $ai;
29
-    flex-flow: $ff;
30
-}
31
-
32
-// 布局pandding
33
-@mixin layoutPadding($top:0, $right:0, $bottom:0, $left:0) {
34
-    padding-top: $top;
35
-    padding-bottom: $bottom;
36
-    padding-right: $right;
37
-    padding-left: $left;
38
-}
39
-
40
-// 布局margin
41
-@mixin layoutMargin($top:0, $right:auto, $bottom:0, $left:auto) {
42
-    margin-top: $top;
43
-    margin-bottom: $bottom;
44
-    margin-right: $right;
45
-    margin-left: $left;
46
-}
47
-
48
-// 单行溢出省略号
49
-@mixin textOverflow(){
50
-  overflow: hidden;
51
-  text-overflow:ellipsis;
52
-  white-space: nowrap;
53
-}

+ 0
- 60
src/util/ajax.js View File

@@ -1,60 +0,0 @@
1
-import axios from 'axios'
2
-import { Toast } from 'vant'
3
-import qs from 'qs'
4
-
5
-const Axios = axios.create({
6
-  timeout: 60000,
7
-  responseType: 'json',
8
-  withCredentials: true,
9
-  headers: {}
10
-})
11
-
12
-Axios.interceptors.request.use((config) => {
13
-  Toast.loading({
14
-    duration: 0, // 持续展示 toast
15
-    forbidClick: true, // 禁用背景点击
16
-    loadingType: 'spinner',
17
-    color: 'white',
18
-    message: '请求中'
19
-  })
20
-  // 处理请求data,若为get请求,拼到url后面,若为post请求,直接添加到body中
21
-  let data = qs.stringify(config.data)
22
-  if (config.method === 'get' || config.method === 'GET') {
23
-    // 判断是通过斜杠传参还是通过query传参
24
-    if (config.url.indexOf(':') > -1) {
25
-      if (typeof config.data === 'object') {
26
-        config.url = Object.keys(config.data).reduce((url, k) => { // 此方法对每个元素进行处理
27
-          const re = new RegExp(`:${k}(?!w)`, 'i')
28
-          return url.replace(re, config.data[k])
29
-        }, config.url)
30
-      } else {
31
-        config.url = config.url.slice(0, config.url.indexOf(':')) + data
32
-      }
33
-    } else {
34
-      config.url += '?' + data
35
-    }
36
-  }
37
-  return config
38
-}, (error) => {
39
-  console.log(error)
40
-})
41
-
42
-Axios.interceptors.response.use((res) => {
43
-  setTimeout(() => {
44
-    Toast.clear()
45
-  }, 500)
46
-  if (res.status === 200) {
47
-    return res.data
48
-  } else {
49
-    Toast.fail('请求失败,状态码为' + res.status)
50
-    return res.data
51
-  }
52
-}, (error) => {
53
-  Toast.fail('请求失败,服务器异常')
54
-  setTimeout(() => {
55
-    Toast.clear()
56
-  }, 500)
57
-  console.log(error)
58
-})
59
-
60
-export default Axios

+ 0
- 11
src/util/api.js View File

@@ -1,11 +0,0 @@
1
-const baseUrl = process.env.NODE_ENV === 'development' ? '/api' : 'http://192.168.0.62:8080/api'
2
-// const baseUrl = '/check-api'
3
-const $api = {
4
-  test: { // 测试接口
5
-    area: {
6
-      method: 'post',
7
-      url: `${baseUrl}/machine/area`
8
-    }
9
-  }
10
-}
11
-export default $api

+ 0
- 27
test/e2e/custom-assertions/elementCount.js View File

@@ -1,27 +0,0 @@
1
-// A custom Nightwatch assertion.
2
-// The assertion name is the filename.
3
-// Example usage:
4
-//
5
-//   browser.assert.elementCount(selector, count)
6
-//
7
-// For more information on custom assertions see:
8
-// http://nightwatchjs.org/guide#writing-custom-assertions
9
-
10
-exports.assertion = function (selector, count) {
11
-  this.message = 'Testing if element <' + selector + '> has count: ' + count
12
-  this.expected = count
13
-  this.pass = function (val) {
14
-    return val === this.expected
15
-  }
16
-  this.value = function (res) {
17
-    return res.value
18
-  }
19
-  this.command = function (cb) {
20
-    var self = this
21
-    return this.api.execute(function (selector) {
22
-      return document.querySelectorAll(selector).length
23
-    }, [selector], function (res) {
24
-      cb.call(self, res)
25
-    })
26
-  }
27
-}

+ 0
- 46
test/e2e/nightwatch.conf.js View File

@@ -1,46 +0,0 @@
1
-require('babel-register')
2
-var config = require('../../config')
3
-
4
-// http://nightwatchjs.org/gettingstarted#settings-file
5
-module.exports = {
6
-  src_folders: ['test/e2e/specs'],
7
-  output_folder: 'test/e2e/reports',
8
-  custom_assertions_path: ['test/e2e/custom-assertions'],
9
-
10
-  selenium: {
11
-    start_process: true,
12
-    server_path: require('selenium-server').path,
13
-    host: '127.0.0.1',
14
-    port: 4444,
15
-    cli_args: {
16
-      'webdriver.chrome.driver': require('chromedriver').path
17
-    }
18
-  },
19
-
20
-  test_settings: {
21
-    default: {
22
-      selenium_port: 4444,
23
-      selenium_host: 'localhost',
24
-      silent: true,
25
-      globals: {
26
-        devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
27
-      }
28
-    },
29
-
30
-    chrome: {
31
-      desiredCapabilities: {
32
-        browserName: 'chrome',
33
-        javascriptEnabled: true,
34
-        acceptSslCerts: true
35
-      }
36
-    },
37
-
38
-    firefox: {
39
-      desiredCapabilities: {
40
-        browserName: 'firefox',
41
-        javascriptEnabled: true,
42
-        acceptSslCerts: true
43
-      }
44
-    }
45
-  }
46
-}

+ 0
- 48
test/e2e/runner.js View File

@@ -1,48 +0,0 @@
1
-// 1. start the dev server using production config
2
-process.env.NODE_ENV = 'testing'
3
-
4
-const webpack = require('webpack')
5
-const DevServer = require('webpack-dev-server')
6
-
7
-const webpackConfig = require('../../build/webpack.prod.conf')
8
-const devConfigPromise = require('../../build/webpack.dev.conf')
9
-
10
-let server
11
-
12
-devConfigPromise.then(devConfig => {
13
-  const devServerOptions = devConfig.devServer
14
-  const compiler = webpack(webpackConfig)
15
-  server = new DevServer(compiler, devServerOptions)
16
-  const port = devServerOptions.port
17
-  const host = devServerOptions.host
18
-  return server.listen(port, host)
19
-})
20
-.then(() => {
21
-  // 2. run the nightwatch test suite against it
22
-  // to run in additional browsers:
23
-  //    1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
24
-  //    2. add it to the --env flag below
25
-  // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
26
-  // For more information on Nightwatch's config file, see
27
-  // http://nightwatchjs.org/guide#settings-file
28
-  let opts = process.argv.slice(2)
29
-  if (opts.indexOf('--config') === -1) {
30
-    opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
31
-  }
32
-  if (opts.indexOf('--env') === -1) {
33
-    opts = opts.concat(['--env', 'chrome'])
34
-  }
35
-
36
-  const spawn = require('cross-spawn')
37
-  const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
38
-
39
-  runner.on('exit', function (code) {
40
-    server.close()
41
-    process.exit(code)
42
-  })
43
-
44
-  runner.on('error', function (err) {
45
-    server.close()
46
-    throw err
47
-  })
48
-})

+ 0
- 19
test/e2e/specs/test.js View File

@@ -1,19 +0,0 @@
1
-// For authoring Nightwatch tests, see
2
-// http://nightwatchjs.org/guide#usage
3
-
4
-module.exports = {
5
-  'default e2e tests': function (browser) {
6
-    // automatically uses dev Server port from /config.index.js
7
-    // default: http://localhost:8080
8
-    // see nightwatch.conf.js
9
-    const devServer = browser.globals.devServerURL
10
-
11
-    browser
12
-      .url(devServer)
13
-      .waitForElementVisible('#app', 5000)
14
-      .assert.elementPresent('.hello')
15
-      .assert.containsText('h1', 'Welcome to Your Vue.js App')
16
-      .assert.elementCount('img', 1)
17
-      .end()
18
-  }
19
-}

+ 0
- 7
test/unit/.eslintrc View File

@@ -1,7 +0,0 @@
1
-{
2
-  "env": { 
3
-    "jest": true
4
-  },
5
-  "globals": { 
6
-  }
7
-}

+ 0
- 30
test/unit/jest.conf.js View File

@@ -1,30 +0,0 @@
1
-const path = require('path')
2
-
3
-module.exports = {
4
-  rootDir: path.resolve(__dirname, '../../'),
5
-  moduleFileExtensions: [
6
-    'js',
7
-    'json',
8
-    'vue'
9
-  ],
10
-  moduleNameMapper: {
11
-    '^@/(.*)$': '<rootDir>/src/$1'
12
-  },
13
-  transform: {
14
-    '^.+\\.js$': '<rootDir>/node_modules/babel-jest',
15
-    '.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
16
-  },
17
-  testPathIgnorePatterns: [
18
-    '<rootDir>/test/e2e'
19
-  ],
20
-  snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
21
-  setupFiles: ['<rootDir>/test/unit/setup'],
22
-  mapCoverage: true,
23
-  coverageDirectory: '<rootDir>/test/unit/coverage',
24
-  collectCoverageFrom: [
25
-    'src/**/*.{js,vue}',
26
-    '!src/main.js',
27
-    '!src/router/index.js',
28
-    '!**/node_modules/**'
29
-  ]
30
-}

+ 0
- 3
test/unit/setup.js View File

@@ -1,3 +0,0 @@
1
-import Vue from 'vue'
2
-
3
-Vue.config.productionTip = false

+ 0
- 11
test/unit/specs/HelloWorld.spec.js View File

@@ -1,11 +0,0 @@
1
-import Vue from 'vue'
2
-import HelloWorld from '@/components/HelloWorld'
3
-
4
-describe('HelloWorld.vue', () => {
5
-  it('should render correct contents', () => {
6
-    const Constructor = Vue.extend(HelloWorld)
7
-    const vm = new Constructor().$mount()
8
-    expect(vm.$el.querySelector('.hello h1').textContent)
9
-      .toEqual('Welcome to Your Vue.js App')
10
-  })
11
-})