初始化
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
||||
}
|
||||
}],
|
||||
"stage-2"
|
||||
],
|
||||
"plugins": ["transform-vue-jsx", "transform-runtime"],
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": ["env", "stage-2"],
|
||||
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
|
@ -0,0 +1,4 @@
|
|||
build/*.js
|
||||
src/assets
|
||||
public
|
||||
dist
|
|
@ -0,0 +1,202 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint',
|
||||
sourceType: 'module'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
es6: true,
|
||||
},
|
||||
extends: ['plugin:vue/recommended', 'eslint:recommended'],
|
||||
|
||||
// add your custom rules here
|
||||
//it is base on https://github.com/vuejs/eslint-config-vue
|
||||
rules: {
|
||||
"vue/max-attributes-per-line": [2, {
|
||||
"singleline": 10,
|
||||
"multiline": {
|
||||
"max": 1,
|
||||
"allowFirstLine": false
|
||||
}
|
||||
}],
|
||||
"vue/singleline-html-element-content-newline": "off",
|
||||
"vue/multiline-html-element-content-newline":"off",
|
||||
"vue/name-property-casing": ["error", "PascalCase"],
|
||||
"vue/no-v-html": "off",
|
||||
'accessor-pairs': 2,
|
||||
'arrow-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
}],
|
||||
'block-spacing': [2, 'always'],
|
||||
'brace-style': [2, '1tbs', {
|
||||
'allowSingleLine': true
|
||||
}],
|
||||
'camelcase': [0, {
|
||||
'properties': 'always'
|
||||
}],
|
||||
'comma-dangle': [2, 'never'],
|
||||
'comma-spacing': [2, {
|
||||
'before': false,
|
||||
'after': true
|
||||
}],
|
||||
'comma-style': [2, 'last'],
|
||||
'constructor-super': 2,
|
||||
'curly': [2, 'multi-line'],
|
||||
'dot-location': [2, 'property'],
|
||||
'eol-last': 2,
|
||||
'eqeqeq': ['off'],
|
||||
'generator-star-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
}],
|
||||
'handle-callback-err': [2, '^(err|error)$'],
|
||||
'indent': [2, 2, {
|
||||
'SwitchCase': 1
|
||||
}],
|
||||
'jsx-quotes': [2, 'prefer-single'],
|
||||
'key-spacing': [2, {
|
||||
'beforeColon': false,
|
||||
'afterColon': true
|
||||
}],
|
||||
'keyword-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
}],
|
||||
'new-cap': [2, {
|
||||
'newIsCap': true,
|
||||
'capIsNew': false
|
||||
}],
|
||||
'new-parens': 2,
|
||||
'no-array-constructor': 2,
|
||||
'no-caller': 2,
|
||||
'no-console': 'off',
|
||||
'no-class-assign': 2,
|
||||
'no-cond-assign': 2,
|
||||
'no-const-assign': 2,
|
||||
'no-control-regex': 0,
|
||||
'no-delete-var': 2,
|
||||
'no-dupe-args': 2,
|
||||
'no-dupe-class-members': 2,
|
||||
'no-dupe-keys': 2,
|
||||
'no-duplicate-case': 2,
|
||||
'no-empty-character-class': 2,
|
||||
'no-empty-pattern': 2,
|
||||
'no-eval': 2,
|
||||
'no-ex-assign': 2,
|
||||
'no-extend-native': 2,
|
||||
'no-extra-bind': 2,
|
||||
'no-extra-boolean-cast': 2,
|
||||
'no-extra-parens': [2, 'functions'],
|
||||
'no-fallthrough': 2,
|
||||
'no-floating-decimal': 2,
|
||||
'no-func-assign': 2,
|
||||
'no-implied-eval': 2,
|
||||
'no-inner-declarations': [2, 'functions'],
|
||||
'no-invalid-regexp': 2,
|
||||
'no-irregular-whitespace': 2,
|
||||
'no-iterator': 2,
|
||||
'no-label-var': 2,
|
||||
'no-labels': [2, {
|
||||
'allowLoop': false,
|
||||
'allowSwitch': false
|
||||
}],
|
||||
'no-lone-blocks': 2,
|
||||
'no-mixed-spaces-and-tabs': 2,
|
||||
'no-multi-spaces': 2,
|
||||
'no-multi-str': 2,
|
||||
'no-multiple-empty-lines': [2, {
|
||||
'max': 1
|
||||
}],
|
||||
'no-native-reassign': 2,
|
||||
'no-negated-in-lhs': 2,
|
||||
'no-new-object': 2,
|
||||
'no-new-require': 2,
|
||||
'no-new-symbol': 2,
|
||||
'no-new-wrappers': 2,
|
||||
'no-obj-calls': 2,
|
||||
'no-octal': 2,
|
||||
'no-octal-escape': 2,
|
||||
'no-path-concat': 2,
|
||||
'no-proto': 2,
|
||||
'no-redeclare': 2,
|
||||
'no-regex-spaces': 2,
|
||||
'no-return-assign': [2, 'except-parens'],
|
||||
'no-self-assign': 2,
|
||||
'no-self-compare': 2,
|
||||
'no-sequences': 2,
|
||||
'no-shadow-restricted-names': 2,
|
||||
'no-spaced-func': 2,
|
||||
'no-sparse-arrays': 2,
|
||||
'no-this-before-super': 2,
|
||||
'no-throw-literal': 2,
|
||||
'no-trailing-spaces': 2,
|
||||
'no-undef': 2,
|
||||
'no-undef-init': 2,
|
||||
'no-unexpected-multiline': 2,
|
||||
'no-unmodified-loop-condition': 2,
|
||||
'no-unneeded-ternary': [2, {
|
||||
'defaultAssignment': false
|
||||
}],
|
||||
'no-unreachable': 2,
|
||||
'no-unsafe-finally': 2,
|
||||
'no-unused-vars': [2, {
|
||||
'vars': 'all',
|
||||
'args': 'none'
|
||||
}],
|
||||
'no-useless-call': 2,
|
||||
'no-useless-computed-key': 2,
|
||||
'no-useless-constructor': 2,
|
||||
'no-useless-escape': 0,
|
||||
'no-whitespace-before-property': 2,
|
||||
'no-with': 2,
|
||||
'one-var': [2, {
|
||||
'initialized': 'never'
|
||||
}],
|
||||
'operator-linebreak': [2, 'after', {
|
||||
'overrides': {
|
||||
'?': 'before',
|
||||
':': 'before'
|
||||
}
|
||||
}],
|
||||
'padded-blocks': [2, 'never'],
|
||||
'quotes': [2, 'single', {
|
||||
'avoidEscape': true,
|
||||
'allowTemplateLiterals': true
|
||||
}],
|
||||
'semi': [2, 'never'],
|
||||
'semi-spacing': [2, {
|
||||
'before': false,
|
||||
'after': true
|
||||
}],
|
||||
'space-before-blocks': [2, 'always'],
|
||||
'space-before-function-paren': [2, 'never'],
|
||||
'space-in-parens': [2, 'never'],
|
||||
'space-infix-ops': 2,
|
||||
'space-unary-ops': [2, {
|
||||
'words': true,
|
||||
'nonwords': false
|
||||
}],
|
||||
'spaced-comment': [2, 'always', {
|
||||
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
|
||||
}],
|
||||
'template-curly-spacing': [2, 'never'],
|
||||
'use-isnan': 2,
|
||||
'valid-typeof': 2,
|
||||
'wrap-iife': [2, 'any'],
|
||||
'yield-star-spacing': [2, 'both'],
|
||||
'yoda': [2, 'never'],
|
||||
'prefer-const': 2,
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||
'object-curly-spacing': [2, 'always', {
|
||||
"objectsInObjects": false
|
||||
}],
|
||||
'array-bracket-spacing': [2, 'never'],
|
||||
|
||||
},
|
||||
globals: {
|
||||
'config':true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
.DS_Store
|
||||
node_modules/
|
||||
/dist/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
/test/unit/coverage/
|
||||
/test/e2e/reports/
|
||||
selenium-debug.log
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
|
@ -0,0 +1,33 @@
|
|||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = {
|
||||
"plugins": {
|
||||
"postcss-import": {},
|
||||
"postcss-url": {},
|
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {},
|
||||
'@our-patches/postcss-px-to-viewport': {
|
||||
// options
|
||||
unitToConvert: 'px',//(String) 需要转换的单位,默认为"px"
|
||||
viewportWidth: 1920, // (Number) 设计稿的视口宽度,一般是750
|
||||
unitPrecision: 3, // (Number) 单位转换后保留的精度(很多时候无法整除)
|
||||
viewportUnit: 'vw', // (String) 希望使用的视口单位
|
||||
selectorBlackList: ['.ignore', '.hairlines'],
|
||||
/*(Array) 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位
|
||||
如果传入的值为字符串的话,只要选择器中含有传入值就会被匹配
|
||||
例如 selectorBlackList 为 ['body'] 的话, 那么 .body-class 就会被忽略
|
||||
如果传入的值为正则表达式的话,那么就会依据CSS选择器是否匹配该正则
|
||||
例如 selectorBlackList 为 [/^body$/] , 那么 body 会被忽略,而 .body 不会*/
|
||||
minPixelValue: 1, // (Number) 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
|
||||
mediaQuery: false, // (Boolean) 媒体查询里的单位是否需要转换单位
|
||||
exclude: [/^node_modules$/],// (Array or Regexp) 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
|
||||
include: [/BI/,/map/],
|
||||
/*(Array or Regexp) 如果设置了include,那将只有匹配到的文件才会被转换,例如只转换 'src/mobile' 下的文件
|
||||
如果值是一个正则表达式,将包含匹配的文件,否则将排除该文件
|
||||
如果传入的值是一个数组,那么数组里的值必须为正则
|
||||
注意:exclude和include是可以一起设置的,将取两者规则的交集*/
|
||||
landscapeUnit: 'vw', //横屏时使用的单位
|
||||
landscapeWidth: 750,// 横屏时使用的视口宽度
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>myvue</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,30 @@
|
|||
# myvue
|
||||
|
||||
> A Vue.js project
|
||||
|
||||
## Build Setup
|
||||
|
||||
``` bash
|
||||
# install dependencies
|
||||
npm install
|
||||
|
||||
# serve with hot reload at localhost:8080
|
||||
npm run dev
|
||||
|
||||
# build for production with minification
|
||||
npm run build
|
||||
|
||||
# build for production and view the bundle analyzer report
|
||||
npm run build --report
|
||||
|
||||
# run unit tests
|
||||
npm run unit
|
||||
|
||||
# run e2e tests
|
||||
npm run e2e
|
||||
|
||||
# run all tests
|
||||
npm test
|
||||
```
|
||||
|
||||
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
|
@ -0,0 +1,41 @@
|
|||
'use strict'
|
||||
require('./check-versions')()
|
||||
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
const ora = require('ora')
|
||||
const rm = require('rimraf')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const webpackConfig = require('./webpack.prod.conf')
|
||||
|
||||
const spinner = ora('building for production...')
|
||||
spinner.start()
|
||||
|
||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||
if (err) throw err
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
spinner.stop()
|
||||
if (err) throw err
|
||||
process.stdout.write(stats.toString({
|
||||
colors: true,
|
||||
modules: false,
|
||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||
chunks: false,
|
||||
chunkModules: false
|
||||
}) + '\n\n')
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.log(chalk.red(' Build failed with errors.\n'))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(chalk.cyan(' Build complete.\n'))
|
||||
console.log(chalk.yellow(
|
||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||
' Opening index.html over file:// won\'t work.\n'
|
||||
))
|
||||
})
|
||||
})
|
|
@ -0,0 +1,54 @@
|
|||
'use strict'
|
||||
const chalk = require('chalk')
|
||||
const semver = require('semver')
|
||||
const packageConfig = require('../package.json')
|
||||
const shell = require('shelljs')
|
||||
|
||||
function exec (cmd) {
|
||||
return require('child_process').execSync(cmd).toString().trim()
|
||||
}
|
||||
|
||||
const versionRequirements = [
|
||||
{
|
||||
name: 'node',
|
||||
currentVersion: semver.clean(process.version),
|
||||
versionRequirement: packageConfig.engines.node
|
||||
}
|
||||
]
|
||||
|
||||
if (shell.which('npm')) {
|
||||
versionRequirements.push({
|
||||
name: 'npm',
|
||||
currentVersion: exec('npm --version'),
|
||||
versionRequirement: packageConfig.engines.npm
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
const warnings = []
|
||||
|
||||
for (let i = 0; i < versionRequirements.length; i++) {
|
||||
const mod = versionRequirements[i]
|
||||
|
||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||
warnings.push(mod.name + ': ' +
|
||||
chalk.red(mod.currentVersion) + ' should be ' +
|
||||
chalk.green(mod.versionRequirement)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (warnings.length) {
|
||||
console.log('')
|
||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||
console.log()
|
||||
|
||||
for (let i = 0; i < warnings.length; i++) {
|
||||
const warning = warnings[i]
|
||||
console.log(' ' + warning)
|
||||
}
|
||||
|
||||
console.log()
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 6.7 KiB |
|
@ -0,0 +1,102 @@
|
|||
'use strict'
|
||||
const path = require('path')
|
||||
const config = require('../config')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const packageConfig = require('../package.json')
|
||||
|
||||
exports.assetsPath = function (_path) {
|
||||
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsSubDirectory
|
||||
: config.dev.assetsSubDirectory
|
||||
|
||||
return path.posix.join(assetsSubDirectory, _path)
|
||||
}
|
||||
|
||||
exports.cssLoaders = function (options) {
|
||||
options = options || {}
|
||||
|
||||
const cssLoader = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
const postcssLoader = {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
// generate loader string to be used with extract text plugin
|
||||
function generateLoaders (loader, loaderOptions) {
|
||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
|
||||
|
||||
if (loader) {
|
||||
loaders.push({
|
||||
loader: loader + '-loader',
|
||||
options: Object.assign({}, loaderOptions, {
|
||||
sourceMap: options.sourceMap
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Extract CSS when that option is specified
|
||||
// (which is the case during production build)
|
||||
if (options.extract) {
|
||||
return ExtractTextPlugin.extract({
|
||||
use: loaders,
|
||||
fallback: 'vue-style-loader',
|
||||
publicPath: '../../'
|
||||
})
|
||||
} else {
|
||||
return ['vue-style-loader'].concat(loaders)
|
||||
}
|
||||
}
|
||||
|
||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||
return {
|
||||
css: generateLoaders(),
|
||||
postcss: generateLoaders(),
|
||||
less: generateLoaders('less'),
|
||||
sass: generateLoaders('sass', { indentedSyntax: true }),
|
||||
scss: generateLoaders('sass'),
|
||||
stylus: generateLoaders('stylus'),
|
||||
styl: generateLoaders('stylus')
|
||||
}
|
||||
}
|
||||
|
||||
// Generate loaders for standalone style files (outside of .vue)
|
||||
exports.styleLoaders = function (options) {
|
||||
const output = []
|
||||
const loaders = exports.cssLoaders(options)
|
||||
|
||||
for (const extension in loaders) {
|
||||
const loader = loaders[extension]
|
||||
output.push({
|
||||
test: new RegExp('\\.' + extension + '$'),
|
||||
use: loader
|
||||
})
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
exports.createNotifierCallback = () => {
|
||||
const notifier = require('node-notifier')
|
||||
|
||||
return (severity, errors) => {
|
||||
if (severity !== 'error') return
|
||||
|
||||
const error = errors[0]
|
||||
const filename = error.file && error.file.split('!').pop()
|
||||
|
||||
notifier.notify({
|
||||
title: packageConfig.name,
|
||||
message: severity + ': ' + error.name,
|
||||
subtitle: filename || '',
|
||||
icon: path.join(__dirname, 'logo.png')
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
const sourceMapEnabled = isProduction
|
||||
? config.build.productionSourceMap
|
||||
: config.dev.cssSourceMap
|
||||
|
||||
module.exports = {
|
||||
loaders: utils.cssLoaders({
|
||||
sourceMap: sourceMapEnabled,
|
||||
extract: isProduction
|
||||
}),
|
||||
cssSourceMap: sourceMapEnabled,
|
||||
cacheBusting: config.dev.cacheBusting,
|
||||
transformToRequire: {
|
||||
video: ['src', 'poster'],
|
||||
source: 'src',
|
||||
img: 'src',
|
||||
image: 'xlink:href'
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
}
|
||||
|
||||
const createLintingRule = () => ({
|
||||
test: /\.(js|vue)$/,
|
||||
loader: 'eslint-loader',
|
||||
enforce: 'pre',
|
||||
include: [resolve('src'), resolve('test')],
|
||||
options: {
|
||||
formatter: require('eslint-friendly-formatter'),
|
||||
emitWarning: !config.dev.showEslintErrorsInOverlay
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, '../'),
|
||||
entry: {
|
||||
app: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: '[name].js',
|
||||
publicPath: process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsPublicPath
|
||||
: config.dev.assetsPublicPath
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: {
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'@': resolve('src'),
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
// ...(config.dev.useEslint ? [createLintingRule()] : []),
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: vueLoaderConfig
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
exclude: [resolve('src/icons')],
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
loader: 'svg-sprite-loader',
|
||||
include: [resolve('src/icons')],
|
||||
options: {
|
||||
symbolId: 'icon-[name]'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
node: {
|
||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||
// source contains it (although only uses it if it's native).
|
||||
setImmediate: false,
|
||||
// prevent webpack from injecting mocks to Node native modules
|
||||
// that does not make sense for the client
|
||||
dgram: 'empty',
|
||||
fs: 'empty',
|
||||
net: 'empty',
|
||||
tls: 'empty',
|
||||
child_process: 'empty'
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||
const portfinder = require('portfinder')
|
||||
|
||||
const HOST = process.env.HOST
|
||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||
|
||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
||||
},
|
||||
// cheap-module-eval-source-map is faster for development
|
||||
devtool: config.dev.devtool,
|
||||
|
||||
// these devServer options should be customized in /config/index.js
|
||||
devServer: {
|
||||
clientLogLevel: 'warning',
|
||||
historyApiFallback: {
|
||||
rewrites: [
|
||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
||||
],
|
||||
},
|
||||
hot: true,
|
||||
contentBase: false, // since we use CopyWebpackPlugin.
|
||||
compress: true,
|
||||
host: HOST || config.dev.host,
|
||||
port: PORT || config.dev.port,
|
||||
open: config.dev.autoOpenBrowser,
|
||||
overlay: config.dev.errorOverlay
|
||||
? { warnings: false, errors: true }
|
||||
: false,
|
||||
publicPath: config.dev.assetsPublicPath,
|
||||
proxy: config.dev.proxyTable,
|
||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||
watchOptions: {
|
||||
poll: config.dev.poll,
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': require('../config/dev.env')
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
// https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: 'index.html',
|
||||
inject: true
|
||||
}),
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.dev.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
module.exports = new Promise((resolve, reject) => {
|
||||
portfinder.basePort = process.env.PORT || config.dev.port
|
||||
portfinder.getPort((err, port) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
// publish the new Port, necessary for e2e tests
|
||||
process.env.PORT = port
|
||||
// add port to devServer config
|
||||
devWebpackConfig.devServer.port = port
|
||||
|
||||
// Add FriendlyErrorsPlugin
|
||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
||||
},
|
||||
onErrors: config.dev.notifyOnErrors
|
||||
? utils.createNotifierCallback()
|
||||
: undefined
|
||||
}))
|
||||
|
||||
resolve(devWebpackConfig)
|
||||
}
|
||||
})
|
||||
})
|
|
@ -0,0 +1,149 @@
|
|||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const env = process.env.NODE_ENV === 'testing'
|
||||
? require('../config/test.env')
|
||||
: require('../config/prod.env')
|
||||
|
||||
const webpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
extract: true,
|
||||
usePostCSS: true
|
||||
})
|
||||
},
|
||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||
},
|
||||
plugins: [
|
||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': env
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
},
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
parallel: true
|
||||
}),
|
||||
// extract css into its own file
|
||||
new ExtractTextPlugin({
|
||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||
allChunks: true,
|
||||
}),
|
||||
// Compress extracted CSS. We are using this plugin so that possible
|
||||
// duplicated CSS from different components can be deduped.
|
||||
new OptimizeCSSPlugin({
|
||||
cssProcessorOptions: config.build.productionSourceMap
|
||||
? { safe: true, map: { inline: false } }
|
||||
: { safe: true }
|
||||
}),
|
||||
// generate dist index.html with correct asset hash for caching.
|
||||
// you can customize output by editing /index.html
|
||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: process.env.NODE_ENV === 'testing'
|
||||
? 'index.html'
|
||||
: config.build.index,
|
||||
template: 'index.html',
|
||||
inject: true,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true
|
||||
// more options:
|
||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||
},
|
||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||
chunksSortMode: 'dependency'
|
||||
}),
|
||||
// keep module.id stable when vendor modules does not change
|
||||
new webpack.HashedModuleIdsPlugin(),
|
||||
// enable scope hoisting
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks (module) {
|
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return (
|
||||
module.resource &&
|
||||
/\.js$/.test(module.resource) &&
|
||||
module.resource.indexOf(
|
||||
path.join(__dirname, '../node_modules')
|
||||
) === 0
|
||||
)
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
}),
|
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'app',
|
||||
async: 'vendor-async',
|
||||
children: true,
|
||||
minChunks: 3
|
||||
}),
|
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.build.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
if (config.build.productionGzip) {
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new CompressionWebpackPlugin({
|
||||
asset: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: new RegExp(
|
||||
'\\.(' +
|
||||
config.build.productionGzipExtensions.join('|') +
|
||||
')$'
|
||||
),
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (config.build.bundleAnalyzerReport) {
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
|
@ -0,0 +1,7 @@
|
|||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
})
|
|
@ -0,0 +1,75 @@
|
|||
'use strict'
|
||||
// Template version: 1.3.1
|
||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||
|
||||
const path = require('path')
|
||||
module.exports = {
|
||||
dev: {
|
||||
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
|
||||
// Use Eslint Loader?
|
||||
// If true, your code will be linted during bundling and
|
||||
// linting errors and warnings will be shown in the console.
|
||||
useEslint: true,
|
||||
// If true, eslint errors and warnings will also be shown in the error overlay
|
||||
// in the browser.
|
||||
showEslintErrorsInOverlay: false,
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
||||
// If you have problems debugging vue-files in devtools,
|
||||
// set this to false - it *may* help
|
||||
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
||||
cacheBusting: true,
|
||||
|
||||
cssSourceMap: true
|
||||
},
|
||||
|
||||
build: {
|
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../dist/index.html'),
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: './',
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
productionSourceMap: true,
|
||||
// https://webpack.js.org/configuration/devtool/#production
|
||||
devtool: '#source-map',
|
||||
|
||||
// Gzip off by default as many popular static hosts such as
|
||||
// Surge or Netlify already gzip all static assets for you.
|
||||
// Before setting to `true`, make sure to:
|
||||
// npm install --save-dev compression-webpack-plugin
|
||||
productionGzip: false,
|
||||
productionGzipExtensions: ['js', 'css'],
|
||||
|
||||
// Run the build command with an extra argument to
|
||||
// View the bundle analyzer report after build finishes:
|
||||
// `npm run build --report`
|
||||
// Set to `true` or `false` to always turn it on or off
|
||||
bundleAnalyzerReport: process.env.npm_config_report
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"'
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const devEnv = require('./dev.env')
|
||||
|
||||
module.exports = merge(devEnv, {
|
||||
NODE_ENV: '"testing"'
|
||||
})
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<title>秦港-双基双控-监管端</title>
|
||||
<script src="./static/config.js"></script>
|
||||
<!-- <script src="./static/map/cesium109/Cesium.js"></script>-->
|
||||
<!-- <link href="./static/map/cesium109/Widgets/widgets.css" rel="stylesheet"/>-->
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.16.0/skins/default/aliplayer-min.css" />
|
||||
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.16.0/aliplayer-min.js"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="https://api.tianditu.gov.cn/api?v=4.0&tk=e8a16137fd226a62a23cc7ba5c9c78ce"></script>
|
||||
<script type="text/javascript" src="./static/map/cesium91/CesiumUnminified/Cesium.js"></script>
|
||||
<script type="text/javascript" src="./static/map/cesium91/CustomCesiumSDK.js"></script>
|
||||
<link href="./static/map/cesium91/CesiumUnminified/Widgets/widgets.css" rel="stylesheet"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,537 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<title>hello-jsmap</title>
|
||||
<script src="http://192.168.192.201:7024/joysuch/jsmap/jsmap.js" type="text/javascript"></script>
|
||||
<link type="text/css" href="http://192.168.192.201:7024/joysuch/jsmap/jsmap.css" rel="stylesheet"/>
|
||||
<!-- <script src="http://mapdemo.joysuch.com/lib/jsmap/jsmap.js" type="text/javascript"></script>-->
|
||||
<!-- <link type="text/css" href="http://mapdemo.joysuch.com/lib/jsmap/jsmap.css" rel="stylesheet"/>-->
|
||||
<link rel="stylesheet" href="http://192.168.192.201:7024/joysuch/LocalAssets/css/animation/pop.css">
|
||||
<link rel="stylesheet" href="http://192.168.192.201:7024/joysuch/LocalAssets/css/animation/loading.css">
|
||||
<link rel="stylesheet" href="http://192.168.192.201:7024/joysuch/LocalAssets/css/dom.css">
|
||||
<style>
|
||||
.jsmap-animation-point,
|
||||
.jsmap-animation-point:after,
|
||||
.jsmap-animation-point:before,
|
||||
.jsmap-animation-point p,
|
||||
.jsmap-animation-point p:after,
|
||||
.jsmap-animation-point p:before {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.jsmap-animation-point {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid hsla(0, 0%, 100%, 0.5);
|
||||
cursor: pointer;
|
||||
color: #0ff;
|
||||
background: currentColor;
|
||||
z-index: 3;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
-o-transform: translate(-50%, -50%);
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
box-shadow: 0 0 2em currentColor, 0 0 0.5em currentColor;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jsmap-animation-point:after,
|
||||
.jsmap-animation-point:before,
|
||||
.jsmap-animation-point p:after,
|
||||
.jsmap-animation-point p:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
border-radius: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
-o-transform: translate(-50%, -50%);
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.jsmap-animation-point:after,
|
||||
.jsmap-animation-point:before {
|
||||
border: 1px solid;
|
||||
-webkit-animation: jsmap-mapAni 1s ease infinite;
|
||||
-moz-animation: jsmap-mapAni 1s ease infinite;
|
||||
-o-animation: jsmap-mapAni 1s ease infinite;
|
||||
-ms-animation: jsmap-mapAni 1s ease infinite;
|
||||
animation: jsmap-mapAni 1s ease infinite;
|
||||
}
|
||||
|
||||
.jsmap-animation-point p:before {
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.jsmap-animation-point p {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-radius: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
-o-transform: translate(-50%, -50%);
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
-webkit-animation: jsmap-mapAni 2s ease infinite;
|
||||
-moz-animation: jsmap-mapAni 2s ease infinite;
|
||||
-o-animation: jsmap-mapAni 2s ease infinite;
|
||||
-ms-animation: jsmap-mapAni 2s ease infinite;
|
||||
animation: jsmap-mapAni 2s ease infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@-o-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@-ms-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='mapContainer'></div>
|
||||
<!--<button id="addMarker" onclick="add()">添加DOM标注</button>-->
|
||||
<!--<button id="removeMarker" onclick="remove()">移除DOM标注</button>-->
|
||||
<select name="markerArea" id="markerArea" style="display: none;" onclick="changeMarker()"></select>
|
||||
<div id="setProperty" style="display: none;" onclick="property()">
|
||||
<form oninput="handleInput()">
|
||||
<p>图标ID:<input type="text" class="ID" readonly/></p>
|
||||
<p>楼层:<input type="text" class="floor" readonly/></p>
|
||||
<p>坐标位置:<input type="text" class="position" readonly/></p>
|
||||
<div id="gradient">偏移:
|
||||
<p>x:<input type="number" id="x轴"/></p>
|
||||
<p>y:<input type="number" id="y轴"/></p>
|
||||
</div>
|
||||
<p>是否显示:
|
||||
<label for="show">
|
||||
显示:<input type="radio" id="show" name="toggle"/>
|
||||
</label>
|
||||
<label for="hide">
|
||||
隐藏:<input type="radio" id="hide" name="toggle"/>
|
||||
</label>
|
||||
</p>
|
||||
<p>深度检测:
|
||||
<label for="on">
|
||||
开:<input type="radio" id="on" name="depth"/>
|
||||
</label>
|
||||
<label for="off">
|
||||
关:<input type="radio" id="off" name="depth"/>
|
||||
</label>
|
||||
</p>
|
||||
<div id="close">x</div>
|
||||
<p><span id="changeImg">更换内容</span></p>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
//定义全局map变量
|
||||
var map = null;
|
||||
//定义地图ID变量
|
||||
var mapID = '100930';
|
||||
//定义循环的起始变量
|
||||
var i = 0;
|
||||
//创建循环的终止变量
|
||||
var max = 0;
|
||||
//创建存储标注的数组
|
||||
var markerArr = [];
|
||||
//获取各个属性标签
|
||||
var propertyInput = document.querySelectorAll('#setProperty>form input');
|
||||
//记录当前所选的Marker
|
||||
var currentMarker = null;
|
||||
//创建文档碎片
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
//定义点标注全局变量
|
||||
var domMarker = null;
|
||||
|
||||
window.onload = function () {
|
||||
//加载地图
|
||||
openMap();
|
||||
};
|
||||
|
||||
window.addEventListener('unload', function (e) {
|
||||
//销毁地图
|
||||
map.destroy();
|
||||
map = null;
|
||||
});
|
||||
|
||||
//打开地图
|
||||
function openMap() {
|
||||
//初始化参数
|
||||
var mapOptions = {
|
||||
//必要,地图容器
|
||||
container: 'mapContainer',
|
||||
//必要,地图类型
|
||||
mapType: jsmap.JSMapType.MAP_3D,
|
||||
//必要,地图路径
|
||||
// mapServerURL: 'http://mapdemo.joysuch.com',
|
||||
mapServerURL: 'http://192.168.192.201:7024/joysuch/jsmap/data/map',
|
||||
openingAnimation: false,
|
||||
enableLighting: true,
|
||||
enableShadows: true,
|
||||
viewOptions: {
|
||||
center: {
|
||||
x: 119.65057611465456,
|
||||
y: 39.93527621050255,
|
||||
z: 0.016594102424956802
|
||||
},
|
||||
distance: 370.01629618875734,
|
||||
rotate: 0,
|
||||
tilt: 90
|
||||
},
|
||||
imageryProvider: jsmap.JSImageryProviderType.IMAGE_TDT,
|
||||
};
|
||||
//初始化地图对象
|
||||
map = new jsmap.JSMap(mapOptions);
|
||||
|
||||
//打开map服务器的地图数据和主题
|
||||
map.openMapById(mapID);
|
||||
|
||||
//地图加载完成事件
|
||||
map.on("loadComplete", e => {
|
||||
var compassControl = new jsmap.JSCompassControl({
|
||||
position: jsmap.JSControlPosition.LEFT_TOP,
|
||||
offset: {
|
||||
x: 10,
|
||||
y: 20
|
||||
}
|
||||
});
|
||||
|
||||
var zoomControl = new jsmap.JSZoomControl({
|
||||
position: jsmap.JSControlPosition.LEFT_TOP,
|
||||
offset: {
|
||||
x: 40,
|
||||
y: 10
|
||||
}
|
||||
});
|
||||
|
||||
if (document.documentElement.clientWidth >= 600) {
|
||||
map.addControl(compassControl);
|
||||
map.addControl(zoomControl);
|
||||
}
|
||||
});
|
||||
|
||||
map.on('mapClickNode', event => {
|
||||
addPointMarker(event);
|
||||
});
|
||||
}
|
||||
|
||||
//添加标注
|
||||
function addPointMarker(event) {
|
||||
remove()
|
||||
setProperty.style.display = "none";
|
||||
// //标注的X轴坐标取值范围
|
||||
// var x = Math.random() * (105.20001908346316 - 105.19474256905414) + 105.19474256905414;
|
||||
// //标注的Y轴坐标取值范围
|
||||
// var y = Math.random() * (37.65154533433473 - 37.649024581292366) + 37.649024581292366;
|
||||
// console.info(event)
|
||||
var x = event.eventInfo.coord.x;
|
||||
var y = event.eventInfo.coord.y;
|
||||
var z = event.eventInfo.coord.z;
|
||||
|
||||
domMarker = new jsmap.JSDomMarker({
|
||||
id: i,
|
||||
position: {
|
||||
x,
|
||||
y,
|
||||
z: 1
|
||||
}, //坐标
|
||||
floorId: 1, //楼层id,默认为1(地面)
|
||||
pointerEvents: 'none',
|
||||
content: '<div>' +
|
||||
'<div class="wrapper">' +
|
||||
'<div class="row cf">' +
|
||||
'<div class="span">' +
|
||||
'<div class="location_indicator"></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
offset: jsmap.JSControlPosition.LEFT_BOTTOM,
|
||||
marginOffset: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
properties: {
|
||||
type: 0,
|
||||
},//属性设置
|
||||
callback: (node) => {
|
||||
// console.log(node);
|
||||
} //回调事件
|
||||
});
|
||||
map.addMarker(domMarker);
|
||||
// //创建option标签
|
||||
// var option = document.createElement('option');
|
||||
// option.value = i;
|
||||
// option.innerText = `第${i}个DOM标注`;
|
||||
// fragment.appendChild(option);
|
||||
// markerArr.push(domMarker);
|
||||
// markerArea.appendChild(fragment);
|
||||
// markerArea.style.display = 'block';
|
||||
|
||||
i -= 1;
|
||||
window.parent.postMessage({'LONGITUDE': x, 'LATITUDE': y}, '*');
|
||||
}
|
||||
|
||||
//移除全部标注
|
||||
function remove() {
|
||||
setProperty.style.display = "none";
|
||||
markerArea.style.display = 'none';
|
||||
markerArea.innerHTML = '';
|
||||
map.removeAllDomMarker();
|
||||
markerArr = [];
|
||||
i = 0;
|
||||
max = 0;
|
||||
}
|
||||
|
||||
//选择标注
|
||||
function changeMarker(e) {
|
||||
e = e || window.event;
|
||||
currentMarker = markerArr.find(item => item._id === e.target.value);
|
||||
if (currentMarker !== undefined) {
|
||||
map.flyToMarker(currentMarker);
|
||||
setProperty.style.display = "block";
|
||||
propertyInput.forEach(item => {
|
||||
if (item.className === 'ID') item.value = currentMarker._id;
|
||||
if (item.className === 'floor') item.value = currentMarker.floorId;
|
||||
if (item.className === 'position') item.value = 'x:' + currentMarker.position.x + ';' + 'y:' + currentMarker.position.y;
|
||||
if (item.id === "show" && currentMarker.show === true) item.checked = true;
|
||||
if (item.id === "x轴") item.value = currentMarker.marginOffset.x;
|
||||
if (item.id === "y轴") item.value = currentMarker.marginOffset.y;
|
||||
if (item.id === "on" && currentMarker.depthTest === true) item.checked = true;
|
||||
if (item.id === "off" && currentMarker.depthTest === false) item.checked = true;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//设置属性事件
|
||||
function property(e) {
|
||||
e = e || window.event;
|
||||
|
||||
let {id} = e.target;
|
||||
//设置显隐
|
||||
if (id === 'show') currentMarker.show = true;
|
||||
if (id === 'hide') currentMarker.show = false;
|
||||
//是否开启深度检测
|
||||
if (id === 'on') currentMarker.depthTest = true;
|
||||
if (id === 'off') currentMarker.depthTest = false;
|
||||
if (id === "changeImg") currentMarker.content = 'DOMMarker';
|
||||
;
|
||||
if (id === 'close') setProperty.style.display = "none";
|
||||
}
|
||||
|
||||
//实时修改属性
|
||||
function handleInput(e) {
|
||||
e = e || window.event;
|
||||
let {id, className, value} = e.target;
|
||||
//修改偏移
|
||||
currentMarker.marginOffset = {
|
||||
x: id === 'x轴' ? Number(value) : currentMarker.marginOffset.x,
|
||||
y: id === 'y轴' ? Number(value) : currentMarker.marginOffset.y,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,479 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>hello-jsmap</title>
|
||||
<script src="http://192.168.192.201:7024/joysuch/jsmap/jsmap.js" type="text/javascript"></script>
|
||||
<link type="text/css" href="http://192.168.192.201:7024/joysuch/jsmap/jsmap.css" rel="stylesheet"/>
|
||||
<!-- <script src="http://mapdemo.joysuch.com/lib/jsmap/jsmap.js" type="text/javascript"></script>-->
|
||||
<!-- <link type="text/css" href="http://mapdemo.joysuch.com/lib/jsmap/jsmap.css" rel="stylesheet"/>-->
|
||||
<link rel="stylesheet" href="http://192.168.192.201:7024/joysuch/LocalAssets/css/animation/pop.css">
|
||||
<link rel="stylesheet" href="http://192.168.192.201:7024/joysuch/LocalAssets/css/animation/loading.css">
|
||||
<link rel="stylesheet" href="http://192.168.192.201:7024/joysuch/LocalAssets/css/dom.css">
|
||||
<style>
|
||||
.jsmap-animation-point,
|
||||
.jsmap-animation-point:after,
|
||||
.jsmap-animation-point:before,
|
||||
.jsmap-animation-point p,
|
||||
.jsmap-animation-point p:after,
|
||||
.jsmap-animation-point p:before {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.jsmap-animation-point {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid hsla(0, 0%, 100%, 0.5);
|
||||
cursor: pointer;
|
||||
color: #0ff;
|
||||
background: currentColor;
|
||||
z-index: 3;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
-o-transform: translate(-50%, -50%);
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
box-shadow: 0 0 2em currentColor, 0 0 0.5em currentColor;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jsmap-animation-point:after,
|
||||
.jsmap-animation-point:before,
|
||||
.jsmap-animation-point p:after,
|
||||
.jsmap-animation-point p:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
border-radius: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
-o-transform: translate(-50%, -50%);
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.jsmap-animation-point:after,
|
||||
.jsmap-animation-point:before {
|
||||
border: 1px solid;
|
||||
-webkit-animation: jsmap-mapAni 1s ease infinite;
|
||||
-moz-animation: jsmap-mapAni 1s ease infinite;
|
||||
-o-animation: jsmap-mapAni 1s ease infinite;
|
||||
-ms-animation: jsmap-mapAni 1s ease infinite;
|
||||
animation: jsmap-mapAni 1s ease infinite;
|
||||
}
|
||||
|
||||
.jsmap-animation-point p:before {
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.jsmap-animation-point p {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-radius: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
-o-transform: translate(-50%, -50%);
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
-webkit-animation: jsmap-mapAni 2s ease infinite;
|
||||
-moz-animation: jsmap-mapAni 2s ease infinite;
|
||||
-o-animation: jsmap-mapAni 2s ease infinite;
|
||||
-ms-animation: jsmap-mapAni 2s ease infinite;
|
||||
animation: jsmap-mapAni 2s ease infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@-o-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@-ms-keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes jsmap-mapAni {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=1);
|
||||
}
|
||||
|
||||
25% {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
50% {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
75% {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=20);
|
||||
}
|
||||
|
||||
to {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='mapContainer'></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
//定义全局map变量
|
||||
var map = null;
|
||||
//定义地图ID变量
|
||||
var mapID = '100930';
|
||||
//定义循环的起始变量
|
||||
var i = 0;
|
||||
|
||||
//定义点标注全局变量
|
||||
var domMarker = null;
|
||||
|
||||
window.onload = function () {
|
||||
window.addEventListener('message', function (e) {
|
||||
//加载地图
|
||||
// console.info('地图加载完成')
|
||||
// console.info(mapData)
|
||||
openMap(e.data);
|
||||
add(e.data);
|
||||
});
|
||||
};
|
||||
|
||||
window.addEventListener('unload', function (e) {
|
||||
//销毁地图
|
||||
map.destroy();
|
||||
map = null;
|
||||
});
|
||||
|
||||
//打开地图
|
||||
function openMap(mapData) {
|
||||
//初始化参数
|
||||
var mapOptions = {
|
||||
//必要,地图容器
|
||||
container: 'mapContainer',
|
||||
//必要,地图类型
|
||||
mapType: jsmap.JSMapType.MAP_3D,
|
||||
//必要,地图路径
|
||||
// mapServerURL: 'http://mapdemo.joysuch.com',
|
||||
mapServerURL: 'http://192.168.192.201:7024/joysuch/jsmap/data/map',
|
||||
mapScaleLevelRange: [15,20], //地图缩放范围,默认[1,24]
|
||||
openingAnimation: false,
|
||||
enableLighting: true,
|
||||
enableShadows: true,
|
||||
viewOptions: {
|
||||
center: {
|
||||
x: Number(mapData.longitude),
|
||||
y: Number(mapData.latitude),
|
||||
z: 0.016594102424956802
|
||||
|
||||
},
|
||||
distance: 370.01629618875734,
|
||||
rotate: 0,
|
||||
tilt: 90
|
||||
},
|
||||
imageryProvider: jsmap.JSImageryProviderType.IMAGE_TDT,
|
||||
};
|
||||
//初始化地图对象
|
||||
map = new jsmap.JSMap(mapOptions);
|
||||
|
||||
//打开map服务器的地图数据和主题
|
||||
map.openMapById(mapID);
|
||||
|
||||
//地图加载完成事件
|
||||
map.on("loadComplete", e => {
|
||||
var compassControl = new jsmap.JSCompassControl({
|
||||
position: jsmap.JSControlPosition.LEFT_TOP,
|
||||
offset: {
|
||||
x: 10,
|
||||
y: 20
|
||||
}
|
||||
});
|
||||
|
||||
var zoomControl = new jsmap.JSZoomControl({
|
||||
position: jsmap.JSControlPosition.LEFT_TOP,
|
||||
offset: {
|
||||
x: 40,
|
||||
y: 10
|
||||
}
|
||||
});
|
||||
|
||||
if (document.documentElement.clientWidth >= 600) {
|
||||
map.addControl(compassControl);
|
||||
map.addControl(zoomControl);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//添加标注
|
||||
function add(mapData) {
|
||||
var content = '<div>' +
|
||||
'<div class="wrapper">' +
|
||||
'<div class="row cf">' +
|
||||
'<div class="span">' +
|
||||
'<div class="location_indicator"></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div>' +
|
||||
'<div class="divpoint divpoint-theme-29baf1">' +
|
||||
'<div class="divpoint-wrap">' +
|
||||
'<div class="area">' +
|
||||
'<div class="arrow-lt"></div>' +
|
||||
'<div class="b-t"></div>' +
|
||||
'<div class="b-r"></div>' +
|
||||
'<div class="b-b"></div>' +
|
||||
'<div class="b-l"></div>' +
|
||||
'<div class="arrow-rb"></div>' +
|
||||
'<div class="label-wrap">' +
|
||||
'<div class="title">' + mapData.name + '</div>' +
|
||||
'<div class="label-content">';
|
||||
if (mapData.number) {
|
||||
content +=
|
||||
'<div class="data-li">' +
|
||||
'<div class="data-label">编号:</div>' +
|
||||
'<div class="data-value">' +
|
||||
'<span class="label-tag data-value-status-1">' + mapData.number + '</span>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}
|
||||
if (mapData.workcontent) {
|
||||
content +=
|
||||
'<div class="data-li">' +
|
||||
'<div class="data-label">作业内容:</div>' +
|
||||
'<div class="data-value">' +
|
||||
'<span class="label-tag data-value-status-1">' + mapData.workcontent + '</span>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}
|
||||
if (mapData.address) {
|
||||
content +=
|
||||
'<div class="data-li">' +
|
||||
'<div class="data-label">地址:</div>' +
|
||||
'<div class="data-value">' +
|
||||
'<span class="label-tag data-value-status-1">' + mapData.address + '</span>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}
|
||||
content +=
|
||||
'<div class="data-li">' +
|
||||
'<div class="data-label">经度:</div>' +
|
||||
'<div class="data-value">' +
|
||||
'<span class="label-num">' + mapData.longitude + '</span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="data-li">' +
|
||||
'<div class="data-label">纬度:</div>' +
|
||||
'<div class="data-value">' +
|
||||
'<span class="label-num">' + mapData.latitude + '</span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="b-t-l"></div>' +
|
||||
'<div class="b-b-r"></div>' +
|
||||
'</div>' +
|
||||
'<div class="arrow"></div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
domMarker = new jsmap.JSDomMarker({
|
||||
id: i,
|
||||
position: {
|
||||
x: Number(mapData.longitude),
|
||||
y: Number(mapData.latitude),
|
||||
z: 1
|
||||
}, //坐标
|
||||
floorId: 1, //楼层id,默认为1(地面)
|
||||
pointerEvents: 'none',
|
||||
content: content,
|
||||
offset: jsmap.JSControlPosition.LEFT_BOTTOM,
|
||||
marginOffset: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
properties: {
|
||||
type: 0,
|
||||
},//属性设置
|
||||
callback: (node) => {
|
||||
// console.log(node);
|
||||
} //回调事件
|
||||
});
|
||||
map.addMarker(domMarker);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/bin" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"name": "qa-regulatory-gwj-vue",
|
||||
"version": "1.0.0",
|
||||
"description": "A Vue.js project",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 192.168.151.43",
|
||||
"start": "npm run dev",
|
||||
"unit": "jest --config test/unit/jest.conf.js --coverage",
|
||||
"e2e": "node test/e2e/runner.js",
|
||||
"test": "npm run unit && npm run e2e",
|
||||
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
|
||||
"build": "node build/build.js",
|
||||
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
|
||||
},
|
||||
"dependencies": {
|
||||
"@riophae/vue-treeselect": "^0.4.0",
|
||||
"animate.css": "^4.1.1",
|
||||
"axios": "^0.21.1",
|
||||
"dayjs": "^1.11.10",
|
||||
"element-ui": "^2.15.1",
|
||||
"html2canvas": "^1.4.1",
|
||||
"js-cookie": "^2.2.1",
|
||||
"jspdf": "^2.5.1",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.3",
|
||||
"motion": "^10.16.4",
|
||||
"nprogress": "^0.2.0",
|
||||
"relation-graph": "^1.1.0",
|
||||
"v-viewer": "^1.6.3",
|
||||
"vue": "^2.5.2",
|
||||
"vue-baidu-map": "^0.21.22",
|
||||
"vue-count-to": "^1.0.13",
|
||||
"vue-esign": "^1.0.5",
|
||||
"vue-particles": "^1.0.9",
|
||||
"vue-pdf": "^4.3.0",
|
||||
"vue-print-nb": "^1.6.0",
|
||||
"vue-qr": "^2.3.0",
|
||||
"vue-quill-editor": "^3.0.6",
|
||||
"vue-router": "^3.0.1",
|
||||
"vue-to-pdf": "^1.0.0",
|
||||
"vue-video-player": "^5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@our-patches/postcss-px-to-viewport": "^1.2.0",
|
||||
"autoprefixer": "^7.1.2",
|
||||
"babel-core": "^6.22.1",
|
||||
"babel-eslint": "^8.2.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"babel-jest": "^21.0.2",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-dynamic-import-node": "^1.2.0",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
|
||||
"babel-plugin-transform-runtime": "^6.22.0",
|
||||
"babel-plugin-transform-vue-jsx": "^3.5.0",
|
||||
"babel-preset-env": "^1.3.2",
|
||||
"babel-preset-stage-2": "^6.22.0",
|
||||
"babel-register": "^6.22.0",
|
||||
"chalk": "^2.0.1",
|
||||
"chromedriver": "^2.27.2",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"cross-spawn": "^5.0.1",
|
||||
"css-loader": "^0.28.0",
|
||||
"echarts": "^5.4.2",
|
||||
"eslint": "^4.15.0",
|
||||
"eslint-config-standard": "^10.2.1",
|
||||
"eslint-friendly-formatter": "^3.0.0",
|
||||
"eslint-loader": "^1.7.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-plugin-node": "^5.2.0",
|
||||
"eslint-plugin-promise": "^3.4.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"eslint-plugin-vue": "^4.0.0",
|
||||
"extract-text-webpack-plugin": "^3.0.0",
|
||||
"file-loader": "^1.1.4",
|
||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"jest": "^22.0.4",
|
||||
"jest-serializer-vue": "^0.3.0",
|
||||
"nightwatch": "^0.9.12",
|
||||
"node-notifier": "^5.1.2",
|
||||
"optimize-css-assets-webpack-plugin": "^3.2.0",
|
||||
"ora": "^1.2.0",
|
||||
"portfinder": "^1.0.13",
|
||||
"postcss-import": "^11.0.0",
|
||||
"postcss-loader": "^2.0.8",
|
||||
"postcss-url": "^7.2.1",
|
||||
"rimraf": "^2.6.0",
|
||||
"sass": "1.26.2",
|
||||
"sass-loader": "^7.3.1",
|
||||
"screenfull": "^5.1.0",
|
||||
"selenium-server": "^3.0.1",
|
||||
"semver": "^5.3.0",
|
||||
"shelljs": "^0.7.6",
|
||||
"svg-sprite-loader": "^4.1.3",
|
||||
"svgo": "^1.2.0",
|
||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||
"url-loader": "^0.5.8",
|
||||
"vue-jest": "^1.0.2",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-style-loader": "^3.0.1",
|
||||
"vue-template-compiler": "^2.5.2",
|
||||
"vuex": "^3.6.2",
|
||||
"webpack": "^3.6.0",
|
||||
"webpack-bundle-analyzer": "^2.9.0",
|
||||
"webpack-dev-server": "^2.9.1",
|
||||
"webpack-merge": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not ie <= 8"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
{
|
||||
"particles": {
|
||||
"number": {
|
||||
"value": 40,
|
||||
"density": {
|
||||
"enable": true,
|
||||
"value_area": 800
|
||||
}
|
||||
},
|
||||
"color": {
|
||||
"value": "#ffffff"
|
||||
},
|
||||
"shape": {
|
||||
"type": "circle",
|
||||
"stroke": {
|
||||
"width": 0,
|
||||
"color": "#000000"
|
||||
},
|
||||
"polygon": {
|
||||
"nb_sides": 5
|
||||
},
|
||||
"image": {
|
||||
"src": "img/github.svg",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
}
|
||||
},
|
||||
"opacity": {
|
||||
"value": 0.7,
|
||||
"random": false,
|
||||
"anim": {
|
||||
"enable": false,
|
||||
"speed": 1,
|
||||
"opacity_min": 0.1,
|
||||
"sync": false
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"value": 3,
|
||||
"random": true,
|
||||
"anim": {
|
||||
"enable": false,
|
||||
"speed": 40,
|
||||
"size_min": 0.1,
|
||||
"sync": false
|
||||
}
|
||||
},
|
||||
"line_linked": {
|
||||
"enable": true,
|
||||
"distance": 150,
|
||||
"color": "#ffffff",
|
||||
"opacity": 0.6,
|
||||
"width": 1
|
||||
},
|
||||
"move": {
|
||||
"enable": true,
|
||||
"speed": 6,
|
||||
"direction": "none",
|
||||
"random": false,
|
||||
"straight": false,
|
||||
"out_mode": "out",
|
||||
"bounce": false,
|
||||
"attract": {
|
||||
"enable": false,
|
||||
"rotateX": 600,
|
||||
"rotateY": 1200
|
||||
}
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"detect_on": "canvas",
|
||||
"events": {
|
||||
"onhover": {
|
||||
"enable": true,
|
||||
"mode": "grab"
|
||||
},
|
||||
"onclick": {
|
||||
"enable": true,
|
||||
"mode": "push"
|
||||
},
|
||||
"resize": true
|
||||
},
|
||||
"modes": {
|
||||
"grab": {
|
||||
"distance": 200,
|
||||
"line_linked": {
|
||||
"opacity": 1
|
||||
}
|
||||
},
|
||||
"bubble": {
|
||||
"distance": 400,
|
||||
"size": 40,
|
||||
"duration": 2,
|
||||
"opacity": 8,
|
||||
"speed": 3
|
||||
},
|
||||
"repulse": {
|
||||
"distance": 200,
|
||||
"duration": 0.4
|
||||
},
|
||||
"push": {
|
||||
"particles_nb": 4
|
||||
},
|
||||
"remove": {
|
||||
"particles_nb": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"retina_detect": false
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/untitled/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App'
|
||||
}
|
||||
// 更新
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.vue-treeselect__placeholder{
|
||||
color: #dcdfe6 !important;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
.vue-treeselect__single-value{
|
||||
color: #606266 !important;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
.vue-treeselect__label{
|
||||
color: #606266 !important;
|
||||
font-size: 14px !important;
|
||||
font-weight: 500;
|
||||
}
|
||||
body{
|
||||
font-family: '微软雅黑', "宋体", "Arial Narrow", Helvetica, sans-serif;
|
||||
}
|
||||
.el-dialog__body{
|
||||
padding-top: 15px !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,13 @@
|
|||
// 初始化地图
|
||||
export default {
|
||||
init() {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 如果已加载直接返回
|
||||
if (window.T) {
|
||||
console.log('地图脚本初始化成功...')
|
||||
resolve(window.T)
|
||||
reject('error')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 302 KiB |
After Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 405 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 7.2 MiB |
After Width: | Height: | Size: 5.6 MiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 6.4 KiB |
|
@ -0,0 +1,106 @@
|
|||
import { Loading } from 'element-ui'
|
||||
import html2canvas from 'html2canvas'
|
||||
import jsPDF from 'jspdf'
|
||||
|
||||
function toChangeRealPdf(result, ref, pageName, loading, margin = 10) {
|
||||
// grid-stack
|
||||
if (result) {
|
||||
html2canvas(ref, {
|
||||
scale: window.devicePixelRatio * 2 // 增加清晰度
|
||||
}).then(canvas => {
|
||||
// 未生成pdf的canvas页面高度
|
||||
let leftHeight = canvas.height
|
||||
|
||||
const a4Width = 190
|
||||
const a4Height = 277 // A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277
|
||||
// 一页pdf显示html页面生成的canvas高度;
|
||||
const a4HeightCanvas = Math.floor(canvas.width / a4Width * a4Height)
|
||||
|
||||
const context = canvas.getContext('2d')
|
||||
const imageData = context.getImageData(0, 0, canvas.width, canvas.height)
|
||||
|
||||
// pdf页面偏移
|
||||
let position = 0
|
||||
|
||||
const pdf = new jsPDF('p', 'mm', 'a4') // A4纸,纵向
|
||||
let index = 1
|
||||
const canvas1 = document.createElement('canvas')
|
||||
let height
|
||||
pdf.setDisplayMode('fullwidth', 'continuous', 'FullScreen')
|
||||
const createImgPdf = (canvas) => {
|
||||
if (leftHeight > 0) {
|
||||
index++
|
||||
let checkCount = 0
|
||||
if (leftHeight > a4HeightCanvas) {
|
||||
let i = position + a4HeightCanvas
|
||||
// 获取图像数据
|
||||
// const context = canvas.getContext('2d')
|
||||
const canvasW = canvas.width
|
||||
const mid = parseInt(canvasW / 2)
|
||||
for (i = position + a4HeightCanvas; i >= position; i--) {
|
||||
for (let j = 0; j < mid; j++) {
|
||||
// 每四个数组元素代表了一个像素点的RGBA信息,每个元素数值介于0~255
|
||||
const c = imageData.data
|
||||
const index = i * canvasW + j
|
||||
const lastIndex = i * canvasW - j - 1
|
||||
const index4 = 4 * index
|
||||
const lastIndex4 = 4 * lastIndex
|
||||
}
|
||||
checkCount++
|
||||
if (checkCount >= margin * 2) {
|
||||
break
|
||||
}
|
||||
}
|
||||
height = Math.round(i - position) || Math.min(leftHeight, a4HeightCanvas)
|
||||
if (height <= 0) {
|
||||
height = a4HeightCanvas
|
||||
}
|
||||
} else {
|
||||
height = leftHeight
|
||||
}
|
||||
|
||||
canvas1.width = canvas.width
|
||||
canvas1.height = height
|
||||
|
||||
|
||||
const ctx = canvas1.getContext('2d')
|
||||
ctx.drawImage(result, 0, position, canvas.width, height, 0, 0, canvas.width, height)
|
||||
|
||||
if (position != 0) {
|
||||
pdf.addPage()
|
||||
}
|
||||
pdf.addImage(canvas1, 'JPEG', 10, 10, a4Width, a4Width / canvas1.width * height)
|
||||
leftHeight -= height
|
||||
position += height
|
||||
}
|
||||
}
|
||||
|
||||
// 当内容未超过pdf一页显示的范围,无需分页
|
||||
if (leftHeight < a4HeightCanvas) {
|
||||
// const pageData = result.toDataURL('image/jpeg', 1.0)
|
||||
pdf.addImage(result, 'JPEG', 10, 10, a4Width, a4Width / result.width * leftHeight)
|
||||
} else {
|
||||
while (leftHeight > 0) {
|
||||
createImgPdf(canvas)
|
||||
}
|
||||
}
|
||||
pdf.save(pageName + '.pdf')
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default function downloadPdf(ref, pageName, margin) {
|
||||
const loading = Loading.service({
|
||||
fullscreen: true,
|
||||
lock: true,
|
||||
text: '导出中......',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
html2canvas(ref, {
|
||||
scale: window.devicePixelRatio * 2 // 增加清晰度
|
||||
}).then(canvas => {
|
||||
toChangeRealPdf(canvas, ref, pageName, loading, margin)
|
||||
})
|
||||
}
|
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.0 KiB |