许成详 6 vuotta sitten
vanhempi
commit
aa4605530b

+ 18
- 0
.babelrc Näytä tiedosto

@@ -0,0 +1,18 @@
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
+  }
18
+}

+ 9
- 0
.editorconfig Näytä tiedosto

@@ -0,0 +1,9 @@
1
+root = true
2
+
3
+[*]
4
+charset = utf-8
5
+indent_style = space
6
+indent_size = 2
7
+end_of_line = lf
8
+insert_final_newline = true
9
+trim_trailing_whitespace = true

+ 5
- 0
.eslintignore Näytä tiedosto

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

+ 29
- 0
.eslintrc.js Näytä tiedosto

@@ -0,0 +1,29 @@
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
.gitignore Näytä tiedosto

@@ -0,0 +1,17 @@
1
+.DS_Store
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

+ 10
- 0
.postcssrc.js Näytä tiedosto

@@ -0,0 +1,10 @@
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
+}

+ 41
- 0
build/build.js Näytä tiedosto

@@ -0,0 +1,41 @@
1
+'use strict'
2
+require('./check-versions')()
3
+
4
+process.env.NODE_ENV = 'production'
5
+
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')
13
+
14
+const spinner = ora('building for production...')
15
+spinner.start()
16
+
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
+    }
34
+
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
+  })
41
+})

+ 54
- 0
build/check-versions.js Näytä tiedosto

@@ -0,0 +1,54 @@
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
+}

+ 101
- 0
build/utils.js Näytä tiedosto

@@ -0,0 +1,101 @@
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')
6
+
7
+exports.assetsPath = function (_path) {
8
+  const assetsSubDirectory = process.env.NODE_ENV === 'production'
9
+    ? config.build.assetsSubDirectory
10
+    : config.dev.assetsSubDirectory
11
+
12
+  return path.posix.join(assetsSubDirectory, _path)
13
+}
14
+
15
+exports.cssLoaders = function (options) {
16
+  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
+  // 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
+    }
44
+
45
+    // Extract CSS when that option is specified
46
+    // (which is the case during production build)
47
+    if (options.extract) {
48
+      return ExtractTextPlugin.extract({
49
+        use: loaders,
50
+        fallback: 'vue-style-loader'
51
+      })
52
+    } else {
53
+      return ['vue-style-loader'].concat(loaders)
54
+    }
55
+  }
56
+
57
+  // https://vue-loader.vuejs.org/en/configurations/extract-css.html
58
+  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')
66
+  }
67
+}
68
+
69
+// Generate loaders for standalone style files (outside of .vue)
70
+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]
76
+    output.push({
77
+      test: new RegExp('\\.' + extension + '$'),
78
+      use: loader
79
+    })
80
+  }
81
+
82
+  return output
83
+}
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
+}

+ 22
- 0
build/vue-loader.conf.js Näytä tiedosto

@@ -0,0 +1,22 @@
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
+}

+ 92
- 0
build/webpack.base.conf.js Näytä tiedosto

@@ -0,0 +1,92 @@
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')
6
+
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
+})
21
+
22
+module.exports = {
23
+  context: path.resolve(__dirname, '../'),
24
+  entry: {
25
+    app: './src/main.js'
26
+  },
27
+  output: {
28
+    path: config.build.assetsRoot,
29
+    filename: '[name].js',
30
+    publicPath: process.env.NODE_ENV === 'production'
31
+      ? config.build.assetsPublicPath
32
+      : config.dev.assetsPublicPath
33
+  },
34
+  resolve: {
35
+    extensions: ['.js', '.vue', '.json'],
36
+    alias: {
37
+      'vue$': 'vue/dist/vue.esm.js',
38
+      '@': resolve('src'),
39
+    }
40
+  },
41
+  module: {
42
+    rules: [
43
+      ...(config.dev.useEslint ? [createLintingRule()] : []),
44
+      {
45
+        test: /\.vue$/,
46
+        loader: 'vue-loader',
47
+        options: vueLoaderConfig
48
+      },
49
+      {
50
+        test: /\.js$/,
51
+        loader: 'babel-loader',
52
+        include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
53
+      },
54
+      {
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
+        }
61
+      },
62
+      {
63
+        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
64
+        loader: 'url-loader',
65
+        options: {
66
+          limit: 10000,
67
+          name: utils.assetsPath('media/[name].[hash:7].[ext]')
68
+        }
69
+      },
70
+      {
71
+        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
72
+        loader: 'url-loader',
73
+        options: {
74
+          limit: 10000,
75
+          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
76
+        }
77
+      }
78
+    ]
79
+  },
80
+  node: {
81
+    // prevent webpack from injecting useless setImmediate polyfill because Vue
82
+    // source contains it (although only uses it if it's native).
83
+    setImmediate: false,
84
+    // prevent webpack from injecting mocks to Node native modules
85
+    // that does not make sense for the client
86
+    dgram: 'empty',
87
+    fs: 'empty',
88
+    net: 'empty',
89
+    tls: 'empty',
90
+    child_process: 'empty'
91
+  }
92
+}

+ 95
- 0
build/webpack.dev.conf.js Näytä tiedosto

@@ -0,0 +1,95 @@
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, {
17
+  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
+    }
46
+  },
47
+  plugins: [
48
+    new webpack.DefinePlugin({
49
+      'process.env': require('../config/dev.env')
50
+    }),
51
+    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
+    ])
68
+  ]
69
+})
70
+
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
81
+
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
+      }))
91
+
92
+      resolve(devWebpackConfig)
93
+    }
94
+  })
95
+})

+ 149
- 0
build/webpack.prod.conf.js Näytä tiedosto

@@ -0,0 +1,149 @@
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')
13
+
14
+const env = process.env.NODE_ENV === 'testing'
15
+  ? require('../config/test.env')
16
+  : require('../config/prod.env')
17
+
18
+const webpackConfig = merge(baseWebpackConfig, {
19
+  module: {
20
+    rules: utils.styleLoaders({
21
+      sourceMap: config.build.productionSourceMap,
22
+      extract: true,
23
+      usePostCSS: true
24
+    })
25
+  },
26
+  devtool: config.build.productionSourceMap ? config.build.devtool : false,
27
+  output: {
28
+    path: config.build.assetsRoot,
29
+    filename: utils.assetsPath('js/[name].[chunkhash].js'),
30
+    chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
31
+  },
32
+  plugins: [
33
+    // http://vuejs.github.io/vue-loader/en/workflow/production.html
34
+    new webpack.DefinePlugin({
35
+      'process.env': env
36
+    }),
37
+    new UglifyJsPlugin({
38
+      uglifyOptions: {
39
+        compress: {
40
+          warnings: false
41
+        }
42
+      },
43
+      sourceMap: config.build.productionSourceMap,
44
+      parallel: true
45
+    }),
46
+    // 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
+    }),
62
+    // generate dist index.html with correct asset hash for caching.
63
+    // you can customize output by editing /index.html
64
+    // 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
+    // split vendor js into its own file
86
+    new webpack.optimize.CommonsChunkPlugin({
87
+      name: 'vendor',
88
+      minChunks (module) {
89
+        // any required modules inside node_modules are extracted to vendor
90
+        return (
91
+          module.resource &&
92
+          /\.js$/.test(module.resource) &&
93
+          module.resource.indexOf(
94
+            path.join(__dirname, '../node_modules')
95
+          ) === 0
96
+        )
97
+      }
98
+    }),
99
+    // extract webpack runtime and module manifest to its own file in order to
100
+    // prevent vendor hash from being updated whenever app bundle is updated
101
+    new webpack.optimize.CommonsChunkPlugin({
102
+      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
+    ])
123
+  ]
124
+})
125
+
126
+if (config.build.productionGzip) {
127
+  const CompressionWebpackPlugin = require('compression-webpack-plugin')
128
+
129
+  webpackConfig.plugins.push(
130
+    new CompressionWebpackPlugin({
131
+      asset: '[path].gz[query]',
132
+      algorithm: 'gzip',
133
+      test: new RegExp(
134
+        '\\.(' +
135
+        config.build.productionGzipExtensions.join('|') +
136
+        ')$'
137
+      ),
138
+      threshold: 10240,
139
+      minRatio: 0.8
140
+    })
141
+  )
142
+}
143
+
144
+if (config.build.bundleAnalyzerReport) {
145
+  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
146
+  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
147
+}
148
+
149
+module.exports = webpackConfig

