@ -0,0 +1,12 @@ |
||||
{ |
||||
"presets": [ |
||||
["env", { |
||||
"modules": false, |
||||
"targets": { |
||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"] |
||||
} |
||||
}], |
||||
"stage-2" |
||||
], |
||||
"plugins": ["transform-vue-jsx", "transform-runtime"] |
||||
} |
||||
@ -0,0 +1,9 @@ |
||||
root = true |
||||
|
||||
[*] |
||||
charset = utf-8 |
||||
indent_style = space |
||||
indent_size = 2 |
||||
end_of_line = lf |
||||
insert_final_newline = true |
||||
trim_trailing_whitespace = true |
||||
@ -0,0 +1,4 @@ |
||||
/build/ |
||||
/config/ |
||||
/dist/ |
||||
/*.js |
||||
@ -0,0 +1,29 @@ |
||||
// https://eslint.org/docs/user-guide/configuring
|
||||
|
||||
module.exports = { |
||||
root: true, |
||||
parserOptions: { |
||||
parser: 'babel-eslint' |
||||
}, |
||||
env: { |
||||
browser: true, |
||||
}, |
||||
extends: [ |
||||
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
|
||||
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
|
||||
'plugin:vue/essential',
|
||||
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
|
||||
'standard' |
||||
], |
||||
// required to lint *.vue files
|
||||
plugins: [ |
||||
'vue' |
||||
], |
||||
// add your custom rules here
|
||||
rules: { |
||||
// allow async-await
|
||||
'generator-star-spacing': 'off', |
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' |
||||
} |
||||
} |
||||
@ -0,0 +1,17 @@ |
||||
.DS_Store |
||||
node_modules/ |
||||
/dist/ |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
|
||||
# Editor directories and files |
||||
.idea |
||||
.vscode |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
||||
*.lock |
||||
package-lock |
||||
# *.zip |
||||
@ -0,0 +1,10 @@ |
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = { |
||||
"plugins": { |
||||
"postcss-import": {}, |
||||
"postcss-url": {}, |
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {} |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
# tdtmap |
||||
|
||||
> A Vue.js project |
||||
|
||||
## Build Setup |
||||
|
||||
``` bash |
||||
# install dependencies |
||||
npm install |
||||
|
||||
# serve with hot reload at localhost:8080 |
||||
npm run dev |
||||
|
||||
# build for production with minification |
||||
npm run build |
||||
|
||||
# build for production and view the bundle analyzer report |
||||
npm run build --report |
||||
``` |
||||
|
||||
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). |
||||
@ -0,0 +1,41 @@ |
||||
'use strict' |
||||
require('./check-versions')() |
||||
|
||||
process.env.NODE_ENV = 'production' |
||||
|
||||
const ora = require('ora') |
||||
const rm = require('rimraf') |
||||
const path = require('path') |
||||
const chalk = require('chalk') |
||||
const webpack = require('webpack') |
||||
const config = require('../config') |
||||
const webpackConfig = require('./webpack.prod.conf') |
||||
|
||||
const spinner = ora('building for production...') |
||||
spinner.start() |
||||
|
||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { |
||||
if (err) throw err |
||||
webpack(webpackConfig, (err, stats) => { |
||||
spinner.stop() |
||||
if (err) throw err |
||||
process.stdout.write(stats.toString({ |
||||
colors: true, |
||||
modules: false, |
||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||
chunks: false, |
||||
chunkModules: false |
||||
}) + '\n\n') |
||||
|
||||
if (stats.hasErrors()) { |
||||
console.log(chalk.red(' Build failed with errors.\n')) |
||||
process.exit(1) |
||||
} |
||||
|
||||
console.log(chalk.cyan(' Build complete.\n')) |
||||
console.log(chalk.yellow( |
||||
' Tip: built files are meant to be served over an HTTP server.\n' + |
||||
' Opening index.html over file:// won\'t work.\n' |
||||
)) |
||||
}) |
||||
}) |
||||
@ -0,0 +1,54 @@ |
||||
'use strict' |
||||
const chalk = require('chalk') |
||||
const semver = require('semver') |
||||
const packageConfig = require('../package.json') |
||||
const shell = require('shelljs') |
||||
|
||||
function exec (cmd) { |
||||
return require('child_process').execSync(cmd).toString().trim() |
||||
} |
||||
|
||||
const versionRequirements = [ |
||||
{ |
||||
name: 'node', |
||||
currentVersion: semver.clean(process.version), |
||||
versionRequirement: packageConfig.engines.node |
||||
} |
||||
] |
||||
|
||||
if (shell.which('npm')) { |
||||
versionRequirements.push({ |
||||
name: 'npm', |
||||
currentVersion: exec('npm --version'), |
||||
versionRequirement: packageConfig.engines.npm |
||||
}) |
||||
} |
||||
|
||||
module.exports = function () { |
||||
const warnings = [] |
||||
|
||||
for (let i = 0; i < versionRequirements.length; i++) { |
||||
const mod = versionRequirements[i] |
||||
|
||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { |
||||
warnings.push(mod.name + ': ' + |
||||
chalk.red(mod.currentVersion) + ' should be ' + |
||||
chalk.green(mod.versionRequirement) |
||||
) |
||||
} |
||||
} |
||||
|
||||
if (warnings.length) { |
||||
console.log('') |
||||
console.log(chalk.yellow('To use this template, you must update following to modules:')) |
||||
console.log() |
||||
|
||||
for (let i = 0; i < warnings.length; i++) { |
||||
const warning = warnings[i] |
||||
console.log(' ' + warning) |
||||
} |
||||
|
||||
console.log() |
||||
process.exit(1) |
||||
} |
||||
} |
||||
|
After Width: | Height: | Size: 6.7 KiB |
@ -0,0 +1,101 @@ |
||||
'use strict' |
||||
const path = require('path') |
||||
const config = require('../config') |
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin') |
||||
const packageConfig = require('../package.json') |
||||
|
||||
exports.assetsPath = function (_path) { |
||||
const assetsSubDirectory = process.env.NODE_ENV === 'production' |
||||
? config.build.assetsSubDirectory |
||||
: config.dev.assetsSubDirectory |
||||
|
||||
return path.posix.join(assetsSubDirectory, _path) |
||||
} |
||||
|
||||
exports.cssLoaders = function (options) { |
||||
options = options || {} |
||||
|
||||
const cssLoader = { |
||||
loader: 'css-loader', |
||||
options: { |
||||
sourceMap: options.sourceMap |
||||
} |
||||
} |
||||
|
||||
const postcssLoader = { |
||||
loader: 'postcss-loader', |
||||
options: { |
||||
sourceMap: options.sourceMap |
||||
} |
||||
} |
||||
|
||||
// generate loader string to be used with extract text plugin
|
||||
function generateLoaders (loader, loaderOptions) { |
||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] |
||||
|
||||
if (loader) { |
||||
loaders.push({ |
||||
loader: loader + '-loader', |
||||
options: Object.assign({}, loaderOptions, { |
||||
sourceMap: options.sourceMap |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
// Extract CSS when that option is specified
|
||||
// (which is the case during production build)
|
||||
if (options.extract) { |
||||
return ExtractTextPlugin.extract({ |
||||
use: loaders, |
||||
fallback: 'vue-style-loader' |
||||
}) |
||||
} else { |
||||
return ['vue-style-loader'].concat(loaders) |
||||
} |
||||
} |
||||
|
||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||
return { |
||||
css: generateLoaders(), |
||||
postcss: generateLoaders(), |
||||
less: generateLoaders('less'), |
||||
sass: generateLoaders('sass', { indentedSyntax: true }), |
||||
scss: generateLoaders('sass'), |
||||
stylus: generateLoaders('stylus'), |
||||
styl: generateLoaders('stylus') |
||||
} |
||||
} |
||||
|
||||
// Generate loaders for standalone style files (outside of .vue)
|
||||
exports.styleLoaders = function (options) { |
||||
const output = [] |
||||
const loaders = exports.cssLoaders(options) |
||||
|
||||
for (const extension in loaders) { |
||||
const loader = loaders[extension] |
||||
output.push({ |
||||
test: new RegExp('\\.' + extension + '$'), |
||||
use: loader |
||||
}) |
||||
} |
||||
|
||||
return output |
||||
} |
||||
|
||||
exports.createNotifierCallback = () => { |
||||
const notifier = require('node-notifier') |
||||
|
||||
return (severity, errors) => { |
||||
if (severity !== 'error') return |
||||
|
||||
const error = errors[0] |
||||
const filename = error.file && error.file.split('!').pop() |
||||
|
||||
notifier.notify({ |
||||
title: packageConfig.name, |
||||
message: severity + ': ' + error.name, |
||||
subtitle: filename || '', |
||||
icon: path.join(__dirname, 'logo.png') |
||||
}) |
||||
} |
||||
} |
||||
@ -0,0 +1,22 @@ |
||||
'use strict' |
||||
const utils = require('./utils') |
||||
const config = require('../config') |
||||
const isProduction = process.env.NODE_ENV === 'production' |
||||
const sourceMapEnabled = isProduction |
||||
? config.build.productionSourceMap |
||||
: config.dev.cssSourceMap |
||||
|
||||
module.exports = { |
||||
loaders: utils.cssLoaders({ |
||||
sourceMap: sourceMapEnabled, |
||||
extract: isProduction |
||||
}), |
||||
cssSourceMap: sourceMapEnabled, |
||||
cacheBusting: config.dev.cacheBusting, |
||||
transformToRequire: { |
||||
video: ['src', 'poster'], |
||||
source: 'src', |
||||
img: 'src', |
||||
image: 'xlink:href' |
||||
} |
||||
} |
||||
@ -0,0 +1,92 @@ |
||||
'use strict' |
||||
const path = require('path') |
||||
const utils = require('./utils') |
||||
const config = require('../config') |
||||
const vueLoaderConfig = require('./vue-loader.conf') |
||||
require("babel-polyfill") |
||||
function resolve (dir) { |
||||
return path.join(__dirname, '..', dir) |
||||
} |
||||
|
||||
const createLintingRule = () => ({ |
||||
test: /\.(js|vue)$/, |
||||
loader: 'eslint-loader', |
||||
enforce: 'pre', |
||||
include: [resolve('src'), resolve('test')], |
||||
options: { |
||||
formatter: require('eslint-friendly-formatter'), |
||||
emitWarning: !config.dev.showEslintErrorsInOverlay |
||||
} |
||||
}) |
||||
|
||||
module.exports = { |
||||
context: path.resolve(__dirname, '../'), |
||||
entry: { |
||||
app: './src/main.js' |
||||
}, |
||||
output: { |
||||
path: config.build.assetsRoot, |
||||
filename: '[name].js', |
||||
publicPath: process.env.NODE_ENV === 'production' |
||||
? config.build.assetsPublicPath |
||||
: config.dev.assetsPublicPath |
||||
}, |
||||
resolve: { |
||||
extensions: ['.js', '.vue', '.json'], |
||||
alias: { |
||||
'vue$': 'vue/dist/vue.esm.js', |
||||
'@': resolve('src'), |
||||
} |
||||
}, |
||||
module: { |
||||
rules: [ |
||||
// ...(config.dev.useEslint ? [createLintingRule()] : []),
|
||||
{ |
||||
test: /\.vue$/, |
||||
loader: 'vue-loader', |
||||
options: vueLoaderConfig |
||||
}, |
||||
{ |
||||
test: /\.js$/, |
||||
loader: 'babel-loader', |
||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] |
||||
}, |
||||
{ |
||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, |
||||
loader: 'url-loader', |
||||
options: { |
||||
limit: 10000, |
||||
name: utils.assetsPath('img/[name].[hash:7].[ext]') |
||||
} |
||||
}, |
||||
{ |
||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, |
||||
loader: 'url-loader', |
||||
options: { |
||||
limit: 10000, |
||||
name: utils.assetsPath('media/[name].[hash:7].[ext]') |
||||
} |
||||
}, |
||||
{ |
||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, |
||||
loader: 'url-loader', |
||||
options: { |
||||
limit: 10000, |
||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]') |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
node: { |
||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||
// source contains it (although only uses it if it's native).
|
||||
setImmediate: false, |
||||
// prevent webpack from injecting mocks to Node native modules
|
||||
// that does not make sense for the client
|
||||
dgram: 'empty', |
||||
fs: 'empty', |
||||
net: 'empty', |
||||
tls: 'empty', |
||||
child_process: 'empty' |
||||
} |
||||
} |
||||
@ -0,0 +1,95 @@ |
||||
'use strict' |
||||
const utils = require('./utils') |
||||
const webpack = require('webpack') |
||||
const config = require('../config') |
||||
const merge = require('webpack-merge') |
||||
const path = require('path') |
||||
const baseWebpackConfig = require('./webpack.base.conf') |
||||
const CopyWebpackPlugin = require('copy-webpack-plugin') |
||||
const HtmlWebpackPlugin = require('html-webpack-plugin') |
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') |
||||
const portfinder = require('portfinder') |
||||
|
||||
const HOST = process.env.HOST |
||||
const PORT = process.env.PORT && Number(process.env.PORT) |
||||
|
||||
const devWebpackConfig = merge(baseWebpackConfig, { |
||||
module: { |
||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) |
||||
}, |
||||
// cheap-module-eval-source-map is faster for development
|
||||
devtool: config.dev.devtool, |
||||
|
||||
// these devServer options should be customized in /config/index.js
|
||||
devServer: { |
||||
clientLogLevel: 'warning', |
||||
historyApiFallback: { |
||||
rewrites: [ |
||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, |
||||
], |
||||
}, |
||||
hot: true, |
||||
contentBase: false, // since we use CopyWebpackPlugin.
|
||||
compress: true, |
||||
host: HOST || config.dev.host, |
||||
port: PORT || config.dev.port, |
||||
open: config.dev.autoOpenBrowser, |
||||
overlay: config.dev.errorOverlay |
||||
? { warnings: false, errors: true } |
||||
: false, |
||||
publicPath: config.dev.assetsPublicPath, |
||||
proxy: config.dev.proxyTable, |
||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||
watchOptions: { |
||||
poll: config.dev.poll, |
||||
} |
||||
}, |
||||
plugins: [ |
||||
new webpack.DefinePlugin({ |
||||
'process.env': require('../config/dev.env') |
||||
}), |
||||
new webpack.HotModuleReplacementPlugin(), |
||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
||||
new webpack.NoEmitOnErrorsPlugin(), |
||||
// https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({ |
||||
filename: 'index.html', |
||||
template: 'index.html', |
||||
inject: true |
||||
}), |
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([ |
||||
{ |
||||
from: path.resolve(__dirname, '../static'), |
||||
to: config.dev.assetsSubDirectory, |
||||
ignore: ['.*'] |
||||
} |
||||
]) |
||||
] |
||||
}) |
||||
|
||||
module.exports = new Promise((resolve, reject) => { |
||||
portfinder.basePort = process.env.PORT || config.dev.port |
||||
portfinder.getPort((err, port) => { |
||||
if (err) { |
||||
reject(err) |
||||
} else { |
||||
// publish the new Port, necessary for e2e tests
|
||||
process.env.PORT = port |
||||
// add port to devServer config
|
||||
devWebpackConfig.devServer.port = port |
||||
|
||||
// Add FriendlyErrorsPlugin
|
||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ |
||||
compilationSuccessInfo: { |
||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], |
||||
}, |
||||
onErrors: config.dev.notifyOnErrors |
||||
? utils.createNotifierCallback() |
||||
: undefined |
||||
})) |
||||
|
||||
resolve(devWebpackConfig) |
||||
} |
||||
}) |
||||
}) |
||||
@ -0,0 +1,145 @@ |
||||
'use strict' |
||||
const path = require('path') |
||||
const utils = require('./utils') |
||||
const webpack = require('webpack') |
||||
const config = require('../config') |
||||
const merge = require('webpack-merge') |
||||
const baseWebpackConfig = require('./webpack.base.conf') |
||||
const CopyWebpackPlugin = require('copy-webpack-plugin') |
||||
const HtmlWebpackPlugin = require('html-webpack-plugin') |
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin') |
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') |
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') |
||||
|
||||
const env = require('../config/prod.env') |
||||
|
||||
const webpackConfig = merge(baseWebpackConfig, { |
||||
module: { |
||||
rules: utils.styleLoaders({ |
||||
sourceMap: config.build.productionSourceMap, |
||||
extract: true, |
||||
usePostCSS: true |
||||
}) |
||||
}, |
||||
devtool: config.build.productionSourceMap ? config.build.devtool : false, |
||||
output: { |
||||
path: config.build.assetsRoot, |
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'), |
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') |
||||
}, |
||||
plugins: [ |
||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||
new webpack.DefinePlugin({ |
||||
'process.env': env |
||||
}), |
||||
new UglifyJsPlugin({ |
||||
uglifyOptions: { |
||||
compress: { |
||||
warnings: false |
||||
} |
||||
}, |
||||
sourceMap: config.build.productionSourceMap, |
||||
parallel: true |
||||
}), |
||||
// extract css into its own file
|
||||
new ExtractTextPlugin({ |
||||
filename: utils.assetsPath('css/[name].[contenthash].css'), |
||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||
allChunks: true, |
||||
}), |
||||
// Compress extracted CSS. We are using this plugin so that possible
|
||||
// duplicated CSS from different components can be deduped.
|
||||
new OptimizeCSSPlugin({ |
||||
cssProcessorOptions: config.build.productionSourceMap |
||||
? { safe: true, map: { inline: false } } |
||||
: { safe: true } |
||||
}), |
||||
// generate dist index.html with correct asset hash for caching.
|
||||
// you can customize output by editing /index.html
|
||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({ |
||||
filename: config.build.index, |
||||
template: 'index.html', |
||||
inject: true, |
||||
minify: { |
||||
removeComments: true, |
||||
collapseWhitespace: true, |
||||
removeAttributeQuotes: true |
||||
// more options:
|
||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||
}, |
||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||
chunksSortMode: 'dependency' |
||||
}), |
||||
// keep module.id stable when vendor modules does not change
|
||||
new webpack.HashedModuleIdsPlugin(), |
||||
// enable scope hoisting
|
||||
new webpack.optimize.ModuleConcatenationPlugin(), |
||||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({ |
||||
name: 'vendor', |
||||
minChunks (module) { |
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return ( |
||||
module.resource && |
||||
/\.js$/.test(module.resource) && |
||||
module.resource.indexOf( |
||||
path.join(__dirname, '../node_modules') |
||||
) === 0 |
||||
) |
||||
} |
||||
}), |
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({ |
||||
name: 'manifest', |
||||
minChunks: Infinity |
||||
}), |
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({ |
||||
name: 'app', |
||||
async: 'vendor-async', |
||||
children: true, |
||||
minChunks: 3 |
||||
}), |
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([ |
||||
{ |
||||
from: path.resolve(__dirname, '../static'), |
||||
to: config.build.assetsSubDirectory, |
||||
ignore: ['.*'] |
||||
} |
||||
]) |
||||
] |
||||
}) |
||||
|
||||
if (config.build.productionGzip) { |
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin') |
||||
|
||||
webpackConfig.plugins.push( |
||||
new CompressionWebpackPlugin({ |
||||
asset: '[path].gz[query]', |
||||
algorithm: 'gzip', |
||||
test: new RegExp( |
||||
'\\.(' + |
||||
config.build.productionGzipExtensions.join('|') + |
||||
')$' |
||||
), |
||||
threshold: 10240, |
||||
minRatio: 0.8 |
||||
}) |
||||
) |
||||
} |
||||
|
||||
if (config.build.bundleAnalyzerReport) { |
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin |
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin()) |
||||
} |
||||
|
||||
module.exports = webpackConfig |
||||
@ -0,0 +1,7 @@ |
||||
'use strict' |
||||
const merge = require('webpack-merge') |
||||
const prodEnv = require('./prod.env') |
||||
|
||||
module.exports = merge(prodEnv, { |
||||
NODE_ENV: '"development"' |
||||
}) |
||||
@ -0,0 +1,85 @@ |
||||
'use strict' |
||||
// Template version: 1.3.1
|
||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||
|
||||
const path = require('path') |
||||
|
||||
module.exports = { |
||||
dev: { |
||||
|
||||
// Paths
|
||||
assetsSubDirectory: 'static', |
||||
assetsPublicPath: '/', |
||||
proxyTable: { |
||||
'/api':{ |
||||
target: "http://frp.freefrp.net:23334/equipfile", |
||||
changeOrigin:true, |
||||
pathRewrite:{ |
||||
'^/api':'' |
||||
} |
||||
} |
||||
|
||||
}, |
||||
|
||||
// Various Dev Server settings
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false, |
||||
errorOverlay: true, |
||||
notifyOnErrors: true, |
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
|
||||
// Use Eslint Loader?
|
||||
// If true, your code will be linted during bundling and
|
||||
// linting errors and warnings will be shown in the console.
|
||||
useEslint: true, |
||||
// If true, eslint errors and warnings will also be shown in the error overlay
|
||||
// in the browser.
|
||||
showEslintErrorsInOverlay: false, |
||||
|
||||
/** |
||||
* Source Maps |
||||
*/ |
||||
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
devtool: 'cheap-module-eval-source-map', |
||||
|
||||
// If you have problems debugging vue-files in devtools,
|
||||
// set this to false - it *may* help
|
||||
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
||||
cacheBusting: true, |
||||
|
||||
cssSourceMap: true |
||||
}, |
||||
|
||||
build: { |
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../dist/index.html'), |
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'), |
||||
assetsSubDirectory: 'static', |
||||
assetsPublicPath: '/', |
||||
|
||||
/** |
||||
* Source Maps |
||||
*/ |
||||
|
||||
productionSourceMap: true, |
||||
// https://webpack.js.org/configuration/devtool/#production
|
||||
devtool: '#source-map', |
||||
|
||||
// Gzip off by default as many popular static hosts such as
|
||||
// Surge or Netlify already gzip all static assets for you.
|
||||
// Before setting to `true`, make sure to:
|
||||
// npm install --save-dev compression-webpack-plugin
|
||||
productionGzip: false, |
||||
productionGzipExtensions: ['js', 'css'], |
||||
|
||||
// Run the build command with an extra argument to
|
||||
// View the bundle analyzer report after build finishes:
|
||||
// `npm run build --report`
|
||||
// Set to `true` or `false` to always turn it on or off
|
||||
bundleAnalyzerReport: process.env.npm_config_report |
||||
} |
||||
} |
||||
@ -0,0 +1,4 @@ |
||||
'use strict' |
||||
module.exports = { |
||||
NODE_ENV: '"production"' |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
||||
<title>地籍图查询</title> |
||||
<script src="https://www.sdmap.gov.cn/api/olapi/js/jquery-1.6.4.min.js"></script> |
||||
<script type="text/javascript" src="https://www.sdmap.gov.cn/api/olapi/ol/openlayers.js"></script> |
||||
<script src="https://api.tianditu.gov.cn/api?v=4.0&tk=780f098f82b2c43d3a822f2c5bf7b9e4" type="text/javascript"></script> |
||||
<style type="text/css"> |
||||
html,body{ |
||||
margin: 0; |
||||
padding: 0; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<div id="app"></div> |
||||
<!-- built files will be auto injected --> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,81 @@ |
||||
{ |
||||
"name": "tdtmap", |
||||
"version": "1.0.0", |
||||
"description": "A Vue.js project", |
||||
"author": "per_fect <1914084464@qq.com>", |
||||
"private": true, |
||||
"scripts": { |
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", |
||||
"start": "npm run dev", |
||||
"lint": "eslint --ext .js,.vue src", |
||||
"build": "node build/build.js" |
||||
}, |
||||
"dependencies": { |
||||
"babel-polyfill": "^6.26.0", |
||||
"element-ui": "^2.15.6", |
||||
"js-base64": "^2.6.2", |
||||
"ol": "^6.12.0", |
||||
"url-search-params-polyfill": "^8.1.1", |
||||
"vue": "^2.5.2", |
||||
"vue-router": "^3.0.1", |
||||
"xlsx": "^0.17.4", |
||||
"xslx": "^1.0.0" |
||||
}, |
||||
"devDependencies": { |
||||
"autoprefixer": "^7.1.2", |
||||
"axios": "^0.26.0", |
||||
"babel-core": "^6.22.1", |
||||
"babel-eslint": "^8.2.1", |
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3", |
||||
"babel-loader": "^7.1.1", |
||||
"babel-plugin-syntax-jsx": "^6.18.0", |
||||
"babel-plugin-transform-runtime": "^6.22.0", |
||||
"babel-plugin-transform-vue-jsx": "^3.5.0", |
||||
"babel-preset-env": "^1.3.2", |
||||
"babel-preset-stage-2": "^6.22.0", |
||||
"chalk": "^2.0.1", |
||||
"copy-webpack-plugin": "^4.0.1", |
||||
"css-loader": "^0.28.0", |
||||
"eslint": "^4.15.0", |
||||
"eslint-config-standard": "^10.2.1", |
||||
"eslint-friendly-formatter": "^3.0.0", |
||||
"eslint-loader": "^1.7.1", |
||||
"eslint-plugin-import": "^2.7.0", |
||||
"eslint-plugin-node": "^5.2.0", |
||||
"eslint-plugin-promise": "^3.4.0", |
||||
"eslint-plugin-standard": "^3.0.1", |
||||
"eslint-plugin-vue": "^4.0.0", |
||||
"extract-text-webpack-plugin": "^3.0.0", |
||||
"file-loader": "^1.1.4", |
||||
"friendly-errors-webpack-plugin": "^1.6.1", |
||||
"html-webpack-plugin": "^2.30.1", |
||||
"node-notifier": "^5.1.2", |
||||
"optimize-css-assets-webpack-plugin": "^3.2.0", |
||||
"ora": "^1.2.0", |
||||
"portfinder": "^1.0.13", |
||||
"postcss-import": "^11.0.0", |
||||
"postcss-loader": "^2.0.8", |
||||
"postcss-url": "^7.2.1", |
||||
"rimraf": "^2.6.0", |
||||
"semver": "^5.3.0", |
||||
"shelljs": "^0.7.6", |
||||
"uglifyjs-webpack-plugin": "^1.1.1", |
||||
"url-loader": "^0.5.8", |
||||
"vue-loader": "^13.3.0", |
||||
"vue-style-loader": "^3.0.1", |
||||
"vue-template-compiler": "^2.5.2", |
||||
"webpack": "^3.6.0", |
||||
"webpack-bundle-analyzer": "^2.9.0", |
||||
"webpack-dev-server": "^2.9.1", |
||||
"webpack-merge": "^4.1.0" |
||||
}, |
||||
"engines": { |
||||
"node": ">= 6.0.0", |
||||
"npm": ">= 3.0.0" |
||||
}, |
||||
"browserslist": [ |
||||
"> 1%", |
||||
"last 2 versions", |
||||
"not ie <= 8" |
||||
] |
||||
} |
||||
@ -0,0 +1,163 @@ |
||||
<template> |
||||
<div id="app"> |
||||
|
||||
<router-view /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'App' |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
#app { |
||||
font-family: "Avenir", Helvetica, Arial, sans-serif; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
text-align: center; |
||||
color: #2c3e50; |
||||
width: 100%; |
||||
height: 100%; |
||||
/* margin-top: 60px; */ |
||||
|
||||
} |
||||
.header { |
||||
width: 100%; |
||||
height: 80px; |
||||
background-color: rgba(0, 63, 138, 1); |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
z-index: 999; |
||||
} |
||||
.logo { |
||||
border-width: 0px; |
||||
position: absolute; |
||||
left: 48px; |
||||
top: 26px; |
||||
width: 66px; |
||||
height: 32px; |
||||
display: flex; |
||||
font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", |
||||
sans-serif; |
||||
font-weight: 650; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #ffffff; |
||||
} |
||||
.title { |
||||
border-width: 0px; |
||||
position: absolute; |
||||
left: 139px; |
||||
top: 30px; |
||||
width: 216px; |
||||
height: 24px; |
||||
display: flex; |
||||
font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", |
||||
sans-serif; |
||||
font-weight: 650; |
||||
font-style: normal; |
||||
font-size: 18px; |
||||
color: #ffffff; |
||||
} |
||||
.search { |
||||
border-width: 0px; |
||||
position: absolute; |
||||
background-color: rgba(26, 94, 174, 1); |
||||
left: 430px; |
||||
top: 22px; |
||||
/* width: 360px; */ |
||||
height: 42px; |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
.img{ |
||||
width: 24px; |
||||
height: 24px; |
||||
margin: 0 20px; |
||||
} |
||||
input { |
||||
width: 209px; |
||||
/* height: 42px; */ |
||||
background-color: rgba(26, 94, 174, 1); |
||||
border: none; |
||||
border-radius: 0px; |
||||
} |
||||
input::-webkit-input-placeholder { |
||||
/* Mozilla Firefox 4 to 18 */ |
||||
color: rgb(166, 186, 255); |
||||
} |
||||
.el-button{ |
||||
border-radius: 0; |
||||
} |
||||
.sel{ |
||||
background-color: rgba(22, 144, 255, 1); |
||||
font-size: 16px; |
||||
font-weight: 500; |
||||
} |
||||
/* 使用说明 */ |
||||
.use{ |
||||
position: relative; |
||||
float: right; |
||||
margin-right: 48px; |
||||
top: 30px; |
||||
} |
||||
.txt{ |
||||
color: #fff; |
||||
font-weight: 400; |
||||
font-style: normal; |
||||
/* font-size: 13px; */ |
||||
font-family: 'ArialMT', 'Arial', sans-serif; |
||||
display: flex; |
||||
align-items: center; |
||||
cursor: pointer; |
||||
} |
||||
.use:hover .list{ |
||||
display: block; |
||||
} |
||||
.use-img{ |
||||
width: 16px; |
||||
height: 16px; |
||||
margin-right: 5px; |
||||
} |
||||
.list{ |
||||
display: none; |
||||
position: absolute; |
||||
background-color: #fff; |
||||
width: 207px; |
||||
top:60px; |
||||
right: -30px; |
||||
} |
||||
.ps{ |
||||
font-family: PingFangSC-Regular, "PingFang SC", sans-serif; |
||||
font-weight: 400; |
||||
font-style: normal; |
||||
font-size: 11px; |
||||
margin-bottom: 0; |
||||
} |
||||
.ul{ |
||||
padding: 6px; |
||||
text-align: left; |
||||
margin: 0; |
||||
} |
||||
li{ |
||||
list-style-type:none; |
||||
} |
||||
.li{ |
||||
font-family: PingFangSC-Regular, "PingFang SC", sans-serif; |
||||
font-weight: 400; |
||||
font-style: normal; |
||||
font-size: 11px; |
||||
|
||||
} |
||||
.lis{ |
||||
font-family: PingFangSC-Regular, "PingFang SC", sans-serif; |
||||
font-weight: 400; |
||||
font-style: normal; |
||||
font-size: 11px; |
||||
color: rgb(153, 153, 153); |
||||
} |
||||
|
||||
</style> |
||||
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 777 B |
|
After Width: | Height: | Size: 5.2 KiB |
@ -0,0 +1,888 @@ |
||||
export const xzqData = [{ |
||||
objectiId: 1, |
||||
code: '370203', |
||||
name: '市北区', |
||||
nameCode: '55799456', |
||||
length: '33134.279764', |
||||
area: '55799456.179337' |
||||
}] |
||||
export const djqData = [{ |
||||
objectiId: 1, |
||||
code: '370203004', |
||||
name: '合肥路街道', |
||||
nameCode: '370203', |
||||
length: '6637.320253', |
||||
area: '2832211.358111' |
||||
}] |
||||
export const djzqData = [{ |
||||
objectiId: 1, |
||||
code: '370203004002', |
||||
name: '合肥路街道2', |
||||
nameCode: '370203', |
||||
length: '4396.032725', |
||||
area: '1000591.332551' |
||||
}, |
||||
{ |
||||
objectiId: 5, |
||||
code: '370203004001', |
||||
name: '合肥路街道1', |
||||
nameCode: '370203', |
||||
length: '2421.107957', |
||||
area: '355275.583152' |
||||
}, |
||||
{ |
||||
objectiId: 6, |
||||
code: '370203004003', |
||||
name: '合肥路街道4', |
||||
nameCode: '370203', |
||||
length: '3109.799029', |
||||
area: '534857.041259' |
||||
} |
||||
] |
||||
export const zdDetail = [ |
||||
//23
|
||||
{ |
||||
bdcdyh:'370203003001GB00002W00000000', |
||||
lon:120.39779913902, |
||||
lat:36.139437026978 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00003W00000000', |
||||
lon:120.39728415489, |
||||
lat:36.138943500519 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00005W00000000', |
||||
lon:120.39664042473, |
||||
lat:36.138085193635 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00009W00000000', |
||||
lon:120.39711249351, |
||||
lat:36.137420005799 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00006W00000000', |
||||
lon:120.39852869987, |
||||
lat:36.137505836487 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00010W00000000', |
||||
lon:120.39887202263, |
||||
lat:36.136475868226 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203032502GB00001W00000000', |
||||
lon:120.3981210041, |
||||
lat:36.135596103669 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00022W00000000', |
||||
lon:120.39492381096, |
||||
lat:36.135274238587 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00018W00000000', |
||||
lon:120.39556754112, |
||||
lat:36.134008235932 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00015W00000000', |
||||
lon:120.40071738243, |
||||
lat:36.134544677735 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00021W00000000', |
||||
lon:120.39870036125, |
||||
lat:36.133257217408 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00027W00000000', |
||||
lon:120.39736998558, |
||||
lat:36.132077045441 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00026W00000000', |
||||
lon:120.40037405968, |
||||
lat:36.132227249146 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00028W00000000', |
||||
lon:120.40136111259, |
||||
lat:36.131883926392 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003001GB00020W00000000', |
||||
lon:120.40337813377, |
||||
lat:36.133343048096 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00004W00000000', |
||||
lon:120.40554535866, |
||||
lat:36.133965320588 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00010W00000000', |
||||
lon:120.40575993538, |
||||
lat:36.132527656556 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00022W00000000', |
||||
lon:120.40227306366, |
||||
lat:36.130714483261 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00018W00000000', |
||||
lon:120.40514839172, |
||||
lat:36.131014890671 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00028W00000000', |
||||
lon:120.40727270126, |
||||
lat:36.129856176376 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00072W00000000', |
||||
lon:120.40823829651, |
||||
lat:36.131036348343 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00015W00000000', |
||||
lon:120.40922534943, |
||||
lat:36.131551332474 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00011W00000000', |
||||
lon:120.40935409546, |
||||
lat:36.132152147293 |
||||
}, |
||||
//13
|
||||
{ |
||||
bdcdyh:'370203003002GB00087W00000000', |
||||
lon:120.38439882279, |
||||
lat:36.134566135406 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00089W00000000', |
||||
lon:120.3848494339, |
||||
lat:36.134094066619 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00090W00000000', |
||||
lon:120.38497817994, |
||||
lat:36.133149929046 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00095W00000000', |
||||
lon:120.38463485718, |
||||
lat:36.132398910522 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00094W00000000', |
||||
lon:120.38343322754, |
||||
lat:36.131712265014 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00098W00000000', |
||||
lon:120.3852034855, |
||||
lat:36.132742233276 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00096W00000000', |
||||
lon:120.38587940217, |
||||
lat:36.131733722686 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00007W00000000', |
||||
lon:120.38744581224, |
||||
lat:36.132785148619 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00099W00000000', |
||||
lon:120.38733852388, |
||||
lat:36.131132907866 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00097W00000000', |
||||
lon:120.38605106355, |
||||
lat:36.129888362883 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00101W00000000', |
||||
lon:120.38864744187, |
||||
lat:36.13076812744 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00088W00000000', |
||||
lon:120.38774621965, |
||||
lat:36.129630870818 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003002GB00100W00000000', |
||||
lon:120.38916242601, |
||||
lat:36.130446262358 |
||||
}, |
||||
|
||||
//8
|
||||
{ |
||||
bdcdyh:'370203003005GB00043W00000000', |
||||
lon:120.38205993652, |
||||
lat:36.129534311294 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00009W00000000', |
||||
lon:120.38128746032, |
||||
lat:36.128053731918 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00012W00000000', |
||||
lon:120.38214576721, |
||||
lat:36.127924985886 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00006W00000000', |
||||
lon:120.38366926193, |
||||
lat:36.128804750442 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00014W00000000', |
||||
lon:120.38319719314, |
||||
lat:36.127324171066 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00018W00000000', |
||||
lon:120.38394821167, |
||||
lat:36.12655169487 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00021W00000000', |
||||
lon:120.38474214554, |
||||
lat:36.125865049362 |
||||
}, |
||||
//17
|
||||
{ |
||||
bdcdyh:'370203003005GB00023W00000000', |
||||
lon:120.38201702117, |
||||
lat:36.125918693542 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00032W00000000', |
||||
lon:120.38141620635, |
||||
lat:36.123815841675 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00024W00000000', |
||||
lon:120.3780688095, |
||||
lat:36.12589723587 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00029W00000000', |
||||
lon:120.37817609786, |
||||
lat:36.124802894592 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00033W00000000', |
||||
lon:120.37813318251, |
||||
lat:36.123386688232 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003005GB00036W00000000', |
||||
lon:120.37761819838, |
||||
lat:36.122485466003 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00002W00000000', |
||||
lon:120.37532222747, |
||||
lat:36.122013397217 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00005W00000000', |
||||
lon:120.37798297881, |
||||
lat:36.121026344299 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00015W00000000', |
||||
lon:120.37390602111, |
||||
lat:36.119245357513 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00017W00000000', |
||||
lon:120.37339103698, |
||||
lat:36.118644542694 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00012W00000000', |
||||
lon:120.37607324599, |
||||
lat:36.119288272858 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00022W00000000', |
||||
lon:120.37579429625, |
||||
lat:36.117979354858 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00014W00000000', |
||||
lon:120.3784550476, |
||||
lat:36.119331188202 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00020W00000000', |
||||
lon:120.37834775923, |
||||
lat:36.118129558563 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00010W00000000', |
||||
lon:120.37972105025, |
||||
lat:36.119974918365 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003007GB00013W00000000', |
||||
lon:120.37933481215, |
||||
lat:36.11941701889 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203007002GB00008W00000000', |
||||
lon:120.37504327773, |
||||
lat:36.11576921463 |
||||
}, |
||||
//27
|
||||
{ |
||||
bdcdyh:'370203003004GB00005W00000000', |
||||
lon:120.39371145248, |
||||
lat:36.130102939605 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00007W00000000', |
||||
lon:120.39199483871, |
||||
lat:36.130167312621 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00012W00000000', |
||||
lon:120.39160860061, |
||||
lat:36.129566497802 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00017W00000000', |
||||
lon:120.39010656356, |
||||
lat:36.128858394622 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00026W00000000', |
||||
lon:120.39100778579, |
||||
lat:36.127785511016 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00050W00000000', |
||||
lon:120.39201629638, |
||||
lat:36.126219100951 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00010W00000000', |
||||
lon:120.39435518264, |
||||
lat:36.129673786162 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00020W00000000', |
||||
lon:120.39418352126, |
||||
lat:36.128772563933 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00029W00000000', |
||||
lon:120.39448392867, |
||||
lat:36.126841373443 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00036W00000000', |
||||
lon:120.3943122673, |
||||
lat:36.125146217345 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00040W00000000', |
||||
lon:120.3956211853, |
||||
lat:36.123944587707 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00049W00000000', |
||||
lon:120.39647949218, |
||||
lat:36.130210227965 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00021W00000000', |
||||
lon:120.39611471175, |
||||
lat:36.128407783507 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00024W00000000', |
||||
lon:120.39712322234, |
||||
lat:36.128214664458 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00014W00000000', |
||||
lon:120.39875400542, |
||||
lat:36.12954504013 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00032W00000000', |
||||
lon:120.39765966415, |
||||
lat:36.126347846984 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00037W00000000', |
||||
lon:120.39710176467, |
||||
lat:36.124695606231 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003004GB00043W00000000', |
||||
lon:120.39684427261, |
||||
lat:36.12347251892 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00064W00000000', |
||||
lon:120.39755237579, |
||||
lat:36.122893161773 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00035W00000000', |
||||
lon:120.40143621444, |
||||
lat:36.129008598327 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00037W00000000', |
||||
lon:120.40072811126, |
||||
lat:36.128708190917 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00041W00000000', |
||||
lon:120.3994299221, |
||||
lat:36.128171749114 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00054W00000000', |
||||
lon:120.39955866813, |
||||
lat:36.125983066558 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00049W00000000', |
||||
lon:120.40264857292, |
||||
lat:36.126927204131 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00050W00000000', |
||||
lon:120.4031206417, |
||||
lat:36.12676627159 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00074W00000000', |
||||
lon:120.40167224883, |
||||
lat:36.126015253065 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003003GB00057W00000000', |
||||
lon:120.40125382423, |
||||
lat:36.124953098296 |
||||
}, |
||||
|
||||
//40
|
||||
{ |
||||
bdcdyh:'370203003006GB00102W00000000', |
||||
lon:120.39029968261, |
||||
lat:36.124974555969 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00002W00000000', |
||||
lon:120.38697374343, |
||||
lat:36.126068897247 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00005W00000000', |
||||
lon:120.38755310058, |
||||
lat:36.125317878723 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00103W00000000', |
||||
lon:120.38836849212, |
||||
lat:36.124266452789 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00024W00000000', |
||||
lon:120.38935554503, |
||||
lat:36.123408145905 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00015W00000000', |
||||
lon:120.38560045241, |
||||
lat:36.124266452789 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00022W00000000', |
||||
lon:120.38510692595, |
||||
lat:36.1239124012 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00025W00000000', |
||||
lon:120.38459194182, |
||||
lat:36.123236484528 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00032W00000000', |
||||
lon:120.38432372092, |
||||
lat:36.122839517594 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00037W00000000', |
||||
lon:120.38378727911, |
||||
lat:36.1226034832 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00045W00000000', |
||||
lon:120.38342249869, |
||||
lat:36.122034854889 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00048W00000000', |
||||
lon:120.38275731085, |
||||
lat:36.121873922348 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00053W00000000', |
||||
lon:120.38282168387, |
||||
lat:36.121552057266 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00059W00000000', |
||||
lon:120.38266075133, |
||||
lat:36.121273107529 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00061W00000000', |
||||
lon:120.38238180159, |
||||
lat:36.121058530808 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00065W00000000', |
||||
lon:120.38227451323, |
||||
lat:36.120661563874 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00070W00000000', |
||||
lon:120.38209212302, |
||||
lat:36.120221681595 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00076W00000000', |
||||
lon:120.38270366667, |
||||
lat:36.119835443497 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00001W00000000', |
||||
lon:120.38421643256, |
||||
lat:36.120296783447 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00077W00000000', |
||||
lon:120.38524640082, |
||||
lat:36.119889087677 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00104W00000000', |
||||
lon:120.38852942465, |
||||
lat:36.122785873413 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00051W00000000', |
||||
lon:120.38852942465, |
||||
lat:36.122785873413 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00002W00000000', |
||||
lon:120.38156641006, |
||||
lat:36.119245357514 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00004W00000000', |
||||
lon:120.38345468521, |
||||
lat:36.118816204072 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00005W00000000', |
||||
lon:120.38465631484, |
||||
lat:36.118837661744 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00101W00000000', |
||||
lon:120.38512838363, |
||||
lat:36.118880577086 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00026W00000000', |
||||
lon:120.38673234462, |
||||
lat:36.117024488449 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00030W00000000', |
||||
lon:120.38647485256, |
||||
lat:36.11655778408 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00006W00000000', |
||||
lon:120.38849723816, |
||||
lat:36.118397779463 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00007W00000000', |
||||
lon:120.38911951065, |
||||
lat:36.118022270201 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00014W00000000', |
||||
lon:120.38740289688, |
||||
lat:36.117764778136 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00022W00000000', |
||||
lon:120.38730633736, |
||||
lat:36.117212243079 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00010W00000000', |
||||
lon:120.38175952911, |
||||
lat:36.117850608825 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00019W00000000', |
||||
lon:120.37991416931, |
||||
lat:36.117464370727 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00024W00000000', |
||||
lon:120.38094413757, |
||||
lat:36.117121047973 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00031W00000000', |
||||
lon:120.38094413757, |
||||
lat:36.117121047973 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00043W00000000', |
||||
lon:120.3785408783, |
||||
lat:36.11405260086 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00059W00000000', |
||||
lon:120.37909877777, |
||||
lat:36.111863918304 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00064W00000000', |
||||
lon:120.38018239021, |
||||
lat:36.111509866714 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00001W00000000', |
||||
lon:120.38047206878, |
||||
lat:36.111649341582 |
||||
}, |
||||
|
||||
//40
|
||||
{ |
||||
bdcdyh:'370203003006GB00014W00000000', |
||||
lon:120.39210212707, |
||||
lat:36.1245668602 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00101W00000000', |
||||
lon:120.39268148421, |
||||
lat:36.122721500398 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00039W00000000', |
||||
lon:120.39553535461, |
||||
lat:36.122399635316 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00042W00000000', |
||||
lon:120.39723587512, |
||||
lat:36.122249431611 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00054W00000000', |
||||
lon:120.39100242137, |
||||
lat:36.121476955415 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00067W00000000', |
||||
lon:120.39003682612, |
||||
lat:36.120575733186 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00068W00000000', |
||||
lon:120.39265466212, |
||||
lat:36.120500631334 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00089W00000000', |
||||
lon:120.39223623751, |
||||
lat:36.119459934236 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00085W00000000', |
||||
lon:120.39354515551, |
||||
lat:36.119513578417 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003006GB00093W00000000', |
||||
lon:120.39492917536, |
||||
lat:36.118269033434 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00018W00000000', |
||||
lon:120.38950038432, |
||||
lat:36.11751801491 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00011W00000000', |
||||
lon:120.39073420047, |
||||
lat:36.117990083696 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00033W00000000', |
||||
lon:120.39034796237, |
||||
lat:36.116058893205 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00023W00000000', |
||||
lon:120.39321256159, |
||||
lat:36.11697084427 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00060W00000000', |
||||
lon:120.39406013964, |
||||
lat:36.11727125168 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00005W00000000', |
||||
lon:120.39415669917, |
||||
lat:36.116756267549 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00003W00000000', |
||||
lon:120.3923220682, |
||||
lat:36.115876502992 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00010W00000000', |
||||
lon:120.39222550868, |
||||
lat:36.115071840288 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00036W00000000', |
||||
lon:120.38812172888, |
||||
lat:36.115463442804 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00038W00000000', |
||||
lon:120.38892639159, |
||||
lat:36.115195221903 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00041W00000000', |
||||
lon:120.38821292399, |
||||
lat:36.114074058535 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00046W00000000', |
||||
lon:120.3871454048, |
||||
lat:36.113226480486 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00016W00000000', |
||||
lon:120.3901816654, |
||||
lat:36.11359662533 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00017W00000000', |
||||
lon:120.39123309134, |
||||
lat:36.113221116068 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00053W00000000', |
||||
lon:120.38902295111, |
||||
lat:36.11212677479 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00018W00000000', |
||||
lon:120.38954866409, |
||||
lat:36.111756629944 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00020W00000000', |
||||
lon:120.38813245773, |
||||
lat:36.111241645813 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00021W00000000', |
||||
lon:120.38858306884, |
||||
lat:36.110222406388 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00050W00000000', |
||||
lon:120.38700592994, |
||||
lat:36.112636394501 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00071W00000000', |
||||
lon:120.38391602515, |
||||
lat:36.111327476501 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00074W00000000', |
||||
lon:120.38219941138, |
||||
lat:36.111048526764 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00083W00000000', |
||||
lon:120.38037550925, |
||||
lat:36.109718151092 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003008GB00102W00000000', |
||||
lon:120.38196337699, |
||||
lat:36.109095878601 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00037W00000000', |
||||
lon:120.38143766403, |
||||
lat:36.107432909012 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00061W00000000', |
||||
lon:120.38219941139, |
||||
lat:36.107894248962 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00063W00000000', |
||||
lon:120.38278949737, |
||||
lat:36.108666725159 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00033W00000000', |
||||
lon:120.38320792198, |
||||
lat:36.10787279129 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00002W00000000', |
||||
lon:120.38409841537, |
||||
lat:36.107701129913 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203003009GB00027W00000000', |
||||
lon:120.38545024871, |
||||
lat:36.10923535347 |
||||
}, |
||||
{ |
||||
bdcdyh:'370203032509GB00004W00000000', |
||||
lon:120.38579357147, |
||||
lat:36.108291215897 |
||||
}, |
||||
] |
||||
@ -0,0 +1,269 @@ |
||||
import Draw from 'ol/interaction/Draw' |
||||
import VectorSource from 'ol/source/Vector'; |
||||
import VectorLayer from 'ol/layer/Vector'; |
||||
import TileLayer from 'ol/layer/Tile'; |
||||
import OSM from 'ol/source/OSM'; |
||||
|
||||
import { |
||||
unByKey |
||||
} from 'ol/Observable.js'; |
||||
import Overlay from 'ol/Overlay'; |
||||
import { |
||||
getArea, |
||||
getLength |
||||
} from 'ol/sphere.js'; |
||||
import View from 'ol/View'; |
||||
import { |
||||
LineString, |
||||
Polygon |
||||
} from 'ol/geom.js'; |
||||
import { |
||||
Circle as CircleStyle, |
||||
Fill, |
||||
Stroke, |
||||
Style, |
||||
Text |
||||
} from 'ol/style.js'; |
||||
export default{ |
||||
|
||||
measure(map, measureType) { |
||||
var source = new VectorSource(); |
||||
|
||||
var vector = new VectorLayer({ |
||||
id:'lineAndArea', |
||||
source: source, |
||||
style: new Style({ |
||||
fill: new Fill({ |
||||
color: 'rgba(255, 255, 255, 0.2)' |
||||
}), |
||||
stroke: new Stroke({ |
||||
color: '#ffcc33', |
||||
width: 2 |
||||
}), |
||||
image: new CircleStyle({ |
||||
radius: 7, |
||||
fill: new Fill({ |
||||
color: '#ffcc33' |
||||
}) |
||||
}) |
||||
}), |
||||
zIndex:16 |
||||
}); |
||||
map.addLayer(vector) |
||||
/** |
||||
* Currently drawn feature. |
||||
* @type {module:ol/Feature~Feature} |
||||
*/ |
||||
var sketch; |
||||
|
||||
|
||||
/** |
||||
* The help tooltip element. |
||||
* @type {Element} |
||||
*/ |
||||
var helpTooltipElement; |
||||
|
||||
|
||||
/** |
||||
* Overlay to show the help messages. |
||||
* @type {module:ol/Overlay} |
||||
*/ |
||||
var helpTooltip; |
||||
|
||||
|
||||
/** |
||||
* The measure tooltip element. |
||||
* @type {Element} |
||||
*/ |
||||
var measureTooltipElement; |
||||
|
||||
|
||||
/** |
||||
* Overlay to show the measurement. |
||||
* @type {module:ol/Overlay} |
||||
*/ |
||||
var measureTooltip; |
||||
|
||||
|
||||
/** |
||||
* Message to show when the user is drawing a polygon. |
||||
* @type {string} |
||||
*/ |
||||
var continuePolygonMsg = '继续点击绘制多边形'; |
||||
|
||||
|
||||
/** |
||||
* Message to show when the user is drawing a line. |
||||
* @type {string} |
||||
*/ |
||||
var continueLineMsg = '继续点击绘制线'; |
||||
|
||||
|
||||
|
||||
/** |
||||
* Handle pointer move. |
||||
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt The event. |
||||
*/ |
||||
var pointerMoveHandler = function (evt) { |
||||
if (evt.dragging) { |
||||
return; |
||||
} |
||||
/** @type {string} */ |
||||
var helpMsg = '请点击开始绘制'; |
||||
|
||||
if (sketch) { |
||||
var geom = sketch.getGeometry(); |
||||
if (geom instanceof Polygon) { |
||||
helpMsg = continuePolygonMsg; |
||||
} else if (geom instanceof LineString) { |
||||
helpMsg = continueLineMsg; |
||||
} |
||||
} |
||||
|
||||
helpTooltipElement.innerHTML = helpMsg; |
||||
helpTooltip.setPosition(evt.coordinate); |
||||
|
||||
helpTooltipElement.classList.remove('hidden'); |
||||
}; |
||||
|
||||
map.on('pointermove', pointerMoveHandler); |
||||
|
||||
map.getViewport().addEventListener('mouseout', function () { |
||||
helpTooltipElement.classList.add('hidden'); |
||||
}); |
||||
|
||||
var draw; |
||||
var formatLength = function (line) { |
||||
//获取投影坐标系
|
||||
var sourceProj = map.getView().getProjection(); |
||||
//ol/sphere里有getLength()和getArea()用来测量距离和区域面积,默认的投影坐标系是EPSG:3857, 其中有个options的参数,可以设置投影坐标系
|
||||
var length = getLength(line, {projection: sourceProj}); |
||||
//var length = getLength(line);
|
||||
var output; |
||||
if (length > 100) { |
||||
output = (Math.round(length / 1000 * 100) / 100) + |
||||
' ' + 'km'; |
||||
} else { |
||||
output = (Math.round(length * 100) / 100) + |
||||
' ' + 'm'; |
||||
} |
||||
return output; |
||||
}; |
||||
var formatArea = function (polygon) { |
||||
//获取投影坐标系
|
||||
var sourceProj = map.getView().getProjection(); |
||||
var area = getArea(polygon, {projection: sourceProj}) |
||||
//var area = getArea(polygon);
|
||||
//console.info(area)
|
||||
var output; |
||||
if (area > 10000) { |
||||
output = (Math.round(area / 1000000 * 100) / 100) + |
||||
' ' + 'km<sup>2</sup>'; |
||||
} else { |
||||
output = (Math.round(area * 100) / 100) + |
||||
' ' + 'm<sup>2</sup>'; |
||||
} |
||||
return output; |
||||
}; |
||||
|
||||
function addInteraction() { |
||||
draw = new Draw({ |
||||
source: source, |
||||
type: measureType, |
||||
style: new Style({ |
||||
fill: new Fill({ |
||||
color: 'rgba(255, 255, 255, 0.2)' |
||||
}), |
||||
stroke: new Stroke({ |
||||
color: 'rgba(0, 0, 0, 0.5)', |
||||
lineDash: [10, 10], |
||||
width: 2 |
||||
}), |
||||
image: new CircleStyle({ |
||||
radius: 5, |
||||
stroke: new Stroke({ |
||||
color: 'rgba(0, 0, 0, 0.7)' |
||||
}), |
||||
fill: new Fill({ |
||||
color: 'rgba(255, 255, 255, 0.2)' |
||||
}) |
||||
}) |
||||
}) |
||||
}); |
||||
map.addInteraction(draw); |
||||
|
||||
createMeasureTooltip(); |
||||
createHelpTooltip(); |
||||
|
||||
var listener; |
||||
draw.on('drawstart', |
||||
function (evt) { |
||||
// set sketch
|
||||
sketch = evt.feature; |
||||
|
||||
/** @type {module:ol/coordinate~Coordinate|undefined} */ |
||||
var tooltipCoord = evt.coordinate; |
||||
|
||||
listener = sketch.getGeometry().on('change', function (evt) { |
||||
var geom = evt.target; |
||||
var output; |
||||
if (geom instanceof Polygon) { |
||||
output = formatArea(geom); |
||||
tooltipCoord = geom.getInteriorPoint().getCoordinates(); |
||||
} else if (geom instanceof LineString) { |
||||
output = formatLength(geom); |
||||
tooltipCoord = geom.getLastCoordinate(); |
||||
} |
||||
measureTooltipElement.innerHTML = output; |
||||
measureTooltip.setPosition(tooltipCoord); |
||||
}); |
||||
}, this); |
||||
|
||||
draw.on('drawend', |
||||
function () { |
||||
measureTooltipElement.className = 'ol-tooltip ol-tooltip-static measureNum'; |
||||
measureTooltip.setOffset([0, -7]); |
||||
// unset sketch
|
||||
sketch = null; |
||||
// unset tooltip so that a new one can be created
|
||||
measureTooltipElement = null; |
||||
createMeasureTooltip(); |
||||
unByKey(listener); |
||||
map.un('pointermove', pointerMoveHandler); |
||||
map.removeInteraction(draw); |
||||
helpTooltipElement.classList.add('hidden'); |
||||
//console.info(helpTooltipElement.classList)
|
||||
}, this); |
||||
} |
||||
|
||||
function createHelpTooltip() { |
||||
if (helpTooltipElement) { |
||||
helpTooltipElement.parentNode.removeChild(helpTooltipElement); |
||||
} |
||||
helpTooltipElement = document.createElement('div'); |
||||
helpTooltipElement.className = 'ol-tooltip hidden'; |
||||
helpTooltip = new Overlay({ |
||||
element: helpTooltipElement, |
||||
offset: [15, 0], |
||||
positioning: 'center-left' |
||||
}); |
||||
map.addOverlay(helpTooltip); |
||||
} |
||||
|
||||
function createMeasureTooltip() { |
||||
if (measureTooltipElement) { |
||||
measureTooltipElement.parentNode.removeChild(measureTooltipElement); |
||||
} |
||||
measureTooltipElement = document.createElement('div'); |
||||
measureTooltipElement.className = 'ol-tooltip ol-tooltip-measure'; |
||||
measureTooltip = new Overlay({ |
||||
element: measureTooltipElement, |
||||
offset: [0, -15], |
||||
positioning: 'bottom-center' |
||||
}); |
||||
map.addOverlay(measureTooltip); |
||||
} |
||||
// 量测调用
|
||||
addInteraction(); |
||||
} |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
// directives.js
|
||||
|
||||
import Vue from 'vue' |
||||
|
||||
//select选择器无限滚动
|
||||
const install = Vue.directive('loadmore', { |
||||
bind (el, binding) { |
||||
// 获取element-ui定义好的scroll盒子
|
||||
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap') |
||||
SELECTWRAP_DOM.addEventListener('scroll', function () { |
||||
|
||||
const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight |
||||
if (CONDITION) { |
||||
binding.value() |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
|
||||
const input = Vue.directive('onfocus',{ //input框一进来就聚焦,在移动端Safari上autofocus不管用
|
||||
inserted(el,binding){ |
||||
// console.log(el)
|
||||
el.firstElementChild.focus(); |
||||
} |
||||
}) |
||||
export {install,input} |
||||
@ -0,0 +1,27 @@ |
||||
// The Vue build version to load with the `import` command
|
||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
||||
import Vue from 'vue' |
||||
import App from './App' |
||||
import router from './router' |
||||
import ElementUI from 'element-ui' |
||||
import 'element-ui/lib/theme-chalk/index.css' |
||||
import Axios from 'axios' |
||||
import {install,input} from './directives' |
||||
// import Base64 from 'js-base64'
|
||||
Vue.prototype.$axios = Axios |
||||
import "babel-polyfill" |
||||
Vue.use(ElementUI); |
||||
|
||||
Vue.config.productionTip = false |
||||
|
||||
Vue.use(install) |
||||
Vue.use(input) |
||||
/* eslint-disable no-new */ |
||||
new Vue({ |
||||
el: '#app', |
||||
router, |
||||
components: { |
||||
App |
||||
}, |
||||
template: '<App/>' |
||||
}) |
||||
@ -0,0 +1,21 @@ |
||||
import Vue from 'vue' |
||||
import Router from 'vue-router' |
||||
import HelloWorld from '@/components/HelloWorld' |
||||
import SearchHouse from '@/components/searchHouse' |
||||
|
||||
Vue.use(Router) |
||||
|
||||
export default new Router({ |
||||
routes: [ |
||||
{ |
||||
path: '/', |
||||
name: 'HelloWorld', |
||||
component: HelloWorld |
||||
}, |
||||
{ |
||||
path: '/searchHouse', |
||||
name: 'SearchHouse', |
||||
component: SearchHouse |
||||
}, |
||||
] |
||||
}) |
||||
@ -0,0 +1,5 @@ |
||||
export const lmap = { |
||||
map: null, |
||||
|
||||
|
||||
} |
||||