|
|
- webpackJsonp([5],{
-
- /***/ "/nO3":
- /***/ (function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__.p + "static/img/alert.f2fea34.png";
-
- /***/ }),
-
- /***/ "/ydS":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_factory_js__ = __webpack_require__("Brla");
-
-
-
-
- /* harmony default export */ __webpack_exports__["a"] = ({
- name: 'bm-navigation',
- render: function render() {},
-
- mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('control')],
- props: {
- anchor: {
- type: String
- },
- offset: {
- type: Object
- },
- type: {
- type: String
- },
- showZoomInfo: {
- type: Boolean
- },
- enableGeolocation: {
- type: Boolean,
- default: false
- }
- },
- watch: {
- anchor: function anchor() {
- this.reload();
- },
- offset: function offset() {
- this.reload();
- },
- type: function type() {
- this.reload();
- },
- showZoomInfo: function showZoomInfo() {
- this.reload();
- }
- },
- methods: {
- load: function load() {
- var BMap = this.BMap,
- map = this.map,
- anchor = this.anchor,
- offset = this.offset,
- type = this.type,
- showZoomInfo = this.showZoomInfo,
- enableGeolocation = this.enableGeolocation;
-
- this.originInstance = new BMap.NavigationControl({
- anchor: global[anchor],
- offset: offset && Object(__WEBPACK_IMPORTED_MODULE_1__base_factory_js__["d" /* createSize */])(BMap, offset),
- type: global[type],
- showZoomInfo: showZoomInfo,
- enableGeolocation: enableGeolocation
- });
- map.addControl(this.originInstance);
- }
- }
- });
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
-
- /***/ }),
-
- /***/ "3tqA":
- /***/ (function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
- true ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global.BMapLib = global.BMapLib || {}, global.BMapLib.MarkerClusterer = factory());
- }(this, (function () { 'use strict';
-
- var __commonjs_global = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this;
- function __commonjs(fn, module) { return module = { exports: {} }, fn(module, module.exports, __commonjs_global), module.exports; }
-
-
- var index$1 = __commonjs(function (module, exports, global) {
- (function (root, factory) {
- if (typeof exports === 'object') {
- module.exports = factory();
- } else if (true) {
- !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {
- root.BMapLib = root.BMapLib || {};
- root.BMapLib.TextIconOverlay = root.BMapLib.TextIconOverlay || factory();
- }
- })(__commonjs_global, function() {
- var T,
- baidu = T = baidu || {version: "1.3.8"};
- var context = {};
- //提出guid,防止在与老版本Tangram混用时
- //在下一行错误的修改context[undefined]
- baidu.guid = "$BAIDU$";
-
- //Tangram可能被放在闭包中
- //一些页面级别唯一的属性,需要挂载在context[baidu.guid]上
- context[baidu.guid] = context[baidu.guid] || {};
-
- /**
- * @ignore
- * @namespace baidu.dom 操作dom的方法。
- */
- baidu.dom = baidu.dom || {};
-
-
- /**
- * 从文档中获取指定的DOM元素
- * @name baidu.dom.g
- * @function
- * @grammar baidu.dom.g(id)
- * @param {string|HTMLElement} id 元素的id或DOM元素
- * @shortcut g,T.G
- * @meta standard
- * @see baidu.dom.q
- *
- * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数
- */
- baidu.dom.g = function (id) {
- if ('string' == typeof id || id instanceof String) {
- return document.getElementById(id);
- } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) {
- return id;
- }
- return null;
- };
-
- // 声明快捷方法
- baidu.g = baidu.G = baidu.dom.g;
-
- /**
- * 获取目标元素所属的document对象
- * @name baidu.dom.getDocument
- * @function
- * @grammar baidu.dom.getDocument(element)
- * @param {HTMLElement|string} element 目标元素或目标元素的id
- * @meta standard
- * @see baidu.dom.getWindow
- *
- * @returns {HTMLDocument} 目标元素所属的document对象
- */
- baidu.dom.getDocument = function (element) {
- element = baidu.dom.g(element);
- return element.nodeType == 9 ? element : element.ownerDocument || element.document;
- };
-
- /**
- * @ignore
- * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。
- */
- baidu.lang = baidu.lang || {};
-
- /**
- * 判断目标参数是否string类型或String对象
- * @name baidu.lang.isString
- * @function
- * @grammar baidu.lang.isString(source)
- * @param {Any} source 目标参数
- * @shortcut isString
- * @meta standard
- * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
- *
- * @returns {boolean} 类型判断结果
- */
- baidu.lang.isString = function (source) {
- return '[object String]' == Object.prototype.toString.call(source);
- };
-
- // 声明快捷方法
- baidu.isString = baidu.lang.isString;
-
- /**
- * 从文档中获取指定的DOM元素
- * **内部方法**
- *
- * @param {string|HTMLElement} id 元素的id或DOM元素
- * @meta standard
- * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数
- */
- baidu.dom._g = function (id) {
- if (baidu.lang.isString(id)) {
- return document.getElementById(id);
- }
- return id;
- };
-
- // 声明快捷方法
- baidu._g = baidu.dom._g;
-
- /**
- * @ignore
- * @namespace baidu.browser 判断浏览器类型和特性的属性。
- */
- baidu.browser = baidu.browser || {};
-
- if (/msie (\d+\.\d)/i.test(navigator.userAgent)) {
- //IE 8下,以documentMode为准
- //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241
- /**
- * 判断是否为ie浏览器
- * @property ie ie版本号
- * @grammar baidu.browser.ie
- * @meta standard
- * @shortcut ie
- * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon
- */
- baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241'];
- }
-
- /**
- * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE)
- *
- * @author berg
- * @name baidu.dom.getComputedStyle
- * @function
- * @grammar baidu.dom.getComputedStyle(element, key)
- * @param {HTMLElement|string} element 目标元素或目标元素的id
- * @param {string} key 要获取的样式名
- *
- * @see baidu.dom.getStyle
- *
- * @returns {string} 目标元素的computed style值
- */
-
- baidu.dom.getComputedStyle = function(element, key){
- element = baidu.dom._g(element);
- var doc = baidu.dom.getDocument(element),
- styles;
- if (doc.defaultView && doc.defaultView.getComputedStyle) {
- styles = doc.defaultView.getComputedStyle(element, null);
- if (styles) {
- return styles[key] || styles.getPropertyValue(key);
- }
- }
- return '';
- };
-
- /**
- * 提供给setStyle与getStyle使用
- */
- baidu.dom._styleFixer = baidu.dom._styleFixer || {};
-
- /**
- * 提供给setStyle与getStyle使用
- */
- baidu.dom._styleFilter = baidu.dom._styleFilter || [];
-
- /**
- * 为获取和设置样式的过滤器
- * @private
- * @meta standard
- */
- baidu.dom._styleFilter.filter = function (key, value, method) {
- for (var i = 0, filters = baidu.dom._styleFilter, filter; filter = filters[i]; i++) {
- if (filter = filter[method]) {
- value = filter(key, value);
- }
- }
- return value;
- };
-
- /**
- * @ignore
- * @namespace baidu.string 操作字符串的方法。
- */
- baidu.string = baidu.string || {};
-
- /**
- * 将目标字符串进行驼峰化处理
- * @name baidu.string.toCamelCase
- * @function
- * @grammar baidu.string.toCamelCase(source)
- * @param {string} source 目标字符串
- * @remark
- * 支持单词以“-_”分隔
- * @meta standard
- *
- * @returns {string} 驼峰化处理后的字符串
- */
- baidu.string.toCamelCase = function (source) {
- //提前判断,提高getStyle等的效率 thanks xianwei
- if (source.indexOf('-') < 0 && source.indexOf('_') < 0) {
- return source;
- }
- return source.replace(/[-_][^-_]/g, function (match) {
- return match.charAt(1).toUpperCase();
- });
- };
-
- /**
- * 获取目标元素的样式值
- * @name baidu.dom.getStyle
- * @function
- * @grammar baidu.dom.getStyle(element, key)
- * @param {HTMLElement|string} element 目标元素或目标元素的id
- * @param {string} key 要获取的样式名
- * @remark
- *
- * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。<br />
- * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。<br />
- * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。
- * @shortcut getStyle
- * @meta standard
- * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle
- *
- * @returns {string} 目标元素的样式值
- */
- baidu.dom.getStyle = function (element, key) {
- var dom = baidu.dom;
-
- element = dom.g(element);
- key = baidu.string.toCamelCase(key);
- //computed style, then cascaded style, then explicitly set style.
- var value = element.style[key] ||
- (element.currentStyle ? element.currentStyle[key] : "") ||
- dom.getComputedStyle(element, key);
-
- // 在取不到值的时候,用fixer进行修正
- if (!value) {
- var fixer = dom._styleFixer[key];
- if(fixer){
- value = fixer.get ? fixer.get(element) : baidu.dom.getStyle(element, fixer);
- }
- }
-
- /* 检查结果过滤器 */
- if (fixer = dom._styleFilter) {
- value = fixer.filter(key, value, 'get');
- }
-
- return value;
- };
-
- // 声明快捷方法
- baidu.getStyle = baidu.dom.getStyle;
-
-
- if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) {
- /**
- * 判断是否为opera浏览器
- * @property opera opera版本号
- * @grammar baidu.browser.opera
- * @meta standard
- * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome
- */
- baidu.browser.opera = + RegExp['\x241'];
- }
-
- /**
- * 判断是否为webkit内核
- * @property isWebkit
- * @grammar baidu.browser.isWebkit
- * @meta standard
- * @see baidu.browser.isGecko
- */
- baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent);
-
- /**
- * 判断是否为gecko内核
- * @property isGecko
- * @grammar baidu.browser.isGecko
- * @meta standard
- * @see baidu.browser.isWebkit
- */
- baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent);
-
- /**
- * 判断是否严格标准的渲染模式
- * @property isStrict
- * @grammar baidu.browser.isStrict
- * @meta standard
- */
- baidu.browser.isStrict = document.compatMode == "CSS1Compat";
-
- /**
- * 获取目标元素相对于整个文档左上角的位置
- * @name baidu.dom.getPosition
- * @function
- * @grammar baidu.dom.getPosition(element)
- * @param {HTMLElement|string} element 目标元素或目标元素的id
- * @meta standard
- *
- * @returns {Object} 目标元素的位置,键值为top和left的Object。
- */
- baidu.dom.getPosition = function (element) {
- element = baidu.dom.g(element);
- var doc = baidu.dom.getDocument(element),
- browser = baidu.browser,
- getStyle = baidu.dom.getStyle,
- // Gecko 1.9版本以下用getBoxObjectFor计算位置
- // 但是某些情况下是有bug的
- // 对于这些有bug的情况
- // 使用递归查找的方式
- BUGGY_GECKO_BOX_OBJECT = browser.isGecko > 0 &&
- doc.getBoxObjectFor &&
- getStyle(element, 'position') == 'absolute' &&
- (element.style.top === '' || element.style.left === ''),
- pos = {"left":0,"top":0},
- viewport = (browser.ie && !browser.isStrict) ? doc.body : doc.documentElement,
- parent,
- box;
-
- if(element == viewport){
- return pos;
- }
-
- if(element.getBoundingClientRect){ // IE and Gecko 1.9+
-
- //当HTML或者BODY有border width时, 原生的getBoundingClientRect返回值是不符合预期的
- //考虑到通常情况下 HTML和BODY的border只会设成0px,所以忽略该问题.
- box = element.getBoundingClientRect();
-
- pos.left = Math.floor(box.left) + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
- pos.top = Math.floor(box.top) + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
-
- // IE会给HTML元素添加一个border,默认是medium(2px)
- // 但是在IE 6 7 的怪异模式下,可以被html { border: 0; } 这条css规则覆盖
- // 在IE7的标准模式下,border永远是2px,这个值通过clientLeft 和 clientTop取得
- // 但是。。。在IE 6 7的怪异模式,如果用户使用css覆盖了默认的medium
- // clientTop和clientLeft不会更新
- pos.left -= doc.documentElement.clientLeft;
- pos.top -= doc.documentElement.clientTop;
-
- var htmlDom = doc.body,
- // 在这里,不使用element.style.borderLeftWidth,只有computedStyle是可信的
- htmlBorderLeftWidth = parseInt(getStyle(htmlDom, 'borderLeftWidth')),
- htmlBorderTopWidth = parseInt(getStyle(htmlDom, 'borderTopWidth'));
- if(browser.ie && !browser.isStrict){
- pos.left -= isNaN(htmlBorderLeftWidth) ? 2 : htmlBorderLeftWidth;
- pos.top -= isNaN(htmlBorderTopWidth) ? 2 : htmlBorderTopWidth;
- }
- } else {
- // safari/opera/firefox
- parent = element;
-
- do {
- pos.left += parent.offsetLeft;
- pos.top += parent.offsetTop;
-
- // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了
- if (browser.isWebkit > 0 && getStyle(parent, 'position') == 'fixed') {
- pos.left += doc.body.scrollLeft;
- pos.top += doc.body.scrollTop;
- break;
- }
-
- parent = parent.offsetParent;
- } while (parent && parent != element);
-
- // 对body offsetTop的修正
- if(browser.opera > 0 || (browser.isWebkit > 0 && getStyle(element, 'position') == 'absolute')){
- pos.top -= doc.body.offsetTop;
- }
-
- // 计算除了body的scroll
- parent = element.offsetParent;
- while (parent && parent != doc.body) {
- pos.left -= parent.scrollLeft;
- // see https://bugs.opera.com/show_bug.cgi?id=249965
- if (!browser.opera || parent.tagName != 'TR') {
- pos.top -= parent.scrollTop;
- }
- parent = parent.offsetParent;
- }
- }
-
- return pos;
- };
-
- /**
- * @ignore
- * @namespace baidu.event 屏蔽浏览器差异性的事件封装。
- * @property target 事件的触发元素
- * @property pageX 鼠标事件的鼠标x坐标
- * @property pageY 鼠标事件的鼠标y坐标
- * @property keyCode 键盘事件的键值
- */
- baidu.event = baidu.event || {};
-
- /**
- * 事件监听器的存储表
- * @private
- * @meta standard
- */
- baidu.event._listeners = baidu.event._listeners || [];
-
- /**
- * 为目标元素添加事件监听器
- * @name baidu.event.on
- * @function
- * @grammar baidu.event.on(element, type, listener)
- * @param {HTMLElement|string|window} element 目标元素或目标元素id
- * @param {string} type 事件类型
- * @param {Function} listener 需要添加的监听器
- * @remark
- *
- 1. 不支持跨浏览器的鼠标滚轮事件监听器添加<br>
- 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败
-
- * @shortcut on
- * @meta standard
- * @see baidu.event.un
- *
- * @returns {HTMLElement|window} 目标元素
- */
- baidu.event.on = function (element, type, listener) {
- type = type.replace(/^on/i, '');
- element = baidu.dom._g(element);
-
- var realListener = function (ev) {
- // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载
- // 2. element是为了修正this
- listener.call(element, ev);
- },
- lis = baidu.event._listeners,
- filter = baidu.event._eventFilter,
- afterFilter,
- realType = type;
- type = type.toLowerCase();
- // filter过滤
- if(filter && filter[type]){
- afterFilter = filter[type](element, type, realListener);
- realType = afterFilter.type;
- realListener = afterFilter.listener;
- }
-
- // 事件监听器挂载
- if (element.addEventListener) {
- element.addEventListener(realType, realListener, false);
- } else if (element.attachEvent) {
- element.attachEvent('on' + realType, realListener);
- }
-
- // 将监听器存储到数组中
- lis[lis.length] = [element, type, listener, realListener, realType];
- return element;
- };
-
- // 声明快捷方法
- baidu.on = baidu.event.on;
-
- /**
- * 返回一个当前页面的唯一标识字符串。
- * @name baidu.lang.guid
- * @function
- * @grammar baidu.lang.guid()
- * @version 1.1.1
- * @meta standard
- *
- * @returns {String} 当前页面的唯一标识字符串
- */
-
- (function(){
- //不直接使用window,可以提高3倍左右性能
- var guid = context[baidu.guid];
-
- baidu.lang.guid = function() {
- return "TANGRAM__" + (guid._counter ++).toString(36);
- };
-
- guid._counter = guid._counter || 1;
- })();
-
- /**
- * 所有类的实例的容器
- * key为每个实例的guid
- * @meta standard
- */
-
- context[baidu.guid]._instances = context[baidu.guid]._instances || {};
-
- /**
- * 判断目标参数是否为function或Function实例
- * @name baidu.lang.isFunction
- * @function
- * @grammar baidu.lang.isFunction(source)
- * @param {Any} source 目标参数
- * @version 1.2
- * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
- * @meta standard
- * @returns {boolean} 类型判断结果
- */
- baidu.lang.isFunction = function (source) {
- // chrome下,'function' == typeof /a/ 为true.
- return '[object Function]' == Object.prototype.toString.call(source);
- };
-
- /**
- *
- * @ignore
- * @class Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。
- * @name baidu.lang.Class
- * @grammar baidu.lang.Class(guid)
- * @param {string} guid 对象的唯一标识
- * @meta standard
- * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。<br>baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。
- * @meta standard
- * @see baidu.lang.inherits,baidu.lang.Event
- */
- baidu.lang.Class = function(guid) {
- this.guid = guid || baidu.lang.guid();
- context[baidu.guid]._instances[this.guid] = this;
- };
- context[baidu.guid]._instances = context[baidu.guid]._instances || {};
-
- /**
- * 释放对象所持有的资源,主要是自定义事件。
- * @name dispose
- * @grammar obj.dispose()
- */
- baidu.lang.Class.prototype.dispose = function(){
- delete context[baidu.guid]._instances[this.guid];
-
- for(var property in this){
- if (!baidu.lang.isFunction(this[property])) {
- delete this[property];
- }
- }
- this.disposed = true;
- };
-
- /**
- * 重载了默认的toString方法,使得返回信息更加准确一些。
- * @return {string} 对象的String表示形式
- */
- baidu.lang.Class.prototype.toString = function(){
- return "[object " + (this._className || "Object" ) + "]";
- };
-
- /**
- * @ignore
- * @class 自定义的事件对象。
- * @name baidu.lang.Event
- * @grammar baidu.lang.Event(type[, target])
- * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。
- * @param {Object} [target]触发事件的对象
- * @meta standard
- * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。
- * @meta standard
- * @see baidu.lang.Class
- */
- baidu.lang.Event = function (type, target) {
- this.type = type;
- this.returnValue = true;
- this.target = target || null;
- this.currentTarget = null;
- };
-
- /**
- * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
- * @grammar obj.addEventListener(type, handler[, key])
- * @param {string} type 自定义事件的名称
- * @param {Function} handler 自定义事件被触发时应该调用的回调函数
- * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。
- * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。
- */
- baidu.lang.Class.prototype.addEventListener = function (type, handler, key) {
- if (!baidu.lang.isFunction(handler)) {
- return;
- }
-
- !this.__listeners && (this.__listeners = {});
-
- var t = this.__listeners, id;
- if (typeof key == "string" && key) {
- if (/[^\w\-]/.test(key)) {
- throw("nonstandard key:" + key);
- } else {
- handler.hashCode = key;
- id = key;
- }
- }
- type.indexOf("on") != 0 && (type = "on" + type);
-
- typeof t[type] != "object" && (t[type] = {});
- id = id || baidu.lang.guid();
- handler.hashCode = id;
- t[type][id] = handler;
- };
-
- /**
- * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
- * @grammar obj.removeEventListener(type, handler)
- * @param {string} type 事件类型
- * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key
- * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。
- */
- baidu.lang.Class.prototype.removeEventListener = function (type, handler) {
- if (typeof handler != "undefined") {
- if ( (baidu.lang.isFunction(handler) && ! (handler = handler.hashCode))
- || (! baidu.lang.isString(handler))
- ){
- return;
- }
- }
-
- !this.__listeners && (this.__listeners = {});
-
- type.indexOf("on") != 0 && (type = "on" + type);
-
- var t = this.__listeners;
- if (!t[type]) {
- return;
- }
- if (typeof handler != "undefined") {
- t[type][handler] && delete t[type][handler];
- } else {
- for(var guid in t[type]){
- delete t[type][guid];
- }
- }
- };
-
- /**
- * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。
- * @grammar obj.dispatchEvent(event, options)
- * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持)
- * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持)
- * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:<br>
- myobj.onMyEvent = function(){}<br>
- myobj.addEventListener("onMyEvent", function(){});
- */
- baidu.lang.Class.prototype.dispatchEvent = function (event, options) {
- if (baidu.lang.isString(event)) {
- event = new baidu.lang.Event(event);
- }
- !this.__listeners && (this.__listeners = {});
-
- // 20100603 添加本方法的第二个参数,将 options extend到event中去传递
- options = options || {};
- for (var i in options) {
- event[i] = options[i];
- }
-
- var i, t = this.__listeners, p = event.type;
- event.target = event.target || this;
- event.currentTarget = this;
-
- p.indexOf("on") != 0 && (p = "on" + p);
-
- baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments);
-
- if (typeof t[p] == "object") {
- for (i in t[p]) {
- t[p][i].apply(this, arguments);
- }
- }
- return event.returnValue;
- };
-
-
- baidu.lang.inherits = function (subClass, superClass, className) {
- var key, proto,
- selfProps = subClass.prototype,
- clazz = new Function();
-
- clazz.prototype = superClass.prototype;
- proto = subClass.prototype = new clazz();
- for (key in selfProps) {
- proto[key] = selfProps[key];
- }
- subClass.prototype.constructor = subClass;
- subClass.superClass = superClass.prototype;
-
- // 类名标识,兼容Class的toString,基本没用
- if ("string" == typeof className) {
- proto._className = className;
- }
- };
- // 声明快捷方法
- baidu.inherits = baidu.lang.inherits;
-
-
- /**
-
- * 图片的路径
-
- * @private
- * @type {String}
-
- */
- var _IMAGE_PATH = 'http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m';
-
- /**
-
- * 图片的后缀名
-
- * @private
- * @type {String}
-
- */
- var _IMAGE_EXTENSION = 'png';
-
- /**
- *@exports TextIconOverlay as BMapLib.TextIconOverlay
- */
-
- /**
- * TextIconOverlay
- * @class 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。文字通常是数字(0-9)或字母(A-Z ),而文字与图标之间有一定的映射关系。
- *该覆盖物适用于以下类似的场景:需要在地图上添加一系列覆盖物,这些覆盖物之间用不同的图标和文字来区分,文字可能表示了该覆盖物的某一属性值,根据该文字和一定的映射关系,自动匹配相应颜色和大小的图标。
- *
- *@constructor
- *@param {Point} position 表示一个经纬度坐标位置。
- *@param {String} text 表示该覆盖物显示的文字信息。
- *@param {Json Object} options 可选参数,可选项包括:<br />
- *"<b>styles</b>":{Array<IconStyle>} 一组图标风格。单个图表风格包括以下几个属性:<br />
- * url {String} 图片的url地址。(必选)<br />
- * size {Size} 图片的大小。(必选)<br />
- * anchor {Size} 图标定位在地图上的位置相对于图标左上角的偏移值,默认偏移值为图标的中心位置。(可选)<br />
- * offset {Size} 图片相对于可视区域的偏移值,此功能的作用等同于CSS中的background-position属性。(可选)<br />
- * textSize {Number} 文字的大小。(可选,默认10)<br />
- * textColor {String} 文字的颜色。(可选,默认black)<br />
- */
- var TextIconOverlay = function(position, text, options){
- try {
- BMap;
- } catch (e) {
- throw Error('Baidu Map JS API is not ready yet!');
- }
- T.lang.inherits(TextIconOverlay, BMap.Overlay, "TextIconOverlay");
- this._position = position;
- this._text = text;
- this._options = options || {};
- this._styles = this._options['styles'] || [];
- (!this._styles.length) && this._setupDefaultStyles();
- };
-
-
- TextIconOverlay.prototype._setupDefaultStyles = function(){
- var sizes = [53, 56, 66, 78, 90];
- for(var i = 0, size; size = sizes[i]; i++){
- this._styles.push({
- url:_IMAGE_PATH + i + '.' + _IMAGE_EXTENSION,
- size: new BMap.Size(size, size)
- });
- }//for循环的简洁写法
- };
-
- /**
- *继承Overlay的intialize方法,自定义覆盖物时必须。
- *@param {Map} map BMap.Map的实例化对象。
- *@return {HTMLElement} 返回覆盖物对应的HTML元素。
- */
- TextIconOverlay.prototype.initialize = function(map){
- this._map = map;
-
- this._domElement = document.createElement('div');
- this._updateCss();
- this._updateText();
- this._updatePosition();
-
- this._bind();
-
- this._map.getPanes().markerMouseTarget.appendChild(this._domElement);
- return this._domElement;
- };
-
- /**
- *继承Overlay的draw方法,自定义覆盖物时必须。
- *@return 无返回值。
- */
- TextIconOverlay.prototype.draw = function(){
- this._map && this._updatePosition();
- };
-
- /**
- *获取该覆盖物上的文字。
- *@return {String} 该覆盖物上的文字。
- */
- TextIconOverlay.prototype.getText = function(){
- return this._text;
- };
-
- /**
- *设置该覆盖物上的文字。
- *@param {String} text 要设置的文字,通常是字母A-Z或数字0-9。
- *@return 无返回值。
- */
- TextIconOverlay.prototype.setText = function(text){
- if(text && (!this._text || (this._text.toString() != text.toString()))){
- this._text = text;
- this._updateText();
- this._updateCss();
- this._updatePosition();
- }
- };
-
- /**
- *获取该覆盖物的位置。
- *@return {Point} 该覆盖物的经纬度坐标。
- */
- TextIconOverlay.prototype.getPosition = function () {
- return this._position;
- };
-
- /**
- *设置该覆盖物的位置。
- *@param {Point} position 要设置的经纬度坐标。
- *@return 无返回值。
- */
- TextIconOverlay.prototype.setPosition = function (position) {
- if(position && (!this._position || !this._position.equals(position))){
- this._position = position;
- this._updatePosition();
- }
- };
-
- /**
- *由文字信息获取风格数组的对应索引值。
- *内部默认的对应函数为文字转换为数字除以10的结果,比如文字8返回索引0,文字25返回索引2.
- *如果需要自定义映射关系,请覆盖该函数。
- *@param {String} text 文字。
- *@param {Array<IconStyle>} styles 一组图标风格。
- *@return {Number} 对应的索引值。
- */
- TextIconOverlay.prototype.getStyleByText = function(text, styles){
- var count = parseInt(text);
- var index = parseInt(count / 10);
- index = Math.max(0, index);
- index = Math.min(index, styles.length - 1);
- return styles[index];
- };
-
- /**
- *更新相应的CSS。
- *@return 无返回值。
- */
- TextIconOverlay.prototype._updateCss = function(){
- if (!this._domElement) {
- return
- }
- var style = this.getStyleByText(this._text, this._styles);
- this._domElement.style.cssText = this._buildCssText(style);
- };
-
- /**
- *更新覆盖物的显示文字。
- *@return 无返回值。
- */
- TextIconOverlay.prototype._updateText = function(){
- if (this._domElement) {
- this._domElement.innerHTML = this._text;
- }
- };
-
- /**
- *调整覆盖物在地图上的位置更新覆盖物的显示文字。
- *@return 无返回值。
- */
- TextIconOverlay.prototype._updatePosition = function(){
- if (this._domElement && this._position) {
- var style = this._domElement.style;
- var pixelPosition= this._map.pointToOverlayPixel(this._position);
- pixelPosition.x -= Math.ceil(parseInt(style.width) / 2);
- pixelPosition.y -= Math.ceil(parseInt(style.height) / 2);
- style.left = pixelPosition.x + "px";
- style.top = pixelPosition.y + "px";
- }
- };
-
- /**
- * 为该覆盖物的HTML元素构建CSS
- * @param {IconStyle} 一个图标的风格。
- * @return {String} 构建完成的CSSTEXT。
- */
- TextIconOverlay.prototype._buildCssText = function(style) {
- //根据style来确定一些默认值
- var url = style['url'];
- var size = style['size'];
- var anchor = style['anchor'];
- var offset = style['offset'];
- var textColor = style['textColor'] || 'black';
- var textSize = style['textSize'] || 10;
-
- var csstext = [];
- if (T.browser["ie"] < 7) {
- csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
- 'sizingMethod=scale,src="' + url + '");');
- } else {
- csstext.push('background-image:url(' + url + ');');
- var backgroundPosition = '0 0';
- (offset instanceof BMap.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px');
- csstext.push('background-position:' + backgroundPosition + ';');
- }
-
- if (size instanceof BMap.Size){
- if (anchor instanceof BMap.Size) {
- if (anchor.height > 0 && anchor.height < size.height) {
- csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;');
- }
- if(anchor.width > 0 && anchor.width < size.width){
- csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;');
- }
- } else {
- csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
- csstext.push('width:' + size.width + 'px; text-align:center;');
- }
- }
-
- csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
- textSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
- return csstext.join('');
- };
-
-
- /**
-
- * 当鼠标点击该覆盖物时会触发该事件
-
- * @name TextIconOverlay#click
-
- * @event
-
- * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
-
- * <br />"<b>type</b> : {String} 事件类型
-
- * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
-
- *
-
- */
-
- /**
-
- * 当鼠标进入该覆盖物区域时会触发该事件
-
- * @name TextIconOverlay#mouseover
-
- * @event
- * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
-
- * <br />"<b>type</b> : {String} 事件类型
-
- * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
-
- * <br />"<b>point</b> : {BMap.Point} 最新添加上的节点BMap.Point对象
-
- * <br />"<b>pixel</b>:{BMap.pixel} 最新添加上的节点BMap.Pixel对象
-
- *
-
- * @example <b>参考示例:</b><br />
-
- * myTextIconOverlay.addEventListener("mouseover", function(e) { alert(e.point); });
-
- */
-
- /**
-
- * 当鼠标离开该覆盖物区域时会触发该事件
-
- * @name TextIconOverlay#mouseout
-
- * @event
-
- * @param {Event Object} e 回调函数会返回event参数,包括以下返回值:
-
- * <br />"<b>type</b> : {String} 事件类型
-
- * <br />"<b>target</b>:{BMapLib.TextIconOverlay} 事件目标
-
- * <br />"<b>point</b> : {BMap.Point} 最新添加上的节点BMap.Point对象
-
- * <br />"<b>pixel</b>:{BMap.pixel} 最新添加上的节点BMap.Pixel对象
-
- *
-
- * @example <b>参考示例:</b><br />
-
- * myTextIconOverlay.addEventListener("mouseout", function(e) { alert(e.point); });
-
- */
-
-
- /**
- * 为该覆盖物绑定一系列事件
- * 当前支持click mouseover mouseout
- * @return 无返回值。
- */
- TextIconOverlay.prototype._bind = function(){
- if (!this._domElement){
- return;
- }
-
- var me = this;
- var map = this._map;
-
- var BaseEvent = T.lang.Event;
- function eventExtend(e, be){
- var elem = e.srcElement || e.target;
- var x = e.clientX || e.pageX;
- var y = e.clientY || e.pageY;
- if (e && be && x && y && elem){
- var offset = T.dom.getPosition(map.getContainer());
- be.pixel = new BMap.Pixel(x - offset.left, y - offset.top);
- be.point = map.pixelToPoint(be.pixel);
- }
- return be;
- }//给事件参数增加pixel和point两个值
-
- T.event.on(this._domElement,"mouseover", function(e){
- me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseover")));
- });
- T.event.on(this._domElement,"mouseout", function(e){
- me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseout")));
- });
- T.event.on(this._domElement,"click", function(e){
- me.dispatchEvent(eventExtend(e, new BaseEvent("onclick")));
- });
- };
-
- return TextIconOverlay;
- });
- });
-
- var TextIconOverlay = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
-
- /**
- * 获取一个扩展的视图范围,把上下左右都扩大一样的像素值。
- * @param {Map} map BMap.Map的实例化对象
- * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象
- * @param {Number} gridSize 要扩大的像素值
- *
- * @return {BMap.Bounds} 返回扩大后的视图范围。
- */
- var getExtendedBounds = function(map, bounds, gridSize){
- bounds = cutBoundsInRange(bounds);
- var pixelNE = map.pointToPixel(bounds.getNorthEast());
- var pixelSW = map.pointToPixel(bounds.getSouthWest());
- pixelNE.x += gridSize;
- pixelNE.y -= gridSize;
- pixelSW.x -= gridSize;
- pixelSW.y += gridSize;
- var newNE = map.pixelToPoint(pixelNE);
- var newSW = map.pixelToPoint(pixelSW);
- return new BMap.Bounds(newSW, newNE);
- };
-
- /**
- * 按照百度地图支持的世界范围对bounds进行边界处理
- * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象
- *
- * @return {BMap.Bounds} 返回不越界的视图范围
- */
- var cutBoundsInRange = function (bounds) {
- var maxX = getRange(bounds.getNorthEast().lng, -180, 180);
- var minX = getRange(bounds.getSouthWest().lng, -180, 180);
- var maxY = getRange(bounds.getNorthEast().lat, -74, 74);
- var minY = getRange(bounds.getSouthWest().lat, -74, 74);
- return new BMap.Bounds(new BMap.Point(minX, minY), new BMap.Point(maxX, maxY));
- };
-
- /**
- * 对单个值进行边界处理。
- * @param {Number} i 要处理的数值
- * @param {Number} min 下边界值
- * @param {Number} max 上边界值
- *
- * @return {Number} 返回不越界的数值
- */
- var getRange = function (i, mix, max) {
- mix && (i = Math.max(i, mix));
- max && (i = Math.min(i, max));
- return i;
- };
-
- /**
- * 判断给定的对象是否为数组
- * @param {Object} source 要测试的对象
- *
- * @return {Boolean} 如果是数组返回true,否则返回false
- */
- var isArray = function (source) {
- return '[object Array]' === Object.prototype.toString.call(source);
- };
-
- /**
- * 返回item在source中的索引位置
- * @param {Object} item 要测试的对象
- * @param {Array} source 数组
- *
- * @return {Number} 如果在数组内,返回索引,否则返回-1
- */
- var indexOf = function(item, source){
- var index = -1;
- if(isArray(source)){
- if (source.indexOf) {
- index = source.indexOf(item);
- } else {
- for (var i = 0, m; m = source[i]; i++) {
- if (m === item) {
- index = i;
- break;
- }
- }
- }
- }
- return index;
- };
-
- /**
- *@exports MarkerClusterer as BMapLib.MarkerClusterer
- */
-
- /**
- * MarkerClusterer
- * @class 用来解决加载大量点要素到地图上产生覆盖现象的问题,并提高性能
- * @constructor
- * @param {Map} map 地图的一个实例。
- * @param {Json Object} options 可选参数,可选项包括:<br />
- * markers {Array<Marker>} 要聚合的标记数组<br />
- * girdSize {Number} 聚合计算时网格的像素大小,默认60<br />
- * maxZoom {Number} 最大的聚合级别,大于该级别就不进行相应的聚合<br />
- * minClusterSize {Number} 最小的聚合数量,小于该数量的不能成为一个聚合,默认为2<br />
- * isAverangeCenter {Boolean} 聚合点的落脚位置是否是所有聚合在内点的平均值,默认为否,落脚在聚合内的第一个点<br />
- * styles {Array<IconStyle>} 自定义聚合后的图标风格,请参考TextIconOverlay类<br />
- */
- var MarkerClusterer = function(map, options){
- try {
- BMap;
- } catch (e) {
- throw Error('Baidu Map JS API is not ready yet!');
- }
- if (!map){
- return;
- }
- this._map = map;
- this._markers = [];
- this._clusters = [];
-
- var opts = options || {};
- this._gridSize = opts["gridSize"] || 60;
- this._maxZoom = opts["maxZoom"] || 18;
- this._minClusterSize = opts["minClusterSize"] || 2;
- this._isAverageCenter = false;
- if (opts['isAverageCenter'] != undefined) {
- this._isAverageCenter = opts['isAverageCenter'];
- }
- this._styles = opts["styles"] || [];
-
- var that = this;
- this._map.addEventListener("zoomend",function(){
- that._redraw();
- });
-
- this._map.addEventListener("moveend",function(){
- that._redraw();
- });
-
- var mkrs = opts["markers"];
- isArray(mkrs) && this.addMarkers(mkrs);
- };
-
- /**
- * 添加要聚合的标记数组。
- * @param {Array<Marker>} markers 要聚合的标记数组
- *
- * @return 无返回值。
- */
- MarkerClusterer.prototype.addMarkers = function(markers){
- if (!markers.length) {
- return
- }
- for(var i = 0, len = markers.length; i <len ; i++){
- this._pushMarkerTo(markers[i]);
- }
- this._createClusters();
- };
-
- /**
- * 把一个标记添加到要聚合的标记数组中
- * @param {BMap.Marker} marker 要添加的标记
- *
- * @return 无返回值。
- */
- MarkerClusterer.prototype._pushMarkerTo = function(marker){
- var index = indexOf(marker, this._markers);
- if(index === -1){
- marker.isInCluster = false;
- this._markers.push(marker);//Marker拖放后enableDragging不做变化,忽略
- }
- };
-
- /**
- * 添加一个聚合的标记。
- * @param {BMap.Marker} marker 要聚合的单个标记。
- * @return 无返回值。
- */
- MarkerClusterer.prototype.addMarker = function(marker) {
- this._pushMarkerTo(marker);
- this._createClusters();
- };
-
- /**
- * 根据所给定的标记,创建聚合点
- * @return 无返回值
- */
- MarkerClusterer.prototype._createClusters = function(){
- var mapBounds = this._map.getBounds();
- if (!mapBounds.getCenter()) {
- return
- }
- var extendedBounds = getExtendedBounds(this._map, mapBounds, this._gridSize);
- for(var i = 0, marker; marker = this._markers[i]; i++){
- if(!marker.isInCluster && extendedBounds.containsPoint(marker.getPosition()) ){
- this._addToClosestCluster(marker);
- }
- }
- };
-
- /**
- * 根据标记的位置,把它添加到最近的聚合中
- * @param {BMap.Marker} marker 要进行聚合的单个标记
- *
- * @return 无返回值。
- */
- MarkerClusterer.prototype._addToClosestCluster = function (marker){
- var distance = 4000000;
- var clusterToAddTo = null;
- var position = marker.getPosition();
- for(var i = 0, cluster; cluster = this._clusters[i]; i++){
- var center = cluster.getCenter();
- if(center){
- var d = this._map.getDistance(center, marker.getPosition());
- if(d < distance){
- distance = d;
- clusterToAddTo = cluster;
- }
- }
- }
-
- if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)){
- clusterToAddTo.addMarker(marker);
- } else {
- var cluster = new Cluster(this);
- cluster.addMarker(marker);
- this._clusters.push(cluster);
- }
- };
-
- /**
- * 清除上一次的聚合的结果
- * @return 无返回值。
- */
- MarkerClusterer.prototype._clearLastClusters = function(){
- for(var i = 0, cluster; cluster = this._clusters[i]; i++){
- cluster.remove();
- }
- this._clusters = [];//置空Cluster数组
- this._removeMarkersFromCluster();//把Marker的cluster标记设为false
- };
-
- /**
- * 清除某个聚合中的所有标记
- * @return 无返回值
- */
- MarkerClusterer.prototype._removeMarkersFromCluster = function(){
- for(var i = 0, marker; marker = this._markers[i]; i++){
- marker.isInCluster = false;
- }
- };
-
- /**
- * 把所有的标记从地图上清除
- * @return 无返回值
- */
- MarkerClusterer.prototype._removeMarkersFromMap = function(){
- for(var i = 0, marker; marker = this._markers[i]; i++){
- marker.isInCluster = false;
- var label = marker.getLabel();
- this._map.removeOverlay(marker);
- marker.setLabel(label);
- }
- };
-
- /**
- * 删除单个标记
- * @param {BMap.Marker} marker 需要被删除的marker
- *
- * @return {Boolean} 删除成功返回true,否则返回false
- */
- MarkerClusterer.prototype._removeMarker = function(marker) {
- var index = indexOf(marker, this._markers);
- if (index === -1) {
- return false;
- }
- this._map.removeOverlay(marker);
- this._markers.splice(index, 1);
- return true;
- };
-
- /**
- * 删除单个标记
- * @param {BMap.Marker} marker 需要被删除的marker
- *
- * @return {Boolean} 删除成功返回true,否则返回false
- */
- MarkerClusterer.prototype.removeMarker = function(marker) {
- var success = this._removeMarker(marker);
- if (success) {
- this._clearLastClusters();
- this._createClusters();
- }
- return success;
- };
-
- /**
- * 删除一组标记
- * @param {Array<BMap.Marker>} markers 需要被删除的marker数组
- *
- * @return {Boolean} 删除成功返回true,否则返回false
- */
- MarkerClusterer.prototype.removeMarkers = function(markers) {
- var success = false;
- for (var i = 0; i < markers.length; i++) {
- var r = this._removeMarker(markers[i]);
- success = success || r;
- }
-
- if (success) {
- this._clearLastClusters();
- this._createClusters();
- }
- return success;
- };
-
- /**
- * 从地图上彻底清除所有的标记
- * @return 无返回值
- */
- MarkerClusterer.prototype.clearMarkers = function() {
- this._clearLastClusters();
- this._removeMarkersFromMap();
- this._markers = [];
- };
-
- /**
- * 重新生成,比如改变了属性等
- * @return 无返回值
- */
- MarkerClusterer.prototype._redraw = function () {
- this._clearLastClusters();
- this._createClusters();
- };
-
- /**
- * 获取网格大小
- * @return {Number} 网格大小
- */
- MarkerClusterer.prototype.getGridSize = function() {
- return this._gridSize;
- };
-
- /**
- * 设置网格大小
- * @param {Number} size 网格大小
- * @return 无返回值
- */
- MarkerClusterer.prototype.setGridSize = function(size) {
- this._gridSize = size;
- this._redraw();
- };
-
- /**
- * 获取聚合的最大缩放级别。
- * @return {Number} 聚合的最大缩放级别。
- */
- MarkerClusterer.prototype.getMaxZoom = function() {
- return this._maxZoom;
- };
-
- /**
- * 设置聚合的最大缩放级别
- * @param {Number} maxZoom 聚合的最大缩放级别
- * @return 无返回值
- */
- MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
- this._maxZoom = maxZoom;
- this._redraw();
- };
-
- /**
- * 获取聚合的样式风格集合
- * @return {Array<IconStyle>} 聚合的样式风格集合
- */
- MarkerClusterer.prototype.getStyles = function() {
- return this._styles;
- };
-
- /**
- * 设置聚合的样式风格集合
- * @param {Array<IconStyle>} styles 样式风格数组
- * @return 无返回值
- */
- MarkerClusterer.prototype.setStyles = function(styles) {
- this._styles = styles;
- this._redraw();
- };
-
- /**
- * 获取单个聚合的最小数量。
- * @return {Number} 单个聚合的最小数量。
- */
- MarkerClusterer.prototype.getMinClusterSize = function() {
- return this._minClusterSize;
- };
-
- /**
- * 设置单个聚合的最小数量。
- * @param {Number} size 单个聚合的最小数量。
- * @return 无返回值。
- */
- MarkerClusterer.prototype.setMinClusterSize = function(size) {
- this._minClusterSize = size;
- this._redraw();
- };
-
- /**
- * 获取单个聚合的落脚点是否是聚合内所有标记的平均中心。
- * @return {Boolean} true或false。
- */
- MarkerClusterer.prototype.isAverageCenter = function() {
- return this._isAverageCenter;
- };
-
- /**
- * 获取聚合的Map实例。
- * @return {Map} Map的示例。
- */
- MarkerClusterer.prototype.getMap = function() {
- return this._map;
- };
-
- /**
- * 获取所有的标记数组。
- * @return {Array<Marker>} 标记数组。
- */
- MarkerClusterer.prototype.getMarkers = function() {
- return this._markers;
- };
-
- /**
- * 获取聚合的总数量。
- * @return {Number} 聚合的总数量。
- */
- MarkerClusterer.prototype.getClustersCount = function() {
- var count = 0;
- for(var i = 0, cluster; cluster = this._clusters[i]; i++){
- cluster.isReal() && count++;
- }
- return count;
- };
-
- /**
- * @ignore
- * Cluster
- * @class 表示一个聚合对象,该聚合,包含有N个标记,这N个标记组成的范围,并有予以显示在Map上的TextIconOverlay等。
- * @constructor
- * @param {MarkerClusterer} markerClusterer 一个标记聚合器示例。
- */
- function Cluster(markerClusterer){
- this._markerClusterer = markerClusterer;
- this._map = markerClusterer.getMap();
- this._minClusterSize = markerClusterer.getMinClusterSize();
- this._isAverageCenter = markerClusterer.isAverageCenter();
- this._center = null;//落脚位置
- this._markers = [];//这个Cluster中所包含的markers
- this._gridBounds = null;//以中心点为准,向四边扩大gridSize个像素的范围,也即网格范围
- this._isReal = false; //真的是个聚合
-
- this._clusterMarker = new TextIconOverlay(this._center, this._markers.length, {"styles":this._markerClusterer.getStyles()});
- //this._map.addOverlay(this._clusterMarker);
- }
-
- /**
- * 向该聚合添加一个标记。
- * @param {Marker} marker 要添加的标记。
- * @return 无返回值。
- */
- Cluster.prototype.addMarker = function(marker){
- if(this.isMarkerInCluster(marker)){
- return false;
- }//也可用marker.isInCluster判断,外面判断OK,这里基本不会命中
-
- if (!this._center){
- this._center = marker.getPosition();
- this.updateGridBounds();//
- } else {
- if(this._isAverageCenter){
- var l = this._markers.length + 1;
- var lat = (this._center.lat * (l - 1) + marker.getPosition().lat) / l;
- var lng = (this._center.lng * (l - 1) + marker.getPosition().lng) / l;
- this._center = new BMap.Point(lng, lat);
- this.updateGridBounds();
- }//计算新的Center
- }
-
- marker.isInCluster = true;
- this._markers.push(marker);
-
- var len = this._markers.length;
- if(len < this._minClusterSize ){
- this._map.addOverlay(marker);
- //this.updateClusterMarker();
- return true;
- } else if (len === this._minClusterSize) {
- for (var i = 0; i < len; i++) {
- var label = this._markers[i].getLabel();
- this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]);
- this._markers[i].setLabel(label);
- }
-
- }
- this._map.addOverlay(this._clusterMarker);
- this._isReal = true;
- this.updateClusterMarker();
- return true;
- };
-
- /**
- * 判断一个标记是否在该聚合中。
- * @param {Marker} marker 要判断的标记。
- * @return {Boolean} true或false。
- */
- Cluster.prototype.isMarkerInCluster= function(marker){
- if (this._markers.indexOf) {
- return this._markers.indexOf(marker) != -1;
- } else {
- for (var i = 0, m; m = this._markers[i]; i++) {
- if (m === marker) {
- return true;
- }
- }
- }
- return false;
- };
-
- /**
- * 判断一个标记是否在该聚合网格范围中。
- * @param {Marker} marker 要判断的标记。
- * @return {Boolean} true或false。
- */
- Cluster.prototype.isMarkerInClusterBounds = function(marker) {
- return this._gridBounds.containsPoint(marker.getPosition());
- };
-
- Cluster.prototype.isReal = function(marker) {
- return this._isReal;
- };
-
- /**
- * 更新该聚合的网格范围。
- * @return 无返回值。
- */
- Cluster.prototype.updateGridBounds = function() {
- var bounds = new BMap.Bounds(this._center, this._center);
- this._gridBounds = getExtendedBounds(this._map, bounds, this._markerClusterer.getGridSize());
- };
-
- /**
- * 更新该聚合的显示样式,也即TextIconOverlay。
- * @return 无返回值。
- */
- Cluster.prototype.updateClusterMarker = function () {
- if (this._map.getZoom() > this._markerClusterer.getMaxZoom()) {
- this._clusterMarker && this._map.removeOverlay(this._clusterMarker);
- for (var i = 0, marker; marker = this._markers[i]; i++) {
- this._map.addOverlay(marker);
- }
- return;
- }
-
- if (this._markers.length < this._minClusterSize) {
- this._clusterMarker.hide();
- return;
- }
-
- this._clusterMarker.setPosition(this._center);
-
- this._clusterMarker.setText(this._markers.length);
-
- this._clusterMarker.addEventListener && !this._clusterMarker._hasClickEvent && this._clusterMarker.addEventListener("click", function(event){
- this._clusterMarker._hasClickEvent = true;
- this._markers && this._map.setViewport(this.getBounds());
- }.bind(this));
- };
-
- /**
- * 删除该聚合。
- * @return 无返回值。
- */
- Cluster.prototype.remove = function(){
- for (var i = 0, m; m = this._markers[i]; i++) {
- var label = this._markers[i].getLabel();
- this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]);
- this._markers[i].setLabel(label);
- }//清除散的标记点
- this._map.removeOverlay(this._clusterMarker);
- this._markers.length = 0;
- delete this._markers;
- };
-
- /**
- * 获取该聚合所包含的所有标记的最小外接矩形的范围。
- * @return {BMap.Bounds} 计算出的范围。
- */
- Cluster.prototype.getBounds = function() {
- var bounds = new BMap.Bounds(this._center,this._center);
- for (var i = 0, marker; marker = this._markers[i]; i++) {
- bounds.extend(marker.getPosition());
- }
- return bounds;
- };
-
- /**
- * 获取该聚合的落脚点。
- * @return {BMap.Point} 该聚合的落脚点。
- */
- Cluster.prototype.getCenter = function() {
- return this._center;
- };
-
- return MarkerClusterer;
-
- })));
-
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("DuR2")))
-
- /***/ }),
-
- /***/ "7AC4":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_factory_js__ = __webpack_require__("Brla");
-
-
-
-
- /* harmony default export */ __webpack_exports__["a"] = ({
- name: 'bm-scale',
- render: function render() {},
-
- mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('control')],
- props: {
- anchor: {
- type: String
- },
- offset: {
- type: Object
- }
- },
- watch: {
- anchor: function anchor() {
- this.reload();
- },
- offset: function offset() {
- this.reload();
- }
- },
- methods: {
- load: function load() {
- var BMap = this.BMap,
- map = this.map,
- anchor = this.anchor,
- offset = this.offset;
-
- this.originInstance = new BMap.ScaleControl({
- anchor: global[anchor],
- offset: offset && Object(__WEBPACK_IMPORTED_MODULE_1__base_factory_js__["d" /* createSize */])(BMap, offset)
- });
- map.addControl(this.originInstance);
- }
- }
- });
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
-
- /***/ }),
-
- /***/ "8Hu+":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__ = __webpack_require__("HpPs");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__base_factory_js__ = __webpack_require__("Brla");
- //
- //
- //
- //
- //
- //
-
-
-
-
-
- /* harmony default export */ __webpack_exports__["a"] = ({
- name: 'bm-info-window',
- mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('overlay')],
- props: {
- show: {
- type: Boolean
- },
- position: {
- type: Object
- },
- title: {
- type: String
- },
- width: {
- type: Number
- },
- height: {
- type: Number
- },
- maxWidth: {
- type: Number
- },
- offset: {
- type: Object
- },
- maximize: {
- type: Boolean
- },
- autoPan: {
- type: Boolean
- },
- closeOnClick: {
- type: Boolean,
- default: true
- },
- message: {
- type: String
- }
- },
- watch: {
- show: function show(val) {
- val ? this.openInfoWindow() : this.closeInfoWindow();
- },
- 'position.lng': function positionLng(val, oldVal) {
- this.reload();
- },
- 'position.lat': function positionLat(val, oldVal) {
- this.reload();
- },
- 'offset.width': function offsetWidth(val, oldVal) {
- this.reload();
- },
- 'offset.height': function offsetHeight(val) {
- this.reload();
- },
- maxWidth: function maxWidth() {
- this.reload();
- },
- width: function width(val) {
- this.originInstance.setWidth(val);
- },
- height: function height(val) {
- this.originInstance.setHeight(val);
- },
- title: function title(val) {
- this.originInstance.setTitle(val);
- },
- maximize: function maximize(val) {
- val ? this.originInstance.enableMaximize() : this.originInstance.disableMaximize();
- },
- autoPan: function autoPan(val) {
- val ? this.originInstance.enableAutoPan() : this.originInstance.disableAutoPan();
- },
- closeOnClick: function closeOnClick(val) {
- val ? this.originInstance.enableCloseOnClick() : this.originInstance.disableCloseOnClick();
- }
- },
- methods: {
- redraw: function redraw() {
- this.originInstance.redraw();
- },
- load: function load() {
- var BMap = this.BMap,
- map = this.map,
- show = this.show,
- title = this.title,
- width = this.width,
- height = this.height,
- maxWidth = this.maxWidth,
- offset = this.offset,
- autoPan = this.autoPan,
- closeOnClick = this.closeOnClick,
- message = this.message,
- maximize = this.maximize,
- bindObserver = this.bindObserver,
- $parent = this.$parent;
-
- var $content = this.$el;
- var overlay = new BMap.InfoWindow($content, {
- width: width,
- height: height,
- title: title,
- maxWidth: maxWidth,
- offset: Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["d" /* createSize */])(BMap, offset),
- enableAutoPan: autoPan,
- enableCloseOnClick: closeOnClick,
- enableMessage: typeof message === 'undefined',
- message: message
- });
-
- maximize ? overlay.enableMaximize() : overlay.disableMaximize();
- __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__["a" /* default */].call(this, overlay);
- this.originInstance = overlay;
- overlay.redraw();[].forEach.call($content.querySelectorAll('img'), function ($img) {
- $img.onload = function () {
- return overlay.redraw();
- };
- });
- bindObserver();
- this.$container = $parent.originInstance && $parent.originInstance.openInfoWindow ? $parent.originInstance : map;
- show && this.openInfoWindow();
- },
- bindObserver: function bindObserver() {
- var MutationObserver = global.MutationObserver;
- if (!MutationObserver) {
- return;
- }
- var $el = this.$el,
- originInstance = this.originInstance;
-
- this.observer = new MutationObserver(function (mutations) {
- return originInstance.redraw();
- });
- this.observer.observe($el, { attributes: true, childList: true, characterData: true, subtree: true });
- },
- openInfoWindow: function openInfoWindow() {
- var BMap = this.BMap,
- $container = this.$container,
- position = this.position,
- originInstance = this.originInstance;
-
- $container.openInfoWindow(originInstance, Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["c" /* createPoint */])(BMap, position));
- },
- closeInfoWindow: function closeInfoWindow() {
- this.$container.closeInfoWindow(this.originInstance);
- }
- }
- });
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
-
- /***/ }),
-
- /***/ "9LO+":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__("Zrlr");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
-
- var types = {
- control: {
- unload: 'removeControl'
- },
- layer: {
- unload: 'removeTileLayer'
- },
- overlay: {
- unload: 'removeOverlay'
- },
- contextMenu: {
- unload: 'removeContextMenu'
- }
- };
-
- var getParent = function getParent($component) {
- return $component.abstract || $component.$el === $component.$children[0].$el ? getParent($component.$parent) : $component;
- };
-
- function destroyInstance() {
- var unload = this.unload,
- renderByParent = this.renderByParent,
- $parent = this.$parent;
-
- if (renderByParent) {
- $parent.reload();
- }
- unload();
- }
-
- var Mixin = function Mixin(prop) {
- __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Mixin);
-
- this.methods = {
- ready: function ready() {
- var $parent = getParent(this.$parent);
- var BMap = this.BMap = $parent.BMap;
- var map = this.map = $parent.map;
- this.load();
- this.$emit('ready', {
- BMap: BMap,
- map: map
- });
- },
- transmitEvent: function transmitEvent(e) {
- this.$emit(e.type.replace(/^on/, ''), e);
- },
- reload: function reload() {
- var _this = this;
-
- this && this.BMap && this.$nextTick(function () {
- _this.unload();
- _this.$nextTick(_this.load);
- });
- },
- unload: function unload() {
- var map = this.map,
- originInstance = this.originInstance;
-
- try {
- switch (prop.type) {
- case 'search':
- return originInstance.clearResults();
- case 'autoComplete':
- case 'lushu':
- return originInstance.dispose();
- case 'markerClusterer':
- return originInstance.clearMarkers();
- default:
- map[types[prop.type].unload](originInstance);
- }
- } catch (e) {}
- }
- };
- this.computed = {
- renderByParent: function renderByParent() {
- return this.$parent.preventChildrenRender;
- }
- };
- this.mounted = function () {
- var $parent = getParent(this.$parent);
- var map = $parent.map;
- var ready = this.ready;
-
- map ? ready() : $parent.$on('ready', ready);
- };
- this.destroyed = destroyInstance;
- this.beforeDestroy = destroyInstance;
- };
-
- /* harmony default export */ __webpack_exports__["a"] = (function (type) {
- return new Mixin({ type: type });
- });
-
- /***/ }),
-
- /***/ "Brla":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["c"] = createPoint;
- /* unused harmony export createPixel */
- /* unused harmony export createBounds */
- /* harmony export (immutable) */ __webpack_exports__["d"] = createSize;
- /* harmony export (immutable) */ __webpack_exports__["a"] = createIcon;
- /* harmony export (immutable) */ __webpack_exports__["b"] = createLabel;
- function createPoint(BMap) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var lng = options.lng,
- lat = options.lat;
-
- return new BMap.Point(lng, lat);
- }
-
- function createPixel(BMap) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var x = options.x,
- y = options.y;
-
- return new BMap.Pixel(x, y);
- }
-
- function createBounds(BMap) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var sw = options.sw,
- ne = options.ne;
-
- return new BMap.Bounds(createPoint(BMap, sw), createPoint(BMap, ne));
- }
-
- function createSize(BMap) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var width = options.width,
- height = options.height;
-
- return new BMap.Size(width, height);
- }
-
- function createIcon(BMap) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var url = options.url,
- size = options.size,
- _options$opts = options.opts,
- opts = _options$opts === undefined ? {} : _options$opts;
-
- return new BMap.Icon(url, createSize(BMap, size), {
- anchor: opts.anchor && createSize(BMap, opts.anchor),
- imageSize: opts.imageSize && createSize(BMap, opts.imageSize),
- imageOffset: opts.imageOffset && createSize(BMap, opts.imageOffset),
- infoWindowAnchor: opts.infoWindowAnchor && createSize(BMap, opts.infoWindowAnchor),
- printImageUrl: opts.printImageUrl
- });
- }
-
- function createLabel(BMap) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var content = options.content,
- opts = options.opts;
-
- return new BMap.Label(content, {
- offset: opts.offset && createSize(BMap, opts.offset),
- position: opts.position && createPoint(BMap, opts.position),
- enableMassClear: opts.enableMassClear
- });
- }
-
- /***/ }),
-
- /***/ "HpPs":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
-
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/base/events.js
- /* harmony default export */ var events = ({
- 'bm-map': ['click', 'dblclick', 'rightclick', 'rightdblclick', 'maptypechange', 'mousemove', 'mouseover', 'mouseout', 'movestart', 'moving', 'moveend', 'zoomstart', 'zoomend', 'addoverlay', 'addcontrol', 'removecontrol', 'removeoverlay', 'clearoverlays', 'dragstart', 'dragging', 'dragend', 'addtilelayer', 'removetilelayer', 'load', 'resize', 'hotspotclick', 'hotspotover', 'hotspotout', 'tilesloaded', 'touchstart', 'touchmove', 'touchend', 'longpress'],
- 'bm-geolocation': ['locationSuccess', 'locationError'],
- 'bm-overview-map': ['viewchanged', 'viewchanging'],
- 'bm-marker': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'infowindowclose', 'infowindowopen', 'dragstart', 'dragging', 'dragend', 'rightclick'],
- 'bm-polyline': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate'],
- 'bm-polygon': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate'],
- 'bm-circle': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate'],
- 'bm-label': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'rightclick'],
- 'bm-info-window': ['close', 'open', 'maximize', 'restore', 'clickclose'],
- 'bm-ground': ['click', 'dblclick'],
- 'bm-autocomplete': ['onconfirm', 'onhighlight'],
- 'bm-point-collection': ['click', 'mouseover', 'mouseout']
- });
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/base/bindEvent.js
-
-
- /* harmony default export */ var bindEvent = __webpack_exports__["a"] = (function (instance, eventList) {
- var _this = this;
-
- var ev = eventList || events[this.$options.name];
- ev && ev.forEach(function (event) {
- var hasOn = event.slice(0, 2) === 'on';
- var eventName = hasOn ? event.slice(2) : event;
- var listener = _this.$listeners[eventName];
- listener && instance.addEventListener(event, listener.fns);
- });
- });
-
- /***/ }),
-
- /***/ "LVSh":
- /***/ (function(module, exports) {
-
- // removed by extract-text-webpack-plugin
-
- /***/ }),
-
- /***/ "NTBm":
- /***/ (function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__.p + "static/img/yellow.762c207.gif";
-
- /***/ }),
-
- /***/ "PVXw":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__ = __webpack_require__("HpPs");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__base_factory_js__ = __webpack_require__("Brla");
- //
- //
- //
- //
- //
- //
-
-
-
-
-
- /* harmony default export */ __webpack_exports__["a"] = ({
- name: 'bm-marker',
- mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('overlay')],
- props: {
- position: {},
- offset: {},
- icon: {},
- massClear: {
- type: Boolean,
- default: true
- },
- dragging: {
- type: Boolean,
- default: false
- },
- clicking: {
- type: Boolean,
- default: true
- },
- raiseOnDrag: {
- type: Boolean,
- default: false
- },
- draggingCursor: {
- type: String
- },
- rotation: {
- type: Number
- },
- shadow: {
- type: Object
- },
- title: {
- type: String
- },
- label: {
- type: Object
- },
- animation: {
- type: String
- },
- top: {
- type: Boolean,
- default: false
- },
- zIndex: {
- type: Number,
- default: 0
- }
- },
- watch: {
- 'position.lng': function positionLng(val, oldVal) {
- var BMap = this.BMap,
- originInstance = this.originInstance,
- position = this.position,
- renderByParent = this.renderByParent,
- $parent = this.$parent;
-
- if (val !== oldVal && val >= -180 && val <= 180) {
- originInstance.setPosition(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["c" /* createPoint */])(BMap, { lng: val, lat: position.lat }));
- }
- renderByParent && $parent.reload();
- },
- 'position.lat': function positionLat(val, oldVal) {
- var BMap = this.BMap,
- originInstance = this.originInstance,
- position = this.position,
- renderByParent = this.renderByParent,
- $parent = this.$parent;
-
- if (val !== oldVal && val >= -74 && val <= 74) {
- originInstance.setPosition(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["c" /* createPoint */])(BMap, { lng: position.lng, lat: val }));
- }
- renderByParent && $parent.reload();
- },
- 'offset.width': function offsetWidth(val, oldVal) {
- var BMap = this.BMap,
- originInstance = this.originInstance;
-
- if (val !== oldVal) {
- originInstance.setOffset(new BMap.Size(val, this.offset.height));
- }
- },
- 'offset.height': function offsetHeight(val, oldVal) {
- var BMap = this.BMap,
- originInstance = this.originInstance;
-
- if (val !== oldVal) {
- originInstance.setOffset(new BMap.Size(this.offset.width, val));
- }
- },
-
- icon: {
- deep: true,
- handler: function handler(val) {
- var BMap = this.BMap,
- originInstance = this.originInstance,
- rotation = this.rotation;
-
- originInstance && originInstance.setIcon(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["a" /* createIcon */])(BMap, val));
- rotation && originInstance && originInstance.setRotation(rotation);
- }
- },
- massClear: function massClear(val) {
- val ? this.originInstance.enableMassClear() : this.originInstance.disableMassClear();
- },
- dragging: function dragging(val) {
- val ? this.originInstance.enableDragging() : this.originInstance.disableDragging();
- },
- clicking: function clicking() {
- this.reload();
- },
- raiseOnDrag: function raiseOnDrag() {
- this.reload();
- },
- draggingCursor: function draggingCursor(val) {
- this.originInstance.setDraggingCursor(val);
- },
- rotation: function rotation(val) {
- this.originInstance.setRotation(val);
- },
- shadow: function shadow(val) {
- this.originInstance.setShadow(val);
- },
- title: function title(val) {
- this.originInstance.setTitle(val);
- },
- label: function label(val) {
- this.reload();
- },
- animation: function animation(val) {
- this.originInstance.setAnimation(global[val]);
- },
- top: function top(val) {
- this.originInstance.setTop(val);
- },
- zIndex: function zIndex(val) {
- this.originInstance.setZIndex(val);
- }
- },
- methods: {
- load: function load() {
- var BMap = this.BMap,
- map = this.map,
- position = this.position,
- offset = this.offset,
- icon = this.icon,
- massClear = this.massClear,
- dragging = this.dragging,
- clicking = this.clicking,
- raiseOnDrag = this.raiseOnDrag,
- draggingCursor = this.draggingCursor,
- rotation = this.rotation,
- shadow = this.shadow,
- title = this.title,
- label = this.label,
- animation = this.animation,
- top = this.top,
- renderByParent = this.renderByParent,
- $parent = this.$parent,
- zIndex = this.zIndex;
-
- var overlay = new BMap.Marker(new BMap.Point(position.lng, position.lat), {
- offset: offset,
- icon: icon && Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["a" /* createIcon */])(BMap, icon),
- enableMassClear: massClear,
- enableDragging: dragging,
- enableClicking: clicking,
- raiseOnDrag: raiseOnDrag,
- draggingCursor: draggingCursor,
- rotation: rotation,
- shadow: shadow,
- title: title
- });
- this.originInstance = overlay;
- label && overlay && overlay.setLabel(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["b" /* createLabel */])(BMap, label));
- overlay.setTop(top);
- overlay.setZIndex(zIndex);
- __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__["a" /* default */].call(this, overlay);
- if (renderByParent) {
- $parent.reload();
- } else {
- map.addOverlay(overlay);
- }
- overlay.setAnimation(global[animation]);
- }
- }
- });
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
-
- /***/ }),
-
- /***/ "S4eb":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* unused harmony export isPoint */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return checkType; });
- /* unused harmony export getPosition */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__factory__ = __webpack_require__("Brla");
-
-
- var isPoint = function isPoint(obj) {
- return obj.lng && obj.lat;
- };
- var checkType = function checkType(val) {
- return Object.prototype.toString.call(val).slice(8, -1);
- };
-
- var getPosition = function getPosition(BMap, point) {
- return isPoint(point) ? Object(__WEBPACK_IMPORTED_MODULE_0__factory__["c" /* createPoint */])(BMap, point) : point;
- };
-
- /***/ }),
-
- /***/ "SP3F":
- /***/ (function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__.p + "static/img/red.6dbe9e9.gif";
-
- /***/ }),
-
- /***/ "Txow":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise__ = __webpack_require__("//Fk");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__ = __webpack_require__("BO1k");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__base_bindEvent_js__ = __webpack_require__("HpPs");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__base_util_js__ = __webpack_require__("S4eb");
-
-
- //
- //
- //
- //
- //
- //
- //
- //
-
-
-
-
- /* harmony default export */ __webpack_exports__["a"] = ({
- name: 'bm-map',
- props: {
- ak: {
- type: String
- },
- center: {
- type: [Object, String]
- },
- zoom: {
- type: Number
- },
- minZoom: {
- type: Number
- },
- maxZoom: {
- type: Number
- },
- highResolution: {
- type: Boolean,
- default: true
- },
- mapClick: {
- type: Boolean,
- default: true
- },
- mapType: {
- type: String
- },
- dragging: {
- type: Boolean,
- default: true
- },
- scrollWheelZoom: {
- type: Boolean,
- default: false
- },
- doubleClickZoom: {
- type: Boolean,
- default: true
- },
- keyboard: {
- type: Boolean,
- default: true
- },
- inertialDragging: {
- type: Boolean,
- default: true
- },
- continuousZoom: {
- type: Boolean,
- default: true
- },
- pinchToZoom: {
- type: Boolean,
- default: true
- },
- autoResize: {
- type: Boolean,
- default: true
- },
- theme: {
- type: Array
- },
- mapStyle: {
- type: Object
- }
- },
- watch: {
- center: function center(val, oldVal) {
- var map = this.map,
- zoom = this.zoom;
-
- if (Object(__WEBPACK_IMPORTED_MODULE_3__base_util_js__["a" /* checkType */])(val) === 'String' && val !== oldVal) {
- map.centerAndZoom(val, zoom);
- }
- },
- 'center.lng': function centerLng(val, oldVal) {
- var BMap = this.BMap,
- map = this.map,
- zoom = this.zoom,
- center = this.center;
-
- if (val !== oldVal && val >= -180 && val <= 180) {
- map.centerAndZoom(new BMap.Point(val, center.lat), zoom);
- }
- },
- 'center.lat': function centerLat(val, oldVal) {
- var BMap = this.BMap,
- map = this.map,
- zoom = this.zoom,
- center = this.center;
-
- if (val !== oldVal && val >= -74 && val <= 74) {
- map.centerAndZoom(new BMap.Point(center.lng, val), zoom);
- }
- },
- zoom: function zoom(val, oldVal) {
- var map = this.map;
-
- if (val !== oldVal && val >= 3 && val <= 19) {
- map.setZoom(val);
- }
- },
- minZoom: function minZoom(val) {
- var map = this.map;
-
- map.setMinZoom(val);
- },
- maxZoom: function maxZoom(val) {
- var map = this.map;
-
- map.setMaxZoom(val);
- },
- highResolution: function highResolution() {
- this.reset();
- },
- mapClick: function mapClick() {
- this.reset();
- },
- mapType: function mapType(val) {
- var map = this.map;
-
- map.setMapType(global[val]);
- },
- dragging: function dragging(val) {
- var map = this.map;
-
- val ? map.enableDragging() : map.disableDragging();
- },
- scrollWheelZoom: function scrollWheelZoom(val) {
- var map = this.map;
-
- val ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
- },
- doubleClickZoom: function doubleClickZoom(val) {
- var map = this.map;
-
- val ? map.enableDoubleClickZoom() : map.disableDoubleClickZoom();
- },
- keyboard: function keyboard(val) {
- var map = this.map;
-
- val ? map.enableKeyboard() : map.disableKeyboard();
- },
- inertialDragging: function inertialDragging(val) {
- var map = this.map;
-
- val ? map.enableInertialDragging() : map.disableInertialDragging();
- },
- continuousZoom: function continuousZoom(val) {
- var map = this.map;
-
- val ? map.enableContinuousZoom() : map.disableContinuousZoom();
- },
- pinchToZoom: function pinchToZoom(val) {
- var map = this.map;
-
- val ? map.enablePinchToZoom() : map.disablePinchToZoom();
- },
- autoResize: function autoResize(val) {
- var map = this.map;
-
- val ? map.enableAutoResize() : map.disableAutoResize();
- },
- theme: function theme(val) {
- var map = this.map;
-
- map.setMapStyle({ styleJson: val });
- },
-
- 'mapStyle.features': {
- handler: function handler(val, oldVal) {
- var map = this.map,
- mapStyle = this.mapStyle;
- var style = mapStyle.style,
- styleJson = mapStyle.styleJson;
-
- map.setMapStyle({
- styleJson: styleJson,
- features: val,
- style: style
- });
- },
-
- deep: true
- },
- 'mapStyle.style': function mapStyleStyle(val, oldVal) {
- var map = this.map,
- mapStyle = this.mapStyle;
- var features = mapStyle.features,
- styleJson = mapStyle.styleJson;
-
- map.setMapStyle({
- styleJson: styleJson,
- features: features,
- style: val
- });
- },
-
- 'mapStyle.styleJson': {
- handler: function handler(val, oldVal) {
- var map = this.map,
- mapStyle = this.mapStyle;
- var features = mapStyle.features,
- style = mapStyle.style;
-
- map.setMapStyle({
- styleJson: val,
- features: features,
- style: style
- });
- },
-
- deep: true
- },
- mapStyle: function mapStyle(val) {
- var map = this.map,
- theme = this.theme;
-
- !theme && map.setMapStyle(val);
- }
- },
- methods: {
- setMapOptions: function setMapOptions() {
- var map = this.map,
- minZoom = this.minZoom,
- maxZoom = this.maxZoom,
- mapType = this.mapType,
- dragging = this.dragging,
- scrollWheelZoom = this.scrollWheelZoom,
- doubleClickZoom = this.doubleClickZoom,
- keyboard = this.keyboard,
- inertialDragging = this.inertialDragging,
- continuousZoom = this.continuousZoom,
- pinchToZoom = this.pinchToZoom,
- autoResize = this.autoResize;
-
- minZoom && map.setMinZoom(minZoom);
- maxZoom && map.setMaxZoom(maxZoom);
- mapType && map.setMapType(global[mapType]);
- dragging ? map.enableDragging() : map.disableDragging();
- scrollWheelZoom ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
- doubleClickZoom ? map.enableDoubleClickZoom() : map.disableDoubleClickZoom();
- keyboard ? map.enableKeyboard() : map.disableKeyboard();
- inertialDragging ? map.enableInertialDragging() : map.disableInertialDragging();
- continuousZoom ? map.enableContinuousZoom() : map.disableContinuousZoom();
- pinchToZoom ? map.enablePinchToZoom() : map.disablePinchToZoom();
- autoResize ? map.enableAutoResize() : map.disableAutoResize();
- },
- init: function init(BMap) {
- if (this.map) {
- return;
- }
- var $el = this.$refs.view;
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
-
- try {
- for (var _iterator = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default()(this.$slots.default || []), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var $node = _step.value;
-
- if ($node.componentOptions && $node.componentOptions.tag === 'bm-view') {
- this.hasBmView = true;
- $el = $node.elm;
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
-
- var map = new BMap.Map($el, { enableHighResolution: this.highResolution, enableMapClick: this.mapClick });
- this.map = map;
- var setMapOptions = this.setMapOptions,
- zoom = this.zoom,
- getCenterPoint = this.getCenterPoint,
- theme = this.theme,
- mapStyle = this.mapStyle;
-
- theme ? map.setMapStyle({ styleJson: theme }) : map.setMapStyle(mapStyle);
- setMapOptions();
- __WEBPACK_IMPORTED_MODULE_2__base_bindEvent_js__["a" /* default */].call(this, map);
- // 此处强行初始化一次地图 回避一个由于错误的 center 字符串导致初始化失败抛出的错误
- map.reset();
- map.centerAndZoom(getCenterPoint(), zoom);
- this.$emit('ready', { BMap: BMap, map: map });
- // Debug
- // global.map = map
- // global.mapComponent = this
- },
- getCenterPoint: function getCenterPoint() {
- var center = this.center,
- BMap = this.BMap;
-
- switch (Object(__WEBPACK_IMPORTED_MODULE_3__base_util_js__["a" /* checkType */])(center)) {
- case 'String':
- return center;
- case 'Object':
- return new BMap.Point(center.lng, center.lat);
- default:
- return new BMap.Point();
- }
- },
- initMap: function initMap(BMap) {
- this.BMap = BMap;
- this.init(BMap);
- },
- getMapScript: function getMapScript() {
- if (!global.BMap) {
- var ak = this.ak || this._BMap().ak;
- global.BMap = {};
- global.BMap._preloader = new __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
- global._initBaiduMap = function () {
- resolve(global.BMap);
- global.document.body.removeChild($script);
- global.BMap._preloader = null;
- global._initBaiduMap = null;
- };
- var $script = document.createElement('script');
- global.document.body.appendChild($script);
- $script.src = 'https://api.map.baidu.com/api?v=2.0&ak=' + ak + '&callback=_initBaiduMap';
- });
- return global.BMap._preloader;
- } else if (!global.BMap._preloader) {
- return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise___default.a.resolve(global.BMap);
- } else {
- return global.BMap._preloader;
- }
- },
- reset: function reset() {
- var getMapScript = this.getMapScript,
- initMap = this.initMap;
-
- getMapScript().then(initMap);
- }
- },
- mounted: function mounted() {
- this.reset();
- },
- data: function data() {
- return {
- hasBmView: false
- };
- }
- });
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
-
- /***/ }),
-
- /***/ "tjHi":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
-
- // EXTERNAL MODULE: ./node_modules/babel-runtime/helpers/toConsumableArray.js
- var toConsumableArray = __webpack_require__("Gu7T");
- var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
-
- // EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/map.js
- var core_js_map = __webpack_require__("ifoU");
- var map_default = /*#__PURE__*/__webpack_require__.n(core_js_map);
-
- // EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/json/stringify.js
- var stringify = __webpack_require__("mvHQ");
- var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);
-
- // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/map/Map.vue
- var Map = __webpack_require__("Txow");
-
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-470f2580","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/map/Map.vue
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(!_vm.hasBmView)?_c('div',{ref:"view",staticStyle:{"width":"100%","height":"100%"}}):_vm._e(),_vm._v(" "),_vm._t("default")],2)}
- var staticRenderFns = []
- var esExports = { render: render, staticRenderFns: staticRenderFns }
- /* harmony default export */ var map_Map = (esExports);
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/map/Map.vue
- var normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
-
- /* template functional */
- var __vue_template_functional__ = false
- /* styles */
- var __vue_styles__ = null
- /* scopeId */
- var __vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var __vue_module_identifier__ = null
- var Component = normalizeComponent(
- Map["a" /* default */],
- map_Map,
- __vue_template_functional__,
- __vue_styles__,
- __vue_scopeId__,
- __vue_module_identifier__
- )
-
- /* harmony default export */ var components_map_Map = (Component.exports);
-
- // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/controls/Scale.vue
- var Scale = __webpack_require__("7AC4");
-
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/controls/Scale.vue
- var Scale_normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
- var __vue_template__ = null
- /* template functional */
- var Scale___vue_template_functional__ = false
- /* styles */
- var Scale___vue_styles__ = null
- /* scopeId */
- var Scale___vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var Scale___vue_module_identifier__ = null
- var Scale_Component = Scale_normalizeComponent(
- Scale["a" /* default */],
- __vue_template__,
- Scale___vue_template_functional__,
- Scale___vue_styles__,
- Scale___vue_scopeId__,
- Scale___vue_module_identifier__
- )
-
- /* harmony default export */ var controls_Scale = (Scale_Component.exports);
-
- // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/controls/Navigation.vue
- var Navigation = __webpack_require__("/ydS");
-
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/controls/Navigation.vue
- var Navigation_normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
- var Navigation___vue_template__ = null
- /* template functional */
- var Navigation___vue_template_functional__ = false
- /* styles */
- var Navigation___vue_styles__ = null
- /* scopeId */
- var Navigation___vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var Navigation___vue_module_identifier__ = null
- var Navigation_Component = Navigation_normalizeComponent(
- Navigation["a" /* default */],
- Navigation___vue_template__,
- Navigation___vue_template_functional__,
- Navigation___vue_styles__,
- Navigation___vue_scopeId__,
- Navigation___vue_module_identifier__
- )
-
- /* harmony default export */ var controls_Navigation = (Navigation_Component.exports);
-
- // EXTERNAL MODULE: ./node_modules/bmaplib.markerclusterer/index.js
- var bmaplib_markerclusterer = __webpack_require__("3tqA");
- var bmaplib_markerclusterer_default = /*#__PURE__*/__webpack_require__.n(bmaplib_markerclusterer);
-
- // EXTERNAL MODULE: ./node_modules/vue-baidu-map/components/base/factory.js
- var factory = __webpack_require__("Brla");
-
- // EXTERNAL MODULE: ./node_modules/vue-baidu-map/components/base/mixins/common.js
- var common = __webpack_require__("9LO+");
-
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/extra/MarkerClusterer.vue
-
- //
- //
- //
- //
- //
- //
-
-
-
-
-
- /* harmony default export */ var MarkerClusterer = ({
- name: 'bml-marker-clusterer',
- mixins: [Object(common["a" /* default */])('markerClusterer')],
- props: {
- gridSize: {
- type: Object
- },
- maxZoom: {
- type: Number
- },
- minClusterSize: {
- type: Number
- },
- styles: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- averageCenter: {
- type: Boolean,
- default: false
- }
- },
- watch: {
- gridSize: {
- handler: function handler(val) {
- var BMap = this.BMap,
- originInstance = this.originInstance;
-
- originInstance.setGridSize(BMap, val.map);
- },
-
- deep: true
- },
- maxZoom: function maxZoom(val) {
- var originInstance = this.originInstance;
-
- originInstance.setMaxZoom(val);
- },
-
- minClusterSize: {
- handler: function handler(val) {
- var BMap = this.BMap,
- originInstance = this.originInstance;
-
- originInstance.setMinClusterSize(Object(factory["d" /* createSize */])(BMap, val));
- },
-
- deep: true
- },
- styles: {
- handler: function handler(val) {
- var BMap = this.BMap,
- originInstance = this.originInstance;
-
- var obj = JSON.parse(stringify_default()(val)).map(function (item) {
- item.size = item.size && Object(factory["d" /* createSize */])(BMap, item.size);
- return item;
- });
- originInstance.setStyles(obj);
- },
-
- deep: true
- },
- averageCenter: function averageCenter(val) {
- this.reload();
- }
- },
- methods: {
- load: function load() {
- var _this = this;
-
- var BMap = this.BMap,
- map = this.map,
- gridSize = this.gridSize,
- minClusterSize = this.minClusterSize,
- maxZoom = this.maxZoom,
- styles = this.styles,
- averageCenter = this.averageCenter;
-
- this.originInstance = new bmaplib_markerclusterer_default.a(map, {
- gridSize: gridSize && Object(factory["d" /* createSize */])(BMap, gridSize),
- maxZoom: maxZoom,
- minClusterSize: minClusterSize && Object(factory["d" /* createSize */])(BMap, minClusterSize),
- styles: styles.map(function (item) {
- item.size = Object(factory["d" /* createSize */])(BMap, item.size);
- return item;
- }),
- isAverageCenter: averageCenter
- });
- this.$nextTick(function () {
- var markers = _this.$children.map(function (inst) {
- return inst.originInstance;
- }).filter(function (marker) {
- return marker instanceof BMap.Marker;
- });
- _this.originInstance.addMarkers(markers);
- });
- }
- },
- beforeCreate: function beforeCreate() {
- this.preventChildrenRender = true;
- }
- });
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-02bae26d","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/extra/MarkerClusterer.vue
- var MarkerClusterer_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',[_vm._t("default")],2)}
- var MarkerClusterer_staticRenderFns = []
- var MarkerClusterer_esExports = { render: MarkerClusterer_render, staticRenderFns: MarkerClusterer_staticRenderFns }
- /* harmony default export */ var extra_MarkerClusterer = (MarkerClusterer_esExports);
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/extra/MarkerClusterer.vue
- var MarkerClusterer_normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
-
- /* template functional */
- var MarkerClusterer___vue_template_functional__ = false
- /* styles */
- var MarkerClusterer___vue_styles__ = null
- /* scopeId */
- var MarkerClusterer___vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var MarkerClusterer___vue_module_identifier__ = null
- var MarkerClusterer_Component = MarkerClusterer_normalizeComponent(
- MarkerClusterer,
- extra_MarkerClusterer,
- MarkerClusterer___vue_template_functional__,
- MarkerClusterer___vue_styles__,
- MarkerClusterer___vue_scopeId__,
- MarkerClusterer___vue_module_identifier__
- )
-
- /* harmony default export */ var components_extra_MarkerClusterer = (MarkerClusterer_Component.exports);
-
- // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/overlays/Marker.vue
- var Marker = __webpack_require__("PVXw");
-
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-8b00e1e8","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/overlays/Marker.vue
- var Marker_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._t("default")],2)}
- var Marker_staticRenderFns = []
- var Marker_esExports = { render: Marker_render, staticRenderFns: Marker_staticRenderFns }
- /* harmony default export */ var overlays_Marker = (Marker_esExports);
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/overlays/Marker.vue
- var Marker_normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
-
- /* template functional */
- var Marker___vue_template_functional__ = false
- /* styles */
- var Marker___vue_styles__ = null
- /* scopeId */
- var Marker___vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var Marker___vue_module_identifier__ = null
- var Marker_Component = Marker_normalizeComponent(
- Marker["a" /* default */],
- overlays_Marker,
- Marker___vue_template_functional__,
- Marker___vue_styles__,
- Marker___vue_scopeId__,
- Marker___vue_module_identifier__
- )
-
- /* harmony default export */ var components_overlays_Marker = (Marker_Component.exports);
-
- // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/overlays/InfoWindow.vue
- var InfoWindow = __webpack_require__("8Hu+");
-
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-6b5c0453","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/overlays/InfoWindow.vue
- var InfoWindow_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.show),expression:"show"}]},[_vm._t("default")],2)}
- var InfoWindow_staticRenderFns = []
- var InfoWindow_esExports = { render: InfoWindow_render, staticRenderFns: InfoWindow_staticRenderFns }
- /* harmony default export */ var overlays_InfoWindow = (InfoWindow_esExports);
- // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/overlays/InfoWindow.vue
- var InfoWindow_normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
-
- /* template functional */
- var InfoWindow___vue_template_functional__ = false
- /* styles */
- var InfoWindow___vue_styles__ = null
- /* scopeId */
- var InfoWindow___vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var InfoWindow___vue_module_identifier__ = null
- var InfoWindow_Component = InfoWindow_normalizeComponent(
- InfoWindow["a" /* default */],
- overlays_InfoWindow,
- InfoWindow___vue_template_functional__,
- InfoWindow___vue_styles__,
- InfoWindow___vue_scopeId__,
- InfoWindow___vue_module_identifier__
- )
-
- /* harmony default export */ var components_overlays_InfoWindow = (InfoWindow_Component.exports);
-
- // EXTERNAL MODULE: ./src/api/index.js + 5 modules
- var api = __webpack_require__("gyMJ");
-
- // EXTERNAL MODULE: ./node_modules/moment/moment.js
- var moment = __webpack_require__("PJh5");
- var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
-
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/doorMagnetism/home.vue
-
-
-
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
-
-
-
-
-
-
- // import AMap from 'AMap'
-
-
- /* harmony default export */ var home = ({
- // inject: ['reload'],
- name: "Home",
- data: function data() {
- var self = this;
- return {
- selectoption: [],
- selectoptionValue: '',
- Processed: 0,
- openDoorlog: 0,
- closeDoorlog: 0,
- fcDoorlog: 0,
- map: {
- zoom: 10,
- width: "100%",
- height: "100%",
- center: {
- lng: 114.064552,
- lat: 22.548457
- }
- },
- points: [{
- lng: 114.064552,
- lat: 22.548457
- }],
- markers: [],
- infoWindow: {
- lng: 114.064552,
- lat: 22.548457,
- show: false,
- info: {
- air: 0,
- area: 12313,
- areaEnergy: '深圳市',
- code: "440300A055",
- energy: 7922.66,
- lat: "22.548457",
- lng: "114.064552",
- name: "",
- water: 0
- }
- },
-
- center: [114.064552, 22.548457],
- lng: 0,
- lat: 0,
- loaded: false,
- zoom: 19,
- alarmList: [],
- settime: 0,
- fault: 0,
- alert: 0,
- a1: 0,
- a2: 0,
- a3: 0,
- Statistics: {
- projectSum: 0,
- deviceSum: 0,
- bindingSum: 0,
- islineSum: 0,
- unlineSum: 0,
- lowElectricity: 0,
- openlook: 0,
- closelook: 0,
- openDoorlog: 0,
- closeDoorlog: 0,
- fcDoorlog: 0,
- Processed: 0
- },
- settime1: '',
- unlineDevice: '',
- unlinedeviceSum: 0,
- allunline: [],
- settime2: null,
- audiosrc: __webpack_require__("8R8w"),
- prelist: [],
- userInfo: { type: '' }
- };
- },
-
- components: {
- BaiduMap: components_map_Map,
- BmScale: controls_Scale,
- BmNavigation: controls_Navigation,
- BmMarkerClusterer: components_extra_MarkerClusterer,
- BmMarker: components_overlays_Marker,
- BmInfoWindow: components_overlays_InfoWindow
- },
- created: function created() {
- this.userInfo = JSON.parse(localStorage.getItem('info'));
- // this.selectoption = JSON.parse(localStorage.getItem('selectoption'))
- // this.selectoptionValue = localStorage.getItem('tenantId')
- // var _this = this
- // // this.$refs.audio.play()
- // this.getalertDevice()
- // this.settime2 = setInterval(function() {
- // _this.getalertDevice()
- // }, 3000)
- },
- activated: function activated() {
- var _this = this;
- this.settime1 = setInterval(function () {
- _this.getReportList();
- _this.getSum();
- }, 30000);
- },
- beforeDestroy: function beforeDestroy() {
- window.clearInterval(this.settime1);
- this.settime1 = null;
- },
- beforeRouteLeave: function beforeRouteLeave(to, from, next) {
- window.clearInterval(this.settime1);
- this.settime1 = null;
- next();
- },
- mounted: function mounted() {
- var _this = this;
- this.Statistics.openlook = this.$store.state.openlook;
- this.getSum();
- this.getReportList();
- this.settime1 = setInterval(function () {
- _this.getReportList();
- _this.getSum();
- }, 30000);
- },
-
- watch: {
- '$store.state.Statistics.openlook': function $storeStateStatisticsOpenlook() {
- this.Statistics.openlook = this.$store.state.Statistics.openlook;
- }
- },
- methods: {
- // selectTenantId(e) {
- // localStorage.setItem('tenantId', e)
- // this.reload()
- // },
- validate: function validate(arr1, arr2) {
- if (!arr1 instanceof Array || !arr2 instanceof Array) {
- return true;
- }
- if (arr1.length != arr2.length) {
- return false;
- }
- var arr1Str = stringify_default()(arr1);
- for (var i = 0; i < arr2.length; i++) {
- if (arr1Str.indexOf(stringify_default()(arr2[i])) == -1) {
- return false;
- }
- }
- return true;
- },
- unique: function unique(arr, u_key) {
- var map = new map_default.a();
- arr.forEach(function (item, index) {
- if (!map.has(item[u_key])) {
- map.set(item[u_key], item);
- }
- });
- return [].concat(toConsumableArray_default()(map.values()));
- },
- getalertDevice: function getalertDevice() {
- var _this2 = this;
-
- // if (this.currentPage > this.carouselPage) {
- // this.currentPage = 1
- // }
- var data = {
- pageNum: 1,
- pageSize: 1,
- orderType: 'desc',
- orderBy: "createAt",
- q: stringify_default()({
- lockStatus: 1
- })
- };
- Object(api["i" /* httpPostno */])(data, this.$api.getList).then(function (res) {
- if (res.success) {
- _this2.$store.commit('updatedata', res.data.total);
- }
- });
- var data = {
- pageNum: this.currentPage,
- pageSize: this.pageSize,
- orderType: 'desc',
- orderBy: "createAt",
- q: stringify_default()({
- operateCode: 1,
- startTime: moment_default()().subtract('days', 0).format('YYYY-MM-DD 00:00:00'),
- endTime: moment_default()().format('YYYY-MM-DD HH:mm:ss')
- })
- };
- Object(api["i" /* httpPostno */])(data, this.$api.getReportList).then(function (res) {
- if (res.success) {
- // if (res.data.total > 0) {
-
- // } else {
- // this.$refs.audio.pause()
- // this.vocieStatus = true
- // }
- res.data.list.map(function (li) {
- li.createAt = moment_default()(li.createAt).format('YYYY/MM/DD HH:mm:ss');
- });
- var time = new Date();
- var list = [];
- res.data.list.map(function (li) {
- var time = moment_default()(time).valueOf();
- var time1 = moment_default()(li.createAt).valueOf();
- li['sharkFlag'] = false;
- if (time - time1 < 6000) {
- list.push(li);
- li['sharkFlag'] = true;
- }
- });
- _this2.poplist(list);
- // this.alarmList = res.data.list
- _this2.unlinedeviceSum = res.data.total;
- _this2.tableData = res.data.list;
- _this2.pageTotal = res.data.total;
- } else {
- _this2.$message.error(res.msg);
- }
- });
- },
- poplist: function poplist(list) {
- var _this3 = this;
-
- var list1 = this.unique(list, 'imei');
- var tt = this.validate(this.prelist, list1);
-
- if (tt) {} else {
- this.prelist = list1;
- if (list1.length == 0) {
- this.$refs.audio.pause();
- } else {
- if (!this.vocieStatus) {
- this.$refs.audio.play();
- this.vocieStatus = false;
- setTimeout(function () {
- _this3.$refs.audio.pause();
- }, 10000);
- }
- }
- list1.map(function (li) {
- setTimeout(function () {
- _this3.$notify({
- title: li.name,
- offset: 200,
- duration: 2000,
- message: li.createAt + ' 开门警报',
- type: 'warning'
- });
- }, 3000);
- });
- }
- },
- getSum: function getSum() {
- var _this4 = this;
-
- var data = {};
- Object(api["f" /* httpGetno */])(data, this.$api.getEnterprise).then(function (res) {
- if (res.success) {
- _this4.Statistics.projectSum = res.data.total;
- }
- });
- var data1 = {
- pageSize: 0,
- pageNum: 0
- };
- Object(api["i" /* httpPostno */])(data1, this.$api.getList).then(function (res) {
- if (res.success) {
- var arr = [0, 0, 0, 0];
- var st = [0, 0, 0];
- var unlineList = [];
- var bindSum = 0;
- res.data.list.forEach(function (li) {
- if (li.isOnline == 1) {
- arr[0] += 1;
- } else if (li.isOnline == 0) {
- arr[1] += 1;
- }
- if (li.roomId) {
- bindSum += 1;
- }
- if (li.lockStatus == 1) {
- arr[2] += 1;
- unlineList.push(li);
- } else if (li.lockStatus == 0) {
- arr[3] += 1;
- }
- if (li.battery >= 0 && li.battery <= 15) {
- st[0] += 1;
- } else if (li.battery > 15 && li.battery <= 60) {
- st[1] += 1;
- } else if (li.battery > 60 && li.battery <= 100) {
- st[2] += 1;
- }
- });
- _this4.Statistics.deviceSum = res.data.total;
- _this4.Statistics.unlineSum = arr[1];
- _this4.Statistics.islineSum = arr[0];
- _this4.Statistics.openlook = arr[2];
- _this4.Statistics.closelook = arr[3];
- _this4.Statistics.bindingSum = bindSum;
- _this4.Statistics.deviceBattery = st;
- _this4.Statistics.lowElectricity = st[0];
- _this4.Statistics.unlineList = unlineList;
- _this4.infoWindow.info.air = res.data.total;
- _this4.drawLine();
- _this4.drawLine1();
- _this4.getalert();
- }
- });
- },
- handler: function handler(_ref) {
- var BMap = _ref.BMap,
- map = _ref.map;
-
- map.setMapStyle({
- style: "midnight"
- });
- },
- infoWindowClose: function infoWindowClose(e) {
- this.infoWindow.show = false;
- },
- infoWindowOpen: function infoWindowOpen(e) {
- this.infoWindow.show = true;
- },
- lookDetail: function lookDetail(data, target) {
- var _this5 = this;
-
- this.infoWindow.show = true;
- return;
- this.infoWindow.info = data;
- this.activeName = data.name;
- //为弹窗口标题添加title
- this.$nextTick(function () {
- var win = document.querySelector(".BMap_bubble_title");
- win.title = _this5.activeName;
- });
- if (target == 'left') {
- //点击的是左侧列表项,则不需要滚动
- this.map.center = {
- lng: data.lng,
- lat: data.lat
- };
- this.map.zoom = 15;
- return;
- }
- //滚动到指定元素位置
- this.$nextTick(function () {
- var obj = document.querySelector(".active");
- var scrollTop = obj.offsetTop;
- _this5.$refs.box.scrollTop = scrollTop - 180;
- });
- },
- getReportList: function getReportList() {
- var _this6 = this;
-
- var data = {
- pageNum: 1,
- pageSize: 20,
- orderType: 'desc',
- orderBy: "createAt"
- };
- Object(api["i" /* httpPostno */])(data, this.$api.getReportList).then(function (res) {
- if (res.success) {
- res.data.list.map(function (li) {
- li.createAt = moment_default()(li.createAt).format('YYYY/MM/DD HH:mm:ss');
- });
- _this6.alarmList = res.data.list;
- } else {
- _this6.$message.error(res.msg);
- }
- }).catch(function (error) {
- _this6.$message.error(error.msg);
- });
- },
-
- // 根据类型和指定天数范围获取报警记录
- getOrderReport: function getOrderReport() {
- // 设备报警
- var Statistics = this.Statistics;
- this.Processed = Statistics.Processed;
- this.openDoorlog = Statistics.openDoorlog;
- this.closeDoorlog = Statistics.closeDoorlog;
- this.fcDoorlog = Statistics.fcDoorlog;
- },
- getalert: function getalert() {
- var _this7 = this;
-
- var str1 = {
- day: 7
- };
- Object(api["i" /* httpPostno */])(str1, this.$api.monitorReport).then(function (res) {
- if (res.success) {
- var dat = [0, 0, 0, 0, 0, 0, 0],
- dat1 = [0, 0, 0, 0, 0, 0, 0],
- dat2 = [0, 0, 0, 0, 0, 0, 0],
- dat3 = [0, 0, 0, 0, 0, 0, 0];
- var day8 = moment_default()().subtract('days', 6).format('YYYY/MM/DD');
- var day7 = moment_default()().subtract('days', 5).format('YYYY/MM/DD');
- var day6 = moment_default()().subtract('days', 4).format('YYYY/MM/DD');
- var day5 = moment_default()().subtract('days', 3).format('YYYY/MM/DD');
- var day4 = moment_default()().subtract('days', 2).format('YYYY/MM/DD');
- var day3 = moment_default()().subtract('days', 1).format('YYYY/MM/DD');
- var day2 = moment_default()().subtract('days', 0).format('YYYY/MM/DD');
- var i = 0;
- res.data.map(function (li) {
- if (li.code == 1) {
- if (li.order == day8) {
- dat[0] += li.count;
- } else if (li.order == day7) {
- dat[1] += li.count;
- } else if (li.order == day6) {
- dat[2] += li.count;
- } else if (li.order == day5) {
- dat[3] += li.count;
- } else if (li.order == day4) {
- dat[4] += li.count;
- } else if (li.order == day3) {
- dat[5] += li.count;
- } else if (li.order == day2) {
- console.log(li);
- dat[6] += li.count;
- }
- } else if (li.code == 2) {
- if (li.order == day8) {
- dat3[0] += li.count;
- } else if (li.order == day7) {
- dat3[1] += li.count;
- } else if (li.order == day6) {
- dat3[2] += li.count;
- } else if (li.order == day5) {
- dat3[3] += li.count;
- } else if (li.order == day4) {
- dat3[4] += li.count;
- } else if (li.order == day3) {
- dat3[5] += li.count;
- } else if (li.order == day2) {
- dat3[6] += li.count;
- }
- } else if (li.code == 4) {
- if (li.order == day8) {
- dat1[0] += li.count;
- } else if (li.order == day7) {
- dat1[1] += li.count;
- } else if (li.order == day6) {
- dat1[2] += li.count;
- } else if (li.order == day5) {
- dat1[3] += li.count;
- } else if (li.order == day4) {
- dat1[4] += li.count;
- } else if (li.order == day3) {
- dat1[5] += li.count;
- } else if (li.order == day2) {
- dat1[6] += li.count;
- }
- } else if (li.code == 17) {
- if (li.order == day8) {
- dat2[0] += li.count;
- } else if (li.order == day7) {
- dat2[1] += li.count;
- } else if (li.order == day6) {
- dat2[2] += li.count;
- } else if (li.order == day5) {
- dat2[3] += li.count;
- } else if (li.order == day4) {
- dat2[4] += li.count;
- } else if (li.order == day3) {
- dat2[5] += li.count;
- } else if (li.order == day2) {
- dat2[6] += li.count;
- }
- }
- });
- var allertLog = {};
- _this7.openDoorlog = dat[6];
- _this7.closeDoorlog = dat2[6];
- _this7.fcDoorlog = dat1[6];
- _this7.LowElectricity = dat3[6];
- allertLog.openDoorlog = dat;
- allertLog.closeDoorlog = dat2;
- allertLog.fcDoorlog = dat1;
- allertLog.LowElectricity = dat3;
- var myChart = _this7.$echarts.init(_this7.$refs.myChart2);
- // 绘制图表
- var str = new Array(7);
- for (var i = 0; i < 7; i++) {
- str[i] = moment_default()().subtract(i, 'days').format('MM月DD号');
- }
- myChart.setOption({
- tooltip: {
- trigger: 'item'
- },
- legend: {
- data: ['开门报警', '关门报警', '防拆报警', '低电报警'],
- left: '4%',
- // x:'left',
- top: '8%',
- textStyle: {
- fontSize: 12,
- color: '#F1F1F3'
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- axisLabel: {
- textStyle: {
- color: "#fff"
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(219,225,255,1)",
- width: 1,
- type: "solid"
- }
- },
- data: [str[6], str[5], str[4], str[3], str[2], str[1], str[0]]
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- textStyle: {
- color: "#fff"
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(219,225,255,1)",
- width: 1,
- type: "solid"
- }
- }
- },
- series: [{
- name: "开门报警",
- data: [allertLog.openDoorlog[0], allertLog.openDoorlog[1], allertLog.openDoorlog[2], allertLog.openDoorlog[3], allertLog.openDoorlog[4], allertLog.openDoorlog[5], allertLog.openDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }, {
- name: "关门报警",
- data: [allertLog.closeDoorlog[0], allertLog.closeDoorlog[1], allertLog.closeDoorlog[2], allertLog.closeDoorlog[3], allertLog.closeDoorlog[4], allertLog.closeDoorlog[5], allertLog.closeDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }, {
- name: "防拆报警",
- data: [allertLog.fcDoorlog[0], allertLog.fcDoorlog[1], allertLog.fcDoorlog[2], allertLog.fcDoorlog[3], allertLog.fcDoorlog[4], allertLog.fcDoorlog[5], allertLog.fcDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }, {
- name: "低电报警",
- data: [allertLog.LowElectricity[0], allertLog.LowElectricity[1], allertLog.LowElectricity[2], allertLog.LowElectricity[3], allertLog.LowElectricity[4], allertLog.LowElectricity[5], allertLog.LowElectricity[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }]
- });
- }
- });
- },
- drawLine2: function drawLine2() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = this.$echarts.init(this.$refs.myChart2);
- // 绘制图表
- var str = new Array(7);
- for (var i = 0; i < 7; i++) {
- str[i] = moment_default()().subtract(i, 'days').format('MM月DD号');
- }
- var allertLog = this.Statistics;
- myChart.setOption({
- tooltip: {
- trigger: 'item'
- },
- legend: {
- data: ['开门报警', '关门报警', '防拆报警', '低电报警'],
- right: '10%',
- top: '8%',
- x: 'left',
- textStyle: {
- fontSize: 12,
- color: '#F1F1F3'
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- axisLabel: {
- interval: 0,
- rotate: 45,
- textStyle: {
- color: "#fff"
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(219,225,255,1)",
- width: 1,
- type: "solid"
- }
- },
- data: [str[6], str[5], str[4], str[3], str[2], str[1], str[0]]
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- textStyle: {
- color: "#fff"
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(219,225,255,1)",
- width: 1,
- type: "solid"
- }
- }
- },
- series: [{
- name: "开门报警",
- data: [allertLog.openDoorlog[0], allertLog.openDoorlog[1], allertLog.openDoorlog[2], allertLog.openDoorlog[3], allertLog.openDoorlog[4], allertLog.openDoorlog[5], allertLog.openDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }, {
- name: "关门报警",
- data: [allertLog.closeDoorlog[0], allertLog.closeDoorlog[1], allertLog.closeDoorlog[2], allertLog.closeDoorlog[3], allertLog.closeDoorlog[4], allertLog.closeDoorlog[5], allertLog.closeDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }, {
- name: "防拆报警",
- data: [allertLog.fcDoorlog[0], allertLog.fcDoorlog[1], allertLog.fcDoorlog[2], allertLog.fcDoorlog[3], allertLog.fcDoorlog[4], allertLog.fcDoorlog[5], allertLog.fcDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }, {
- name: "低电报警",
- data: [allertLog.fcDoorlog[0], allertLog.fcDoorlog[1], allertLog.fcDoorlog[2], allertLog.fcDoorlog[3], allertLog.fcDoorlog[4], allertLog.fcDoorlog[5], allertLog.fcDoorlog[6]],
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- }
- }]
- });
- },
-
- // 统计设备总数和房间总数
- drawLine1: function drawLine1() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = this.$echarts.init(this.$refs.myChart1);
- // 绘制图表
- var Statistics = this.Statistics;
- myChart.setOption({
- tooltip: {
- trigger: 'item'
- },
- legend: {
- show: false
- },
- series: [{
- name: '设备电量状态',
- type: 'pie',
- radius: '50%',
- data: [{
- value: Statistics.deviceBattery[0],
- name: '低电'
- }, {
- value: Statistics.deviceBattery[1],
- name: '电量(15%-60%)'
- }, {
- value: Statistics.deviceBattery[2],
- name: '电量(60%-100%)'
- }],
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(255, 255, 255, 0.5)'
- }
- }
- }]
- });
- },
- drawLine: function drawLine() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = this.$echarts.init(this.$refs.myChart);
- var Statistics = this.Statistics;
- // 绘制图表
- myChart.setOption({
- title: {
- text: '',
- textAlign: 'center',
- x: 'center',
- y: 'center',
- textStyle: {
- color: '#ffffff' //字体颜色
- }
-
- },
- tooltip: {},
- xAxis: {
- data: ["项目总数", "设备总数", "已绑定数量", "在线数量", "离线数量", "低电数量", "门开数量", "门关数量"],
- axisLabel: {
- interval: 0,
- rotate: 45,
- textStyle: {
- color: "#fff",
- fontSize: 12
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(219,225,255,1)",
- width: 0.5,
- type: "solid"
- }
- }
- },
- legend: {
- textStyle: {
- color: "#fff"
- },
- show: false
- },
- yAxis: {
- name: '单位/个',
- axisLabel: {
- textStyle: {
- color: "#fff"
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(219,225,255,1)",
- width: 1,
- type: "solid"
- }
- }
- },
- series: [{
- name: '',
- type: 'bar',
- itemStyle: {
- barWidth: 10,
- normal: {
- label: {
- show: true, //开启显示
- position: 'top', //在上方显示
- textStyle: { //数值样式
- color: 'white',
- fontSize: 10
- }
- }
- }
- },
- data: [{
- value: Statistics.projectSum,
- itemStyle: {
- color: '#00BFB4'
- }
- }, {
- value: Statistics.deviceSum,
- itemStyle: {
- color: '#32ECFF'
- }
- }, {
- value: Statistics.bindingSum,
- itemStyle: {
- color: '#EB55FF'
- }
- }, {
- value: Statistics.islineSum,
- itemStyle: {
- color: '#00BFB4'
- }
- }, {
- value: Statistics.unlineSum,
- itemStyle: {
- color: '#32ECFF'
- }
- }, {
- value: Statistics.lowElectricity,
- itemStyle: {
- color: '#EB55FF'
- }
- }, {
- value: Statistics.openlook,
- itemStyle: {
- color: '#00BFB4'
- }
- }, {
- value: Statistics.closelook,
- itemStyle: {
- color: '#32ECFF'
- }
- }]
- }]
- });
- }
- }
- });
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-789f624e","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/views/doorMagnetism/home.vue
- var home_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"home main-cont1"},[_c('el-badge',{staticClass:"item",attrs:{"value":_vm.Statistics.openlook}},[_c('router-link',{attrs:{"to":"EquipmentList"}},[_c('img',{staticClass:"alertimg",attrs:{"src":__webpack_require__("/nO3"),"alt":""}})])],1),_vm._v(" "),_c('div',{staticClass:"flexcolum"},[_c('div',{staticClass:"columdiv columdiv1"},[_c('div',{staticStyle:{"position":"relative"}},[_c('div',{ref:"myChart",attrs:{"id":"myChart"}}),_vm._v(" "),(_vm.userInfo.type==0)?_c('div',{staticClass:"selectoptions"},[_c('selectoption')],1):_vm._e()]),_vm._v(" "),_c('div',{staticClass:"fault"},[_vm._m(0),_vm._v(" "),_c('div',{staticClass:"textlist"},[_c('div',{staticClass:"textli"},[_c('div',[_vm._v("今日开门报警")]),_vm._v(" "),_c('div',{staticClass:"red"},[_vm._v(_vm._s(_vm.openDoorlog)+"起")])]),_vm._v(" "),_c('div',{staticClass:"textli"},[_c('div',[_vm._v("已关门报警")]),_vm._v(" "),_c('div',{staticClass:"red"},[_vm._v(_vm._s(_vm.closeDoorlog)+"起")])]),_vm._v(" "),_c('div',{staticClass:"textli"},[_c('div',[_vm._v("今日防拆报警")]),_vm._v(" "),_c('div',{staticClass:"orange"},[_vm._v(_vm._s(_vm.fcDoorlog)+"起")])]),_vm._v(" "),_c('div',{staticClass:"textli"},[_c('div',[_vm._v("防拆处理")]),_vm._v(" "),_c('div',{staticClass:"orange"},[_vm._v(_vm._s(_vm.fcDoorlog)+"起")])])])])]),_vm._v(" "),_c('div',{staticClass:"columdiv"},[_c('div',{ref:"myChart1",attrs:{"id":"myChart1"}}),_vm._v(" "),_c('div',{staticClass:"fault fault1"},[_c('div',{staticClass:"table"},[_c('table',{staticClass:"tablexontent"},[_vm._m(1),_vm._v(" "),_c('div',{staticClass:"alarm"},_vm._l((_vm.alarmList),function(item,index){return _c('tr',{key:index},[_c('th',[_vm._v(_vm._s(item.createAt))]),_vm._v(" "),_c('th',[_vm._v(_vm._s(item.name))]),_vm._v(" "),_c('th',[(item.operateCode==0)?_c('span',[_vm._v("心跳")]):_vm._e(),_vm._v(" "),(item.operateCode==1)?_c('span',[_vm._v("门已打开报警")]):_vm._e(),_vm._v(" "),(item.operateCode==2)?_c('span',[_vm._v("低电压告警")]):_vm._e(),_vm._v(" "),(item.operateCode==4)?_c('span',[_vm._v("防拆报警")]):_vm._e(),_vm._v(" "),(item.operateCode==5)?_c('span',[_vm._v("设备故障")]):_vm._e(),_vm._v(" "),(item.operateCode==13)?_c('span',[_vm._v("设备测试")]):_vm._e(),_vm._v(" "),(item.operateCode==17)?_c('span',[_vm._v("门已关")]):_vm._e(),_vm._v(" "),(item.operateCode==18)?_c('span',[_vm._v("低电压恢复与上电开机")]):_vm._e(),_vm._v(" "),(item.operateCode==20)?_c('span',[_vm._v("防拆恢复")]):_vm._e(),_vm._v(" "),(item.operateCode==21)?_c('span',[_vm._v("故障恢复")]):_vm._e(),_vm._v(" "),(item.operateCode==170)?_c('span',[_vm._v("设备ACK")]):_vm._e(),_vm._v(" "),(item.operateCode==30)?_c('span',[_vm._v("添加子设备")]):_vm._e(),_vm._v(" "),(item.operateCode==31)?_c('span',[_vm._v("删除子设备")]):_vm._e()])])}),0)])])]),_vm._v(" "),_c('audio',{ref:"audio",staticClass:"voice",attrs:{"muted":"","src":_vm.audiosrc,"controls":"controls","autoplay":false,"loop":""}}),_vm._v(" "),_c('div',{ref:"myChart2",attrs:{"id":"myChart2"}})])])],1)}
- var home_staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"imglist"},[_c('div',{staticClass:"imgli"},[_c('img',{attrs:{"src":__webpack_require__("NTBm")}})]),_vm._v(" "),_c('div',{staticClass:"imgli"},[_c('img',{attrs:{"src":__webpack_require__("SP3F")}})])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('tr',{staticClass:"rowtitle"},[_c('th',[_vm._v("报警时间")]),_vm._v(" "),_c('th',[_vm._v("房间名称")]),_vm._v(" "),_c('th',[_vm._v("报警内容")])])}]
- var home_esExports = { render: home_render, staticRenderFns: home_staticRenderFns }
- /* harmony default export */ var doorMagnetism_home = (home_esExports);
- // CONCATENATED MODULE: ./src/views/doorMagnetism/home.vue
- function injectStyle (ssrContext) {
- __webpack_require__("LVSh")
- }
- var home_normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
-
- /* template functional */
- var home___vue_template_functional__ = false
- /* styles */
- var home___vue_styles__ = injectStyle
- /* scopeId */
- var home___vue_scopeId__ = "data-v-789f624e"
- /* moduleIdentifier (server only) */
- var home___vue_module_identifier__ = null
- var home_Component = home_normalizeComponent(
- home,
- doorMagnetism_home,
- home___vue_template_functional__,
- home___vue_styles__,
- home___vue_scopeId__,
- home___vue_module_identifier__
- )
-
- /* harmony default export */ var views_doorMagnetism_home = __webpack_exports__["default"] = (home_Component.exports);
-
-
- /***/ })
-
- });
|