+ 7
- 0
config/dev.env.js Näytä tiedosto

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

+ 81
- 0
config/index.js Näytä tiedosto

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

+ 4
- 0
config/prod.env.js Näytä tiedosto

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

+ 7
- 0
config/test.env.js Näytä tiedosto

@@ -0,0 +1,7 @@
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
+})

+ 13
- 0
index.html Näytä tiedosto

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

+ 15645
- 0
package-lock.json
File diff suppressed because it is too large
Näytä tiedosto


+ 94
- 0
package.json Näytä tiedosto

@@ -0,0 +1,94 @@
1
+{
2
+  "name": "myvue",
3
+  "version": "1.0.0",
4
+  "description": "A Vue.js project",
5
+  "author": "xuchengxiang <xcx18267901393@dingtalk.com>",
6
+  "private": true,
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",
14
+    "build": "node build/build.js"
15
+  },
16
+  "dependencies": {
17
+    "axios": "^0.18.0",
18
+    "mescroll.js": "^1.3.8",
19
+    "vant": "^1.4.5",
20
+    "vue": "^2.5.2",
21
+    "vue-awesome-swiper": "^3.1.3",
22
+    "vue-router": "^3.0.1",
23
+    "vuex": "^3.0.1"
24
+  },
25
+  "devDependencies": {
26
+    "autoprefixer": "^7.1.2",
27
+    "babel-core": "^6.22.1",
28
+    "babel-eslint": "^8.2.1",
29
+    "babel-helper-vue-jsx-merge-props": "^2.0.3",
30
+    "babel-jest": "^21.0.2",
31
+    "babel-loader": "^7.1.1",
32
+    "babel-plugin-dynamic-import-node": "^1.2.0",
33
+    "babel-plugin-syntax-jsx": "^6.18.0",
34
+    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
35
+    "babel-plugin-transform-runtime": "^6.22.0",
36
+    "babel-plugin-transform-vue-jsx": "^3.5.0",
37
+    "babel-preset-env": "^1.3.2",
38
+    "babel-preset-stage-2": "^6.22.0",
39
+    "babel-register": "^6.22.0",
40
+    "chalk": "^2.0.1",
41
+    "chromedriver": "^2.27.2",
42
+    "copy-webpack-plugin": "^4.0.1",
43
+    "cross-spawn": "^5.0.1",
44
+    "css-loader": "^0.28.0",
45
+    "eslint": "^4.15.0",
46
+    "eslint-config-standard": "^10.2.1",
47
+    "eslint-friendly-formatter": "^3.0.0",
48
+    "eslint-loader": "^1.7.1",
49
+    "eslint-plugin-import": "^2.7.0",
50
+    "eslint-plugin-node": "^5.2.0",
51
+    "eslint-plugin-promise": "^3.4.0",
52
+    "eslint-plugin-standard": "^3.0.1",
53
+    "eslint-plugin-vue": "^4.0.0",
54
+    "extract-text-webpack-plugin": "^3.0.0",
55
+    "file-loader": "^1.1.4",
56
+    "friendly-errors-webpack-plugin": "^1.6.1",
57
+    "html-webpack-plugin": "^2.30.1",
58
+    "jest": "^22.0.4",
59
+    "jest-serializer-vue": "^0.3.0",
60
+    "nightwatch": "^0.9.12",
61
+    "node-notifier": "^5.1.2",
62
+    "node-sass": "^4.10.0",
63
+    "optimize-css-assets-webpack-plugin": "^3.2.0",
64
+    "ora": "^1.2.0",
65
+    "portfinder": "^1.0.13",
66
+    "postcss-import": "^11.0.0",
67
+    "postcss-loader": "^2.0.8",
68
+    "postcss-url": "^7.2.1",
69
+    "rimraf": "^2.6.0",
70
+    "sass-loader": "^7.1.0",
71
+    "selenium-server": "^3.0.1",
72
+    "semver": "^5.3.0",
73
+    "shelljs": "^0.7.6",
74
+    "uglifyjs-webpack-plugin": "^1.1.1",
75
+    "url-loader": "^0.5.8",
76
+    "vue-jest": "^1.0.2",
77
+    "vue-loader": "^13.3.0",
78
+    "vue-style-loader": "^3.1.2",
79
+    "vue-template-compiler": "^2.5.2",
80
+    "webpack": "^3.6.0",
81
+    "webpack-bundle-analyzer": "^2.9.0",
82
+    "webpack-dev-server": "^2.9.1",
83
+    "webpack-merge": "^4.1.0"
84
+  },
85
+  "engines": {
86
+    "node": ">= 6.0.0",
87
+    "npm": ">= 3.0.0"
88
+  },
89
+  "browserslist": [
90
+    "> 1%",
91
+    "last 2 versions",
92
+    "not ie <= 8"
93
+  ]
94
+}

+ 21
- 0
src/App.vue Näytä tiedosto

@@ -0,0 +1,21 @@
1
+<template>
2
+  <div id="app">
3
+    <router-view/>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+import './assets/css/reset.css'
9
+export default {
10
+  name: 'App'
11
+}
12
+</script>
13
+
14
+<style>
15
+#app {
16
+  width: 100%;
17
+  height: 100%;
18
+  position: relative;
19
+  overflow: hidden;
20
+}
21
+</style>

+ 48
- 0
src/assets/css/reset.css Näytä tiedosto

