├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── index.html ├── mineType.js ├── package.json ├── server.js ├── src ├── App.vue ├── api │ └── index.js ├── assets │ ├── css │ │ └── reset.css │ ├── img │ │ ├── density.png │ │ ├── drawtool_bar-11286ddf48e5d36fafefb42a9e62ffe22bf5e70ea63a9fd442e2c833cc24774e.svg │ │ └── loca.png │ └── logo.png ├── components │ ├── Date.vue │ ├── Hello.vue │ └── freeDate.js ├── config.js ├── element.js ├── fonts │ ├── demo.css │ ├── demo_fontclass.html │ ├── demo_symbol.html │ ├── demo_unicode.html │ ├── iconfont.css │ ├── iconfont.eot │ ├── iconfont.js │ ├── iconfont.svg │ ├── iconfont.ttf │ └── iconfont.woff ├── main.js ├── router │ └── index.js ├── utils │ └── convert.js └── views │ ├── Map │ ├── data.js │ ├── index.vue │ └── map.js │ └── NotFound │ └── index.vue ├── static ├── 0001.png ├── DrawingManager_min.css ├── DrawingManager_min.js ├── GeoUtils_min.js ├── Heatmap_min.js ├── MarkerClusterer_min.js ├── RectangleZoom_min.js ├── TextIconOverlay_min.1.js ├── TextIconOverlay_min.js ├── logo.png ├── m0.png └── quan.png └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = crlf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | 6 | DrawingManager_min.js 7 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint', 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 12 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 13 | extends: ['plugin:vue/essential', 'airbnb-base'], 14 | // required to lint *.vue files 15 | plugins: ['vue'], 16 | // check if imports actually resolve 17 | settings: { 18 | 'import/resolver': { 19 | webpack: { 20 | config: 'build/webpack.base.conf.js', 21 | }, 22 | }, 23 | }, 24 | // add your custom rules here 25 | rules: { 26 | // don't require .vue extension when importing 27 | 'import/extensions': [ 28 | 'error', 29 | 'always', 30 | { 31 | js: 'never', 32 | vue: 'never', 33 | }, 34 | ], 35 | // allow optionalDependencies 36 | 'import/no-extraneous-dependencies': [ 37 | 'error', 38 | { 39 | optionalDependencies: ['test/unit/index.js'], 40 | }, 41 | ], 42 | // allow debugger during development 43 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 44 | 'no-console': 0, 45 | 'linebreak-style': 0, 46 | 'no-unused-vars': 0, 47 | 'arrow-parens': ['error', 'always'], 48 | 'no-mixed-operators': 'off', 49 | 'max-len': [ 50 | 'error', 51 | { 52 | code: 100, 53 | ignorePattern: '<.*>$', 54 | ignoreComments: true, 55 | ignoreTrailingComments: true, 56 | ignoreUrls: true, 57 | ignoreStrings: true, 58 | ignoreTemplateLiterals: true, 59 | ignoreRegExpLiterals: true, 60 | }, 61 | ], 62 | }, 63 | }; 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-echarts-heatmap 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). 22 | 23 | ## 百度地图API文档 24 | 25 | http://lbsyun.baidu.com/index.php?title=jspopular 26 | 27 | ## 官方参考示例地址 28 | 29 | http://lbsyun.baidu.com/jsdemo.htm#a2_1 30 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 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 | }) 42 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 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 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 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 | } 102 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 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 | } 23 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | const createLintingRule = () => ({ 12 | test: /\.(js|vue)$/, 13 | loader: 'eslint-loader', 14 | enforce: 'pre', 15 | include: [resolve('src'), resolve('test')], 16 | options: { 17 | formatter: require('eslint-friendly-formatter'), 18 | emitWarning: !config.dev.showEslintErrorsInOverlay 19 | } 20 | }) 21 | 22 | module.exports = { 23 | context: path.resolve(__dirname, '../'), 24 | entry: { 25 | app: './src/main.js' 26 | }, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: '[name].js', 30 | publicPath: process.env.NODE_ENV === 'production' 31 | ? config.build.assetsPublicPath 32 | : config.dev.assetsPublicPath 33 | }, 34 | resolve: { 35 | extensions: ['.js', '.vue', '.json'], 36 | alias: { 37 | 'vue$': 'vue/dist/vue.esm.js', 38 | '@': resolve('src'), 39 | } 40 | }, 41 | module: { 42 | rules: [ 43 | ...(config.dev.useEslint ? [createLintingRule()] : []), 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 53 | }, 54 | { 55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 56 | loader: 'url-loader', 57 | options: { 58 | limit: 10000, 59 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 60 | } 61 | }, 62 | { 63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 64 | loader: 'url-loader', 65 | options: { 66 | limit: 10000, 67 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 68 | } 69 | }, 70 | { 71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 72 | loader: 'url-loader', 73 | options: { 74 | limit: 10000, 75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 76 | } 77 | } 78 | ] 79 | }, 80 | node: { 81 | // prevent webpack from injecting useless setImmediate polyfill because Vue 82 | // source contains it (although only uses it if it's native). 83 | setImmediate: false, 84 | // prevent webpack from injecting mocks to Node native modules 85 | // that does not make sense for the client 86 | dgram: 'empty', 87 | fs: 'empty', 88 | net: 'empty', 89 | tls: 'empty', 90 | child_process: 'empty' 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 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 | ]) 119 | ] 120 | }) 121 | 122 | if (config.build.productionGzip) { 123 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 124 | 125 | webpackConfig.plugins.push( 126 | new CompressionWebpackPlugin({ 127 | asset: '[path].gz[query]', 128 | algorithm: 'gzip', 129 | test: new RegExp( 130 | '\\.(' + 131 | config.build.productionGzipExtensions.join('|') + 132 | ')$' 133 | ), 134 | threshold: 10240, 135 | minRatio: 0.8 136 | }) 137 | ) 138 | } 139 | 140 | if (config.build.bundleAnalyzerReport) { 141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 143 | } 144 | 145 | module.exports = webpackConfig 146 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 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 | console.log(process.env.NODE_ENV); 8 | 9 | module.exports = { 10 | dev: { 11 | // Paths 12 | assetsSubDirectory: 'static', 13 | assetsPublicPath: '/', 14 | proxyTable: { 15 | '/api': { 16 | target: 'http://192.168.10.223/', 17 | changeOrigin: true, 18 | pathRewrite: { 19 | '^/api': '/', 20 | }, 21 | }, 22 | }, 23 | 24 | // Various Dev Server settings 25 | host: '0.0.0.0', // can be overwritten by process.env.HOST 26 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 27 | autoOpenBrowser: false, 28 | errorOverlay: true, 29 | notifyOnErrors: true, 30 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 31 | 32 | // Use Eslint Loader? 33 | // If true, your code will be linted during bundling and 34 | // linting errors and warnings will be shown in the console. 35 | useEslint: true, 36 | // If true, eslint errors and warnings will also be shown in the error overlay 37 | // in the browser. 38 | showEslintErrorsInOverlay: false, 39 | 40 | /** 41 | * Source Maps 42 | */ 43 | 44 | // https://webpack.js.org/configuration/devtool/#development 45 | devtool: 'cheap-module-eval-source-map', 46 | 47 | // If you have problems debugging vue-files in devtools, 48 | // set this to false - it *may* help 49 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 50 | cacheBusting: true, 51 | 52 | cssSourceMap: true, 53 | }, 54 | 55 | build: { 56 | // Template for index.html 57 | index: path.resolve(__dirname, '../dist/index.html'), 58 | 59 | // Paths 60 | assetsRoot: path.resolve(__dirname, '../dist'), 61 | assetsSubDirectory: 'static', 62 | assetsPublicPath: '/', 63 | 64 | /** 65 | * Source Maps 66 | */ 67 | 68 | productionSourceMap: true, 69 | // https://webpack.js.org/configuration/devtool/#production 70 | devtool: '#source-map', 71 | 72 | // Gzip off by default as many popular static hosts such as 73 | // Surge or Netlify already gzip all static assets for you. 74 | // Before setting to `true`, make sure to: 75 | // npm install --save-dev compression-webpack-plugin 76 | productionGzip: false, 77 | productionGzipExtensions: ['js', 'css'], 78 | 79 | // Run the build command with an extra argument to 80 | // View the bundle analyzer report after build finishes: 81 | // `npm run build --report` 82 | // Set to `true` or `false` to always turn it on or off 83 | bundleAnalyzerReport: process.env.npm_config_report, 84 | }, 85 | }; 86 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 用电人口数量展示地图 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /mineType.js: -------------------------------------------------------------------------------- 1 | const type = { 2 | '.': 'application/x-', 3 | '.tif': 'image/tiff', 4 | '.js': 'application/x-javascript', 5 | '.css': 'text/css', 6 | '.jpg': 'image/jpeg', 7 | '.png': 'image/png', 8 | '.gif': 'image/gif', 9 | }; 10 | 11 | module.exports = type; 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-echarts-heatmap", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "wuqian <1307144731@qq.com>", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "lint": "eslint --ext .js,.vue src", 11 | "build": "node build/build.js" 12 | }, 13 | "dependencies": { 14 | "axios": "^0.18.0", 15 | "echarts": "^4.1.0", 16 | "element-ui": "^2.4.5", 17 | "vue": "^2.5.2", 18 | "vue-router": "^3.0.1" 19 | }, 20 | "devDependencies": { 21 | "autoprefixer": "^7.1.2", 22 | "babel-core": "^6.22.1", 23 | "babel-eslint": "^8.2.1", 24 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 25 | "babel-loader": "^7.1.1", 26 | "babel-plugin-syntax-jsx": "^6.18.0", 27 | "babel-plugin-transform-runtime": "^6.22.0", 28 | "babel-plugin-transform-vue-jsx": "^3.5.0", 29 | "babel-preset-env": "^1.3.2", 30 | "babel-preset-stage-2": "^6.22.0", 31 | "chalk": "^2.0.1", 32 | "copy-webpack-plugin": "^4.0.1", 33 | "css-loader": "^0.28.0", 34 | "eslint": "^4.15.0", 35 | "eslint-config-airbnb-base": "^11.3.0", 36 | "eslint-friendly-formatter": "^3.0.0", 37 | "eslint-import-resolver-webpack": "^0.8.3", 38 | "eslint-loader": "^1.7.1", 39 | "eslint-plugin-import": "^2.7.0", 40 | "eslint-plugin-vue": "^4.0.0", 41 | "extract-text-webpack-plugin": "^3.0.0", 42 | "file-loader": "^1.1.4", 43 | "friendly-errors-webpack-plugin": "^1.6.1", 44 | "html-webpack-plugin": "^2.30.1", 45 | "node-notifier": "^5.1.2", 46 | "optimize-css-assets-webpack-plugin": "^3.2.0", 47 | "ora": "^1.2.0", 48 | "portfinder": "^1.0.13", 49 | "postcss-import": "^11.0.0", 50 | "postcss-loader": "^2.0.8", 51 | "postcss-url": "^7.2.1", 52 | "rimraf": "^2.6.0", 53 | "semver": "^5.3.0", 54 | "shelljs": "^0.7.6", 55 | "uglifyjs-webpack-plugin": "^1.1.1", 56 | "url-loader": "^0.5.8", 57 | "vue-loader": "^13.3.0", 58 | "vue-style-loader": "^3.0.1", 59 | "vue-template-compiler": "^2.5.2", 60 | "webpack": "^3.6.0", 61 | "webpack-bundle-analyzer": "^2.9.0", 62 | "webpack-dev-server": "^2.9.1", 63 | "webpack-merge": "^4.1.0" 64 | }, 65 | "engines": { 66 | "node": ">= 6.0.0", 67 | "npm": ">= 3.0.0" 68 | }, 69 | "browserslist": [ 70 | "> 1%", 71 | "last 2 versions", 72 | "not ie <= 8" 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const http = require('http'); 2 | const fs = require('fs'); 3 | 4 | const mineType = require('./mineType'); 5 | 6 | const documentRoot = './dist/'; 7 | 8 | const server = http.createServer((req, res) => { 9 | const url = req.url; 10 | let file = documentRoot + url; 11 | 12 | const arr = url.split('/'); 13 | 14 | // console.log(arr); 15 | 16 | if (arr.length > 1 && (!arr[1] || /\?/.test(arr[1]))) { 17 | file = `${documentRoot}index.html`; 18 | } else if (arr[arr.length - 1].indexOf('.') === -1 || /\?/.test(arr[arr.length - 1])) { 19 | file = `${documentRoot}${url}index.html`; 20 | } 21 | 22 | // console.log('url', url, file, documentRoot); 23 | 24 | fs.readFile(file, (err, data) => { 25 | if (err) { 26 | res.writeHeader(404, { 27 | 'content-type': 'text/html;charset="utf-8"', 28 | }); 29 | res.write('

404

'); 30 | res.end(); 31 | } else { 32 | const nameReg = new RegExp(/(\.([^.]+))$/); 33 | const name = url.match(nameReg); 34 | if (name && mineType[name[0]]) { 35 | res.writeHeader(200, { 36 | 'content-type': `${mineType[name[0]]};charset="utf-8"`, 37 | }); 38 | } else { 39 | res.writeHeader(200, { 40 | 'content-type': 'text/html;charset="utf-8"', 41 | }); 42 | } 43 | res.write(data); 44 | res.end(); 45 | } 46 | }); 47 | }).listen(8585); 48 | 49 | console.log('------------------------------------'); 50 | console.log('server run'); 51 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/api/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * axios初始化配置 3 | * -------------------------------------- 4 | * 大部分接口以这个为基础 5 | */ 6 | 7 | import axios from 'axios'; 8 | import { Message } from 'element-ui'; 9 | import config from '../config'; 10 | 11 | const instance = axios.create({ 12 | baseURL: config.apiHost, 13 | withCredentials: true, 14 | params: {}, 15 | }); 16 | 17 | instance.interceptors.request.use((request) => { 18 | const axiosRequest = { 19 | ...request, 20 | params: { 21 | ...request.params, 22 | }, 23 | }; 24 | return axiosRequest; 25 | }); 26 | 27 | instance.interceptors.response.use( 28 | (response) => { 29 | if (response.data.code !== '0') { 30 | Message({ 31 | message: response.data.message, 32 | type: 'warning', 33 | }); 34 | console.log(response.data.message); 35 | } 36 | return response; 37 | }, 38 | (error) => { 39 | console.log(error.message); 40 | return Promise.reject(error); 41 | }, 42 | ); 43 | export default instance; 44 | -------------------------------------------------------------------------------- /src/assets/css/reset.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by dingyiming on 2017/6/2. 3 | *

