Commit be42a35ecacf4436eb517ae652befd36b8231182
1 parent
d96228f9
修复子节点显示错误
Showing
23 changed files
with
722 additions
and
57 deletions
Too many changes to show.
To preserve performance only 23 of 28 files are displayed.
.gitignore
.idea/codeStyles/codeStyleConfig.xml deleted
100644 → 0
.idea/dataSources.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project version="4"> | |
| 3 | - <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> | |
| 4 | - <data-source source="LOCAL" name="192.168.1.141" uuid="b55ce2b3-e282-488f-871b-1dd3cf1f116d"> | |
| 5 | - <driver-ref>mysql.8</driver-ref> | |
| 6 | - <synchronize>true</synchronize> | |
| 7 | - <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver> | |
| 8 | - <jdbc-url>jdbc:mysql://192.168.1.141:3306</jdbc-url> | |
| 9 | - <driver-properties> | |
| 10 | - <property name="autoReconnect" value="true" /> | |
| 11 | - <property name="zeroDateTimeBehavior" value="CONVERT_TO_NULL" /> | |
| 12 | - <property name="tinyInt1isBit" value="false" /> | |
| 13 | - <property name="characterEncoding" value="utf8" /> | |
| 14 | - <property name="characterSetResults" value="utf8" /> | |
| 15 | - <property name="yearIsDateType" value="false" /> | |
| 16 | - </driver-properties> | |
| 17 | - </data-source> | |
| 18 | - </component> | |
| 19 | -</project> | |
| 20 | 0 | \ No newline at end of file |
.idea/encodings.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project version="4"> | |
| 3 | - <component name="Encoding"> | |
| 4 | - <file url="file://$PROJECT_DIR$" charset="UTF-8" /> | |
| 5 | - <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> | |
| 6 | - <file url="file://$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java" charset="UTF-8" /> | |
| 7 | - </component> | |
| 8 | -</project> | |
| 9 | 0 | \ No newline at end of file |
.idea/jarRepositories.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project version="4"> | |
| 3 | - <component name="RemoteRepositoriesConfiguration"> | |
| 4 | - <remote-repository> | |
| 5 | - <option name="id" value="central" /> | |
| 6 | - <option name="name" value="Central Repository" /> | |
| 7 | - <option name="url" value="https://repo.maven.apache.org/maven2" /> | |
| 8 | - </remote-repository> | |
| 9 | - <remote-repository> | |
| 10 | - <option name="id" value="central" /> | |
| 11 | - <option name="name" value="Maven Central repository" /> | |
| 12 | - <option name="url" value="https://repo1.maven.org/maven2" /> | |
| 13 | - </remote-repository> | |
| 14 | - <remote-repository> | |
| 15 | - <option name="id" value="jboss.community" /> | |
| 16 | - <option name="name" value="JBoss Community repository" /> | |
| 17 | - <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | |
| 18 | - </remote-repository> | |
| 19 | - </component> | |
| 20 | -</project> | |
| 21 | 0 | \ No newline at end of file |
src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java
| ... | ... | @@ -80,11 +80,10 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager { |
| 80 | 80 | String channelId = channel.getChannelId(); |
| 81 | 81 | HashMap<String, HashSet<String>> channelMap = deviceMap.get(deviceId); |
| 82 | 82 | if (channelMap == null) return; |
| 83 | - | |
| 84 | 83 | // 作为父设备, 确定自己的子节点数 |
| 85 | 84 | if (channelMap.get(channelId) == null) { |
| 86 | 85 | channelMap.put(channelId, new HashSet<String>()); |
| 87 | - }else if (channelMap.get(channelId).size()> 0) { | |
| 86 | + }else if (channelMap.get(channelId).size() > 0) { | |
| 88 | 87 | channel.setSubCount(channelMap.get(channelId).size()); |
| 89 | 88 | } |
| 90 | 89 | |
| ... | ... | @@ -107,7 +106,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager { |
| 107 | 106 | if (!StringUtils.isEmpty(parentId)) { |
| 108 | 107 | |
| 109 | 108 | if (channelMap.get(parentId) == null) { |
| 110 | - channelMap.put(parentId, new HashSet<>()); | |
| 109 | + channelMap.put(parentId, new HashSet<String>()); | |
| 111 | 110 | } |
| 112 | 111 | channelMap.get(parentId).add(channelId); |
| 113 | 112 | |
| ... | ... | @@ -404,11 +403,10 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager { |
| 404 | 403 | if (subChannel == null) { |
| 405 | 404 | subChannel = new HashSet<>(); |
| 406 | 405 | } |
| 407 | - if ("null".equals(s[6])) { | |
| 406 | + if (!"null".equals(s[6])) { | |
| 408 | 407 | subChannel.add(s[6]); |
| 409 | 408 | } |
| 410 | 409 | channelMap.put(channelId, subChannel); |
| 411 | - System.out.println(); | |
| 412 | 410 | } |
| 413 | 411 | } |
| 414 | 412 | deviceMap.put(device.getDeviceId(),channelMap); | ... | ... |
web_src/.babelrc
0 → 100644
web_src/.editorconfig
0 → 100644
web_src/.gitignore
0 → 100644
web_src/.postcssrc.js
0 → 100644
web_src/README.md
0 → 100644
| 1 | +# gb_web | |
| 2 | + | |
| 3 | +> A Vue.js project | |
| 4 | + | |
| 5 | +## Build Setup | |
| 6 | + | |
| 7 | +``` bash | |
| 8 | +# install dependencies | |
| 9 | +npm install | |
| 10 | + | |
| 11 | +# serve with hot reload at localhost:8080 | |
| 12 | +npm run dev | |
| 13 | + | |
| 14 | +# build for production with minification | |
| 15 | +npm run build | |
| 16 | + | |
| 17 | +# build for production and view the bundle analyzer report | |
| 18 | +npm run build --report | |
| 19 | +``` | |
| 20 | + | |
| 21 | +For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). | ... | ... |
web_src/build/build.js
0 → 100644
| 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 | +}) | ... | ... |
web_src/build/check-versions.js
0 → 100644
| 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 | +} | ... | ... |
web_src/build/logo.png
0 → 100644
6.69 KB
web_src/build/utils.js
0 → 100644
| 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 | +} | ... | ... |
web_src/build/vue-loader.conf.js
0 → 100644
| 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 | +} | ... | ... |
web_src/build/webpack.base.conf.js
0 → 100644
| 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 | + | |
| 12 | + | |
| 13 | +module.exports = { | |
| 14 | + context: path.resolve(__dirname, '../'), | |
| 15 | + entry: { | |
| 16 | + app: './src/main.js' | |
| 17 | + }, | |
| 18 | + output: { | |
| 19 | + path: config.build.assetsRoot, | |
| 20 | + filename: '[name].js', | |
| 21 | + publicPath: process.env.NODE_ENV === 'production' | |
| 22 | + ? config.build.assetsPublicPath | |
| 23 | + : config.dev.assetsPublicPath | |
| 24 | + }, | |
| 25 | + resolve: { | |
| 26 | + extensions: ['.js', '.vue', '.json'], | |
| 27 | + alias: { | |
| 28 | + 'vue$': 'vue/dist/vue.esm.js', | |
| 29 | + '@': resolve('src'), | |
| 30 | + } | |
| 31 | + }, | |
| 32 | + module: { | |
| 33 | + rules: [ | |
| 34 | + { | |
| 35 | + test: /\.vue$/, | |
| 36 | + loader: 'vue-loader', | |
| 37 | + options: vueLoaderConfig | |
| 38 | + }, | |
| 39 | + { | |
| 40 | + test: /\.js$/, | |
| 41 | + loader: 'babel-loader', | |
| 42 | + include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] | |
| 43 | + }, | |
| 44 | + { | |
| 45 | + test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, | |
| 46 | + loader: 'url-loader', | |
| 47 | + options: { | |
| 48 | + limit: 10000, | |
| 49 | + name: utils.assetsPath('img/[name].[hash:7].[ext]') | |
| 50 | + } | |
| 51 | + }, | |
| 52 | + { | |
| 53 | + test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, | |
| 54 | + loader: 'url-loader', | |
| 55 | + options: { | |
| 56 | + limit: 10000, | |
| 57 | + name: utils.assetsPath('media/[name].[hash:7].[ext]') | |
| 58 | + } | |
| 59 | + }, | |
| 60 | + { | |
| 61 | + test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, | |
| 62 | + loader: 'url-loader', | |
| 63 | + options: { | |
| 64 | + limit: 10000, | |
| 65 | + name: utils.assetsPath('fonts/[name].[hash:7].[ext]') | |
| 66 | + } | |
| 67 | + } | |
| 68 | + ] | |
| 69 | + }, | |
| 70 | + node: { | |
| 71 | + // prevent webpack from injecting useless setImmediate polyfill because Vue | |
| 72 | + // source contains it (although only uses it if it's native). | |
| 73 | + setImmediate: false, | |
| 74 | + // prevent webpack from injecting mocks to Node native modules | |
| 75 | + // that does not make sense for the client | |
| 76 | + dgram: 'empty', | |
| 77 | + fs: 'empty', | |
| 78 | + net: 'empty', | |
| 79 | + tls: 'empty', | |
| 80 | + child_process: 'empty' | |
| 81 | + } | |
| 82 | +} | ... | ... |
web_src/build/webpack.dev.conf.js
0 → 100755
| 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 | + { from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'}, | |
| 68 | + { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'}, | |
| 69 | + { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/'} | |
| 70 | + ]) | |
| 71 | + ] | |
| 72 | +}) | |
| 73 | + | |
| 74 | +module.exports = new Promise((resolve, reject) => { | |
| 75 | + portfinder.basePort = process.env.PORT || config.dev.port | |
| 76 | + portfinder.getPort((err, port) => { | |
| 77 | + if (err) { | |
| 78 | + reject(err) | |
| 79 | + } else { | |
| 80 | + // publish the new Port, necessary for e2e tests | |
| 81 | + process.env.PORT = port | |
| 82 | + // add port to devServer config | |
| 83 | + devWebpackConfig.devServer.port = port | |
| 84 | + | |
| 85 | + // Add FriendlyErrorsPlugin | |
| 86 | + devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ | |
| 87 | + compilationSuccessInfo: { | |
| 88 | + messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], | |
| 89 | + }, | |
| 90 | + onErrors: config.dev.notifyOnErrors | |
| 91 | + ? utils.createNotifierCallback() | |
| 92 | + : undefined | |
| 93 | + })) | |
| 94 | + | |
| 95 | + resolve(devWebpackConfig) | |
| 96 | + } | |
| 97 | + }) | |
| 98 | +}) | ... | ... |
web_src/build/webpack.prod.conf.js
0 → 100644
| 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 = require('../config/prod.env') | |
| 15 | + | |
| 16 | +const webpackConfig = merge(baseWebpackConfig, { | |
| 17 | + module: { | |
| 18 | + rules: utils.styleLoaders({ | |
| 19 | + sourceMap: config.build.productionSourceMap, | |
| 20 | + extract: true, | |
| 21 | + usePostCSS: true | |
| 22 | + }) | |
| 23 | + }, | |
| 24 | + devtool: config.build.productionSourceMap ? config.build.devtool : false, | |
| 25 | + output: { | |
| 26 | + path: config.build.assetsRoot, | |
| 27 | + filename: utils.assetsPath('js/[name].[chunkhash].js'), | |
| 28 | + chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') | |
| 29 | + }, | |
| 30 | + plugins: [ | |
| 31 | + // http://vuejs.github.io/vue-loader/en/workflow/production.html | |
| 32 | + new webpack.DefinePlugin({ | |
| 33 | + 'process.env': env | |
| 34 | + }), | |
| 35 | + new UglifyJsPlugin({ | |
| 36 | + uglifyOptions: { | |
| 37 | + compress: { | |
| 38 | + warnings: false | |
| 39 | + } | |
| 40 | + }, | |
| 41 | + sourceMap: config.build.productionSourceMap, | |
| 42 | + parallel: true | |
| 43 | + }), | |
| 44 | + // extract css into its own file | |
| 45 | + new ExtractTextPlugin({ | |
| 46 | + filename: utils.assetsPath('css/[name].[contenthash].css'), | |
| 47 | + // Setting the following option to `false` will not extract CSS from codesplit chunks. | |
| 48 | + // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. | |
| 49 | + // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, | |
| 50 | + // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 | |
| 51 | + allChunks: true, | |
| 52 | + }), | |
| 53 | + // Compress extracted CSS. We are using this plugin so that possible | |
| 54 | + // duplicated CSS from different components can be deduped. | |
| 55 | + new OptimizeCSSPlugin({ | |
| 56 | + cssProcessorOptions: config.build.productionSourceMap | |
| 57 | + ? { safe: true, map: { inline: false } } | |
| 58 | + : { safe: true } | |
| 59 | + }), | |
| 60 | + // generate dist index.html with correct asset hash for caching. | |
| 61 | + // you can customize output by editing /index.html | |
| 62 | + // see https://github.com/ampedandwired/html-webpack-plugin | |
| 63 | + new HtmlWebpackPlugin({ | |
| 64 | + filename: config.build.index, | |
| 65 | + template: 'index.html', | |
| 66 | + inject: true, | |
| 67 | + minify: { | |
| 68 | + removeComments: true, | |
| 69 | + collapseWhitespace: true, | |
| 70 | + removeAttributeQuotes: true | |
| 71 | + // more options: | |
| 72 | + // https://github.com/kangax/html-minifier#options-quick-reference | |
| 73 | + }, | |
| 74 | + // necessary to consistently work with multiple chunks via CommonsChunkPlugin | |
| 75 | + chunksSortMode: 'dependency' | |
| 76 | + }), | |
| 77 | + // keep module.id stable when vendor modules does not change | |
| 78 | + new webpack.HashedModuleIdsPlugin(), | |
| 79 | + // enable scope hoisting | |
| 80 | + new webpack.optimize.ModuleConcatenationPlugin(), | |
| 81 | + // split vendor js into its own file | |
| 82 | + new webpack.optimize.CommonsChunkPlugin({ | |
| 83 | + name: 'vendor', | |
| 84 | + minChunks (module) { | |
| 85 | + // any required modules inside node_modules are extracted to vendor | |
| 86 | + return ( | |
| 87 | + module.resource && | |
| 88 | + /\.js$/.test(module.resource) && | |
| 89 | + module.resource.indexOf( | |
| 90 | + path.join(__dirname, '../node_modules') | |
| 91 | + ) === 0 | |
| 92 | + ) | |
| 93 | + } | |
| 94 | + }), | |
| 95 | + // extract webpack runtime and module manifest to its own file in order to | |
| 96 | + // prevent vendor hash from being updated whenever app bundle is updated | |
| 97 | + new webpack.optimize.CommonsChunkPlugin({ | |
| 98 | + name: 'manifest', | |
| 99 | + minChunks: Infinity | |
| 100 | + }), | |
| 101 | + // This instance extracts shared chunks from code splitted chunks and bundles them | |
| 102 | + // in a separate chunk, similar to the vendor chunk | |
| 103 | + // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk | |
| 104 | + new webpack.optimize.CommonsChunkPlugin({ | |
| 105 | + name: 'app', | |
| 106 | + async: 'vendor-async', | |
| 107 | + children: true, | |
| 108 | + minChunks: 3 | |
| 109 | + }), | |
| 110 | + | |
| 111 | + // copy custom static assets | |
| 112 | + new CopyWebpackPlugin([ | |
| 113 | + { | |
| 114 | + from: path.resolve(__dirname, '../static'), | |
| 115 | + to: config.build.assetsSubDirectory, | |
| 116 | + ignore: ['.*'] | |
| 117 | + }, | |
| 118 | + { from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'}, | |
| 119 | + { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'}, | |
| 120 | + { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/'} | |
| 121 | + ]) | |
| 122 | + ] | |
| 123 | +}) | |
| 124 | + | |
| 125 | +if (config.build.productionGzip) { | |
| 126 | + const CompressionWebpackPlugin = require('compression-webpack-plugin') | |
| 127 | + | |
| 128 | + webpackConfig.plugins.push( | |
| 129 | + new CompressionWebpackPlugin({ | |
| 130 | + asset: '[path].gz[query]', | |
| 131 | + algorithm: 'gzip', | |
| 132 | + test: new RegExp( | |
| 133 | + '\\.(' + | |
| 134 | + config.build.productionGzipExtensions.join('|') + | |
| 135 | + ')$' | |
| 136 | + ), | |
| 137 | + threshold: 10240, | |
| 138 | + minRatio: 0.8 | |
| 139 | + }) | |
| 140 | + ) | |
| 141 | +} | |
| 142 | + | |
| 143 | +if (config.build.bundleAnalyzerReport) { | |
| 144 | + const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin | |
| 145 | + webpackConfig.plugins.push(new BundleAnalyzerPlugin()) | |
| 146 | +} | |
| 147 | + | |
| 148 | +module.exports = webpackConfig | ... | ... |
web_src/config/dev.env.js
0 → 100644
web_src/config/index.js
0 → 100644
| 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 | + '/debug': { | |
| 15 | + target: 'http://localhost:18080', | |
| 16 | + changeOrigin: true, | |
| 17 | + pathRewrite: { | |
| 18 | + '^/debug': '/' | |
| 19 | + } | |
| 20 | + } | |
| 21 | + }, | |
| 22 | + | |
| 23 | + // Various Dev Server settings | |
| 24 | + host: 'localhost', // can be overwritten by process.env.HOST | |
| 25 | + port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined | |
| 26 | + autoOpenBrowser: false, | |
| 27 | + errorOverlay: true, | |
| 28 | + notifyOnErrors: true, | |
| 29 | + poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- | |
| 30 | + | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Source Maps | |
| 34 | + */ | |
| 35 | + | |
| 36 | + // https://webpack.js.org/configuration/devtool/#development | |
| 37 | + devtool: 'cheap-module-eval-source-map', | |
| 38 | + | |
| 39 | + // If you have problems debugging vue-files in devtools, | |
| 40 | + // set this to false - it *may* help | |
| 41 | + // https://vue-loader.vuejs.org/en/options.html#cachebusting | |
| 42 | + cacheBusting: true, | |
| 43 | + | |
| 44 | + cssSourceMap: true | |
| 45 | + }, | |
| 46 | + | |
| 47 | + build: { | |
| 48 | + // Template for index.html | |
| 49 | + index: path.resolve(__dirname, '../../src/main/resources/static/index.html'), | |
| 50 | + | |
| 51 | + // Paths | |
| 52 | + assetsRoot: path.resolve(__dirname, '../../src/main/resources/static/'), | |
| 53 | + assetsSubDirectory: '.', | |
| 54 | + assetsPublicPath: '/', | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * Source Maps | |
| 58 | + */ | |
| 59 | + | |
| 60 | + productionSourceMap: true, | |
| 61 | + // https://webpack.js.org/configuration/devtool/#production | |
| 62 | + devtool: '#source-map', | |
| 63 | + | |
| 64 | + // Gzip off by default as many popular static hosts such as | |
| 65 | + // Surge or Netlify already gzip all static assets for you. | |
| 66 | + // Before setting to `true`, make sure to: | |
| 67 | + // npm install --save-dev compression-webpack-plugin | |
| 68 | + productionGzip: false, | |
| 69 | + productionGzipExtensions: ['js', 'css'], | |
| 70 | + | |
| 71 | + // Run the build command with an extra argument to | |
| 72 | + // View the bundle analyzer report after build finishes: | |
| 73 | + // `npm run build --report` | |
| 74 | + // Set to `true` or `false` to always turn it on or off | |
| 75 | + bundleAnalyzerReport: process.env.npm_config_report | |
| 76 | + } | |
| 77 | +} | ... | ... |
web_src/config/prod.env.js
0 → 100644
web_src/index.html
0 → 100644
| 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 | + <title>gb_web</title> | |
| 7 | + </head> | |
| 8 | + <body> | |
| 9 | + <script type="text/javascript" src="./js/liveplayer-lib.min.js"></script> | |
| 10 | + <div id="app"></div> | |
| 11 | + <!-- built files will be auto injected --> | |
| 12 | + </body> | |
| 13 | +</html> | ... | ... |