@@ -0,0 +1,48 @@
1
+@charset"utf-8";
2
+html,body{width:100%;height:100%;-webkit-text-size-adjust:100%;position:relative;overflow-x:hidden;font-size:100px;}
3
+
4
+@media screen and(max-width:320px){html,body{font-size:85px;}}
5
+@media screen and(min-width:375px){html,body{font-size:100px;}}
6
+@media screen and(min-width:414px){html,body{font-size:110px;}}
7
+
8
+*{margin:0;padding:0;font-family:"微软雅黑";-webkit-tap-highlight-color:rgba(255,0,0,0);-webkit-font-smoothing:antialiased;}
9
+body *{font-size:.15rem;}
10
+a{text-decoration:none;}
11
+a:hover{cursor:pointer;}
12
+em{font-style:normal;}
13
+li{list-style:none;}
14
+img{border:0;vertical-align:middle;}
15
+table{border-collapse:collapse;border-spacing:0;}
16
+p{word-wrap:break-word;}
17
+b{font-weight:normal;}
18
+input,textarea{border:0;-webkit-appearance:none;}
19
+input[type=input]{-webkit-appearance:none;}
20
+input[type=checkbox]{-webkit-appearance:checkbox;}
21
+input:focus,textarea:focus,select:focus{outline:none;}
22
+textarea{resize:none;}
23
+select{direction:rtl;}
24
+select option{direction:ltr;}
25
+::-webkit-scrollbar{display:none;}
26
+
27
+.text-overflow-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
28
+.centerLabel{display:block;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);}
29
+.flex-h{display:flex;display:-webkit-flex;}
30
+.flex-v{display:flex;display:-webkit-flex;flex-direction:column;-webkit-flex-direction:column;}
31
+.flex-item{flex:1;-webkit-flex:1;position:relative;overflow:hidden;}
32
+*[class*="text-overflowEllipsis-line"]{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;}
33
+.text-overflowEllipsis-line2{-webkit-line-clamp:2;}
34
+.text-overflowEllipsis-line3{-webkit-line-clamp:3;}
35
+.text-overflowEllipsis-line4{-webkit-line-clamp:4;}
36
+*[class*="overflow-scroll-y"]{overflow-x:hidden;overflow-y:scroll;-webkit-overflow-scrolling:touch;}
37
+*[class*="overflow-scroll-x"]{overflow-y:hidden;overflow-x:scroll;-webkit-overflow-scrolling:touch;}
38
+.overflow-scroll-y-3d,.overflow-scroll-x-3d{transform:translateZ(0);-webkit-transform:translateZ(0);}
39
+.overflow-scroll-x::-webkit-scrollbar,.overflow-scroll-x-3d::-webkit-scrollbar{width:0;height:0;color:transparent;display:none;}
40
+*>img.cover{width:100%;height:100%;object-fit:cover;}
41
+*>img.contain{width:100%;height:100%;object-fit:contain;}
42
+
43
+.mainPage{width:100%;height:100%;position:relative;background:#fff;}
44
+
45
+.van-toast div{color:white;}
46
+.van-toast i{color:white;}
47
+.van-dialog__message{text-align:center;}
48
+.van-dialog__message.van-dialog__message--has-title{text-align:center;}

+ 178
- 0
src/components/slideTabH/index.vue Näytä tiedosto

@@ -0,0 +1,178 @@
1
+<template>
2
+  <div class="components flex-v">
3
+    <div class="tabNav flex-h" :style="{backgroundColor: backgroundColor || '#fff'}">
4
+      <a
5
+        class="flex-item"
6
+        v-for="(item, index) in data"
7
+        :key="index"
8
+        @click="cutNav(index)"
9
+        :style="{fontSize: fontSize + 'px', color: index === activeIndex ? (activeColor || 'red') : (normalColor || '#333')}"
10
+      >{{item.value}}</a>
11
+      <div class="activeLine" id="activeLine"></div>
12
+    </div>
13
+    <div class="flex-item">
14
+      <div>
15
+        <swiper :options="swiperOption" ref="mySwiper">
16
+          <swiper-slide class="swiper-slide" v-for="(item, index) in data" :key="index">
17
+            <slot :name="'slideTabH-' + item.id"></slot>
18
+          </swiper-slide>
19
+        </swiper>
20
+      </div>
21
+    </div>
22
+  </div>
23
+</template>
24
+
25
+<script>
26
+import { swiper, swiperSlide } from 'vue-awesome-swiper'
27
+import 'swiper/dist/css/swiper.css'
28
+export default {
29
+  name: 'slideTabH',
30
+  props: ['data', 'fontSize', 'activeColor', 'normalColor', 'backgroundColor', 'initIndex'],
31
+  data () {
32
+    var _self = this
33
+    return {
34
+      leftArr: [],
35
+      widthArr: [],
36
+      activeWidth: 0,
37
+      activeIndex: 0,
38
+      stepNum: 120,
39
+      swiperOption: {
40
+        watchSlidesProgress: true,
41
+        initialSlide: _self.activeIndex,
42
+        on: {
43
+          init () {
44
+            document.getElementById('activeLine').style.width = _self.widthArr[_self.activeIndex * _self.stepNum] + 'px'
45
+            document.getElementById('activeLine').style.left = _self.leftArr[_self.activeIndex * _self.stepNum] + 'px'
46
+          },
47
+          setTranslate (translate) { // 滑动偏移量监听
48
+            var num = (-translate / document.body.clientWidth * _self.stepNum).toFixed(0)
49
+            if (num >= 0 && num <= (_self.data.length - 1) * _self.stepNum) {
50
+              document.getElementById('activeLine').style.width = _self.widthArr[num] + 'px'
51
+              document.getElementById('activeLine').style.left = _self.leftArr[num] + 'px'
52
+            }
53
+          },
54
+          touchStart () {
55
+            document.getElementById('activeLine').style.transition = ''
56
+            document.getElementById('activeLine').style.WebkitTransition = ''
57
+          },
58
+          touchEnd () {
59
+            document.getElementById('activeLine').style.transition = '300ms'
60
+            document.getElementById('activeLine').style.WebkitTransition = '300ms'
61
+            if (this.realIndex !== _self.activeIndex) {
62
+              document.getElementById('activeLine').style.width = (_self.widthArr[this.realIndex * _self.stepNum]) + 'px'
63
+              document.getElementById('activeLine').style.left = (_self.leftArr[this.realIndex * _self.stepNum]) + 'px'
64
+            }
65
+          },
66
+          setTransition (speed) {
67
+            if (this.realIndex !== _self.activeIndex) {
68
+              document.getElementById('activeLine').style.width = (_self.widthArr[this.realIndex * _self.stepNum]) + 'px'
69
+              document.getElementById('activeLine').style.left = (_self.leftArr[this.realIndex * _self.stepNum]) + 'px'
70
+            }
71
+          },
72
+          transitionEnd () {
73
+            _self.activeIndex = this.activeIndex
74
+            _self.$emit('slideChange', this.activeIndex)
75
+          }
76
+        }
77
+      }
78
+    }
79
+  },
80
+  computed: {
81
+    MySwiper () {
82
+      return this.$refs.mySwiper.swiper
83
+    }
84
+  },
85
+  components: {
86
+    swiper,
87
+    swiperSlide
88
+  },
89
+  created () {
90
+    this.activeIndex = this.initIndex || 0
91
+    var aLeft = (document.body.clientWidth / this.data.length).toFixed(0)
92
+    this.data.map((item, index) => {
93
+      this.widthArr.push(item.value.length * (this.fontSize || 15))
94
+      this.leftArr.push((aLeft * index - 0) + ((aLeft / 2).toFixed(0) - 0) - this.widthArr[index] / 2)
95
+    })
96
+    this.activeWidth = this.widthArr[this.activeIndex]
97
+    this.widthArr = this.calcArr(this.widthArr, this.stepNum)
98
+    this.leftArr = this.calcArr(this.leftArr, this.stepNum)
99
+  },
100
+  mounted () {
101
+    this.$nextTick(() => {
102
+    })
103
+  },
104
+  methods: {
105
+    cutNav (index) { // 切换nav
106
+      document.getElementById('activeLine').style.transition = '300ms'
107
+      document.getElementById('activeLine').style.WebkitTransition = '300ms'
108
+      this.MySwiper.slideTo(index, 0, false)
109
+    },
110
+    calcArr (arr, num) { // 构造间隔数组:arr-原数组;num-间隔数
111
+      arr = arr || []
112
+      num = num || 20
113
+      var aArr = []
114
+      arr.map((item, index) => {
115
+        if (index < arr.length - 1) {
116
+          aArr.push([])
117
+          for (var n = 0; n < num; n++) {
118
+            aArr[index].push(item + (arr[index + 1] - item) * (n + 1) / num)
119
+          }
120
+        }
121
+      })
122
+      return [arr[0]].concat(...aArr)
123
+    }
124
+  }
125
+}
126
+</script>
127
+
128
+<!-- Add "scoped" attribute to limit CSS to this component only -->
129
+<style lang="scss" scoped>
130
+.components {
131
+  width: 100%;
132
+  height: 100%;
133
+  position: relative;
134
+  overflow: hidden;
135
+  .tabNav {
136
+    background: #fff;
137
+    position: relative;
138
+    overflow: hidden;
139
+    box-shadow: 0 0 0.1rem 0.02rem rgba(0, 0, 0, 0.05);
140
+    z-index: 100;
141
+    > a {
142
+      line-height: 0.45rem;
143
+      text-align: center;
144
+      color: #333;
145
+      position: relative;
146
+      z-index: 1;
147
+    }
148
+    .activeLine {
149
+      height: 0.02rem;
150
+      background: #f9064b;
151
+      position: absolute;
152
+      left: 0;
153
+      bottom: 0;
154
+      z-index: 2;
155
+    }
156
+  }
157
+  > .flex-item {
158
+    position: relative;
159
+    > div {
160
+      width: 100%;
161
+      position: absolute;
162
+      left: 0;
163
+      bottom: 0;
164
+      top: 0;
165
+      overflow: hidden;
166
+      > div {
167
+        width: 100%;
168
+        height: 100%;
169
+      }
170
+    }
171
+  }
172
+  .swiper-slide {
173
+    background: #f8f8f8;
174
+    position: relative;
175
+    z-index: 1;
176
+  }
177
+}
178
+</style>

+ 74
- 0
src/components/swiperBanner/index.vue Näytä tiedosto

@@ -0,0 +1,74 @@
1
+<template>
2
+  <div class="components">
3
+    <swiper :options="swiperOption" ref="myBannerSwiper">
4
+      <swiper-slide class="swiper-slide" v-for="(item,index) in data" :key="index">
5
+        <a @click="bannerLink(item)">
6
+          <img :src="item.img" class="cover" alt>
7
+        </a>
8
+      </swiper-slide>
9
+      <div class="swiper-pagination" slot="pagination"></div>
10
+    </swiper>
11
+  </div>
12
+</template>
13
+
14
+<script>
15
+import { swiper, swiperSlide } from 'vue-awesome-swiper'
16
+import 'swiper/dist/css/swiper.css'
17
+export default {
18
+  name: 'swiperBanner',
19
+  props: ['data'],
20
+  data () {
21
+    return {
22
+      swiperOption: {
23
+        observer: true,
24
+        pagination: {
25
+          el: '.swiper-pagination'
26
+        },
27
+        autoplay: {
28
+          disableOnInteraction: false
29
+        }
30
+      }
31
+    }
32
+  },
33
+  computed: {
34
+  },
35
+  components: {
36
+    swiper,
37
+    swiperSlide
38
+  },
39
+  created () {
40
+  },
41
+  mounted () {
42
+    this.$nextTick(() => {
43
+    })
44
+  },
45
+  methods: {
46
+    bannerLink (item) {
47
+      this.$emit('bannerLink', item)
48
+    }
49
+  }
50
+}
51
+</script>
52
+
53
+<!-- Add "scoped" attribute to limit CSS to this component only -->
54
+<style lang="scss" scoped>
55
+.components {
56
+  width: 100%;
57
+  height: 100%;
58
+  position: relative;
59
+  overflow: hidden;
60
+  >div{
61
+    width: 100%;
62
+    height: 100%;
63
+    .swiper-slide{
64
+      a{
65
+        width: 100%;
66
+        height: 100%;
67
+        display: block;
68
+        position: relative;
69
+        overflow: hidden;
70
+      }
71
+    }
72
+  }
73
+}
74
+</style>

+ 23
- 0
src/main.js Näytä tiedosto

@@ -0,0 +1,23 @@
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 store from './store'
7
+import Vant from 'vant'
8
+import 'vant/lib/index.css'
9
+import toolClass from './util/util'
10
+
11
+Vue.use(Vant)
12
+
13
+Vue.config.productionTip = false
14
+Vue.prototype.toolClass = toolClass
15
+
16
+/* eslint-disable no-new */
17
+new Vue({
18
+  el: '#app',
19
+  router,
20
+  store,
21
+  components: { App },
22
+  template: '<App/>'
23
+})

+ 291
- 0
src/pages/home/index.vue Näytä tiedosto

@@ -0,0 +1,291 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <div class="imgArr" :hidden="true">
4
+      <img
5
+        v-for="item in imgTotal"
6
+        :key="item"
7
+        :src="'https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-' + item + '.png'"
8
+        @load="imgLoad"
9
+        alt
10
+      >
11
+    </div>
12
+    <div class="subPage" v-if="showPage">
13
+      <img
14
+        src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-12.png"
15
+        style="z-index: 3;"
16
+        class="centerLabel cover"
17
+        alt
18
+      >
19
+      <img
20
+        src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-10.png"
21
+        class="icon10"
22
+        style="position: absolute;left:9vw;top:3.7vh;z-index:100;width: 31.2vw;"
23
+        :class="{'active': currentPage !== 0}"
24
+        alt
25
+      >
26
+      <div class="page1" :class="{'show': currentPage === 1}">
27
+        <img
28
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-3.png"
29
+          class="icon3"
30
+          style="position: absolute;left:0;top:0;z-index:2;width: 87.5vw;"
31
+          :class="{'active': currentPage === 1}"
32
+          alt
33
+        >
34
+        <img
35
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-4.png"
36
+          class="icon4"
37
+          style="position: absolute;right:0;bottom:0;z-index:2;width: 77vw;"
38
+          :class="{'active': currentPage === 1}"
39
+          alt
40
+        >
41
+        <div class="centerLabel" style="z-index: 3">
42
+          <img
43
+            src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-11.png"
44
+            class="icon11"
45
+            style="width: 36.5vw;"
46
+            :class="{'active': currentPage === 1}"
47
+            alt
48
+          >
49
+          <div
50
+            class="icon2"
51
+            style="overflow: visible;position: relative;-webkit-transform-style: preserve-3d !important;transform-style: preserve-3d !important;"
52
+          >
53
+            <img
54
+              src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-2.png"
55
+              class="icon2"
56
+              style="width:68vw;transform: translateY(.2rem);-webkit-transform: translateY(.2rem);"
57
+              :class="{'active': currentPage === 1}"
58
+              alt
59
+            >
60
+            <div class="circle circle1 centerLabel" :class="{'active': currentPage === 1}"></div>
61
+            <div class="circle circle2 centerLabel" :class="{'active': currentPage === 1}"></div>
62
+          </div>
63
+          <img
64
+            src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-13.png"
65
+            class="icon13"
66
+            style="width:56vw;display:inline-block;margin-top: .4rem;"
67
+            :class="{'active': currentPage === 1}"
68
+            alt
69
+          >
70
+          <img
71
+            src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-1.png"
72
+            class="icon1"
73
+            style="width: 35.7vw;margin-top: .2rem;"
74
+            :class="{'active': currentPage === 1}"
75
+            @click="currentPage = 2"
76
+            alt
77
+          >
78
+        </div>
79
+      </div>
80
+      <div class="page2" :class="{'show': currentPage === 2}">
81
+        <img
82
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-7.png"
83
+          class="icon7"
84
+          style="position: absolute;left:0;top:0;z-index:2;width: 100vw;"
85
+          :class="{'active': currentPage === 2}"
86
+          alt
87
+        >
88
+        <img
89
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-6.png"
90
+          class="icon6"
91
+          style="position: absolute;right:0;bottom:0;z-index:2;width: 100vw;"
92
+          :class="{'active': currentPage === 2}"
93
+          alt
94
+        >
95
+        <img
96
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-5.png"
97
+          class="icon5"
98
+          style="position: absolute;right:9vw;bottom:3.5vh;z-index:11;width: 43.7vw;"
99
+          :class="{'active': currentPage === 2}"
100
+          alt
101
+        >
102
+        <div class="centerLabel">
103
+          <img
104
+            src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-13.png"
105
+            class="icon13"
106
+            style="width:66vw;display:inline-block;margin-top: .4rem;"
107
+            :class="{'active': currentPage === 2}"
108
+            alt
109
+          >
110
+          <div class="content">
111
+            <span class="flagItem flagItem1" :class="{'active': currentPage === 2}">努力的目标</span>
112
+            <span class="flagItem flagItem2" :class="{'active': currentPage === 2}">努力的目标</span>
113
+            <span class="flagItem flagItem3" :class="{'active': currentPage === 2}">努力的目标</span>
114
+            <span class="flagItem flagItem4" :class="{'active': currentPage === 2}">努力的目标</span>
115
+            <span class="flagItem flagItem5" :class="{'active': currentPage === 2}">努力的目标</span>
116
+            <span class="flagItem flagItem6" :class="{'active': currentPage === 2}">努力的目标</span>
117
+            <span class="flagItem flagItem7" :class="{'active': currentPage === 2}">努力的目标</span>
118
+            <span class="flagItem flagItem8" :class="{'active': currentPage === 2}">努力的目标</span>
119
+            <span class="flagItem flagItem9" :class="{'active': currentPage === 2}">努力的目标</span>
120
+            <span class="flagItem flagItem10" :class="{'active': currentPage === 2}">努力的目标</span>
121
+          </div>
122
+        </div>
123
+      </div>
124
+      <div class="page3" :hidden="currentPage !== 3">
125
+        <img
126
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-8.png"
127
+          class="icon8"
128
+          style="position: absolute;left:0;bottom:0;z-index:2;width: 100vw;"
129
+          alt
130
+        >
131
+        <img
132
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-9.png"
133
+          class="icon9"
134
+          style="position: absolute;left:0;bottom:0;z-index:3;width: 100vw;"
135
+          alt
136
+        >
137
+        <div class="centerLabel">
138
+          <span>亲爱的你,新年好</span>
139
+          <span>亲爱的你,新年好</span>
140
+          <span>亲爱的你,新年好</span>
141
+          <span>亲爱的你,新年好</span>
142
+          <span>亲爱的你,新年好</span>
143
+          <span>亲爱的你,新年好</span>
144
+          <span>亲爱的你,新年好</span>
145
+          <span>亲爱的你,新年好</span>
146
+          <span>亲爱的你,新年好</span>
147
+          <span>亲爱的你,新年好</span>
148
+        </div>
149
+      </div>
150
+      <div class="page4" :hidden="currentPage !== 4">
151
+        <img
152
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-8.png"
153
+          class="icon8"
154
+          style="position: absolute;left:0;bottom:0;z-index:2;width: 100vw;"
155
+          alt
156
+        >
157
+        <img
158
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-9.png"
159
+          class="icon9"
160
+          style="position: absolute;left:0;bottom:0;z-index:3;width: 100vw;"
161
+          alt
162
+        >
163
+        <div class="centerLabel">
164
+          <span>亲爱的你,新年好</span>
165
+          <span>亲爱的你,新年好</span>
166
+          <span>亲爱的你,新年好</span>
167
+          <span></span>
168
+          <span>亲爱的你,新年好</span>
169
+          <span>亲爱的你,新年好</span>
170
+          <span>亲爱的你,新年好</span>
171
+          <span>亲爱的你,新年好</span>
172
+          <span>亲爱的你,新年好</span>
173
+          <span>亲爱的你,新年好</span>
174
+        </div>
175
+      </div>
176
+      <div class="page5" :hidden="currentPage !== 5">
177
+        <img
178
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-8.png"
179
+          class="icon8"
180
+          style="position: absolute;left:0;bottom:0;z-index:2;width: 100vw;"
181
+          alt
182
+        >
183
+        <img
184
+          src="https://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/20181229-images/icon-9.png"
185
+          class="icon9"
186
+          style="position: absolute;left:0;bottom:0;z-index:3;width: 100vw;"
187
+          alt
188
+        >
189
+        <div class="userIcon">
190
+          <a>
191
+            <img :src="userIcon" class="centerLabel cover" alt>
192
+          </a>
193
+        </div>
194
+        <div class="centerLabel">
195
+          <span>亲爱的你,新年好</span>
196
+          <span>亲爱的你,新年好</span>
197
+          <span>亲爱的你,新年好</span>
198
+          <span></span>
199
+          <span>亲爱的你,新年好</span>
200
+          <span>亲爱的你,新年好</span>
201
+          <span>亲爱的你,新年好</span>
202
+          <span>亲爱的你,新年好</span>
203
+          <span>亲爱的你,新年好</span>
204
+          <span>亲爱的你,新年好</span>
205
+        </div>
206
+        <div class="bottomText">
207
+          <div class="qrCode">
208
+            <a>
209
+              <img :src="qrCode" class="centerLabel cover" alt>
210
+            </a>
211
+          </div>
212
+          <span>长按二维码</span>
213
+          <span>祝福你的2019</span>
214
+        </div>
215
+      </div>
216
+    </div>
217
+  </div>
218
+</template>
219
+
220
+<script>
221
+export default {
222
+  name: '',
223
+  data () {
224
+    return {
225
+      showPage: false,
226
+      imgNum: 0,
227
+      imgTotal: 18,
228
+      currentPage: 0,
229
+      userIcon: '',
230
+      qrCode: '',
231
+      flagList: [
232
+        '变更美变更帅',
233
+        '年终奖拿到手软',
234
+        '每天12点前睡觉',
235
+        '瘦身10斤',
236
+        '练出马甲线',
237
+        '少脱发',
238
+        '升职',
239
+        '工资翻番',
240
+        '一定要脱单',
241
+        '带父母旅行',
242
+        '养猫和狗子',
243
+        '买房买车',
244
+        '不用辅导孩子作业',
245
+        '打败拖延症',
246
+        '看一场爱豆演唱会',
247
+        '照顾好身体',
248
+        '学会理财',
249
+        '写出N篇10W+文章',
250
+        '自驾游',
251
+        '多吃水果和蔬菜',
252
+        '中大奖',
253
+        '戒烟',
254
+        '看完20本书',
255
+        '实现财务自由',
256
+        '方案一次过',
257
+        '男(女)神回复我信息'
258
+      ]
259
+    }
260
+  },
261
+  computed: {
262
+  },
263
+  components: {
264
+  },
265
+  created () {
266
+  },
267
+  mounted () {
268
+    this.$nextTick(() => {
269
+    })
270
+  },
271
+  methods: {
272
+    imgLoad () { // 图片加载进度存储
273
+      this.imgNum += 1
274
+      if (this.imgNum === this.imgTotal) {
275
+        this.showPage = true
276
+        window.setTimeout(() => {
277
+          this.currentPage = 1
278
+        }, 300)
279
+      }
280
+    },
281
+    returnImgNum () { // 图片加载进度读取
282
+      return Math.floor((this.imgNum / this.imgTotal) * 100)
283
+    }
284
+  }
285
+}
286
+</script>
287
+
288
+<!-- Add "scoped" attribute to limit CSS to this component only -->
289
+<style lang="scss" scoped>
290
+@import "page.scss";
291
+</style>

+ 486
- 0
src/pages/home/page.scss Näytä tiedosto

@@ -0,0 +1,486 @@
1
+
2
+.mainPage {
3
+  width: 100vw;
4
+  height: 100vh;
5
+  background: linear-gradient(45deg, #ff9267, #fc4c44);
6
+  background: -webkit-linear-gradient(45deg, #ff9267, #fc4c44);
7
+  transform: translateZ(0);
8
+  -webkit-transform: translateZ(0);
9
+  img{
10
+    display: inline-block;
11
+  }
12
+  .subPage{
13
+    width: 100%;
14
+    height: 100%;
15
+    position: relative;
16
+    overflow: hidden;
17
+    >div{
18
+      width: 100%;
19
+      height: 0;
20
+      position: relative;
21
+      overflow: hidden;
22
+      z-index: 10;
23
+      text-align: center;
24
+      &.show{
25
+        height: 100%;
26
+      }
27
+      &.page1{
28
+        .circle{
29
+          width: 80vw;
30
+          height: 80vw;
31
+          border-radius: 80vw;
32
+          border: 2px solid #fff;
33
+          transition: opacity .1s ease-out 2s;
34
+          -webkit-transition: opacity .1s ease-out 2s;
35
+          opacity: 0;
36
+          &.active{
37
+            opacity: 1;
38
+          }
39
+        }
40
+        .circle1{
41
+          -webkit-transform: translate(-50%, -50%) rotateX(80deg) rotateY(-10deg);
42
+          transform: translate(-50%, -50%) rotateX(80deg) rotateY(-10deg);
43
+        }
44
+        .circle2{
45
+          -webkit-transform: translate(-50%, -50%) rotateX(80deg) rotateY(20deg);
46
+          transform: translate(-50%, -50%) rotateX(80deg) rotateY(20deg);
47
+        }
48
+        span{
49
+          width: 100%;
50
+          display: block;
51
+          text-align: center;
52
+          color: #fff;
53
+          margin: .3rem auto 0;
54
+          font-size: .18rem;
55
+          &+span{
56
+            margin: .05rem auto 0;
57
+            font-size: .1rem;
58
+          }
59
+        }
60
+      }
61
+      &.page2{
62
+        >.centerLabel{
63
+          width: 100%;
64
+          z-index: 11;
65
+          h1{
66
+            width: 100%;
67
+            text-align: center;
68
+            color: #fff;
69
+            font-size: .24rem;
70
+            font-weight: normal;
71
+          }
72
+          .content{
73
+            width: 82vw;
74
+            height: 65vh;
75
+            position: relative;
76
+            overflow: hidden;
77
+            margin: 0 auto;
78
+            z-index: 11;
79
+            .flagItem{
80
+              display: inline-block;
81
+              position: absolute;
82
+              padding: 0 .1rem;
83
+              z-index: 11;
84
+              &:nth-child(2n){
85
+                transform: translateX(-1rem);
86
+                -webkit-transform: translateX(-1rem);
87
+                transition: all 1.4s ease 1.5s;
88
+                -webkit-transition: all 1.4s ease 1.5s;
89
+              }
90
+              &:nth-child(2n-1){
91
+                transform: translateX(1rem);
92
+                -webkit-transform: translateX(1rem);
93
+                transition: all .8s ease 1.6s;
94
+                -webkit-transition: all .8s ease 1.6s;
95
+              }
96
+              opacity: 0;
97
+              &.active{
98
+                opacity: 1;
99
+                transform: translateX(0);
100
+                -webkit-transform: translateX(0);
101
+              }
102
+              &::after{
103
+                content: '';
104
+                width: 0;
105
+                height: 0;
106
+                border-style: solid dashed dashed dashed;
107
+                display: block;
108
+                position: absolute;
109
+              }
110
+            }
111
+            .flagItem1{
112
+              left: 0;
113
+              top: .1rem;
114
+              font-size: .16rem;
115
+              color: #fff;
116
+              line-height: .32rem;
117
+              background: #5bcff1;
118
+              border-radius: .1rem;
119
+              overflow: visible;
120
+              &::after{
121
+                content: '';
122
+                border-color: #5bcff1 transparent transparent transparent;
123
+                border-width: .15rem;
124
+                bottom: -.24rem;
125
+                right: 50%;
126
+                -webkit-transform: rotateY(60deg) rotateZ(-20deg);
127
+                transform: rotateY(60deg) rotateZ(-20deg);
128
+              }
129
+            }
130
+            .flagItem2{
131
+              right: 10%;
132
+              top: .3rem;
133
+              font-size: .22rem;
134
+              color: #fff;
135
+              line-height: .52rem;
136
+              background: #f8b551;
137
+              border-radius: .1rem;
138
+              overflow: visible;
139
+              &::after{
140
+                content: '';
141
+                border-color: #f8b551 transparent transparent transparent;
142
+                border-width: .15rem;
143
+                bottom: -.24rem;
144
+                left: 50%;
145
+                -webkit-transform: rotateY(60deg) rotateZ(20deg);
146
+                transform: rotateY(60deg) rotateZ(20deg);
147
+              }
148
+            }
149
+            .flagItem3{
150
+              left: 5%;
151
+              top: .7rem;
152
+              font-size: .18rem;
153
+              color: #fff;
154
+              line-height: .34rem;
155
+              background: #de7ba2;
156
+              border-radius: .1rem;
157
+              overflow: visible;
158
+              &::after{
159
+                content: '';
160
+                border-color: #de7ba2 transparent transparent transparent;
161
+                border-width: .15rem;
162
+                bottom: -.24rem;
163
+                left: 50%;
164
+                -webkit-transform: rotateY(60deg) rotateZ(-20deg);
165
+                transform: rotateY(60deg) rotateZ(-20deg);
166
+              }
167
+            }
168
+            .flagItem4{
169
+              right: 0;
170
+              top: 1rem;
171
+              font-size: .18rem;
172
+              color: #fff;
173
+              line-height: .32rem;
174
+              background: #fdc17a;
175
+              border-radius: .1rem;
176
+              overflow: visible;
177
+              &::after{
178
+                content: '';
179
+                border-color: #fdc17a transparent transparent transparent;
180
+                border-width: .15rem;
181
+                bottom: -.24rem;
182
+                right: 50%;
183
+                -webkit-transform: rotateY(60deg) rotateZ(20deg);
184
+                transform: rotateY(60deg) rotateZ(20deg);
185
+              }
186
+            }
187
+            .flagItem5{
188
+              left: 3%;
189
+              top: 1.3rem;
190
+              font-size: .18rem;
191
+              color: #fff;
192
+              line-height: .34rem;
193
+              background: #f8b551;
194
+              border-radius: .1rem;
195
+              overflow: visible;
196
+              &::after{
197
+                content: '';
198
+                border-color: #f8b551 transparent transparent transparent;
199
+                border-width: .15rem;
200
+                bottom: -.24rem;
201
+                left: 60%;
202
+                -webkit-transform: rotateY(60deg) rotateZ(-20deg);
203
+                transform: rotateY(60deg) rotateZ(-20deg);
204
+              }
205
+            }
206
+            .flagItem6{
207
+              right: 5%;
208
+              top: 1.5rem;
209
+              font-size: .16rem;
210
+              color: #fff;
211
+              line-height: .32rem;
212
+              background: #f8b551;
213
+              border-radius: .1rem;
214
+              overflow: visible;
215
+              &::after{
216
+                content: '';
217
+                border-color: #f8b551 transparent transparent transparent;
218
+                border-width: .15rem;
219
+                bottom: -.24rem;
220
+                left: 50%;
221
+                -webkit-transform: rotateY(60deg) rotateZ(20deg);
222
+                transform: rotateY(60deg) rotateZ(20deg);
223
+              }
224
+            }
225
+            .flagItem7.active{
226
+              left: 50%;
227
+              top: 1.9rem;
228
+              font-size: .22rem;
229
+              color: #fff;
230
+              line-height: .54rem;
231
+              background: #a57dd1;
232
+              border-radius: .1rem;
233
+              overflow: visible;
234
+              transform: translateX(-50%);
235
+              -webkit-transform: translateX(-50%);
236
+              &::after{
237
+                content: '';
238
+                border-color: #a57dd1 transparent transparent transparent;
239
+                border-width: .15rem;
240
+                bottom: -.24rem;
241
+                left: 60%;
242
+                -webkit-transform: rotateY(60deg) rotateZ(-20deg);
243
+                transform: rotateY(60deg) rotateZ(-20deg);
244
+              }
245
+            }
246
+            .flagItem8{
247
+              left: 5%;
248
+              top: 2.5rem;
249
+              font-size: .18rem;
250
+              color: #fff;
251
+              line-height: .34rem;
252
+              background: #f8b551;
253
+              border-radius: .1rem;
254
+              overflow: visible;
255
+              &::after{
256
+                content: '';
257
+                border-color: #f8b551 transparent transparent transparent;
258
+                border-width: .15rem;
259
+                bottom: -.24rem;
260
+                left: 60%;
261
+                -webkit-transform: rotateY(60deg) rotateZ(-20deg);
262
+                transform: rotateY(60deg) rotateZ(-20deg);
263
+              }
264
+            }
265
+            .flagItem9{
266
+              left: 15%;
267
+              top: 3rem;
268
+              font-size: .18rem;
269
+              color: #fff;
270
+              line-height: .28rem;
271
+              background: #fdc17a;
272
+              border-radius: .1rem;
273
+              overflow: visible;
274
+              &::after{
275
+                content: '';
276
+                border-color: #fdc17a transparent transparent transparent;
277
+                border-width: .15rem;
278
+                bottom: -.24rem;
279
+                left: 60%;
280
+                -webkit-transform: rotateY(60deg) rotateZ(-20deg);
281
+                transform: rotateY(60deg) rotateZ(-20deg);
282
+              }
283
+            }
284
+            .flagItem10{
285
+              right: 5%;
286
+              top: 2.4rem;
287
+              font-size: .16rem;
288
+              color: #fff;
289
+              line-height: .32rem;
290
+              background: #f8b551;
291
+              border-radius: .1rem;
292
+              overflow: visible;
293
+              &::after{
294
+                content: '';
295
+                border-color: #f8b551 transparent transparent transparent;
296
+                border-width: .15rem;
297
+                bottom: -.24rem;
298
+                left: 50%;
299
+                -webkit-transform: rotateY(60deg) rotateZ(20deg);
300
+                transform: rotateY(60deg) rotateZ(20deg);
301
+              }
302
+            }
303
+          }
304
+        }
305
+      }
306
+      &.page3,
307
+      &.page4,
308
+      &.page5{
309
+        >div.centerLabel{
310
+          width: 66vw;
311
+          margin-top: -.5rem;
312
+          span{
313
+            width: 100%;
314
+            display: block;
315
+            color: #fff;
316
+            text-align: left;
317
+            line-height: .22rem;
318
+            font-size: .14rem;
319
+            min-height: .22rem;
320
+            &:nth-child(1),
321
+            &:nth-child(2),
322
+            &:nth-child(3){
323
+              font-size: .16rem;
324
+            }
325
+          }
326
+        }
327
+        .userIcon{
328
+          width: 12.8vw;
329
+          position: absolute;
330
+          overflow: hidden;
331
+          left: 18vw;
332
+          top: 12.8vh;
333
+          a{
334
+            width: 100%;
335
+            display: block;
336
+            padding-bottom: 100%;
337
+            height: 0;
338
+            position: relative;
339
+            overflow: hidden;
340
+            background: rgba(255, 255, 255, .6);
341
+          }
342
+        }
343
+        .bottomText{
344
+          width: .7rem;
345
+          left: 9vw;
346
+          position: absolute;
347
+          bottom: 1.5vh;
348
+          overflow: hidden;
349
+          z-index: 100;
350
+          a{
351
+            width: 100%;
352
+            display: block;
353
+            padding-bottom: 100%;
354
+            height: 0;
355
+            position: relative;
356
+            overflow: hidden;
357
+            background: rgba(255, 255, 255, .6);
358
+            margin-bottom: .05rem;
359
+          }
360
+          span{
361
+            width: 100%;
362
+            display: block;
363
+            font-size: .1rem;
364
+            color: #fff;
365
+            text-align: left;
366
+            line-height: .14rem;
367
+          }
368
+        }
369
+      }
370
+    }
371
+  }
372
+  .icon3{
373
+    transition: all .5s ease-in;
374
+    -webkit-transition: all .5s ease-in;
375
+    opacity: 0;
376
+    transform: translateX(-100%);
377
+    -webkit-transform: translateX(-100%);
378
+    &.active{
379
+      opacity: 1;
380
+      transform: translateY(0);
381
+      -webkit-transform: translateY(0);
382
+    }
383
+  }
384
+  .icon4{
385
+    transition: all .5s ease-in;
386
+    -webkit-transition: all .5s ease-in;
387
+    opacity: 0;
388
+    transform: translateX(100%);
389
+    -webkit-transform: translateX(100%);
390
+    &.active{
391
+      opacity: 1;
392
+      transform: translateY(0);
393
+      -webkit-transform: translateY(0);
394
+    }
395
+  }
396
+  .icon10{
397
+    transition: all .5s ease-in;
398
+    -webkit-transition: all .5s ease-in;
399
+    opacity: 0;
400
+    transform: translateX(.3rem);
401
+    -webkit-transform: translateX(.3rem);
402
+    &.active{
403
+      opacity: 1;
404
+      transform: translateX(0);
405
+      -webkit-transform: translateX(0);
406
+    }
407
+  }
408
+  .icon11{
409
+    transition: all .5s ease-in .8s;
410
+    -webkit-transition: all .5s ease-in .8s;
411
+    transform: translateY(-100%) scale(0, 0);
412
+    -webkit-transform: translateY(-100%) scale(0, 0);
413
+    &.active{
414
+      transform: translateY(0) scale(1, 1);
415
+      -webkit-transform: translateY(0) scale(1, 1);
416
+    }
417
+  }
418
+  img.icon2{
419
+    transition: all .3s ease-in 1.5s;
420
+    -webkit-transition: all .3s ease-in 1.5s;
421
+    opacity: 0;
422
+    &.active{
423
+      opacity: 1;
424
+    }
425
+  }
426
+  .icon13{
427
+    transition: all .5s ease-out 2s;
428
+    -webkit-transition: all .5s ease-out 2s;
429
+    opacity: 0;
430
+    transform: translateX(.3rem);
431
+    -webkit-transform: translateX(.3rem);
432
+    &.active{
433
+      opacity: 1;
434
+      transform: translateX(0);
435
+      -webkit-transform: translateX(0);
436
+    }
437
+  }
438
+  .icon1{
439
+    transition: all .3s ease-out 3.2s;
440
+    -webkit-transition: all .3s ease-out 3.2s;
441
+    opacity: 0;
442
+    transform: scale(0, 0);
443
+    -webkit-transform: scale(0, 0);
444
+    &.active{
445
+      opacity: 1;
446
+      transform: scale(1, 1);
447
+      -webkit-transform: scale(1, 1);
448
+    }
449
+  }
450
+  .icon7{
451
+    transition: all .5s ease-in;
452
+    -webkit-transition: all .5s ease-in;
453
+    opacity: 0;
454
+    transform: translateY(-1rem);
455
+    -webkit-transform: translateY(-1rem);
456
+    &.active{
457
+      opacity: 1;
458
+      transform: translateY(0);
459
+      -webkit-transform: translateY(0);
460
+    }
461
+  }
462
+  .icon6{
463
+    transition: all .5s ease-in;
464
+    -webkit-transition: all .5s ease-in;
465
+    opacity: 0;
466
+    transform: translateY(1rem);
467
+    -webkit-transform: translateY(1rem);
468
+    &.active{
469
+      opacity: 1;
470
+      transform: translateY(0);
471
+      -webkit-transform: translateY(0);
472
+    }
473
+  }
474
+  .icon5{
475
+    transition: all .5s ease-in .8s;
476
+    -webkit-transition: all .5s ease-in .8s;
477
+    opacity: 0;
478
+    transform: translateY(1rem) scale(0, 0);
479
+    -webkit-transform: translateY(1rem) scale(0, 0);
480
+    &.active{
481
+      opacity: 1;
482
+      transform: translateY(0) scale(1, 1);
483
+      -webkit-transform: translateY(0) scale(1, 1);
484
+    }
485
+  }
486
+}

+ 37
- 0
src/pages/index.vue Näytä tiedosto

@@ -0,0 +1,37 @@
1
+<template>
2
+  <div class="projectIndex">
3
+    <router-view></router-view>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: 'projectIndex',
10
+  data () {
11
+    return {
12
+    }
13
+  },
14
+  computed: {
15
+  },
16
+  components: {
17
+  },
18
+  created () {
19
+  },
20
+  mounted () {
21
+    this.$nextTick(() => {
22
+    })
23
+  },
24
+  methods: {
25
+  }
26
+}
27
+</script>
28
+
29
+<!-- Add "scoped" attribute to limit CSS to this component only -->
30
+<style lang="scss" scoped>
31
+.projectIndex {
32
+  width: 100%;
33
+  height: 100%;
34
+  position: relative;
35
+  overflow: hidden;
36
+}
37
+</style>

+ 29
- 0
src/router/index.js Näytä tiedosto

@@ -0,0 +1,29 @@
1
+/* eslint-disable */
2
+import Vue from 'vue'
3
+import Router from 'vue-router'
4
+import index from '../pages/index'
5
+
6
+import home from '../pages/home/index'
7
+
8
+Vue.use(Router)
9
+
10
+let router = new Router({
11
+  routes: [{
12
+    path: '/',
13
+    name: 'index',
14
+    component: index,
15
+    redirect: '/home',
16
+    children: [{
17
+      path: '/home',
18
+      name: 'home',
19
+      component: home,
20
+      children: []
21
+    }]
22
+  }]
23
+})
24
+
25
+router.beforeEach((to, from, next) => {
26
+  next()
27
+})
28
+
29
+export default router

+ 44
- 0
src/store/index.js Näytä tiedosto

@@ -0,0 +1,44 @@
1
+/* eslint-disable */
2
+import Vue from 'vue'
3
+import Vuex from 'vuex'
4
+
5
+Vue.use(Vuex)
6
+
7
+const store = new Vuex.Store({
8
+  state: {
9
+    projectHeaderData: { // 顶部数据
10
+      hidden: true, // 是否隐藏框架
11
+      title: '', // 标题
12
+      btns: [] // 按钮数据:{value: 'icon-shezhi',type: 'icon',response: ()=>{}},{value: '按钮',type: 'word',response: ()=>{}}
13
+    },
14
+    systemType: null // 系统类型判断:IOS/Android/Other
15
+  },
16
+  mutations: {
17
+    setProjectHeader (state, data) { // 设置顶部数据
18
+      data = data || {}
19
+      state.projectHeaderData = {
20
+        hidden: true,
21
+        title: '',
22
+        btns: [],
23
+        ...data
24
+      }
25
+    },
26
+    setSystemType (state) { // 获取系统类型
27
+      var u = navigator.userAgent
28
+      var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 // android终端
29
+      var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // ios终端
30
+      state.systemType = isIOS ? 'IOS' : isAndroid ? 'Android' : 'Other'
31
+    }
32
+  }
33
+})
34
+export const modules = {
35
+  user: () => require('./user/index').default
36
+}
37
+
38
+Object.keys(modules).forEach((modKey) => {
39
+  const modNS = modKey.split('/')
40
+  const getMod = modules[modKey]
41
+  store.registerModule(...modNS, getMod())
42
+})
43
+
44
+export default store

+ 26
- 0
src/store/user/index.js Näytä tiedosto

@@ -0,0 +1,26 @@
1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    userInfo: null
8
+  },
9
+  mutations: {
10
+  },
11
+  actions: {
12
+    getUserInfo (context, payload) { // 获取手机验证码
13
+      return new Promise((resolve, reject) => {
14
+        Ajax(api.user.getUserInfo.url, {
15
+          method: api.user.getUserInfo.method,
16
+          token: payload
17
+        }).then(res => {
18
+          console.log(JSON.stringify(res))
19
+          resolve(res)
20
+        }).catch((res) => {
21
+          reject(res)
22
+        })
23
+      })
24
+    }
25
+  }
26
+}