4 | * 江苏摇铃网络科技有限公司,版权所有。 5 | * Copyright (C) 2015-2017 All Rights Reserved. 6 | */ 7 | html { 8 | font-size: 100px; 9 | } 10 | 11 | body { 12 | font-size: 16px; 13 | color: #666666; 14 | font-family: 'Microsoft YaHei', '微软雅黑', 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 15 | 'Hiragino Sans GB', sans-serif; 16 | overflow: hidden; 17 | } 18 | 19 | html, 20 | body { 21 | margin: 0; 22 | } 23 | 24 | input, 25 | select, 26 | textarea, 27 | label { 28 | font-family: 'Microsoft YaHei', '微软雅黑', 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 29 | 'Hiragino Sans GB', sans-serif; 30 | } 31 | 32 | a { 33 | text-decoration: none; 34 | } 35 | 36 | ul, 37 | ol { 38 | list-style: none; 39 | } 40 | 41 | html, 42 | body, 43 | div, 44 | h1, 45 | h2, 46 | h3, 47 | h4, 48 | h5, 49 | h6, 50 | p, 51 | dl, 52 | dt, 53 | dd, 54 | ol, 55 | ul, 56 | li, 57 | fieldset, 58 | form, 59 | label, 60 | input, 61 | legend, 62 | table, 63 | caption, 64 | tbody, 65 | tfoot, 66 | thead, 67 | tr, 68 | th, 69 | td, 70 | textarea, 71 | article, 72 | aside, 73 | audio, 74 | canvas, 75 | figure, 76 | footer, 77 | header, 78 | mark, 79 | menu, 80 | nav, 81 | section, 82 | time, 83 | video { 84 | margin: 0; 85 | padding: 0; 86 | } 87 | 88 | .app { 89 | min-width: 1024px; 90 | } 91 | 92 | /* 去除百度地图水印 */ 93 | .BMap_cpyCtrl { 94 | display: none; 95 | } 96 | .anchorBL { 97 | display: none; 98 | } 99 | -------------------------------------------------------------------------------- /src/assets/img/density.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/src/assets/img/density.png -------------------------------------------------------------------------------- /src/assets/img/loca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/src/assets/img/loca.png -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/Date.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 54 | 121 | 122 | -------------------------------------------------------------------------------- /src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 26 | 27 | 28 | 30 | -------------------------------------------------------------------------------- /src/components/freeDate.js: -------------------------------------------------------------------------------- 1 | // 人口数量count 2 | // 经度lng 3 | // 纬度lat 4 | // 地址 5 | // 区域名称 6 | // 等级 7 | const freeList = [ 8 | { 9 | name: '元旦', 10 | date: '01-01', 11 | }, 12 | { 13 | name: '情人节', 14 | date: '02-14', 15 | }, 16 | { 17 | name: '妇女节', 18 | date: '03-08', 19 | }, 20 | { 21 | name: '植树节', 22 | date: '03-12', 23 | }, 24 | // { 25 | // name: '消费者权益日', 26 | // date: '03-12', 27 | // }, 28 | { 29 | name: '劳动节', 30 | date: '05-01', 31 | num: 3, 32 | }, 33 | { 34 | name: '青年节', 35 | date: '05-04', 36 | }, 37 | { 38 | name: '端午节', 39 | date: '05-05', 40 | }, 41 | { 42 | name: '七夕节', 43 | date: '07-07', 44 | }, 45 | { 46 | name: '中秋节', 47 | date: '08-15', 48 | }, 49 | { 50 | name: '国庆节', 51 | date: '10-01', 52 | num: 7, 53 | }, 54 | { 55 | name: '平安夜', 56 | date: '12-24', 57 | }, 58 | { 59 | name: '圣诞节', 60 | date: '12-25', 61 | }, 62 | ]; 63 | 64 | export default freeList; 65 | -------------------------------------------------------------------------------- /src/config.js: -------------------------------------------------------------------------------- 1 | // 配置文件 2 | // (地址配置均以/结尾,后续无需再加) 3 | 4 | // 开发环境 (dev) 5 | let apiHost = `${location.protocol}//${location.host}/api/`; 6 | 7 | if (process.env.NODE_ENV && process.env.NODE_ENV === 'production') { 8 | apiHost = `${location.protocol}//${location.host}/api/`; 9 | } 10 | 11 | console.log(process.env.NODE_ENV); 12 | 13 | export default { 14 | apiHost, 15 | }; 16 | -------------------------------------------------------------------------------- /src/element.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import { 3 | Pagination, 4 | Dialog, 5 | Autocomplete, 6 | Dropdown, 7 | DropdownMenu, 8 | DropdownItem, 9 | Menu, 10 | Submenu, 11 | MenuItem, 12 | MenuItemGroup, 13 | Input, 14 | InputNumber, 15 | Radio, 16 | RadioGroup, 17 | RadioButton, 18 | Checkbox, 19 | CheckboxButton, 20 | CheckboxGroup, 21 | Switch, 22 | Select, 23 | Option, 24 | OptionGroup, 25 | Button, 26 | ButtonGroup, 27 | Table, 28 | TableColumn, 29 | DatePicker, 30 | TimeSelect, 31 | TimePicker, 32 | Popover, 33 | Tooltip, 34 | Breadcrumb, 35 | BreadcrumbItem, 36 | Form, 37 | FormItem, 38 | Tabs, 39 | TabPane, 40 | Tag, 41 | Tree, 42 | Alert, 43 | Slider, 44 | Icon, 45 | Row, 46 | Col, 47 | Upload, 48 | Progress, 49 | Badge, 50 | Card, 51 | Rate, 52 | Steps, 53 | Step, 54 | Carousel, 55 | CarouselItem, 56 | Collapse, 57 | CollapseItem, 58 | Cascader, 59 | ColorPicker, 60 | // Transfer, 61 | Container, 62 | Header, 63 | Aside, 64 | Main, 65 | Footer, 66 | Loading, 67 | MessageBox, 68 | Message, 69 | Notification, 70 | } from 'element-ui'; 71 | 72 | import convert from './utils/convert'; // 转换 73 | 74 | Vue.prototype.convert = convert; 75 | 76 | Vue.use(Pagination); 77 | Vue.use(Dialog); 78 | Vue.use(Autocomplete); 79 | Vue.use(Dropdown); 80 | Vue.use(DropdownMenu); 81 | Vue.use(DropdownItem); 82 | Vue.use(Menu); 83 | Vue.use(Submenu); 84 | Vue.use(MenuItem); 85 | Vue.use(MenuItemGroup); 86 | Vue.use(Input); 87 | Vue.use(InputNumber); 88 | Vue.use(Radio); 89 | Vue.use(RadioGroup); 90 | Vue.use(RadioButton); 91 | Vue.use(Checkbox); 92 | Vue.use(CheckboxButton); 93 | Vue.use(CheckboxGroup); 94 | Vue.use(Switch); 95 | Vue.use(Select); 96 | Vue.use(Option); 97 | Vue.use(OptionGroup); 98 | Vue.use(Button); 99 | Vue.use(ButtonGroup); 100 | Vue.use(Table); 101 | Vue.use(TableColumn); 102 | Vue.use(DatePicker); 103 | Vue.use(TimeSelect); 104 | Vue.use(TimePicker); 105 | Vue.use(Popover); 106 | Vue.use(Tooltip); 107 | Vue.use(Breadcrumb); 108 | Vue.use(BreadcrumbItem); 109 | Vue.use(Form); 110 | Vue.use(FormItem); 111 | Vue.use(Tabs); 112 | Vue.use(TabPane); 113 | Vue.use(Tag); 114 | Vue.use(Tree); 115 | Vue.use(Alert); 116 | Vue.use(Slider); 117 | Vue.use(Icon); 118 | Vue.use(Row); 119 | Vue.use(Col); 120 | Vue.use(Upload); 121 | Vue.use(Progress); 122 | Vue.use(Badge); 123 | Vue.use(Card); 124 | Vue.use(Rate); 125 | Vue.use(Steps); 126 | Vue.use(Step); 127 | Vue.use(Carousel); 128 | Vue.use(CarouselItem); 129 | Vue.use(Collapse); 130 | Vue.use(CollapseItem); 131 | Vue.use(Cascader); 132 | Vue.use(ColorPicker); 133 | Vue.use(Container); 134 | Vue.use(Header); 135 | Vue.use(Aside); 136 | Vue.use(Main); 137 | Vue.use(Footer); 138 | 139 | Vue.use(Loading.directive); 140 | 141 | Vue.prototype.$loading = Loading.service; 142 | Vue.prototype.$msgbox = MessageBox; 143 | Vue.prototype.$alert = MessageBox.alert; 144 | Vue.prototype.$confirm = MessageBox.confirm; 145 | Vue.prototype.$prompt = MessageBox.prompt; 146 | Vue.prototype.$notify = Notification; 147 | Vue.prototype.$message = Message; 148 | -------------------------------------------------------------------------------- /src/fonts/demo.css: -------------------------------------------------------------------------------- 1 | *{margin: 0;padding: 0;list-style: none;} 2 | /* 3 | KISSY CSS Reset 4 | 理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。 5 | 2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。 6 | 3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。 7 | 特色:1. 适应中文;2. 基于最新主流浏览器。 8 | 维护:玉伯, 正淳 9 | */ 10 | 11 | /** 清除内外边距 **/ 12 | body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */ 13 | dl, dt, dd, ul, ol, li, /* list elements 列表元素 */ 14 | pre, /* text formatting elements 文本格式元素 */ 15 | form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */ 16 | th, td /* table elements 表格元素 */ { 17 | margin: 0; 18 | padding: 0; 19 | } 20 | 21 | /** 设置默认字体 **/ 22 | body, 23 | button, input, select, textarea /* for ie */ { 24 | font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif; 25 | } 26 | h1, h2, h3, h4, h5, h6 { font-size: 100%; } 27 | address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */ 28 | code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */ 29 | small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */ 30 | 31 | /** 重置列表元素 **/ 32 | ul, ol { list-style: none; } 33 | 34 | /** 重置文本格式元素 **/ 35 | a { text-decoration: none; } 36 | a:hover { text-decoration: underline; } 37 | 38 | 39 | /** 重置表单元素 **/ 40 | legend { color: #000; } /* for ie6 */ 41 | fieldset, img { border: 0; } /* img 搭车:让链接里的 img 无边框 */ 42 | button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */ 43 | /* 注:optgroup 无法扶正 */ 44 | 45 | /** 重置表格元素 **/ 46 | table { border-collapse: collapse; border-spacing: 0; } 47 | 48 | /* 清除浮动 */ 49 | .ks-clear:after, .clear:after { 50 | content: '\20'; 51 | display: block; 52 | height: 0; 53 | clear: both; 54 | } 55 | .ks-clear, .clear { 56 | *zoom: 1; 57 | } 58 | 59 | .main { 60 | padding: 30px 100px; 61 | width: 960px; 62 | margin: 0 auto; 63 | } 64 | .main h1{font-size:36px; color:#333; text-align:left;margin-bottom:30px; border-bottom: 1px solid #eee;} 65 | 66 | .helps{margin-top:40px;} 67 | .helps pre{ 68 | padding:20px; 69 | margin:10px 0; 70 | border:solid 1px #e7e1cd; 71 | background-color: #fffdef; 72 | overflow: auto; 73 | } 74 | 75 | .icon_lists{ 76 | width: 100% !important; 77 | 78 | } 79 | 80 | .icon_lists li{ 81 | float:left; 82 | width: 100px; 83 | height:180px; 84 | text-align: center; 85 | list-style: none !important; 86 | } 87 | .icon_lists .icon{ 88 | font-size: 42px; 89 | line-height: 100px; 90 | margin: 10px 0; 91 | color:#333; 92 | -webkit-transition: font-size 0.25s ease-out 0s; 93 | -moz-transition: font-size 0.25s ease-out 0s; 94 | transition: font-size 0.25s ease-out 0s; 95 | 96 | } 97 | .icon_lists .icon:hover{ 98 | font-size: 100px; 99 | } 100 | 101 | 102 | 103 | .markdown { 104 | color: #666; 105 | font-size: 14px; 106 | line-height: 1.8; 107 | } 108 | 109 | .highlight { 110 | line-height: 1.5; 111 | } 112 | 113 | .markdown img { 114 | vertical-align: middle; 115 | max-width: 100%; 116 | } 117 | 118 | .markdown h1 { 119 | color: #404040; 120 | font-weight: 500; 121 | line-height: 40px; 122 | margin-bottom: 24px; 123 | } 124 | 125 | .markdown h2, 126 | .markdown h3, 127 | .markdown h4, 128 | .markdown h5, 129 | .markdown h6 { 130 | color: #404040; 131 | margin: 1.6em 0 0.6em 0; 132 | font-weight: 500; 133 | clear: both; 134 | } 135 | 136 | .markdown h1 { 137 | font-size: 28px; 138 | } 139 | 140 | .markdown h2 { 141 | font-size: 22px; 142 | } 143 | 144 | .markdown h3 { 145 | font-size: 16px; 146 | } 147 | 148 | .markdown h4 { 149 | font-size: 14px; 150 | } 151 | 152 | .markdown h5 { 153 | font-size: 12px; 154 | } 155 | 156 | .markdown h6 { 157 | font-size: 12px; 158 | } 159 | 160 | .markdown hr { 161 | height: 1px; 162 | border: 0; 163 | background: #e9e9e9; 164 | margin: 16px 0; 165 | clear: both; 166 | } 167 | 168 | .markdown p, 169 | .markdown pre { 170 | margin: 1em 0; 171 | } 172 | 173 | .markdown > p, 174 | .markdown > blockquote, 175 | .markdown > .highlight, 176 | .markdown > ol, 177 | .markdown > ul { 178 | width: 80%; 179 | } 180 | 181 | .markdown ul > li { 182 | list-style: circle; 183 | } 184 | 185 | .markdown > ul li, 186 | .markdown blockquote ul > li { 187 | margin-left: 20px; 188 | padding-left: 4px; 189 | } 190 | 191 | .markdown > ul li p, 192 | .markdown > ol li p { 193 | margin: 0.6em 0; 194 | } 195 | 196 | .markdown ol > li { 197 | list-style: decimal; 198 | } 199 | 200 | .markdown > ol li, 201 | .markdown blockquote ol > li { 202 | margin-left: 20px; 203 | padding-left: 4px; 204 | } 205 | 206 | .markdown code { 207 | margin: 0 3px; 208 | padding: 0 5px; 209 | background: #eee; 210 | border-radius: 3px; 211 | } 212 | 213 | .markdown pre { 214 | border-radius: 6px; 215 | background: #f7f7f7; 216 | padding: 20px; 217 | } 218 | 219 | .markdown pre code { 220 | border: none; 221 | background: #f7f7f7; 222 | margin: 0; 223 | } 224 | 225 | .markdown strong, 226 | .markdown b { 227 | font-weight: 600; 228 | } 229 | 230 | .markdown > table { 231 | border-collapse: collapse; 232 | border-spacing: 0px; 233 | empty-cells: show; 234 | border: 1px solid #e9e9e9; 235 | width: 95%; 236 | margin-bottom: 24px; 237 | } 238 | 239 | .markdown > table th { 240 | white-space: nowrap; 241 | color: #333; 242 | font-weight: 600; 243 | 244 | } 245 | 246 | .markdown > table th, 247 | .markdown > table td { 248 | border: 1px solid #e9e9e9; 249 | padding: 8px 16px; 250 | text-align: left; 251 | } 252 | 253 | .markdown > table th { 254 | background: #F7F7F7; 255 | } 256 | 257 | .markdown blockquote { 258 | font-size: 90%; 259 | color: #999; 260 | border-left: 4px solid #e9e9e9; 261 | padding-left: 0.8em; 262 | margin: 1em 0; 263 | font-style: italic; 264 | } 265 | 266 | .markdown blockquote p { 267 | margin: 0; 268 | } 269 | 270 | .markdown .anchor { 271 | opacity: 0; 272 | transition: opacity 0.3s ease; 273 | margin-left: 8px; 274 | } 275 | 276 | .markdown .waiting { 277 | color: #ccc; 278 | } 279 | 280 | .markdown h1:hover .anchor, 281 | .markdown h2:hover .anchor, 282 | .markdown h3:hover .anchor, 283 | .markdown h4:hover .anchor, 284 | .markdown h5:hover .anchor, 285 | .markdown h6:hover .anchor { 286 | opacity: 1; 287 | display: inline-block; 288 | } 289 | 290 | .markdown > br, 291 | .markdown > p > br { 292 | clear: both; 293 | } 294 | 295 | 296 | .hljs { 297 | display: block; 298 | background: white; 299 | padding: 0.5em; 300 | color: #333333; 301 | overflow-x: auto; 302 | } 303 | 304 | .hljs-comment, 305 | .hljs-meta { 306 | color: #969896; 307 | } 308 | 309 | .hljs-string, 310 | .hljs-variable, 311 | .hljs-template-variable, 312 | .hljs-strong, 313 | .hljs-emphasis, 314 | .hljs-quote { 315 | color: #df5000; 316 | } 317 | 318 | .hljs-keyword, 319 | .hljs-selector-tag, 320 | .hljs-type { 321 | color: #a71d5d; 322 | } 323 | 324 | .hljs-literal, 325 | .hljs-symbol, 326 | .hljs-bullet, 327 | .hljs-attribute { 328 | color: #0086b3; 329 | } 330 | 331 | .hljs-section, 332 | .hljs-name { 333 | color: #63a35c; 334 | } 335 | 336 | .hljs-tag { 337 | color: #333333; 338 | } 339 | 340 | .hljs-title, 341 | .hljs-attr, 342 | .hljs-selector-id, 343 | .hljs-selector-class, 344 | .hljs-selector-attr, 345 | .hljs-selector-pseudo { 346 | color: #795da3; 347 | } 348 | 349 | .hljs-addition { 350 | color: #55a532; 351 | background-color: #eaffea; 352 | } 353 | 354 | .hljs-deletion { 355 | color: #bd2c00; 356 | background-color: #ffecec; 357 | } 358 | 359 | .hljs-link { 360 | text-decoration: underline; 361 | } 362 | 363 | pre{ 364 | background: #fff; 365 | } 366 | 367 | 368 | 369 | 370 | 371 | -------------------------------------------------------------------------------- /src/fonts/demo_fontclass.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IconFont 7 | 8 | 9 | 10 | 11 |

12 |

IconFont 图标

13 | 70 | 71 |

font-class引用

72 |
73 | 74 |

font-class是unicode使用方式的一种变种,主要是解决unicode书写不直观,语意不明确的问题。

75 |

与unicode使用方式相比,具有如下特点:

76 | 82 |

使用步骤如下:

83 |

第一步:引入项目下面生成的fontclass代码:

84 | 85 | 86 |
<link rel="stylesheet" type="text/css" href="./iconfont.css">
87 |

第二步:挑选相应图标并获取类名,应用于页面:

88 |
<i class="iconfont icon-xxx"></i>
89 |
90 |

"iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。

91 |
92 |
93 | 94 | 95 | -------------------------------------------------------------------------------- /src/fonts/demo_symbol.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IconFont 7 | 8 | 9 | 10 | 24 | 25 | 26 |
27 |

IconFont 图标

28 | 103 | 104 | 105 |

symbol引用

106 |
107 | 108 |

这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇文章 109 | 这种用法其实是做了一个svg的集合,与另外两种相比具有如下特点:

110 | 116 |

使用步骤如下:

117 |

第一步:引入项目下面生成的symbol代码:

118 |
<script src="./iconfont.js"></script>
119 |

第二步:加入通用css代码(引入一次就行):

120 |
<style type="text/css">
121 | .icon {
122 |    width: 1em; height: 1em;
123 |    vertical-align: -0.15em;
124 |    fill: currentColor;
125 |    overflow: hidden;
126 | }
127 | </style>
128 |

第三步:挑选相应图标并获取类名,应用于页面:

129 |
<svg class="icon" aria-hidden="true">
130 |   <use xlink:href="#icon-xxx"></use>
131 | </svg>
132 |         
133 |
134 | 135 | 136 | -------------------------------------------------------------------------------- /src/fonts/demo_unicode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IconFont 7 | 8 | 9 | 29 | 30 | 31 |
32 |

IconFont 图标

33 | 90 |

unicode引用

91 |
92 | 93 |

unicode是字体在网页端最原始的应用方式,特点是:

94 | 99 |
100 |

注意:新版iconfont支持多色图标,这些多色图标在unicode模式下将不能使用,如果有需求建议使用symbol的引用方式

101 |
102 |

unicode使用步骤如下:

103 |

第一步:拷贝项目下面生成的font-face

104 |
@font-face {
105 |   font-family: 'iconfont';
106 |   src: url('iconfont.eot');
107 |   src: url('iconfont.eot?#iefix') format('embedded-opentype'),
108 |   url('iconfont.woff') format('woff'),
109 |   url('iconfont.ttf') format('truetype'),
110 |   url('iconfont.svg#iconfont') format('svg');
111 | }
112 | 
113 |

第二步:定义使用iconfont的样式

114 |
.iconfont{
115 |   font-family:"iconfont" !important;
116 |   font-size:16px;font-style:normal;
117 |   -webkit-font-smoothing: antialiased;
118 |   -webkit-text-stroke-width: 0.2px;
119 |   -moz-osx-font-smoothing: grayscale;
120 | }
121 | 
122 |

第三步:挑选相应图标并获取字体编码,应用于页面

123 |
<i class="iconfont">&#x33;</i>
124 | 125 |
126 |

"iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。

127 |
128 |
129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /src/fonts/iconfont.css: -------------------------------------------------------------------------------- 1 | 2 | @font-face {font-family: "iconfont"; 3 | src: url('iconfont.eot?t=1532863398490'); /* IE9*/ 4 | src: url('iconfont.eot?t=1532863398490#iefix') format('embedded-opentype'), /* IE6-IE8 */ 5 | url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAmwAAsAAAAADiAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZXHEnwY21hcAAAAYAAAACqAAACLm1oPL9nbHlmAAACLAAABTQAAAbMtDjUBmhlYWQAAAdgAAAALwAAADYSJs0baGhlYQAAB5AAAAAcAAAAJAfeA4xobXR4AAAHrAAAABQAAAAsK+kAAGxvY2EAAAfAAAAAGAAAABgJAAqkbWF4cAAAB9gAAAAfAAAAIAEcAG5uYW1lAAAH+AAAAUUAAAJtPlT+fXBvc3QAAAlAAAAAcAAAAJyRRMP/eJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sc4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVLxgYG7438AQw9zAsA4ozAiSAwAnFAyieJzFkr0Ng0AMhZ/D5fKjFClQliCbsAglRQpGyBipMgG7sMETW5BnTENEnfj0neR3OtuyDWAPoBB3kQB7w+D2kmqzXuA86wkP+SWuUhI6GivWbNiy5zBimvTaERvqt5milLitjqsHHFXPSfk8ww5ZYt74/yOz/6Ve22W+n4unaaBbUIlEoO6BFqiPmkPgE2YdqLdgE3gctoFvAPvAt4BDoBlgRID8AdAyNLYAAHicVVNvbBNlGH+f9+3d9frnuvbau3WjW//s7rq0dFvb620T2kZsN3XRwjbm5L8OhiBDYgwJgVgTFvYBE+bCTPSDQTBmfoAENX4Qwp/4yRGTJSTGD5oYiV9AjBKCH+D0vSud0Lz95Xmf57nc8/x+v0MMQv/+Si6RViSiJOpDz6EaQsCmIC7gCMS0fAanIBRjQnJQIFpCi3GJeIasBznOBqVsIa/KLMf6QIAOyMWyBS2DNdDzRfwMZKUIQLi9bTSgrAmQU+Bq1TpmzRfwpxDqTKzxFdeaz6dLwWxUdB72BALhQOCkk2UYJ8YOnwAHZIlneBdrnmN8baFLnd24EzxhrW1k0httD+yay89EFJkHqNdBbI8Kn5f8bX56jrZJYiDMtXidrW3eRFcQDt9yt4qeiPoboj9Cd91E7hABuVEQJaw9ESchuYAMFXEdEGTjar4gcqxqiFoGjBwxChIWls17DAPe5WUQGMb8+4t2RTEUZXFeMZxKX4BEzvS9QbkRaGn5idYFsLoMxUye7Ewa0KIKETB/6nYKCLF0jjfJVXwHYSQgGbWhCIoipPhlJgNaEYwOkAXQBGgwTOQY59dAi+E/V8xyaQzjsVJpHGC8pGazI7mcumjenFyBq6chtQjpxdO00Gz6A6yGkSzsXZk0by6a5RWLB0vzK+Q4KSMn8qMYehbtolwUIa9aohpZqUEEIxs+ULgSaBwxGEVkJJmKLBt0wIINOjVHnOUEoOagJWqBkERvlht8QAnsAbqOqulqEWcl7EkNDI4PDKR8wWBnMAisO898b/51jiny73C36AMe7tEDB04UcLYP63EH6d3W4uiZnDkyk8r0APG/Bru7usAhbF5Lor2Y5x09UaK+2oIB1KGJnRMwB8aoQc97YrtIz70yf7WzP3LZWfaZ33YXklB5m8Xdfckk9CYZx/ozNYUpzoyn093pt4oed2D8M/ghPtGLI9WFQYeSAqeTpBTS++GLgpPvndgQjz/2D4VpXEc8ClHeEFgSyRZxVCxqIBoaGSBPiIhRSu9PJvv11LHL6fTlYw0c2oLxliEb4XcY3DwIFnyM3z906H1sozmJdw4N7cQ2Nr1bdyBSp95NoB773atvtGyjJ0I0kwjlaDKU02k+p8NTk4zOYDwzaiO8JN5Y2L5wQ9yxoxmYaP4aIdfmT10n5Dre0Oyk+MFTfXZgHm12npq/9piXh/g8nU1ufFcOTu3SCl2G5AB7wgY/WnNgeiUPh837S0vm/eFhcC8tgdscGTtIyMExGwegtm5dDRpYnzuL8dk5G80reH9t4z6M922s7f+mbPm8bCMdAew5vsZpVKaXQgYsb3IZy4oCUIPKHCvJUrYEj8NcEUogZQ3L1lnq6B5rVtn65qyInOccwbCT/fGTj35m+bCInSS/tsZjng3zmzuGkzHi8fLuFhJVa2oM+10M8XpILDnUOUabnS/35uEfd6vf4RK+9Hq/ElzQEnYxetcmV5jn+cmQKhz0UnI87hmOO+DyYiJ5D/gU6RVebHVtUgqIo3q/Sx5QvV3Ua1GUQv2oikYRElc1DVny6g11Rbqoptt5e4mQvbgS0hKrNiF6UwY5pwdlPbQqBXd/ahbj2amp4wRSFG7b1xM0c5scn5qafSjZ4ezrU7NwGi5ULN9WKtMOQqYrla0Yb61c+O5CI6hMEziD53bvOUHIiT13H/1iITQS3j0nMNy1K4+O/B/vxhfJ3qHqdoDtVZzE1W0Yb6sO78UXAei/Waqs6lsnnOU4hSiAq1WzThALR3Iwiv4Di4RX1HicY2BkYGAA4tMtc+zi+W2+MnCzMIDA9eYjyxD0/yAWBuYGIJeDgQkkCgBHHAtEAHicY2BkYGBu+N/AEMPCAAJAkpEBFXADAEcRAnR4nGNhYGBgfsnAwMJAGAMAJ6MBFQAAAAAAdgC6APoBlgHUAiICZgLMA1YDZnicY2BkYGDgZkhiYGcAASYg5gJCBob/YD4DABOmAYsAeJxlj01OwzAQhV/6B6QSqqhgh+QFYgEo/RGrblhUavdddN+mTpsqiSPHrdQDcB6OwAk4AtyAO/BIJ5s2lsffvHljTwDc4Acejt8t95E9XDI7cg0XuBeuU38QbpBfhJto41W4Rf1N2MczpsJtdGF5g9e4YvaEd2EPHXwI13CNT+E69S/hBvlbuIk7/Aq30PHqwj7mXle4jUcv9sdWL5xeqeVBxaHJIpM5v4KZXu+Sha3S6pxrW8QmU4OgX0lTnWlb3VPs10PnIhVZk6oJqzpJjMqt2erQBRvn8lGvF4kehCblWGP+tsYCjnEFhSUOjDFCGGSIyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicbYpLDoJAEAX7IT8ZwJO48EjNYJhmSDNEjODpMSEsSKzFW9QriminoP8YRLggRoIUGXJcUcCgJCyJNN73VcvaTcL6cjK/4/Y3qXXsWevj+Tzl68Ts9m7HsGYray/aGQ5hEMuzjHo75w+iDTk6JH8=') format('woff'), 6 | url('iconfont.ttf?t=1532863398490') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ 7 | url('iconfont.svg?t=1532863398490#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family:"iconfont" !important; 12 | font-size:16px; 13 | font-style:normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .icon-ibkkj:before { content: "\e6d7"; } 19 | 20 | .icon-dangqianshitu:before { content: "\e670"; } 21 | 22 | .icon-ditu:before { content: "\e6b4"; } 23 | 24 | .icon-chakan:before { content: "\e62b"; } 25 | 26 | .icon-dangqianweizhi:before { content: "\e800"; } 27 | 28 | .icon-chakan-copy:before { content: "\e600"; } 29 | 30 | .icon-yanjing:before { content: "\e601"; } 31 | 32 | .icon-application:before { content: "\e64b"; } 33 | 34 | .icon-dangqianweizhi1:before { content: "\e668"; } 35 | 36 | -------------------------------------------------------------------------------- /src/fonts/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/src/fonts/iconfont.eot -------------------------------------------------------------------------------- /src/fonts/iconfont.js: -------------------------------------------------------------------------------- 1 | (function(window){var svgSprite='';var script=function(){var scripts=document.getElementsByTagName("script");return scripts[scripts.length-1]}();var shouldInjectCss=script.getAttribute("data-injectcss");var ready=function(fn){if(document.addEventListener){if(~["complete","loaded","interactive"].indexOf(document.readyState)){setTimeout(fn,0)}else{var loadFn=function(){document.removeEventListener("DOMContentLoaded",loadFn,false);fn()};document.addEventListener("DOMContentLoaded",loadFn,false)}}else if(document.attachEvent){IEContentLoaded(window,fn)}function IEContentLoaded(w,fn){var d=w.document,done=false,init=function(){if(!done){done=true;fn()}};var polling=function(){try{d.documentElement.doScroll("left")}catch(e){setTimeout(polling,50);return}init()};polling();d.onreadystatechange=function(){if(d.readyState=="complete"){d.onreadystatechange=null;init()}}}};var before=function(el,target){target.parentNode.insertBefore(el,target)};var prepend=function(el,target){if(target.firstChild){before(el,target.firstChild)}else{target.appendChild(el)}};function appendSvg(){var div,svg;div=document.createElement("div");div.innerHTML=svgSprite;svgSprite=null;svg=div.getElementsByTagName("svg")[0];if(svg){svg.setAttribute("aria-hidden","true");svg.style.position="absolute";svg.style.width=0;svg.style.height=0;svg.style.overflow="hidden";prepend(svg,document.body)}}if(shouldInjectCss&&!window.__iconfont__svg__cssinject__){window.__iconfont__svg__cssinject__=true;try{document.write("")}catch(e){console&&console.log(e)}}ready(appendSvg)})(window) -------------------------------------------------------------------------------- /src/fonts/iconfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by iconfont 9 | 10 | 11 | 12 | 13 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/src/fonts/iconfont.ttf -------------------------------------------------------------------------------- /src/fonts/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/src/fonts/iconfont.woff -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue'; 4 | import 'element-ui/lib/theme-chalk/index.css'; 5 | import App from './App'; 6 | import router from './router'; 7 | import './element'; 8 | import './assets/css/reset.css'; 9 | import './fonts/iconfont.css'; // 图标字体 10 | 11 | Vue.config.productionTip = false; 12 | 13 | /* eslint-disable no-new */ 14 | new Vue({ 15 | el: '#app', 16 | router, 17 | components: { App }, 18 | template: '', 19 | }); 20 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | import Map from '@/views/Map'; 4 | import NotFound from '@/views/NotFound'; 5 | 6 | Vue.use(Router); 7 | 8 | export default new Router({ 9 | mode: 'history', 10 | routes: [ 11 | { 12 | path: '/', 13 | name: 'Map', 14 | component: Map, 15 | }, 16 | { 17 | path: '*', 18 | name: '404', 19 | component: NotFound, 20 | }, 21 | ], 22 | }); 23 | -------------------------------------------------------------------------------- /src/utils/convert.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 公共转换js 3 | */ 4 | 5 | // 将日期时间转成时间戳格式 6 | const dateTime = (str) => { 7 | if (!str) { 8 | return new Date(); 9 | } 10 | const reg = new RegExp(/(\d{4})-(\d{2})-(\d{2}).(\d{2}):(\d{2}):(\d{2})/); 11 | const msg = str.match(reg); 12 | const yy = msg[1]; 13 | const MM = msg[2]; 14 | const dd = msg[3]; 15 | const HH = msg[4]; 16 | const mm = msg[5]; 17 | const SS = msg[6]; 18 | const time = new Date(`${yy}-${MM}-${dd}`).getTime() - 8 * 60 * 60 * 1000; 19 | const ret = time + (parseInt(HH, 0) * 60 * 60 + parseInt(mm, 0) * 60 + parseInt(SS, 0)) * 1000; 20 | return ret; 21 | }; 22 | 23 | /** 24 | * 转出 YYYY-MM-DD 的时间格式 25 | * type 什么都不传 返回 YYYY-MM-SS 26 | * type === 1 YYYY-MM-DD hh:mm:ss 27 | * type === 2 不是时间的会返回null 28 | */ 29 | const convertDate = (date, type) => { 30 | if (!date && type === 2) { 31 | return null; 32 | } 33 | const reg = new RegExp(/(\d{4})-(\d{2})-(\d{2}).(\d{2}):(\d{2}):(\d{2})/); 34 | let dd = new Date(date); 35 | if (reg.test(date)) { 36 | dd = new Date(dateTime(date)); 37 | } 38 | if (dd.toString() === 'Invalid Date') { 39 | dd = new Date(); 40 | } 41 | let m = (dd.getMonth() + 1).toString(); 42 | let d = dd.getDate().toString(); 43 | let hh = dd.getHours().toString(); 44 | let mm = dd.getMinutes().toString(); 45 | let ss = dd.getSeconds().toString(); 46 | if (m.length < 2) { 47 | m = `0${m}`; 48 | } 49 | if (d.length < 2) { 50 | d = `0${d}`; 51 | } 52 | if (hh.length < 2) { 53 | hh = `0${hh}`; 54 | } 55 | if (mm.length < 2) { 56 | mm = `0${mm}`; 57 | } 58 | if (ss.length < 2) { 59 | ss = `0${ss}`; 60 | } 61 | if (type === 1) { 62 | return `${dd.getFullYear()}-${m}-${d} ${hh}:${mm}:${ss}`; 63 | } 64 | return `${dd.getFullYear()}-${m}-${d}`; 65 | }; 66 | 67 | // 转出 YYYY/MM/DD 的时间格式 68 | const convertDateOther = (date, type) => { 69 | const dd = new Date(date); 70 | if (dd.toString() === 'Invalid Date') { 71 | return null; 72 | } 73 | let m = (dd.getMonth() + 1).toString(); 74 | let d = dd.getDate().toString(); 75 | if (m.length < 2) { 76 | m = `0${m}`; 77 | } 78 | if (d.length < 2) { 79 | d = `0${d}`; 80 | } 81 | if (type === 1) { 82 | return `${dd.getFullYear()}`; // 转出年份 83 | } 84 | return `${dd.getFullYear()}/${m}/${d}`; 85 | }; 86 | 87 | // 转出 YYYY 年 MM 月 DD日 的时间格式 88 | const convertDateNew = (date, type) => { 89 | let dd = new Date(date); 90 | if (dd.toString() === 'Invalid Date') { 91 | dd = new Date(); 92 | } 93 | let m = (dd.getMonth() + 1).toString(); 94 | let d = dd.getDate().toString(); 95 | let hh = dd.getHours().toString(); 96 | let mm = dd.getMinutes().toString(); 97 | let ss = dd.getSeconds().toString(); 98 | if (m.length < 2) { 99 | m = `0${m}`; 100 | } 101 | if (d.length < 2) { 102 | d = `0${d}`; 103 | } 104 | if (hh.length < 2) { 105 | hh = `0${hh}`; 106 | } 107 | if (mm.length < 2) { 108 | mm = `0${mm}`; 109 | } 110 | if (ss.length < 2) { 111 | ss = `0${ss}`; 112 | } 113 | if (type === 1) { 114 | return `${dd.getFullYear()}-${m}-${d} ${hh}:${mm}:${ss}`; 115 | } 116 | return `${dd.getFullYear()} 年 ${m} 月 ${d} 日`; 117 | }; 118 | 119 | // 涉及到被转义的文本转json 120 | const getJSON = (str) => { 121 | if (!str) { 122 | return []; 123 | } 124 | let ret = ''; 125 | const fn = (s) => { 126 | if (typeof s === 'string') { 127 | try { 128 | const retstr = JSON.parse(s); 129 | ret = retstr; 130 | fn(retstr); 131 | } catch (error) { 132 | ret = s; 133 | } 134 | } 135 | }; 136 | fn(str); 137 | return ret; 138 | }; 139 | 140 | // JS 取得一个区间的随机整数 最小n 最大m 141 | const rnd = (n, m) => { 142 | const random = Math.floor(Math.random() * (m - n + 1) + n); 143 | return random; 144 | }; 145 | 146 | const GetRandomNum = (Min, Max) => { 147 | const Range = Max - Min; 148 | const Rand = Math.random(); 149 | return Min + Math.round(Rand * Range); 150 | }; 151 | 152 | // 获取区域下拉分类 153 | const getCity = (data, type) => { 154 | const arr = data; 155 | const arrs = []; 156 | for (let i = 0; i < data.length; i += 1) { 157 | for (let j = 0; j < data[i].children.length; j += 1) { 158 | const childItem = data[i].children[j]; 159 | childItem.count = rnd(20000, 100000); 160 | // item.lng = GetRandomNum(104, 104.5) + Math.random(); 161 | // item.lat = GetRandomNum(31, 31.5) + Math.random(); 162 | childItem.name = `${childItem.addr.substring(childItem.addr.length - 3)}供电所`; 163 | arr[i].children[j] = childItem; 164 | arrs.push(childItem); 165 | } 166 | } 167 | if (type === 1) { 168 | return arrs; 169 | } 170 | return arr; 171 | }; 172 | 173 | export default { 174 | dateTime, 175 | convertDate, 176 | convertDateOther, 177 | getJSON, 178 | convertDateNew, 179 | rnd, 180 | getCity, 181 | GetRandomNum, 182 | }; 183 | -------------------------------------------------------------------------------- /src/views/Map/data.js: -------------------------------------------------------------------------------- 1 | // 人口数量count 2 | // 经度lng 3 | // 纬度lat 4 | // 地址 5 | // 区域名称 6 | // 等级 7 | const dataList = [ 8 | { 9 | class: '江油市', 10 | from: '居民区', 11 | rank: '一级', 12 | children: [ 13 | { 14 | class: '江油市', 15 | from: '居民区', 16 | lng: 104.74119604818158, 17 | lat: 31.77836321703157, 18 | count: 60000, 19 | rank: '二级', 20 | addr: '四川省绵阳市江油市中坝镇太白广场', 21 | }, 22 | { 23 | class: '江油市', 24 | from: '居民区', 25 | lng: 104.75398707782969, 26 | lat: 31.785264901707604, 27 | count: 70000, 28 | rank: '二级', 29 | addr: '四川省绵阳市江油市中坝镇南街130号', 30 | }, 31 | { 32 | class: '江油市', 33 | from: '居民区', 34 | lng: 104.89000954737139, 35 | lat: 31.93300324112168, 36 | count: 50000, 37 | rank: '二级', 38 | addr: '四川省绵阳市江油市雁门场镇新街', 39 | }, 40 | { 41 | class: '江油市', 42 | from: '居民区', 43 | lng: 105.10624198449237, 44 | lat: 32.04865294000815, 45 | count: 50000, 46 | rank: '二级', 47 | addr: '四川省绵阳市江油市二郎庙镇迎宾路41号', 48 | }, 49 | { 50 | class: '江油市', 51 | from: '居民区', 52 | lng: 105.07570250137485, 53 | lat: 31.975186003747166, 54 | count: 45000, 55 | rank: '二级', 56 | addr: '四川省绵阳市江油市厚坝镇五金街8号', 57 | }, 58 | { 59 | class: '江油市', 60 | from: '居民区', 61 | lng: 104.98639054214795, 62 | lat: 31.95994390674704, 63 | count: 40000, 64 | rank: '二级', 65 | addr: '四川省绵阳市江油市重华镇灵溪中街122号', 66 | }, 67 | { 68 | class: '江油市', 69 | from: '居民区', 70 | lng: 105.04262839536256, 71 | lat: 31.919219817199918, 72 | count: 35000, 73 | rank: '二级', 74 | addr: '四川省绵阳市江油市小溪坝镇新政街', 75 | }, 76 | { 77 | class: '江油市', 78 | from: '居民区', 79 | lng: 105.12713005973613, 80 | lat: 31.921633065369379, 81 | count: 70000, 82 | rank: '二级', 83 | addr: '四川省绵阳市江油市河口镇三千米街', 84 | }, 85 | { 86 | class: '江油市', 87 | from: '居民区', 88 | lng: 104.89312307426897, 89 | lat: 31.931000622521017, 90 | count: 50000, 91 | rank: '二级', 92 | addr: '四川省绵阳市江油市永胜场镇朝阳街63号', 93 | }, 94 | { 95 | class: '江油市', 96 | from: '居民区', 97 | lng: 104.9074977347854, 98 | lat: 31.870515162556445, 99 | count: 50000, 100 | rank: '二级', 101 | addr: '四川省绵阳市江油市双河镇新街东段155号', 102 | }, 103 | { 104 | class: '江油市', 105 | from: '居民区', 106 | lng: 104.74356607635433, 107 | lat: 31.77981809221172, 108 | count: 60000, 109 | rank: '二级', 110 | addr: '四川省绵阳市江油市新安场镇梨园路', 111 | }, 112 | { 113 | class: '江油市', 114 | from: '居民区', 115 | lng: 104.84800383670744, 116 | lat: 31.732097632172306, 117 | count: 70000, 118 | rank: '二级', 119 | addr: '四川省绵阳市江油市贯山乡新街', 120 | }, 121 | { 122 | class: '江油市', 123 | from: '居民区', 124 | lng: 104.80594590484925, 125 | lat: 31.78277466160138, 126 | count: 50000, 127 | rank: '二级', 128 | addr: '四川省绵阳市江油市三合镇建设北路', 129 | }, 130 | { 131 | class: '江油市', 132 | from: '居民区', 133 | lng: 105.15911456967329, 134 | lat: 31.781361148166739, 135 | count: 50000, 136 | rank: '二级', 137 | addr: '四川省绵阳市江油市龙凤场镇花园街44号', 138 | }, 139 | { 140 | class: '江油市', 141 | from: '居民区', 142 | lng: 104.93314929992522, 143 | lat: 31.952426668806113, 144 | count: 45000, 145 | rank: '二级', 146 | addr: '四川省绵阳市江油市10KV河西开关站内', 147 | }, 148 | { 149 | class: '江油市', 150 | from: '居民区', 151 | lng: 104.7954258175812, 152 | lat: 31.893191505193717, 153 | count: 40000, 154 | rank: '二级', 155 | addr: '四川省绵阳市江油市武都镇海金村三组', 156 | }, 157 | { 158 | class: '江油市', 159 | from: '居民区', 160 | lng: 104.69340901393344, 161 | lat: 31.681396229523583, 162 | count: 35000, 163 | rank: '二级', 164 | addr: '四川省绵阳市江油市青莲镇文昌街12号', 165 | }, 166 | { 167 | class: '江油市', 168 | from: '居民区', 169 | lng: 104.6617540949828, 170 | lat: 31.650441845898557, 171 | count: 70000, 172 | rank: '二级', 173 | addr: '四川省绵阳市江油市九岭镇通达路103号', 174 | }, 175 | { 176 | class: '江油市', 177 | from: '居民区', 178 | lng: 104.74748227875051, 179 | lat: 31.787997067673179, 180 | count: 50000, 181 | rank: '二级', 182 | addr: '四川省绵阳市江油市胜利路碧水花园16号', 183 | }, 184 | { 185 | class: '江油市', 186 | from: '居民区', 187 | lng: 104.73395142265048, 188 | lat: 31.781786888290936, 189 | count: 60000, 190 | rank: '二级', 191 | addr: '四川省绵阳市江油市太平镇新华村4组', 192 | }, 193 | { 194 | class: '江油市', 195 | from: '居民区', 196 | lng: 104.74557316035527, 197 | lat: 31.77148883997275, 198 | count: 64000, 199 | rank: '二级', 200 | addr: '四川省绵阳江油市华丰桥武引4号', 201 | }, 202 | ], 203 | }, 204 | 205 | { 206 | class: '梓潼县', 207 | from: '商业区', 208 | rank: '一级', 209 | children: [ 210 | { 211 | class: '梓潼县', 212 | from: '商业区', 213 | lng: 105.1671826107806, 214 | lat: 31.640535093646525, 215 | count: 43000, 216 | rank: '二级', 217 | addr: '四川省绵阳市梓潼县崇文街中段139号', 218 | }, 219 | { 220 | class: '梓潼县', 221 | from: '商业区', 222 | lng: 105.16930438992076, 223 | lat: 31.644074395427557, 224 | count: 27000, 225 | rank: '二级', 226 | addr: '四川省绵阳市梓潼县文昌镇翠云路中段367号', 227 | }, 228 | { 229 | class: '梓潼县', 230 | from: '商业区', 231 | lng: 105.15054868765235, 232 | lat: 31.61818855707118, 233 | count: 32000, 234 | rank: '二级', 235 | addr: '四川省绵阳市梓潼县长卿镇文昌路南段1058号', 236 | }, 237 | { 238 | class: '梓潼县', 239 | from: '商业区', 240 | lng: 105.0102388619286, 241 | lat: 31.74521891993945, 242 | count: 36000, 243 | rank: '二级', 244 | addr: '四川省绵阳市梓潼县黎雅镇富乐街28号', 245 | }, 246 | { 247 | class: '梓潼县', 248 | from: '商业区', 249 | lng: 105.13688186762355, 250 | lat: 31.908592653796906, 251 | count: 45000, 252 | rank: '二级', 253 | addr: '四川省绵阳市梓潼县玛瑙场镇临江街123号', 254 | }, 255 | { 256 | class: '梓潼县', 257 | from: '商业区', 258 | lng: 105.1938341844829, 259 | lat: 31.653620996937435, 260 | count: 40000, 261 | rank: '二级', 262 | addr: '四川省绵阳市梓潼县许州镇南仙路南段104号', 263 | }, 264 | { 265 | class: '梓潼县', 266 | from: '商业区', 267 | lng: 105.08053025389745, 268 | lat: 31.834430844768684, 269 | count: 35000, 270 | rank: '二级', 271 | addr: '四川省绵阳市梓潼县双板乡场镇双福街145号', 272 | }, 273 | { 274 | class: '梓潼县', 275 | from: '商业区', 276 | lng: 105.30805568304217, 277 | lat: 31.531089389232027, 278 | count: 30000, 279 | rank: '二级', 280 | addr: '四川省绵阳市梓潼县宝石场镇梓盐街96号', 281 | }, 282 | { 283 | class: '梓潼县', 284 | from: '商业区', 285 | lng: 105.28000259638977, 286 | lat: 31.591117567562344, 287 | count: 25000, 288 | rank: '二级', 289 | addr: '四川省绵阳市梓潼县自强场镇中兴街119号', 290 | }, 291 | { 292 | class: '梓潼县', 293 | from: '商业区', 294 | lng: 105.16978051031546, 295 | lat: 31.65171074752621, 296 | count: 25000, 297 | rank: '二级', 298 | addr: '四川省绵阳市梓潼县桂香路中段247号', 299 | }, 300 | { 301 | class: '梓潼县', 302 | from: '商业区', 303 | lng: 105.16887909201155, 304 | lat: 31.638691854359263, 305 | count: 20000, 306 | rank: '二级', 307 | addr: '四川省绵阳市梓潼县文昌路253号', 308 | }, 309 | ], 310 | }, 311 | 312 | { 313 | class: '剑阁县', 314 | from: '工业区', 315 | rank: '一级', 316 | children: [ 317 | { 318 | class: '剑阁县', 319 | from: '工业区', 320 | lng: 105.17001586635908, 321 | lat: 31.63722640333686, 322 | count: 35000, 323 | rank: '二级', 324 | addr: '四川省广元市剑阁县开封镇和平街6号', 325 | }, 326 | { 327 | class: '剑阁县', 328 | from: '工业区', 329 | lng: 105.26594114356398, 330 | lat: 31.886223395338964, 331 | count: 30000, 332 | rank: '二级', 333 | addr: '四川省广元市剑阁县武连镇南街132号', 334 | }, 335 | ], 336 | }, 337 | 338 | { 339 | class: '安县', 340 | from: '安区', 341 | 342 | rank: '一级', 343 | children: [ 344 | { 345 | class: '安县', 346 | from: '安区', 347 | lng: 104.5715879262668, 348 | lat: 31.538122408798455, 349 | count: 66000, 350 | rank: '二级', 351 | addr: '四川省绵阳市绵阳市花荄镇恒源大道中段', 352 | }, 353 | { 354 | class: '安县', 355 | from: '安区', 356 | lng: 104.55973009950111, 357 | lat: 31.547382329509764, 358 | count: 70000, 359 | rank: '二级', 360 | addr: '四川省绵阳市安县花荄镇益昌路西段24号', 361 | }, 362 | { 363 | class: '安县', 364 | from: '安区', 365 | lng: 104.4844461689486, 366 | lat: 31.592547067164757, 367 | count: 65000, 368 | rank: '二级', 369 | addr: '四川省绵阳市安县黄土镇大西街109号', 370 | }, 371 | { 372 | class: '安县', 373 | from: '安区', 374 | lng: 104.28840175848575, 375 | lat: 31.692723013452878, 376 | count: 63000, 377 | rank: '二级', 378 | addr: '四川省绵阳市安县茶坪乡城隍庙街中段', 379 | }, 380 | { 381 | class: '安县', 382 | from: '安区', 383 | lng: 104.17525761304518, 384 | lat: 31.65147226822919, 385 | count: 49000, 386 | rank: '二级', 387 | addr: '四川省绵阳市安县高川乡四平路', 388 | }, 389 | { 390 | class: '安县', 391 | from: '安区', 392 | lng: 104.35814098541357, 393 | lat: 31.632464526963717, 394 | count: 47000, 395 | rank: '二级', 396 | addr: '四川省绵阳市安县桑枣镇温泉路中段', 397 | }, 398 | { 399 | class: '安县', 400 | from: '安区', 401 | lng: 104.34910187604996, 402 | lat: 31.512403607051334, 403 | count: 55000, 404 | rank: '二级', 405 | addr: '四川省绵阳市安县秀水镇南苑小区', 406 | }, 407 | { 408 | class: '安县', 409 | from: '安区', 410 | lng: 104.4219480003807, 411 | lat: 31.469366685078844, 412 | count: 76000, 413 | rank: '二级', 414 | addr: '四川省绵阳市安县塔水镇朝兴街中段54号', 415 | }, 416 | { 417 | class: '安县', 418 | from: '安区', 419 | lng: 104.32943841669098, 420 | lat: 31.434721183035234, 421 | count: 58000, 422 | rank: '二级', 423 | addr: '四川省绵阳市安县河清镇前锋村6组成青路旁', 424 | }, 425 | ], 426 | }, 427 | { 428 | class: '北川县', 429 | from: '北川区', 430 | rank: '一级', 431 | children: [ 432 | { 433 | class: '北川县', 434 | from: '北川区', 435 | lng: 104.45969354028225, 436 | lat: 31.8300423002971, 437 | count: 86000, 438 | rank: '二级', 439 | addr: '四川省绵阳市北川县擂鼓镇和平小区', 440 | }, 441 | { 442 | class: '北川县', 443 | from: '北川区', 444 | lng: 104.45749835110752, 445 | lat: 31.816829683396454, 446 | count: 79000, 447 | rank: '二级', 448 | addr: '四川省绵阳市北川县曲山镇任家坪', 449 | }, 450 | { 451 | class: '北川县', 452 | from: '北川区', 453 | lng: 104.45969354028225, 454 | lat: 31.8300423002971, 455 | count: 105000, 456 | rank: '二级', 457 | addr: '四川省绵阳市北川县桂溪乡下磨湾', 458 | }, 459 | { 460 | class: '北川县', 461 | from: '北川区', 462 | lng: 104.59097398529107, 463 | lat: 31.926424680871759, 464 | count: 73000, 465 | rank: '二级', 466 | addr: '四川省绵阳市北川县陈家坝乡龙湾村', 467 | }, 468 | { 469 | class: '北川县', 470 | from: '北川区', 471 | lng: 104.45969354028225, 472 | lat: 31.8300423002971, 473 | count: 89000, 474 | rank: '二级', 475 | addr: '四川省绵阳市北川县通口镇上街', 476 | }, 477 | { 478 | class: '北川县', 479 | from: '北川区', 480 | lng: 104.45969354028225, 481 | lat: 31.8300423002971, 482 | count: 97000, 483 | rank: '二级', 484 | addr: '四川省绵阳市北川县贯岭乡场镇', 485 | }, 486 | { 487 | class: '北川县', 488 | from: '北川区', 489 | lng: 104.42290771495364, 490 | lat: 31.630117838091559, 491 | count: 125000, 492 | rank: '二级', 493 | addr: '四川省绵阳市北川县安昌镇东风路', 494 | }, 495 | ], 496 | }, 497 | 498 | { 499 | class: '盐亭县', 500 | from: '盐亭区', 501 | rank: '一级', 502 | children: [ 503 | { 504 | class: '盐亭县', 505 | from: '盐亭区', 506 | lng: 105.40786631842528, 507 | lat: 31.067378827484676, 508 | count: 40000, 509 | rank: '二级', 510 | addr: '四川省绵阳市盐亭县玉龙镇人民路159号', 511 | }, 512 | { 513 | class: '盐亭县', 514 | from: '盐亭区', 515 | lng: 105.63068579629148, 516 | lat: 31.082637026979634, 517 | count: 35000, 518 | rank: '二级', 519 | addr: '四川省绵阳市盐亭县金孔镇新街66号', 520 | }, 521 | { 522 | class: '盐亭县', 523 | from: '盐亭区', 524 | lng: 105.62625540202477, 525 | lat: 31.185205831133226, 526 | count: 30000, 527 | rank: '二级', 528 | addr: '四川省绵阳市盐亭县八角镇政府街66号', 529 | }, 530 | { 531 | class: '盐亭县', 532 | from: '盐亭区', 533 | lng: 105.48818482922674, 534 | lat: 31.209005383024168, 535 | count: 49000, 536 | rank: '二级', 537 | addr: '四川省绵阳市盐亭县黄甸镇鸿宇路107号', 538 | }, 539 | { 540 | class: '盐亭县', 541 | from: '盐亭区', 542 | lng: 105.56140578224206, 543 | lat: 31.33626871914007, 544 | count: 47000, 545 | rank: '二级', 546 | addr: '四川省绵阳市盐亭县富驿镇富驿路下街107号', 547 | }, 548 | { 549 | class: '盐亭县', 550 | from: '盐亭区', 551 | lng: 105.3840064015205, 552 | lat: 31.18510949315302, 553 | count: 55000, 554 | rank: '二级', 555 | addr: '四川省绵阳市盐亭县两河镇绵盐大道', 556 | }, 557 | { 558 | class: '盐亭县', 559 | from: '盐亭区', 560 | lng: 105.4087548665408, 561 | lat: 31.25672636984184, 562 | count: 40000, 563 | rank: '二级', 564 | addr: '四川省绵阳市盐亭县云溪镇弥江路上北街261号', 565 | }, 566 | { 567 | class: '盐亭县', 568 | from: '盐亭区', 569 | lng: 105.44313790698624, 570 | lat: 31.387642345569753, 571 | count: 35000, 572 | rank: '二级', 573 | addr: '四川省绵阳市盐亭县黑坪镇仁和路52号', 574 | }, 575 | { 576 | class: '盐亭县', 577 | from: '盐亭区', 578 | lng: 105.33475995229338, 579 | lat: 31.36325199318728, 580 | count: 30000, 581 | rank: '二级', 582 | addr: '四川省绵阳市盐亭县柏梓镇榆龙街', 583 | }, 584 | ], 585 | }, 586 | 587 | { 588 | class: '涪城区', 589 | from: '城北区', 590 | rank: '一级', 591 | children: [ 592 | { 593 | class: '涪城区', 594 | from: '城北区', 595 | lng: 104.70885237813772, 596 | lat: 31.530595987561374, 597 | count: 60000, 598 | rank: '二级', 599 | addr: '四川省绵阳市涪城区青义镇灯塔路34号', 600 | }, 601 | { 602 | class: '涪城区', 603 | from: '城北区', 604 | lng: 104.74923070106969, 605 | lat: 31.48999260352205, 606 | count: 66000, 607 | rank: '二级', 608 | addr: '四川省绵阳市涪城区跃进路北段37号', 609 | }, 610 | { 611 | class: '涪城区', 612 | from: '城北区', 613 | lng: 104.74229908470372, 614 | lat: 31.508246182659116, 615 | count: 50000, 616 | rank: '二级', 617 | addr: '四川省绵阳市涪城区跃进路北段113号', 618 | }, 619 | { 620 | class: '涪城区', 621 | from: '城北区', 622 | lng: 104.74713299960213, 623 | lat: 31.4997899109372, 624 | count: 65000, 625 | rank: '二级', 626 | addr: '四川省绵阳市涪城区跃进路北段85号', 627 | }, 628 | { 629 | class: '涪城区', 630 | from: '城北区', 631 | lng: 104.67051389601079, 632 | lat: 31.435734812546767, 633 | count: 75000, 634 | rank: '二级', 635 | addr: '四川省绵阳市涪城区圆通路99号', 636 | }, 637 | { 638 | class: '涪城区', 639 | from: '城北区', 640 | lng: 104.75715329393867, 641 | lat: 31.46661281475758, 642 | count: 60000, 643 | rank: '二级', 644 | addr: '四川省绵阳市涪城区涪城路涪华车站', 645 | }, 646 | { 647 | class: '涪城区', 648 | from: '城北区', 649 | lng: 104.74449826235491, 650 | lat: 31.49917021648991, 651 | count: 55000, 652 | rank: '二级', 653 | addr: '四川省绵阳市跃进北路88号虹高市场内', 654 | }, 655 | { 656 | class: '涪城区', 657 | from: '城北区', 658 | lng: 104.76675069119367, 659 | lat: 31.46357865700645, 660 | count: 47000, 661 | rank: '二级', 662 | addr: '四川省绵阳市涪城区一环路南段245号', 663 | }, 664 | ], 665 | }, 666 | 667 | { 668 | class: '游仙区', 669 | from: '城南区', 670 | 671 | rank: '一级', 672 | children: [ 673 | { 674 | class: '游仙区', 675 | from: '城南区', 676 | lng: 104.98157984665036, 677 | lat: 31.518816009605446, 678 | count: 60000, 679 | rank: '二级', 680 | addr: '四川省绵阳市游仙区刘家场镇', 681 | }, 682 | { 683 | class: '游仙区', 684 | from: '城南区', 685 | lng: 104.82276536130263, 686 | lat: 31.426748911464605, 687 | count: 66000, 688 | rank: '二级', 689 | addr: '四川省绵阳市游仙区小枧场镇新华街24-1号', 690 | }, 691 | { 692 | class: '游仙区', 693 | from: '城南区', 694 | lng: 105.1037057886647, 695 | lat: 31.418981915440886, 696 | count: 50000, 697 | rank: '二级', 698 | addr: '四川省绵阳市游仙区石马场镇玉泉街14号', 699 | }, 700 | { 701 | class: '游仙区', 702 | from: '城南区', 703 | lng: 104.7846874357861, 704 | lat: 31.514418921960357, 705 | count: 45000, 706 | rank: '二级', 707 | addr: '四川省绵阳市游仙区游仙场镇游仙路256号', 708 | }, 709 | { 710 | class: '游仙区', 711 | from: '城南区', 712 | lng: 104.81593525795081, 713 | lat: 31.56059150704127, 714 | count: 45000, 715 | rank: '二级', 716 | addr: '四川省绵阳市游仙区新桥场镇和平路14号', 717 | }, 718 | { 719 | class: '游仙区', 720 | from: '城南区', 721 | lng: 104.86691114830168, 722 | lat: 31.53792891163498, 723 | count: 40000, 724 | rank: '二级', 725 | addr: '四川省绵阳市游仙区沉抗场镇海涛街32号', 726 | }, 727 | { 728 | class: '游仙区', 729 | from: '城南区', 730 | lng: 104.83531324031024, 731 | lat: 31.352073165144846, 732 | count: 35000, 733 | rank: '二级', 734 | addr: '四川省绵阳市游仙区忠兴场镇团结路12号', 735 | }, 736 | { 737 | class: '游仙区', 738 | from: '城南区', 739 | lng: 104.91011383578649, 740 | lat: 31.680901111728717, 741 | count: 47000, 742 | rank: '二级', 743 | addr: '四川省绵阳市游仙区太平场镇牌坊街100号', 744 | }, 745 | { 746 | class: '游仙区', 747 | from: '城南区', 748 | lng: 104.95054689467212, 749 | lat: 31.558839817065946, 750 | count: 50000, 751 | rank: '二级', 752 | addr: '四川省绵阳市游仙区魏城场镇莲花街', 753 | }, 754 | { 755 | class: '游仙区', 756 | from: '城南区', 757 | lng: 105.1006007381779, 758 | lat: 31.419812584947068, 759 | count: 50000, 760 | rank: '二级', 761 | addr: '四川省绵阳市游仙区玉河场镇黄金街', 762 | }, 763 | { 764 | class: '游仙区', 765 | from: '城南区', 766 | lng: 104.98157984665036, 767 | lat: 31.518816009605446, 768 | count: 60000, 769 | rank: '二级', 770 | addr: '四川省绵阳市游仙区琉璃村堂宏市场2-36号', 771 | }, 772 | { 773 | class: '游仙区', 774 | from: '城南区', 775 | lng: 104.78157120678555, 776 | lat: 31.4696539867288, 777 | count: 56000, 778 | rank: '二级', 779 | addr: '四川省绵阳市游仙区沈家坝下街设计院', 780 | }, 781 | { 782 | class: '游仙区', 783 | from: '城南区', 784 | lng: 104.78446447671786, 785 | lat: 31.47021499819241, 786 | count: 40000, 787 | rank: '二级', 788 | addr: '四川省绵阳市沈家坝北街48栋', 789 | }, 790 | ], 791 | }, 792 | ]; 793 | 794 | export default dataList; 795 | -------------------------------------------------------------------------------- /src/views/Map/index.vue: -------------------------------------------------------------------------------- 1 | 75 | 76 | 734 | 735 | 736 | 834 | 920 | -------------------------------------------------------------------------------- /src/views/Map/map.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | const MP = (ak) => { 4 | return new Promise((resolve, reject) => { 5 | const scriptMap = document.createElement('script'); 6 | scriptMap.type = 'text/javascript'; 7 | scriptMap.src = 'http://api.map.baidu.com/api?v=2.0&ak=' + ak + '&callback=init'; 8 | scriptMap.onerror = reject; 9 | document.head.appendChild(scriptMap); 10 | 11 | window.onload = () => { 12 | let index = 0; 13 | const jsSrc = [ 14 | './static/DrawingManager_min.js', 15 | './static/Heatmap_min.js', 16 | './static/GeoUtils_min.js', 17 | './static/TextIconOverlay_min.js', 18 | './static/MarkerClusterer_min.js', 19 | './static/RectangleZoom_min.js', 20 | ]; 21 | const callback = () => { 22 | index += 1; 23 | if (index === jsSrc.length) { 24 | resolve(BMap); 25 | } 26 | }; 27 | 28 | for (let i = 0; i < jsSrc.length; i += 1) { 29 | const src = jsSrc[i]; 30 | const $script = document.createElement('script'); 31 | $script.type = 'text/javascript'; 32 | $script.src = src; 33 | $script.onerror = reject; 34 | $script.onload = callback; 35 | document.head.appendChild($script); 36 | } 37 | }; 38 | }); 39 | }; 40 | export default MP; 41 | -------------------------------------------------------------------------------- /src/views/NotFound/index.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 224 | -------------------------------------------------------------------------------- /static/0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WQone/vue-echarts-heatmap/2428ae8b2a57c8f9752de458669b9b2d4584d31f/static/0001.png -------------------------------------------------------------------------------- /static/DrawingManager_min.css: -------------------------------------------------------------------------------- 1 | .BMapLib_Drawing_panel{height:47px;border:1px solid #666;border-radius:5px;overflow:hidden;box-shadow:1px 1px 3px rgba(0,0,0,0.3);float:left}.BMapLib_Drawing .BMapLib_box{border-right:1px solid #d2d2d2;float:left;height:100%;width:64px;height:100%;background-image:url(http://api.map.baidu.com/library/DrawingManager/1.4/src/bg_drawing_tool.png);cursor:pointer}.BMapLib_Drawing .BMapLib_last{border-right:0}.BMapLib_Drawing .BMapLib_hander{background-position:0 0}.BMapLib_Drawing .BMapLib_hander_hover{background-position:0 -52px}.BMapLib_Drawing .BMapLib_marker{background-position:-65px 0}.BMapLib_Drawing .BMapLib_marker_hover{background-position:-65px -52px}.BMapLib_Drawing .BMapLib_circle{background-position:-130px 0}.BMapLib_Drawing .BMapLib_circle_hover{background-position:-130px -52px}.BMapLib_Drawing .BMapLib_polyline{background-position:-195px 0}.BMapLib_Drawing .BMapLib_polyline_hover{background-position:-195px -52px}.BMapLib_Drawing .BMapLib_polygon{background-position:-260px 0}.BMapLib_Drawing .BMapLib_polygon_hover{background-position:-260px -52px}.BMapLib_Drawing .BMapLib_rectangle{background-position:-325px 0}.BMapLib_Drawing .BMapLib_rectangle_hover{background-position:-325px -52px} 2 | -------------------------------------------------------------------------------- /static/DrawingManager_min.js: -------------------------------------------------------------------------------- 1 | var BMapLib=window.BMapLib=BMapLib||{};var BMAP_DRAWING_MARKER="marker",BMAP_DRAWING_POLYLINE="polyline",BMAP_DRAWING_CIRCLE="circle",BMAP_DRAWING_RECTANGLE="rectangle",BMAP_DRAWING_POLYGON="polygon";(function(){var b=b||{guid:"$BAIDU$"};(function(){window[b.guid]={};b.extend=function(i,g){for(var h in g){if(g.hasOwnProperty(h)){i[h]=g[h]}}return i};b.lang=b.lang||{};b.lang.guid=function(){return"TANGRAM__"+(window[b.guid]._counter++).toString(36)};window[b.guid]._counter=window[b.guid]._counter||1;window[b.guid]._instances=window[b.guid]._instances||{};b.lang.Class=function(g){this.guid=g||b.lang.guid();window[b.guid]._instances[this.guid]=this};window[b.guid]._instances=window[b.guid]._instances||{};b.lang.isString=function(g){return"[object String]"==Object.prototype.toString.call(g)};b.lang.isFunction=function(g){return"[object Function]"==Object.prototype.toString.call(g)};b.lang.Class.prototype.toString=function(){return"[object "+(this._className||"Object")+"]"};b.lang.Class.prototype.dispose=function(){delete window[b.guid]._instances[this.guid];for(var g in this){if(!b.lang.isFunction(this[g])){delete this[g]}}this.disposed=true};b.lang.Event=function(g,h){this.type=g;this.returnValue=true;this.target=h||null;this.currentTarget=null};b.lang.Class.prototype.addEventListener=function(j,i,h){if(!b.lang.isFunction(i)){return}!this.__listeners&&(this.__listeners={});var g=this.__listeners,k;if(typeof h=="string"&&h){if(/[^\w\-]/.test(h)){throw ("nonstandard key:"+h)}else{i.hashCode=h;k=h}}j.indexOf("on")!=0&&(j="on"+j);typeof g[j]!="object"&&(g[j]={});k=k||b.lang.guid();i.hashCode=k;g[j][k]=i};b.lang.Class.prototype.removeEventListener=function(i,h){if(b.lang.isFunction(h)){h=h.hashCode}else{if(!b.lang.isString(h)){return}}!this.__listeners&&(this.__listeners={});i.indexOf("on")!=0&&(i="on"+i);var g=this.__listeners;if(!g[i]){return}g[i][h]&&delete g[i][h]};b.lang.Class.prototype.dispatchEvent=function(k,g){if(b.lang.isString(k)){k=new b.lang.Event(k)}!this.__listeners&&(this.__listeners={});g=g||{};for(var j in g){k[j]=g[j]}var j,h=this.__listeners,l=k.type;k.target=k.target||this;k.currentTarget=this;l.indexOf("on")!=0&&(l="on"+l);b.lang.isFunction(this[l])&&this[l].apply(this,arguments);if(typeof h[l]=="object"){for(j in h[l]){h[l][j].apply(this,arguments)}}return k.returnValue};b.lang.inherits=function(m,k,j){var i,l,g=m.prototype,h=new Function();h.prototype=k.prototype;l=m.prototype=new h();for(i in g){l[i]=g[i]}m.prototype.constructor=m;m.superClass=k.prototype;if("string"==typeof j){l._className=j}};b.dom=b.dom||{};b._g=b.dom._g=function(g){if(b.lang.isString(g)){return document.getElementById(g)}return g};b.g=b.dom.g=function(g){if("string"==typeof g||g instanceof String){return document.getElementById(g)}else{if(g&&g.nodeName&&(g.nodeType==1||g.nodeType==9)){return g}}return null};b.insertHTML=b.dom.insertHTML=function(j,g,i){j=b.dom.g(j);var h,k;if(j.insertAdjacentHTML){j.insertAdjacentHTML(g,i)}else{h=j.ownerDocument.createRange();g=g.toUpperCase();if(g=="AFTERBEGIN"||g=="BEFOREEND"){h.selectNodeContents(j);h.collapse(g=="AFTERBEGIN")}else{k=g=="BEFOREBEGIN";h[k?"setStartBefore":"setEndAfter"](j);h.collapse(k)}h.insertNode(h.createContextualFragment(i))}return j};b.ac=b.dom.addClass=function(n,o){n=b.dom.g(n);var h=o.split(/\s+/),g=n.className,m=" "+g+" ",k=0,j=h.length;for(;k=h.width-20||i.y<=50||i.y>=h.height-10){if(i.x<=20){this._panByX=8}else{if(i.x>=h.width-20){this._panByX=-8}}if(i.y<=50){this._panByY=8}else{if(i.y>=h.height-10){this._panByY=-8}}if(!this._edgeMoveTimer){this._edgeMoveTimer=setInterval(function(){h.panBy(o._panByX,o._panByY,{"noAnimation":true})},30)}}else{if(this._edgeMoveTimer){clearInterval(this._edgeMoveTimer);this._edgeMoveTimer=null}}};e.prototype._adjustSize=function(g){this.container.style.width=g.width+"px";this.container.style.height=g.height+"px"};e.prototype.getDrawPoint=function(l){var k=this._map,j=b.getTarget(l),h=l.offsetX||l.layerX||0,m=l.offsetY||l.layerY||0;if(j.nodeType!=1){j=j.parentNode}while(j&&j!=k.getContainer()){if(!(j.clientWidth==0&&j.clientHeight==0&&j.offsetParent&&j.offsetParent.nodeName=="TD")){h+=j.offsetLeft||0;m+=j.offsetTop||0}j=j.offsetParent}var i=new BMap.Pixel(h,m);var g=k.pixelToPoint(i);return g};function a(h,g){this.drawingManager=h;g=this.drawingToolOptions=g||{};this.defaultAnchor=BMAP_ANCHOR_TOP_LEFT;this.defaultOffset=new BMap.Size(10,10);this.defaultDrawingModes=[BMAP_DRAWING_MARKER,BMAP_DRAWING_CIRCLE,BMAP_DRAWING_POLYLINE,BMAP_DRAWING_POLYGON,BMAP_DRAWING_RECTANGLE];if(g.drawingModes){this.drawingModes=g.drawingModes}else{this.drawingModes=this.defaultDrawingModes}if(g.anchor){this.setAnchor(g.anchor)}if(g.offset){this.setOffset(g.offset)}}a.prototype=new BMap.Control();a.prototype.initialize=function(i){var h=this.container=document.createElement("div");h.className="BMapLib_Drawing";var g=this.panel=document.createElement("div");g.className="BMapLib_Drawing_panel";if(this.drawingToolOptions&&this.drawingToolOptions.scale){this._setScale(this.drawingToolOptions.scale)}h.appendChild(g);g.innerHTML=this._generalHtml();this._bind(g);i.getContainer().appendChild(h);return h};a.prototype._generalHtml=function(m){var h={};h["hander"]="拖动地图";h[BMAP_DRAWING_MARKER]="画点";h[BMAP_DRAWING_CIRCLE]="画圆";h[BMAP_DRAWING_POLYLINE]="画折线";h[BMAP_DRAWING_POLYGON]="画多边形";h[BMAP_DRAWING_RECTANGLE]="画矩形";var n=function(o,i){return''};var k=[];k.push(n("BMapLib_box BMapLib_hander","hander"));for(var j=0,g=this.drawingModes.length; 4 | j=e.lng&&f.lng<=h.lng&&f.lat>=e.lat&&f.lat<=h.lat)};b.isPointInCircle=function(e,h){if(!(e instanceof BMap.Point)||!(h instanceof BMap.Circle)){return false}var i=h.getCenter();var g=h.getRadius();var f=b.getDistance(e,i);if(f<=g){return true}else{return false}};b.isPointOnPolyline=function(f,h){if(!(f instanceof BMap.Point)||!(h instanceof BMap.Polyline)){return false}var e=h.getBounds();if(!this.isPointInRect(f,e)){return false}var m=h.getPath();for(var k=0;k=Math.min(l.lng,j.lng)&&f.lng<=Math.max(l.lng,j.lng)&&f.lat>=Math.min(l.lat,j.lat)&&f.lat<=Math.max(l.lat,j.lat)){var g=(l.lng-f.lng)*(j.lat-f.lat)-(j.lng-f.lng)*(l.lat-f.lat);if(g<2e-10&&g>-2e-10){return true}}}return false};b.isPointInPolygon=function(o,l){if(!(o instanceof BMap.Point)||!(l instanceof BMap.Polygon)){return false}var k=l.getBounds();if(!this.isPointInRect(o,k)){return false}var t=l.getPath();var h=t.length;var n=true;var j=0;var g=2e-10;var s,q;var e=o;s=t[0];for(var f=1;f<=h;++f){if(e.equals(s)){return n}q=t[f%h];if(e.latMath.max(s.lat,q.lat)){s=q;continue}if(e.lat>Math.min(s.lat,q.lat)&&e.lat=Math.min(s.lng,q.lng)){return n}if(s.lng==q.lng){if(s.lng==e.lng){return n}else{++j}}else{var r=(e.lat-s.lat)*(q.lng-s.lng)/(q.lat-s.lat)+s.lng;if(Math.abs(e.lng-r)=Math.min(s.lat,m.lat)&&e.lat<=Math.max(s.lat,m.lat)){++j}else{j+=2}}}s=q}if(j%2==0){return false}else{return true}};b.degreeToRad=function(e){return Math.PI*e/180};b.radToDegree=function(e){return(180*e)/Math.PI};function d(g,f,e){if(f!=null){g=Math.max(g,f)}if(e!=null){g=Math.min(g,e)}return g}function c(g,f,e){while(g>e){g-=e-f}while(g0){y+=m;k++}else{x+=m;h++}}var u,r;u=y+(2*Math.PI*h-x);r=(2*Math.PI*k-y)+x;if(y>x){if((u-(B-2)*Math.PI)<1){f=u}else{f=r}}else{if((r-(B-2)*Math.PI)<1){f=r}else{f=u}}w=(f-(B-2)*Math.PI)*n*n;return w}})(); -------------------------------------------------------------------------------- /static/Heatmap_min.js: -------------------------------------------------------------------------------- 1 | (function(b,c,a){c[b]=a()})("h337",this,function(){var c={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{0.45:"rgb(0,0,255)",0.55:"rgb(0,255,255)",0.65:"rgb(0,255,0)",0.95:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:0.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}};var g=(function l(){var n=function n(o){this._coordinator={};this._data=[];this._radi=[];this._min=0;this._max=1;this._xField=o.xField||o.defaultXField;this._yField=o.yField||o.defaultYField;this._valueField=o.valueField||o.defaultValueField;if(o.radius){this._cfgRadius=o.radius}};var m=c.defaultRadius;n.prototype={_organiseData:function(o,q){var u=o[this._xField];var s=o[this._yField];var z=this._radi;var w=this._data;var t=this._max;var p=this._min;var v=o[this._valueField]||1;var r=o.radius||this._cfgRadius||m;if(!w[u]){w[u]=[];z[u]=[]}if(!w[u][s]){w[u][s]=v;z[u][s]=r}else{w[u][s]+=v}if(w[u][s]>t){if(!q){this._max=w[u][s]}else{this.setDataMax(w[u][s])}return false}else{return{x:u,y:s,value:v,radius:r,min:p,max:t}}},_unOrganizeData:function(){var r=[];var q=this._data;var p=this._radi;for(var o in q){for(var s in q[o]){r.push({x:o,y:s,radius:p[o][s],value:q[o][s]})}}return{min:this._min,max:this._max,data:r}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0){var p=arguments[0];var o=p.length;while(o--){this.addData.call(this,p[o])}}else{var q=this._organiseData(arguments[0],true);if(q){this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[q]})}}return this},setData:function(q){var p=q.data;var r=p.length;this._data=[];this._radi=[];for(var o=0;othis._renderBoundaries[2]){this._renderBoundaries[2]=r+2*z}if(q+2*z>this._renderBoundaries[3]){this._renderBoundaries[3]=q+2*z}}},_colorize:function(){var w=this._renderBoundaries[0];var u=this._renderBoundaries[1];var B=this._renderBoundaries[2]-w;var z=this._renderBoundaries[3]-u;var G=this._width;var A=this._height;var r=this._opacity;var I=this._maxOpacity;var C=this._minOpacity;var v=this._useGradientOpacity;if(w<0){w=0}if(u<0){u=0}if(w+B>G){B=G-w}if(u+z>A){z=A-u}var J=this.shadowCtx.getImageData(w,u,B,z);var H=J.data;var E=H.length;var F=this._palette;for(var D=3;D0){q=r}else{if(s>0;return w},getDataURL:function(){return this.canvas.toDataURL()}};return m})();var e=(function b(){var m=false;if(c.defaultRenderer==="canvas2d"){m=h}return m})();var i={merge:function(){var m={};var n=arguments.length;for(var p=0;p0){this.heatmap.removeData();var n=this.latlngs.length;d={max:this.heatmap._store.getData().max,data:[]};while(n--){var f=this.latlngs[n].latlng;if(!k.containsPoint(f)){continue}var g=this._map.pointToOverlayPixel(f),i=this._map.pointToOverlayPixel(k.getSouthWest()).x,c=this._map.pointToOverlayPixel(k.getNorthEast()).y,e=new BMap.Pixel(g.x-i,g.y-c);var m=this.pixelTransform(e);d.data.push({x:m.x,y:m.y,count:this.latlngs[n].c})}if(this.conf.radiusChangeByZoom){this.heatmap._store._cfgRadius=this.conf.radiusChangeByZoom(this._map.getZoom())}this.heatmap.setData(d)}};a.prototype.pixelTransform=function(f){var c=this.heatmap.width,e=this.heatmap.height;while(f.x<0){f.x+=c}while(f.x>c){f.x-=c}while(f.y<0){f.y+=e}while(f.y>e){f.y-=e}f.x=(f.x>>0);f.y=(f.y>>0);return f};a.prototype.setDataSet=function(j){this.data=j;if(!b()){return}var i=this._map.getBounds();var l={max:j.max,data:[]};var m=j.data,k=m.length;this.latlngs=[];this.heatmap.removeData();if(this.conf.radiusChangeByZoom){this.heatmap._store._cfgRadius=this.conf.radiusChangeByZoom(this._map.getZoom())}while(k--){var f=new BMap.Point(m[k].lng,m[k].lat);this.latlngs.push({latlng:f,c:m[k].count});if(!i.containsPoint(f)){continue}var g=this._map.pointToOverlayPixel(f),h=this._map.pointToOverlayPixel(i.getSouthWest()).x,c=this._map.pointToOverlayPixel(i.getNorthEast()).y,e=new BMap.Pixel(g.x-h,g.y-c);var n=this.pixelTransform(e);l.data.push({x:n.x,y:n.y,count:m[k].count})}this.heatmap.setData(l)};a.prototype.addDataPoint=function(e,g,f){if(!b()){return}if(this.data&&this.data.data){this.data.data.push({lng:e,lat:g,count:f})}var h=new BMap.Point(e,g),c=this.pixelTransform(this._map.pointToOverlayPixel(h));this.heatmap.store.addDataPoint(c.x,c.y,f);this.latlngs.push({latlng:h,c:f})};a.prototype.toggle=function(){if(!b()){return}if(this.conf.visible===true){this.conf.visible=false}else{this.conf.visible=true}if(this.conf.visible){this.conf.element.style.display="block"}else{this.conf.element.style.display="none"}};a.prototype.setOptions=function(c){if(!b()){return}for(var e in c){if(e=="radius"){this.heatmap._store._cfgRadius=c[e]}if(e=="opacity"){c[e]=c[e]/100}}this.heatmap.configure(c);if(this.data){this.setDataSet(this.data)}};function b(){var c=document.createElement("canvas");return !!(c.getContext&&c.getContext("2d"))}})(); -------------------------------------------------------------------------------- /static/MarkerClusterer_min.js: -------------------------------------------------------------------------------- 1 | var BMapLib=window.BMapLib=BMapLib||{};(function(){var b=function(m,l,j){l=d(l);var n=m.pointToPixel(l.getNorthEast());var i=m.pointToPixel(l.getSouthWest());n.x+=j;n.y-=j;i.x-=j;i.y+=j;var h=m.pixelToPoint(n);var k=m.pixelToPoint(i);return new BMap.Bounds(k,h)};var d=function(i){var k=f(i.getNorthEast().lng,-180,180);var h=f(i.getSouthWest().lng,-180,180);var j=f(i.getNorthEast().lat,-74,74);var l=f(i.getSouthWest().lat,-74,74);return new BMap.Bounds(new BMap.Point(h,l),new BMap.Point(k,j))};var f=function(j,k,h){k&&(j=Math.max(j,k));h&&(j=Math.min(j,h));return j};var a=function(h){return"[object Array]"===Object.prototype.toString.call(h)};var c=function(l,n){var j=-1;if(a(n)){if(n.indexOf){j=n.indexOf(l)}else{for(var k=0,h;h=n[k];k++){if(h===l){j=k;break}}}}return j};var e=BMapLib.MarkerClusterer=function(l,h){if(!l){return}this._map=l;this._markers=[];this._clusters=[];var k=h||{};this._gridSize=k.gridSize||60;this._maxZoom=k.maxZoom||18;this._minClusterSize=k.minClusterSize||2;this._isAverageCenter=false;if(k.isAverageCenter!=undefined){this._isAverageCenter=k.isAverageCenter}this._styles=k.styles||[];var j=this;this._map.addEventListener("zoomend",function(){j._redraw()});this._map.addEventListener("moveend",function(){j._redraw()});var i=k.markers;a(i)&&this.addMarkers(i)};e.prototype.addMarkers=function(k){for(var j=0,h=k.length;jthis._markerClusterer.getMaxZoom()){this._clusterMarker&&this._map.removeOverlay(this._clusterMarker);for(var l=0,j;j=this._markers[l];l++){this._map.addOverlay(j)}return}if(this._markers.length1?1:this._opts.opacity;if(this._opts.zoomTypej){this._opts.zoomType=e}this._isOpen=false;this._fDiv=null;this._followTitle=null};c.prototype._setOptions=function(m){if(!m){return}for(var n in m){if(typeof(m[n])!="undefined"){this._opts[n]=m[n]}}};c.prototype.setStrokeColor=function(m){if(typeof m=="string"){this._opts.strokeColor=m;this._updateStyle()}};c.prototype.setLineStroke=function(m){if(typeof m=="number"&&Math.round(m)>0){this._opts.strokeWeight=Math.round(m);this._updateStyle()}};c.prototype.setLineStyle=function(m){if(m=="solid"||m=="dashed"){this._opts.style=m;this._updateStyle()}};c.prototype.setOpacity=function(m){if(typeof m=="number"&&m>=0&&m<=1){this._opts.opacity=m;this._updateStyle()}};c.prototype.setFillColor=function(m){this._opts.fillColor=m;this._updateStyle()};c.prototype.setCursor=function(m){this._opts.cursor=m;f.setCursor(this._opts.cursor)};c.prototype._updateStyle=function(){if(this._fDiv){this._fDiv.style.border=[this._opts.strokeWeight,"px ",this._opts.style," ",this._opts.color].join("");var m=this._fDiv.style,n=this._opts.opacity;m.opacity=n;m.MozOpacity=n;m.KhtmlOpacity=n;m.filter="alpha(opacity="+(n*100)+")"}};c.prototype.getCursor=function(){return this._opts.cursor};c.prototype._bind=function(){this.setCursor(this._opts.cursor);var n=this;d(this._map.getContainer(),"mousemove",function(q){if(!n._isOpen){return}if(!n._followTitle){return}q=window.event||q;var o=q.target||q.srcElement;if(o!=f.getDom(n._map)){n._followTitle.hide();return}if(!n._mapMoving){n._followTitle.show()}var p=f.getDrawPoint(q,true);n._followTitle.setPosition(p)});if(this._opts.followText){var m=this._followTitle=new BMap.Label(this._opts.followText,{offset:new BMap.Size(14,16)});this._followTitle.setStyles({color:"#333",borderColor:"#ff0103"})}};c.prototype.open=function(){if(this._isOpen==true){return true}if(!!BMapLib._toolInUse){return}this._isOpen=true;BMapLib._toolInUse=true;if(!this.binded){this._bind();this.binded=true}if(this._followTitle){this._map.addOverlay(this._followTitle);this._followTitle.hide()}var o=this;var p=this._map;var q=0;if(/msie (\d+\.\d)/i.test(navigator.userAgent)){q=document.documentMode||+RegExp["\x241"]}var n=function(s){s=window.event||s;if(s.button!=0&&!q||q&&s.button!=1){return}if(!!q&&f.getDom(p).setCapture){f.getDom(p).setCapture()}if(!o._isOpen){return}o._bind.isZooming=true;d(document,"mousemove",m);d(document,"mouseup",r);o._bind.mx=s.layerX||s.offsetX||0;o._bind.my=s.layerY||s.offsetY||0;o._bind.ix=s.pageX||s.clientX||0;o._bind.iy=s.pageY||s.clientY||0;a(f.getDom(p),"beforeBegin",o._generateHTML());o._fDiv=f.getDom(p).previousSibling;o._fDiv.style.width="0";o._fDiv.style.height="0";o._fDiv.style.left=o._bind.mx+"px";o._fDiv.style.top=o._bind.my+"px";b(s);return h(s)};var m=function(z){if(o._isOpen==true&&o._bind.isZooming==true){var z=window.event||z;var u=z.pageX||z.clientX||0;var s=z.pageY||z.clientY||0;var w=o._bind.dx=u-o._bind.ix;var t=o._bind.dy=s-o._bind.iy;var v=Math.abs(w)-o._opts.strokeWeight;var y=Math.abs(t)-o._opts.strokeWeight;o._fDiv.style.width=(v<0?0:v)+"px";o._fDiv.style.height=(y<0?0:y)+"px";var x=[p.getSize().width,p.getSize().height];if(w>=0){o._fDiv.style.right="auto";o._fDiv.style.left=o._bind.mx+"px";if(o._bind.mx+w>=x[0]-2*o._opts.strokeWeight){o._fDiv.style.width=x[0]-o._bind.mx-2*o._opts.strokeWeight+"px";o._followTitle&&o._followTitle.hide()}}else{o._fDiv.style.left="auto";o._fDiv.style.right=x[0]-o._bind.mx+"px";if(o._bind.mx+w<=2*o._opts.strokeWeight){o._fDiv.style.width=o._bind.mx-2*o._opts.strokeWeight+"px";o._followTitle&&o._followTitle.hide()}}if(t>=0){o._fDiv.style.bottom="auto";o._fDiv.style.top=o._bind.my+"px";if(o._bind.my+t>=x[1]-2*o._opts.strokeWeight){o._fDiv.style.height=x[1]-o._bind.my-2*o._opts.strokeWeight+"px";o._followTitle&&o._followTitle.hide()}}else{o._fDiv.style.top="auto";o._fDiv.style.bottom=x[1]-o._bind.my+"px";if(o._bind.my+t<=2*o._opts.strokeWeight){o._fDiv.style.height=o._bind.my-2*o._opts.strokeWeight+"px";o._followTitle&&o._followTitle.hide()}}b(z);return h(z)}};var r=function(A){if(o._isOpen==true){i(document,"mousemove",m);i(document,"mouseup",r);if(!!q&&f.getDom(p).releaseCapture){f.getDom(p).releaseCapture()}var v=parseInt(o._fDiv.style.left)+parseInt(o._fDiv.style.width)/2;var u=parseInt(o._fDiv.style.top)+parseInt(o._fDiv.style.height)/2;var z=[p.getSize().width,p.getSize().height];if(isNaN(v)){v=z[0]-parseInt(o._fDiv.style.right)-parseInt(o._fDiv.style.width)/2}if(isNaN(u)){u=z[1]-parseInt(o._fDiv.style.bottom)-parseInt(o._fDiv.style.height)/2}var C=Math.min(z[0]/Math.abs(o._bind.dx),z[1]/Math.abs(o._bind.dy));C=Math.floor(C);var x=new BMap.Pixel(v-parseInt(o._fDiv.style.width)/2,u-parseInt(o._fDiv.style.height)/2);var w=new BMap.Pixel(v+parseInt(o._fDiv.style.width)/2,u+parseInt(o._fDiv.style.height)/2);var F=p.pixelToPoint(x);var E=p.pixelToPoint(w);var y=new BMap.Bounds(F,E);delete o._bind.dx;delete o._bind.dy;delete o._bind.ix;delete o._bind.iy;if(!isNaN(C)){if(o._opts.zoomType==e){targetZoomLv=Math.round(p.getZoom()+(Math.log(C)/Math.log(2)));if(targetZoomLvp.getZoom()){targetZoomLv=p.getZoom()}}}else{targetZoomLv=p.getZoom()+(o._opts.zoomType==e?1:-1)}var s=p.pixelToPoint({x:v,y:u},p.getZoom());p.centerAndZoom(s,targetZoomLv);var I=f.getDrawPoint(A);if(o._followTitle){o._followTitle.setPosition(I);o._followTitle.show()}o._bind.isZooming=false;o._fDiv.parentNode.removeChild(o._fDiv);o._fDiv=null}var t=y.getSouthWest(),B=y.getNorthEast(),G=new BMap.Point(B.lng,t.lat),H=new BMap.Point(t.lng,B.lat),D=new BMap.Polygon([t,H,B,G]);D.setStrokeWeight(2);D.setStrokeOpacity(0.3);D.setStrokeColor("#111");D.setFillColor("");p.addOverlay(D);new g({duration:240,fps:20,delay:500,render:function(K){var J=0.3*(1-K);D.setStrokeOpacity(J)},finish:function(){p.removeOverlay(D);D=null}});if(o._opts.autoClose){setTimeout(function(){if(o._isOpen==true){o.close()}},70)}b(A);return h(A)};f.show(this._map);this.setCursor(this._opts.cursor);if(!this._isBeginDrawBinded){d(f.getDom(this._map),"mousedown",n);this._isBeginDrawBinded=true}return true};c.prototype.close=function(){if(!this._isOpen){return}this._isOpen=false;BMapLib._toolInUse=false;this._followTitle&&this._followTitle.hide();f.hide()};c.prototype._generateHTML=function(){return["
"].join("")};function a(p,m,o){var n,q;if(p.insertAdjacentHTML){p.insertAdjacentHTML(m,o)}else{n=p.ownerDocument.createRange();m=m.toUpperCase();if(m=="AFTERBEGIN"||m=="BEFOREEND"){n.selectNodeContents(p);n.collapse(m=="AFTERBEGIN")}else{q=m=="BEFOREBEGIN";n[q?"setStartBefore":"setEndAfter"](p);n.collapse(q)}n.insertNode(n.createContextualFragment(o))}return p}function k(n,m){a(n,"beforeEnd",m);return n.lastChild}function b(m){var m=window.event||m;m.stopPropagation?m.stopPropagation():m.cancelBubble=true}function h(m){var m=window.event||m;m.preventDefault?m.preventDefault():m.returnValue=false;return false}function d(m,n,o){if(!m){return}n=n.replace(/^on/i,"").toLowerCase();if(m.addEventListener){m.addEventListener(n,o,false)}else{if(m.attachEvent){m.attachEvent("on"+n,o)}}}function i(m,n,o){if(!m){return}n=n.replace(/^on/i,"").toLowerCase();if(m.removeEventListener){m.removeEventListener(n,o,false)}else{if(m.detachEvent){m.detachEvent("on"+n,o)}}}var f={_map:null,_html:"
",_maskElement:null,_cursor:"default",_inUse:false,show:function(m){if(!this._map){this._map=m}this._inUse=true;if(!this._maskElement){this._createMask(m)}this._maskElement.style.display="block"},_createMask:function(o){this._map=o;if(!this._map){return}var n=this._maskElement=k(this._map.getContainer(),this._html);var m=function(p){b(p);return h(p)};d(n,"mouseup",function(p){if(p.button==2){m(p)}});d(n,"contextmenu",m);n.style.display="none"},getDrawPoint:function(p,r){p=window.event||p;var m=p.layerX||p.offsetX||0;var q=p.layerY||p.offsetY||0;var o=p.target||p.srcElement;if(o!=f.getDom(this._map)&&r==true){while(o&&o!=this._map.getContainer()){if(!(o.clientWidth==0&&o.clientHeight==0&&o.offsetParent&&o.offsetParent.nodeName.toLowerCase()=="td")){m+=o.offsetLeft;q+=o.offsetTop}o=o.offsetParent}}if(o!=f.getDom(this._map)&&o!=this._map.getContainer()){return}if(typeof m==="undefined"||typeof q==="undefined"){return}if(isNaN(m)||isNaN(q)){return}return this._map.pixelToPoint(new BMap.Pixel(m,q))},hide:function(){if(!this._map){return}this._inUse=false;if(this._maskElement){this._maskElement.style.display="none"}},getDom:function(m){if(!this._maskElement){this._createMask(m)}return this._maskElement},setCursor:function(m){this._cursor=m||"default";if(this._maskElement){this._maskElement.style.cursor=this._cursor}}};function g(p){var m={duration:1000,fps:30,delay:0,transition:l.linear,onStop:function(){}};if(p){for(var n in p){m[n]=p[n]}}this._opts=m;if(m.delay){var o=this;setTimeout(function(){o._beginTime=new Date().getTime();o._endTime=o._beginTime+o._opts.duration;o._launch()},m.delay)}else{this._beginTime=new Date().getTime();this._endTime=this._beginTime+this._opts.duration;this._launch()}}g.prototype._launch=function(){var n=this;var m=new Date().getTime();if(m>=n._endTime){if(typeof n._opts.render=="function"){n._opts.render(n._opts.transition(1))}if(typeof n._opts.finish=="function"){n._opts.finish()}return}n.schedule=n._opts.transition((m-n._beginTime)/n._opts.duration);if(typeof n._opts.render=="function"){n._opts.render(n.schedule)}if(!n.terminative){n._timer=setTimeout(function(){n._launch()},1000/n._opts.fps)}};var l={linear:function(m){return m},reverse:function(m){return 1-m},easeInQuad:function(m){return m*m},easeInCubic:function(m){return Math.pow(m,3)},easeOutQuad:function(m){return -(m*(m-2))},easeOutCubic:function(m){return Math.pow((m-1),3)+1},easeInOutQuad:function(m){if(m<0.5){return m*m*2}else{return -2*(m-2)*m-1}return},easeInOutCubic:function(m){if(m<0.5){return Math.pow(m,3)*4}else{return Math.pow(m-1,3)*4+1}},easeInOutSine:function(m){return(1-Math.cos(Math.PI*m))/2}}})(); 2 | -------------------------------------------------------------------------------- /static/TextIconOverlay_min.1.js: -------------------------------------------------------------------------------- 1 | var BMapLib = (window.BMapLib = BMapLib || {}); 2 | (function() { 3 | var d, 4 | c = (d = c || { version: '1.3.8' }); 5 | (function() { 6 | c.guid = '$BAIDU$'; 7 | window[c.guid] = window[c.guid] || {}; 8 | c.dom = c.dom || {}; 9 | c.dom.g = function(f) { 10 | if ('string' == typeof f || f instanceof String) { 11 | return document.getElementById(f); 12 | } else { 13 | if (f && f.nodeName && (f.nodeType == 1 || f.nodeType == 9)) { 14 | return f; 15 | } 16 | } 17 | return null; 18 | }; 19 | c.g = c.G = c.dom.g; 20 | c.dom.getDocument = function(f) { 21 | f = c.dom.g(f); 22 | return f.nodeType == 9 ? f : f.ownerDocument || f.document; 23 | }; 24 | c.lang = c.lang || {}; 25 | c.lang.isString = function(f) { 26 | return '[object String]' == Object.prototype.toString.call(f); 27 | }; 28 | c.isString = c.lang.isString; 29 | c.dom._g = function(f) { 30 | if (c.lang.isString(f)) { 31 | return document.getElementById(f); 32 | } 33 | return f; 34 | }; 35 | c._g = c.dom._g; 36 | c.browser = c.browser || {}; 37 | if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { 38 | c.browser.ie = c.ie = document.documentMode || +RegExp['\x241']; 39 | } 40 | c.dom.getComputedStyle = function(g, f) { 41 | g = c.dom._g(g); 42 | var i = c.dom.getDocument(g), 43 | h; 44 | if (i.defaultView && i.defaultView.getComputedStyle) { 45 | h = i.defaultView.getComputedStyle(g, null); 46 | if (h) { 47 | return h[f] || h.getPropertyValue(f); 48 | } 49 | } 50 | return ''; 51 | }; 52 | c.dom._styleFixer = c.dom._styleFixer || {}; 53 | c.dom._styleFilter = c.dom._styleFilter || []; 54 | c.dom._styleFilter.filter = function(g, k, l) { 55 | for (var f = 0, j = c.dom._styleFilter, h; (h = j[f]); f++) { 56 | if ((h = h[l])) { 57 | k = h(g, k); 58 | } 59 | } 60 | return k; 61 | }; 62 | c.string = c.string || {}; 63 | c.string.toCamelCase = function(f) { 64 | if (f.indexOf('-') < 0 && f.indexOf('_') < 0) { 65 | return f; 66 | } 67 | return f.replace(/[-_][^-_]/g, function(g) { 68 | return g.charAt(1).toUpperCase(); 69 | }); 70 | }; 71 | c.dom.getStyle = function(h, g) { 72 | var j = c.dom; 73 | h = j.g(h); 74 | g = c.string.toCamelCase(g); 75 | var i = h.style[g] || (h.currentStyle ? h.currentStyle[g] : '') || j.getComputedStyle(h, g); 76 | if (!i) { 77 | var f = j._styleFixer[g]; 78 | if (f) { 79 | i = f.get ? f.get(h) : c.dom.getStyle(h, f); 80 | } 81 | } 82 | if ((f = j._styleFilter)) { 83 | i = f.filter(g, i, 'get'); 84 | } 85 | return i; 86 | }; 87 | c.getStyle = c.dom.getStyle; 88 | if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) { 89 | c.browser.opera = +RegExp['\x241']; 90 | } 91 | c.browser.isWebkit = /webkit/i.test(navigator.userAgent); 92 | c.browser.isGecko = 93 | /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent); 94 | c.browser.isStrict = document.compatMode == 'CSS1Compat'; 95 | c.dom.getPosition = function(f) { 96 | f = c.dom.g(f); 97 | var o = c.dom.getDocument(f), 98 | i = c.browser, 99 | l = c.dom.getStyle, 100 | h = 101 | i.isGecko > 0 && 102 | o.getBoxObjectFor && 103 | l(f, 'position') == 'absolute' && 104 | (f.style.top === '' || f.style.left === ''), 105 | m = { left: 0, top: 0 }, 106 | k = i.ie && !i.isStrict ? o.body : o.documentElement, 107 | p, 108 | g; 109 | if (f == k) { 110 | return m; 111 | } 112 | if (f.getBoundingClientRect) { 113 | g = f.getBoundingClientRect(); 114 | m.left = Math.floor(g.left) + Math.max(o.documentElement.scrollLeft, o.body.scrollLeft); 115 | m.top = Math.floor(g.top) + Math.max(o.documentElement.scrollTop, o.body.scrollTop); 116 | m.left -= o.documentElement.clientLeft; 117 | m.top -= o.documentElement.clientTop; 118 | var n = o.body, 119 | q = parseInt(l(n, 'borderLeftWidth')), 120 | j = parseInt(l(n, 'borderTopWidth')); 121 | if (i.ie && !i.isStrict) { 122 | m.left -= isNaN(q) ? 2 : q; 123 | m.top -= isNaN(j) ? 2 : j; 124 | } 125 | } else { 126 | p = f; 127 | do { 128 | m.left += p.offsetLeft; 129 | m.top += p.offsetTop; 130 | if (i.isWebkit > 0 && l(p, 'position') == 'fixed') { 131 | m.left += o.body.scrollLeft; 132 | m.top += o.body.scrollTop; 133 | break; 134 | } 135 | p = p.offsetParent; 136 | } while (p && p != f); 137 | if (i.opera > 0 || (i.isWebkit > 0 && l(f, 'position') == 'absolute')) { 138 | m.top -= o.body.offsetTop; 139 | } 140 | p = f.offsetParent; 141 | while (p && p != o.body) { 142 | m.left -= p.scrollLeft; 143 | if (!i.opera || p.tagName != 'TR') { 144 | m.top -= p.scrollTop; 145 | } 146 | p = p.offsetParent; 147 | } 148 | } 149 | return m; 150 | }; 151 | c.event = c.event || {}; 152 | c.event._listeners = c.event._listeners || []; 153 | c.event.on = function(g, j, l) { 154 | j = j.replace(/^on/i, ''); 155 | g = c.dom._g(g); 156 | var k = function(n) { 157 | l.call(g, n); 158 | }, 159 | f = c.event._listeners, 160 | i = c.event._eventFilter, 161 | m, 162 | h = j; 163 | j = j.toLowerCase(); 164 | if (i && i[j]) { 165 | m = i[j](g, j, k); 166 | h = m.type; 167 | k = m.listener; 168 | } 169 | if (g.addEventListener) { 170 | g.addEventListener(h, k, false); 171 | } else { 172 | if (g.attachEvent) { 173 | g.attachEvent('on' + h, k); 174 | } 175 | } 176 | f[f.length] = [g, j, l, k, h]; 177 | return g; 178 | }; 179 | c.on = c.event.on; 180 | (function() { 181 | var f = window[c.guid]; 182 | c.lang.guid = function() { 183 | return 'TANGRAM__' + (f._counter++).toString(36); 184 | }; 185 | f._counter = f._counter || 1; 186 | })(); 187 | window[c.guid]._instances = window[c.guid]._instances || {}; 188 | c.lang.isFunction = function(f) { 189 | return '[object Function]' == Object.prototype.toString.call(f); 190 | }; 191 | c.lang.Class = function(f) { 192 | this.guid = f || c.lang.guid(); 193 | window[c.guid]._instances[this.guid] = this; 194 | }; 195 | window[c.guid]._instances = window[c.guid]._instances || {}; 196 | c.lang.Class.prototype.dispose = function() { 197 | delete window[c.guid]._instances[this.guid]; 198 | for (var f in this) { 199 | if (!c.lang.isFunction(this[f])) { 200 | delete this[f]; 201 | } 202 | } 203 | this.disposed = true; 204 | }; 205 | c.lang.Class.prototype.toString = function() { 206 | return '[object ' + (this._className || 'Object') + ']'; 207 | }; 208 | c.lang.Event = function(f, g) { 209 | this.type = f; 210 | this.returnValue = true; 211 | this.target = g || null; 212 | this.currentTarget = null; 213 | }; 214 | c.lang.Class.prototype.addEventListener = function(i, h, g) { 215 | if (!c.lang.isFunction(h)) { 216 | return; 217 | } 218 | !this.__listeners && (this.__listeners = {}); 219 | var f = this.__listeners, 220 | j; 221 | if (typeof g == 'string' && g) { 222 | if (/[^\w\-]/.test(g)) { 223 | throw 'nonstandard key:' + g; 224 | } else { 225 | h.hashCode = g; 226 | j = g; 227 | } 228 | } 229 | i.indexOf('on') != 0 && (i = 'on' + i); 230 | typeof f[i] != 'object' && (f[i] = {}); 231 | j = j || c.lang.guid(); 232 | h.hashCode = j; 233 | f[i][j] = h; 234 | }; 235 | c.lang.Class.prototype.removeEventListener = function(i, h) { 236 | if (typeof h != 'undefined') { 237 | if ((c.lang.isFunction(h) && !(h = h.hashCode)) || !c.lang.isString(h)) { 238 | return; 239 | } 240 | } 241 | !this.__listeners && (this.__listeners = {}); 242 | i.indexOf('on') != 0 && (i = 'on' + i); 243 | var g = this.__listeners; 244 | if (!g[i]) { 245 | return; 246 | } 247 | if (typeof h != 'undefined') { 248 | g[i][h] && delete g[i][h]; 249 | } else { 250 | for (var f in g[i]) { 251 | delete g[i][f]; 252 | } 253 | } 254 | }; 255 | c.lang.Class.prototype.dispatchEvent = function(j, f) { 256 | if (c.lang.isString(j)) { 257 | j = new c.lang.Event(j); 258 | } 259 | !this.__listeners && (this.__listeners = {}); 260 | f = f || {}; 261 | for (var h in f) { 262 | j[h] = f[h]; 263 | } 264 | var h, 265 | g = this.__listeners, 266 | k = j.type; 267 | j.target = j.target || this; 268 | j.currentTarget = this; 269 | k.indexOf('on') != 0 && (k = 'on' + k); 270 | c.lang.isFunction(this[k]) && this[k].apply(this, arguments); 271 | if (typeof g[k] == 'object') { 272 | for (h in g[k]) { 273 | g[k][h].apply(this, arguments); 274 | } 275 | } 276 | return j.returnValue; 277 | }; 278 | c.lang.inherits = function(l, j, i) { 279 | var h, 280 | k, 281 | f = l.prototype, 282 | g = new Function(); 283 | g.prototype = j.prototype; 284 | k = l.prototype = new g(); 285 | for (h in f) { 286 | k[h] = f[h]; 287 | } 288 | l.prototype.constructor = l; 289 | l.superClass = j.prototype; 290 | if ('string' == typeof i) { 291 | k._className = i; 292 | } 293 | }; 294 | c.inherits = c.lang.inherits; 295 | })(); 296 | var b = '../static/0001.png'; 297 | var a = 'png'; 298 | var e = (BMapLib.TextIconOverlay = function(f, h, g) { 299 | this._position = f; 300 | this._text = h; 301 | this._options = g || {}; 302 | this._styles = this._options.styles || []; 303 | !this._styles.length && this._setupDefaultStyles(); 304 | }); 305 | d.lang.inherits(e, BMap.Overlay, 'TextIconOverlay'); 306 | e.prototype._setupDefaultStyles = function() { 307 | var h = [53, 56, 66, 78, 90]; 308 | for (var g = 0, f; (f = h[g]); g++) { 309 | this._styles.push({ url: b, size: new BMap.Size(f, f) }); 310 | } 311 | }; 312 | e.prototype.initialize = function(f) { 313 | this._map = f; 314 | this._domElement = document.createElement('div'); 315 | this._updateCss(); 316 | this._updateText(); 317 | this._updatePosition(); 318 | this._bind(); 319 | this._map.getPanes().markerMouseTarget.appendChild(this._domElement); 320 | return this._domElement; 321 | }; 322 | e.prototype.draw = function() { 323 | this._map && this._updatePosition(); 324 | }; 325 | e.prototype.getText = function() { 326 | return this._text; 327 | }; 328 | e.prototype.setText = function(f) { 329 | if (f && (!this._text || this._text.toString() != f.toString())) { 330 | this._text = f; 331 | this._updateText(); 332 | this._updateCss(); 333 | this._updatePosition(); 334 | } 335 | }; 336 | e.prototype.getPosition = function() { 337 | return this._position; 338 | }; 339 | e.prototype.setPosition = function(f) { 340 | if (f && (!this._position || !this._position.equals(f))) { 341 | this._position = f; 342 | this._updatePosition(); 343 | } 344 | }; 345 | e.prototype.getStyleByText = function(i, h) { 346 | var g = parseInt(i); 347 | var f = parseInt(g / 10); 348 | f = Math.max(0, f); 349 | f = Math.min(f, h.length - 1); 350 | return h[f]; 351 | }; 352 | e.prototype._updateCss = function() { 353 | var f = this.getStyleByText(this._text, this._styles); 354 | this._domElement.style.cssText = this._buildCssText(f); 355 | }; 356 | e.prototype._updateText = function() { 357 | if (this._domElement) { 358 | this._domElement.innerHTML = this._text; 359 | } 360 | }; 361 | e.prototype._updatePosition = function() { 362 | if (this._domElement && this._position) { 363 | var f = this._domElement.style; 364 | var g = this._map.pointToOverlayPixel(this._position); 365 | g.x -= Math.ceil(parseInt(f.width) / 2); 366 | g.y -= Math.ceil(parseInt(f.height) / 2); 367 | f.left = g.x + 'px'; 368 | f.top = g.y + 'px'; 369 | } 370 | }; 371 | e.prototype._buildCssText = function(g) { 372 | var h = g.url; 373 | var n = g.size; 374 | var k = g.anchor; 375 | var j = g.offset; 376 | var l = g.textColor || 'black'; 377 | var f = g.textSize || 10; 378 | var m = []; 379 | if (d.browser.ie < 7) { 380 | m.push( 381 | 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="' + 382 | h + 383 | '");', 384 | ); 385 | } else { 386 | m.push('background-image:url(' + h + ');'); 387 | var i = '0 0'; 388 | j instanceof BMap.Size && (i = j.width + 'px ' + j.height + 'px'); 389 | m.push('background-position:' + i + ';'); 390 | } 391 | if (n instanceof BMap.Size) { 392 | if (k instanceof BMap.Size) { 393 | if (k.height > 0 && k.height < n.height) { 394 | m.push('height:' + (n.height - k.height) + 'px; padding-top:' + k.height + 'px;'); 395 | } 396 | if (k.width > 0 && k.width < n.width) { 397 | m.push('width:' + (n.width - k.width) + 'px; padding-left:' + k.width + 'px;'); 398 | } 399 | } else { 400 | m.push('height:' + n.height + 'px; line-height:' + n.height + 'px;'); 401 | m.push('width:' + n.width + 'px; text-align:center;'); 402 | } 403 | } 404 | m.push( 405 | 'cursor:pointer; color:' + 406 | l + 407 | '; position:absolute; font-size:' + 408 | f + 409 | 'px; font-family:Arial,sans-serif; font-weight:bold', 410 | ); 411 | return m.join(''); 412 | }; 413 | e.prototype._bind = function() { 414 | if (!this._domElement) { 415 | return; 416 | } 417 | var g = this; 418 | var i = this._map; 419 | var f = d.lang.Event; 420 | function h(m, l) { 421 | var k = m.srcElement || m.target; 422 | var j = m.clientX || m.pageX; 423 | var o = m.clientY || m.pageY; 424 | if (m && l && j && o && k) { 425 | var n = d.dom.getPosition(i.getContainer()); 426 | l.pixel = new BMap.Pixel(j - n.left, o - n.top); 427 | l.point = i.pixelToPoint(l.pixel); 428 | } 429 | return l; 430 | } 431 | d.event.on(this._domElement, 'mouseover', function(j) { 432 | g.dispatchEvent(h(j, new f('onmouseover'))); 433 | }); 434 | d.event.on(this._domElement, 'mouseout', function(j) { 435 | g.dispatchEvent(h(j, new f('onmouseout'))); 436 | }); 437 | d.event.on(this._domElement, 'click', function(j) { 438 | g.dispatchEvent(h(j, new f('onclick'))); 439 | }); 440 | }; 441 | })(); 442 | -------------------------------------------------------------------------------- /static/TextIconOverlay_min.js: -------------------------------------------------------------------------------- 1 | var BMapLib=window.BMapLib=BMapLib||{};(function(){var d,c=d=c||{version:"1.3.8"};(function(){c.guid="$BAIDU$";window[c.guid]=window[c.guid]||{};c.dom=c.dom||{};c.dom.g=function(f){if("string"==typeof f||f instanceof String){return document.getElementById(f)}else{if(f&&f.nodeName&&(f.nodeType==1||f.nodeType==9)){return f}}return null};c.g=c.G=c.dom.g;c.dom.getDocument=function(f){f=c.dom.g(f);return f.nodeType==9?f:f.ownerDocument||f.document};c.lang=c.lang||{};c.lang.isString=function(f){return"[object String]"==Object.prototype.toString.call(f)};c.isString=c.lang.isString;c.dom._g=function(f){if(c.lang.isString(f)){return document.getElementById(f)}return f};c._g=c.dom._g;c.browser=c.browser||{};if(/msie (\d+\.\d)/i.test(navigator.userAgent)){c.browser.ie=c.ie=document.documentMode||+RegExp["\x241"]}c.dom.getComputedStyle=function(g,f){g=c.dom._g(g);var i=c.dom.getDocument(g),h;if(i.defaultView&&i.defaultView.getComputedStyle){h=i.defaultView.getComputedStyle(g,null);if(h){return h[f]||h.getPropertyValue(f)}}return""};c.dom._styleFixer=c.dom._styleFixer||{};c.dom._styleFilter=c.dom._styleFilter||[];c.dom._styleFilter.filter=function(g,k,l){for(var f=0,j=c.dom._styleFilter,h;h=j[f];f++){if(h=h[l]){k=h(g,k)}}return k};c.string=c.string||{};c.string.toCamelCase=function(f){if(f.indexOf("-")<0&&f.indexOf("_")<0){return f}return f.replace(/[-_][^-_]/g,function(g){return g.charAt(1).toUpperCase()})};c.dom.getStyle=function(h,g){var j=c.dom;h=j.g(h);g=c.string.toCamelCase(g);var i=h.style[g]||(h.currentStyle?h.currentStyle[g]:"")||j.getComputedStyle(h,g);if(!i){var f=j._styleFixer[g];if(f){i=f.get?f.get(h):c.dom.getStyle(h,f)}}if(f=j._styleFilter){i=f.filter(g,i,"get")}return i};c.getStyle=c.dom.getStyle;if(/opera\/(\d+\.\d)/i.test(navigator.userAgent)){c.browser.opera=+RegExp["\x241"]}c.browser.isWebkit=/webkit/i.test(navigator.userAgent);c.browser.isGecko=/gecko/i.test(navigator.userAgent)&&!/like gecko/i.test(navigator.userAgent);c.browser.isStrict=document.compatMode=="CSS1Compat";c.dom.getPosition=function(f){f=c.dom.g(f);var o=c.dom.getDocument(f),i=c.browser,l=c.dom.getStyle,h=i.isGecko>0&&o.getBoxObjectFor&&l(f,"position")=="absolute"&&(f.style.top===""||f.style.left===""),m={left:0,top:0},k=(i.ie&&!i.isStrict)?o.body:o.documentElement,p,g;if(f==k){return m}if(f.getBoundingClientRect){g=f.getBoundingClientRect();m.left=Math.floor(g.left)+Math.max(o.documentElement.scrollLeft,o.body.scrollLeft);m.top=Math.floor(g.top)+Math.max(o.documentElement.scrollTop,o.body.scrollTop);m.left-=o.documentElement.clientLeft;m.top-=o.documentElement.clientTop;var n=o.body,q=parseInt(l(n,"borderLeftWidth")),j=parseInt(l(n,"borderTopWidth"));if(i.ie&&!i.isStrict){m.left-=isNaN(q)?2:q;m.top-=isNaN(j)?2:j}}else{p=f;do{m.left+=p.offsetLeft;m.top+=p.offsetTop;if(i.isWebkit>0&&l(p,"position")=="fixed"){m.left+=o.body.scrollLeft;m.top+=o.body.scrollTop;break}p=p.offsetParent}while(p&&p!=f);if(i.opera>0||(i.isWebkit>0&&l(f,"position")=="absolute")){m.top-=o.body.offsetTop}p=f.offsetParent;while(p&&p!=o.body){m.left-=p.scrollLeft;if(!i.opera||p.tagName!="TR"){m.top-=p.scrollTop}p=p.offsetParent}}return m};c.event=c.event||{};c.event._listeners=c.event._listeners||[];c.event.on=function(g,j,l){j=j.replace(/^on/i,"");g=c.dom._g(g);var k=function(n){l.call(g,n)},f=c.event._listeners,i=c.event._eventFilter,m,h=j;j=j.toLowerCase();if(i&&i[j]){m=i[j](g,j,k);h=m.type;k=m.listener}if(g.addEventListener){g.addEventListener(h,k,false)}else{if(g.attachEvent){g.attachEvent("on"+h,k)}}f[f.length]=[g,j,l,k,h];return g};c.on=c.event.on;(function(){var f=window[c.guid];c.lang.guid=function(){return"TANGRAM__"+(f._counter++).toString(36)};f._counter=f._counter||1})();window[c.guid]._instances=window[c.guid]._instances||{};c.lang.isFunction=function(f){return"[object Function]"==Object.prototype.toString.call(f)};c.lang.Class=function(f){this.guid=f||c.lang.guid();window[c.guid]._instances[this.guid]=this};window[c.guid]._instances=window[c.guid]._instances||{};c.lang.Class.prototype.dispose=function(){delete window[c.guid]._instances[this.guid];for(var f in this){if(!c.lang.isFunction(this[f])){delete this[f]}}this.disposed=true};c.lang.Class.prototype.toString=function(){return"[object "+(this._className||"Object")+"]"};c.lang.Event=function(f,g){this.type=f;this.returnValue=true;this.target=g||null;this.currentTarget=null};c.lang.Class.prototype.addEventListener=function(i,h,g){if(!c.lang.isFunction(h)){return}!this.__listeners&&(this.__listeners={});var f=this.__listeners,j;if(typeof g=="string"&&g){if(/[^\w\-]/.test(g)){throw ("nonstandard key:"+g)}else{h.hashCode=g;j=g}}i.indexOf("on")!=0&&(i="on"+i);typeof f[i]!="object"&&(f[i]={});j=j||c.lang.guid();h.hashCode=j;f[i][j]=h};c.lang.Class.prototype.removeEventListener=function(i,h){if(typeof h!="undefined"){if((c.lang.isFunction(h)&&!(h=h.hashCode))||(!c.lang.isString(h))){return}}!this.__listeners&&(this.__listeners={});i.indexOf("on")!=0&&(i="on"+i);var g=this.__listeners;if(!g[i]){return}if(typeof h!="undefined"){g[i][h]&&delete g[i][h]}else{for(var f in g[i]){delete g[i][f]}}};c.lang.Class.prototype.dispatchEvent=function(j,f){if(c.lang.isString(j)){j=new c.lang.Event(j)}!this.__listeners&&(this.__listeners={});f=f||{};for(var h in f){j[h]=f[h]}var h,g=this.__listeners,k=j.type;j.target=j.target||this;j.currentTarget=this;k.indexOf("on")!=0&&(k="on"+k);c.lang.isFunction(this[k])&&this[k].apply(this,arguments);if(typeof g[k]=="object"){for(h in g[k]){g[k][h].apply(this,arguments)}}return j.returnValue};c.lang.inherits=function(l,j,i){var h,k,f=l.prototype,g=new Function();g.prototype=j.prototype;k=l.prototype=new g();for(h in f){k[h]=f[h]}l.prototype.constructor=l;l.superClass=j.prototype;if("string"==typeof i){k._className=i}};c.inherits=c.lang.inherits})();var b="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m";var a="png";var e=BMapLib.TextIconOverlay=function(f,h,g){this._position=f;this._text=h;this._options=g||{};this._styles=this._options.styles||[];(!this._styles.length)&&this._setupDefaultStyles()};d.lang.inherits(e,BMap.Overlay,"TextIconOverlay");e.prototype._setupDefaultStyles=function(){var h=[53,56,66,78,90];for(var g=0,f;f=h[g];g++){this._styles.push({url:b+g+"."+a,size:new BMap.Size(f,f)})}};e.prototype.initialize=function(f){this._map=f;this._domElement=document.createElement("div");this._updateCss();this._updateText();this._updatePosition();this._bind();this._map.getPanes().markerMouseTarget.appendChild(this._domElement);return this._domElement};e.prototype.draw=function(){this._map&&this._updatePosition()};e.prototype.getText=function(){return this._text};e.prototype.setText=function(f){if(f&&(!this._text||(this._text.toString()!=f.toString()))){this._text=f;this._updateText();this._updateCss();this._updatePosition()}};e.prototype.getPosition=function(){return this._position};e.prototype.setPosition=function(f){if(f&&(!this._position||!this._position.equals(f))){this._position=f;this._updatePosition()}};e.prototype.getStyleByText=function(i,h){var g=parseInt(i);var f=parseInt(g/10);f=Math.max(0,f);f=Math.min(f,h.length-1);return h[f]};e.prototype._updateCss=function(){var f=this.getStyleByText(this._text,this._styles);this._domElement.style.cssText=this._buildCssText(f)};e.prototype._updateText=function(){if(this._domElement){this._domElement.innerHTML=this._text}};e.prototype._updatePosition=function(){if(this._domElement&&this._position){var f=this._domElement.style;var g=this._map.pointToOverlayPixel(this._position);g.x-=Math.ceil(parseInt(f.width)/2);g.y-=Math.ceil(parseInt(f.height)/2);f.left=g.x+"px";f.top=g.y+"px"}};e.prototype._buildCssText=function(g){var h=g.url;var n=g.size;var k=g.anchor;var j=g.offset;var l=g.textColor||"black";var f=g.textSize||10;var m=[];if(d.browser.ie<7){m.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+h+'");')}else{m.push("background-image:url("+h+");");var i="0 0";(j instanceof BMap.Size)&&(i=j.width+"px "+j.height+"px");m.push("background-position:"+i+";")}if(n instanceof BMap.Size){if(k instanceof BMap.Size){if(k.height>0&&k.height0&&k.width