+ 53
- 0
src/util/ajax.js Näytä tiedosto

@@ -0,0 +1,53 @@
1
+import axios from 'axios'
2
+import qs from 'qs'
3
+
4
+const Axios = axios.create({
5
+  timeout: 60000,
6
+  responseType: 'json',
7
+  withCredentials: true,
8
+  queryData: {},
9
+  urlData: {},
10
+  headers: {
11
+    'Content-Type': 'application/json',
12
+    'X-Auth-Token': ''
13
+  }
14
+})
15
+
16
+Axios.interceptors.request.use((config) => {
17
+  let aName = 'X-Auth-Token'
18
+  config.headers[aName] = config.token || ''
19
+  let urlData = qs.stringify(config.urlData)
20
+  let queryData = qs.stringify(config.queryData)
21
+  if (config.url.indexOf(':') > -1) {
22
+    if (typeof config.urlData === 'object') {
23
+      config.url = replaceURLParams(config.url, config.urlData)
24
+    } else {
25
+      config.url = config.url.slice(0, config.url.indexOf(':')) + urlData
26
+    }
27
+  }
28
+  if (queryData) {
29
+    config.url += '?' + queryData
30
+  }
31
+  return config
32
+}, (error) => {
33
+  console.log(error)
34
+})
35
+
36
+const ajax = (...args) => {
37
+  return new Promise((resolve, reject) => {
38
+    Axios(...args).then(({ data, headers }) => {
39
+      resolve(data)
40
+    }).catch(reject)
41
+  })
42
+}
43
+
44
+export default ajax
45
+
46
+export function replaceURLParams (url, params) {
47
+  const args = { ...(params || {}), org: 'MQ' }
48
+
49
+  return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
50
+    const re = new RegExp(`:${k}(?!w)`, 'i')
51
+    return acc.replace(re, args[k])
52
+  }, url)
53
+}

+ 11
- 0
src/util/api.js Näytä tiedosto

@@ -0,0 +1,11 @@
1
+
2
+const $api = {
3
+  user: {
4
+    getUserInfo: { // 获取用户信息
5
+      method: 'get',
6
+      url: `/app-api/user/info`
7
+    }
8
+  }
9
+}
10
+
11
+export default $api

+ 96
- 0
src/util/util.js Näytä tiedosto

@@ -0,0 +1,96 @@
1
+/* eslint-disable */
2
+const toolClass = {
3
+  dateFormat: (timestamp, fmt) => { // 时间格式转换
4
+    if (timestamp) {
5
+      if (!fmt) {
6
+        fmt = 'yyyy-MM-dd hh:mm'
7
+      }
8
+      let date = new Date(timestamp)
9
+      var o = {
10
+        'M+': date.getMonth() + 1,
11
+        'd+': date.getDate(),
12
+        'h+': date.getHours(),
13
+        'm+': date.getMinutes(),
14
+        's+': date.getSeconds(),
15
+        'q+': Math.floor((date.getMonth() + 3) / 3),
16
+        'S': date.getMilliseconds()
17
+      }
18
+      if (/(y+)/.test(fmt)) {
19
+        fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
20
+      }
21
+      for (var k in o) {
22
+        if (new RegExp('(' + k + ')').test(fmt)) {
23
+          fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
24
+        }
25
+      }
26
+      return fmt
27
+    } else {
28
+      return ''
29
+    }
30
+  },
31
+  JsBridge: { // IOS/Android原生交互
32
+    init: function (callback) { // 初始化
33
+      var u = navigator.userAgent
34
+      var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
35
+      if (!isiOS) {
36
+        if (window.WebViewJavascriptBridge) {
37
+          callback(WebViewJavascriptBridge)
38
+        } else {
39
+          document.addEventListener(
40
+            'WebViewJavascriptBridgeReady',
41
+            function () {
42
+              callback(WebViewJavascriptBridge)
43
+            },
44
+            false
45
+          )
46
+        }
47
+      } else {
48
+        if (window.WebViewJavascriptBridge) return callback(WebViewJavascriptBridge)
49
+        if (window.WVJBCallbacks) return window.WVJBCallbacks.push(callback)
50
+        window.WVJBCallbacks = [callback]
51
+        var WVJBIframe = document.createElement('iframe')
52
+        WVJBIframe.style.display = 'none'
53
+        WVJBIframe.src = 'https://__bridge_loaded__'
54
+        document.documentElement.appendChild(WVJBIframe)
55
+        setTimeout(function () { document.documentElement.removeChild(WVJBIframe) }, 0)
56
+      }
57
+    },
58
+    first: function () { // 建立第一次链接
59
+      var u = navigator.userAgent
60
+      var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
61
+      if (!isiOS) {
62
+        var _this = this
63
+        _this.init(function (bridge) {
64
+          bridge.init(function (message, responseCallback) {
65
+            responseCallback(data)
66
+          })
67
+        })
68
+      }
69
+    },
70
+    registerHandler: function (name, fun) { // app通知h5方法
71
+      var _this = this
72
+      _this.init(function (bridge) {
73
+        bridge.registerHandler(name, fun)
74
+      })
75
+    },
76
+    callHandler: function (name, data, fun) { // h5通知app方法
77
+      var _this = this
78
+      _this.init(function (bridge) {
79
+        bridge.callHandler(name, data, fun)
80
+      })
81
+    }
82
+  },
83
+  returnDoubleNum (num) { // 转化双位数
84
+    return num > 9 ? num : ('0' + num)
85
+  },
86
+  checkPhoneNum (num) { // 校验手机号
87
+    var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
88
+    return !!myreg.test(num)
89
+  },
90
+  checkEmail (num) { // 校验邮箱
91
+    var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
92
+    return !!myreg.test(num)
93
+  }
94
+}
95
+
96
+export default toolClass

+ 0
- 0
static/.gitkeep Näytä tiedosto