From 78ad6d55ab0ae43ce0699abd0d6e2d16533bcef5 Mon Sep 17 00:00:00 2001 From: "xuhe@fangjia.com" Date: Wed, 11 Apr 2018 13:52:58 +0800 Subject: [PATCH 01/10] aa --- fangija-zsyf/views/house/add.html | 2 +- fangija-zsyf/views/house/houseManageList.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fangija-zsyf/views/house/add.html b/fangija-zsyf/views/house/add.html index 5446482..5d2191f 100644 --- a/fangija-zsyf/views/house/add.html +++ b/fangija-zsyf/views/house/add.html @@ -30,7 +30,7 @@
-
- - + + +
+ +
+ From aecad0be4564e89d84cd5da8a772c3f5d2b40070 Mon Sep 17 00:00:00 2001 From: zongzhimin Date: Wed, 11 Apr 2018 14:17:05 +0800 Subject: [PATCH 03/10] add --- fangija-zsyf/js/BMapLib_RichMarker.js | 1125 +++++++++++++++++ fangija-zsyf/js/district/districtDetail.js | 121 +- fangija-zsyf/js/log/log_stat.js | 41 + .../views/component/baseInfoComponent.js | 67 +- fangija-zsyf/views/component/nearDist.js | 7 +- fangija-zsyf/views/district/aroundDetail.html | 2 +- fangija-zsyf/views/district/arround.html | 1 + fangija-zsyf/views/district/detail.html | 49 +- fangija-zsyf/views/evaluate/evaluateList.html | 6 +- .../views/evaluate/evaluateReport.html | 1 + fangija-zsyf/views/house/add.html | 270 +++- fangija-zsyf/views/house/detail.html | 606 +++------ fangija-zsyf/views/house/houseList.html | 16 +- fangija-zsyf/views/house/houseManageList.html | 50 +- .../views/intelligentHouse/aroundDetail.html | 2 +- .../views/intelligentHouse/index.html | 1 + .../views/intelligentHouse/mapDetail.html | 2 +- fangija-zsyf/views/news/newsCollectList.html | 2 +- fangija-zsyf/views/news/newsDetail.html | 1 + fangija-zsyf/views/rent/rent.html | 64 +- fangija-zsyf/views/rent/rentManager.html | 1 + fangija-zsyf/views/user/bindingMobile.html | 1 + fangija-zsyf/views/user/codeSms.html | 1 + fangija-zsyf/views/user/passLogin.html | 13 + fangija-zsyf/views/user/updatePass.html | 2 +- fangija-zsyf/views/user/userInfo.html | 2 +- fangija-zsyf/yfindex.html | 2 +- 27 files changed, 1868 insertions(+), 588 deletions(-) create mode 100644 fangija-zsyf/js/BMapLib_RichMarker.js create mode 100644 fangija-zsyf/js/log/log_stat.js diff --git a/fangija-zsyf/js/BMapLib_RichMarker.js b/fangija-zsyf/js/BMapLib_RichMarker.js new file mode 100644 index 0000000..a7af6a8 --- /dev/null +++ b/fangija-zsyf/js/BMapLib_RichMarker.js @@ -0,0 +1,1125 @@ +/** + * @fileoverview °Ù¶ÈµØÍ¼µÄ¸»MarkerÀ࣬¶ÔÍ⿪·Å¡£ + * ÔÊÐíÓû§ÔÚ×Ô¶¨Òå·á¸»µÄMarkerÕ¹ÏÖ£¬²¢Ìí¼Óµã»÷¡¢Ë«»÷¡¢ÍÏ×§µÈʼþ¡£ + * »ùÓÚBaidu Map API 1.2¡£ + * + * @author Baidu Map Api Group + * @version 1.2 + */ +/** + * @namespace BMapµÄËùÓÐlibraryÀà¾ù·ÅÔÚBMapLibÃüÃû¿Õ¼äÏ + */ +var BMapLib = window.BMapLib = BMapLib || {}; +(function () { + /** + * ÉùÃ÷baidu°ü + */ + var baidu = baidu || { + guid: "$BAIDU$" + }; + (function () { + // Ò»Ð©Ò³Ãæ¼¶±ðΨһµÄÊôÐÔ£¬ÐèÒª¹ÒÔØÔÚwindow[baidu.guid]ÉÏ + window[baidu.guid] = {}; + + /** + * ½«Ô´¶ÔÏóµÄËùÓÐÊôÐÔ¿½±´µ½Ä¿±ê¶ÔÏóÖÐ + * @name baidu.extend + * @function + * @grammar baidu.extend(target, source) + * @param {Object} target Ä¿±ê¶ÔÏó + * @param {Object} source Ô´¶ÔÏó + * @returns {Object} Ä¿±ê¶ÔÏó + */ + baidu.extend = function (target, source) { + for (var p in source) { + if (source.hasOwnProperty(p)) { + target[p] = source[p]; + } + } + return target; + }; + /** + * @ignore + * @namespace + * @baidu.lang ¶ÔÓïÑÔ²ãÃæµÄ·â×°£¬°üÀ¨ÀàÐÍÅжϡ¢Ä£¿éÀ©Õ¹¡¢¼Ì³Ð»ùÀàÒÔ¼°¶ÔÏó×Ô¶¨ÒåʼþµÄÖ§³Ö¡£ + * @property guid ¶ÔÏóµÄΨһ±êʶ + */ + baidu.lang = baidu.lang || {}; + + /** + * ·µ»ØÒ»¸öµ±Ç°Ò³ÃæµÄΨһ±êʶ×Ö·û´®¡£ + * @function + * @grammar baidu.lang.guid() + * @returns {String} µ±Ç°Ò³ÃæµÄΨһ±êʶ×Ö·û´® + */ + baidu.lang.guid = function () { + return "TANGRAM__" + (window[baidu.guid]._counter++).toString(36); + }; + + window[baidu.guid]._counter = window[baidu.guid]._counter || 1; + + /** + * ËùÓÐÀàµÄʵÀýµÄÈÝÆ÷ + * keyΪÿ¸öʵÀýµÄguid + */ + window[baidu.guid]._instances = window[baidu.guid]._instances || {}; + + /** + * Tangram¼Ì³Ð»úÖÆÌṩµÄÒ»¸ö»ùÀ࣬Óû§¿ÉÒÔͨ¹ý¼Ì³Ðbaidu.lang.ClassÀ´»ñÈ¡ËüµÄÊôÐÔ¼°·½·¨¡£ + * @function + * @name baidu.lang.Class + * @grammar baidu.lang.Class(guid) + * @param {string} guid ¶ÔÏóµÄΨһ±êʶ + * @meta standard + * @remark baidu.lang.ClassºÍËüµÄ×ÓÀàµÄʵÀý¾ù°üº¬Ò»¸öÈ«¾ÖΨһµÄ±êʶguid¡£ + * guidÊÇÔÚ¹¹Ô캯ÊýÖÐÉú³ÉµÄ£¬Òò´Ë£¬¼Ì³Ð×Ôbaidu.lang.ClassµÄÀàÓ¦¸ÃÖ±½Ó»òÕß¼ä½Óµ÷ÓÃËüµÄ¹¹Ô캯Êý¡£
+ * baidu.lang.ClassµÄ¹¹Ô캯ÊýÖвúÉúguidµÄ·½Ê½¿ÉÒÔ±£Ö¤guidµÄΨһÐÔ£¬¼°Ã¿¸öʵÀý¶¼ÓÐÒ»¸öÈ«¾ÖΨһµÄguid¡£ + */ + baidu.lang.Class = function (guid) { + this.guid = guid || baidu.lang.guid(); + window[baidu.guid]._instances[this.guid] = this; + }; + + window[baidu.guid]._instances = window[baidu.guid]._instances || {}; + /** + * ÅжÏÄ¿±ê²ÎÊýÊÇ·ñstringÀàÐÍ»òString¶ÔÏó + * @name baidu.lang.isString + * @function + * @grammar baidu.lang.isString(source) + * @param {Any} source Ä¿±ê²ÎÊý + * @shortcut isString + * @meta standard + * + * @returns {boolean} ÀàÐÍÅжϽá¹û + */ + baidu.lang.isString = function (source) { + return '[object String]' == Object.prototype.toString.call(source); + }; + baidu.isString = baidu.lang.isString; + + /** + * ÅжÏÄ¿±ê²ÎÊýÊÇ·ñΪfunction»òFunctionʵÀý + * @name baidu.lang.isFunction + * @function + * @grammar baidu.lang.isFunction(source) + * @param {Any} source Ä¿±ê²ÎÊý + * @returns {boolean} ÀàÐÍÅжϽá¹û + */ + baidu.lang.isFunction = function (source) { + return '[object Function]' == Object.prototype.toString.call(source); + }; + /** + * ×Ô¶¨ÒåµÄʼþ¶ÔÏó¡£ + * @function + * @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¡£ + * @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 (baidu.lang.isFunction(handler)) { + handler = handler.hashCode; + } else if (!baidu.lang.isString(handler)) { + return; + } + !this.__listeners && (this.__listeners = {}); + type.indexOf("on") != 0 && (type = "on" + type); + var t = this.__listeners; + if (!t[type]) { + return; + } + t[type][handler] && delete t[type][handler]; + }; + + /** + * ÅÉ·¢×Ô¶¨Òåʼþ£¬Ê¹µÃ°ó¶¨µ½×Ô¶¨ÒåʼþÉÏÃæµÄº¯Êý¶¼»á±»Ö´ÐС£ÒýÈë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°ó¶¨µÄ×Ô¶¨Òåʼþ»Øµ÷º¯ÊýÖ®Í⣬»¹»áµ÷ÓÃÖ±½Ó°ó¶¨µ½¶ÔÏóÉÏÃæµÄ×Ô¶¨Òåʼþ¡£ + * ÀýÈ磺
+ * myobj.onMyEvent = function(){}
+ * 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 = {}); + 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; + }; + + /** + * @ignore + * @namespace baidu.dom + * ²Ù×÷domµÄ·½·¨ + */ + baidu.dom = baidu.dom || {}; + + /** + * ´ÓÎĵµÖлñȡָ¶¨µÄ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.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. ²»Ö§³Ö¿çä¯ÀÀÆ÷µÄÊó±ê¹öÂÖʼþ¼àÌýÆ÷Ìí¼Ó
+ 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) { + listener.call(element, ev); + }, + lis = baidu.event._listeners, + filter = baidu.event._eventFilter, + afterFilter, realType = type; + type = type.toLowerCase(); + 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.event.un + * @function + * @grammar baidu.event.un(element, type, listener) + * @param {HTMLElement|string|window} element Ä¿±êÔªËØ»òÄ¿±êÔªËØid + * @param {string} type ʼþÀàÐÍ + * @param {Function} listener ÐèÒªÒÆ³ýµÄ¼àÌýÆ÷ + * @shortcut un + * @meta standard + * @see baidu.event.on + * + * @returns {HTMLElement|window} Ä¿±êÔªËØ + */ + baidu.event.un = function (element, type, listener) { + element = baidu.dom._g(element); + type = type.replace(/^on/i, '').toLowerCase(); + + var lis = baidu.event._listeners, + len = lis.length, + isRemoveAll = !listener, + item, realType, realListener; + while (len--) { + item = lis[len]; + if (item[1] === type && item[0] === element && (isRemoveAll || item[2] === listener)) { + realType = item[4]; + realListener = item[3]; + if (element.removeEventListener) { + element.removeEventListener(realType, realListener, false); + } else if (element.detachEvent) { + element.detachEvent('on' + realType, realListener); + } + lis.splice(len, 1); + } + } + + return element; + }; + baidu.un = baidu.event.un; + + /** + * ×èֹʼþµÄĬÈÏÐÐΪ + * @name baidu.event.preventDefault + * @function + * @grammar baidu.event.preventDefault(event) + * @param {Event} event ʼþ¶ÔÏó + * @meta standard + */ + baidu.preventDefault = baidu.event.preventDefault = function (event) { + if (event.preventDefault) { + event.preventDefault(); + } else { + event.returnValue = false; + } + }; + })(); + + /** + * @exports RichMarker as BMapLib.RichMarker + */ + var RichMarker = + /** + * RichMarkerÀàµÄ¹¹Ô캯Êý + * @class ¸»Marker¶¨ÒåÀ࣬ʵÏַḻµÄMarkerÕ¹ÏÖЧ¹û¡£ + * + * @constructor + * @param {String | HTMLElement} content Óû§×Ô¶¨ÒåµÄMarkerÄÚÈÝ£¬¿ÉÒÔÊÇ×Ö·û´®£¬Ò²¿ÉÒÔÊÇdom½Úµã + * @param {BMap.Point} position markerµÄλÖà + * @param {Json} RichMarkerOptions ¿ÉÑ¡µÄÊäÈë²ÎÊý£¬·Ç±ØÌîÏî¡£¿ÉÊäÈëÑ¡Ïî°üÀ¨£º
+ * {"anchor" : {BMap.Size} MarkerµÄµÄλÖÃÆ«ÒÆÖµ, + *
"enableDragging" : {Boolean} ÊÇ·ñÆôÓÃÍÏ×§£¬Ä¬ÈÏΪfalse} + * + * @example ²Î¿¼Ê¾Àý£º + * var map = new BMap.Map("container"); + * map.centerAndZoom(new BMap.Point(116.309965, 40.058333), 17); + * var htm = "
" + * + "»¶Ó­Ê¹ÓðٶȵØÍ¼£¡" + * + "" + * + "
"; + * var point = new BMap.Point(116.30816, 40.056863); + * var myRichMarkerObject = new BMapLib.RichMarker(htm, point, {"anchor": new BMap.Size(-72, -84), "enableDragging": true}); + * map.addOverlay(myRichMarkerObject); + */ + BMapLib.RichMarker = function (content, position, opts) { + if (!content || !position || !(position instanceof BMap.Point)) { + return; + } + + /** + * map¶ÔÏó + * @private + * @type {Map} + */ + this._map = null; + + /** + * MarkerÄÚÈÝ + * @private + * @type {String | HTMLElement} + */ + this._content = content; + + /** + * markerÏÔʾλÖà + * @private + * @type {BMap.Point} + */ + this._position = position; + + /** + * markerÖ÷ÈÝÆ÷ + * @private + * @type {HTMLElement} + */ + this._container = null; + + /** + * markerÖ÷ÈÝÆ÷µÄ³ß´ç + * @private + * @type {BMap.Size} + */ + this._size = null; + + opts = opts || {}; + /** + * _optsÊÇĬÈϲÎÊý¸³Öµ¡£ + * ÏÂÃæÍ¨¹ýÓû§ÊäÈëµÄopts£¬¶ÔĬÈϲÎÊý¸³Öµ + * @private + * @type {Json} + */ + this._opts = baidu.extend( + baidu.extend(this._opts || {}, { + + /** + * MarkerÊÇ·ñ¿ÉÒÔÍÏ×§ + * @private + * @type {Boolean} + */ + enableDragging: false, + + /** + * MarkerµÄÆ«ÒÆÁ¿ + * @private + * @type {BMap.Size} + */ + anchor: new BMap.Size(0, 0) + }), opts); + } + + // ¼Ì³Ð¸²¸ÇÎïÀà + RichMarker.prototype = new BMap.Overlay(); + + /** + * ³õʼ»¯£¬ÊµÏÖ×Ô¶¨Ò帲¸ÇÎïµÄinitialize·½·¨ + * Ö÷ÒªÉú³ÉMarkerµÄÖ÷ÈÝÆ÷£¬Ìî³ä×Ô¶¨ÒåµÄÄÚÈÝ£¬²¢¸½¼Óʼþ + * + * @private + * @param {BMap} map mapʵÀý¶ÔÏó + * @return {Dom} ·µ»Ø×Ô¶¨ÒåÉú³ÉµÄdom½Úµã + */ + RichMarker.prototype.initialize = function (map) { + var me = this, + div = me._container = document.createElement("div"); + me._map = map; + baidu.extend(div.style, { + position: "absolute", + zIndex: BMap.Overlay.getZIndex(me._position.lat), + // background: "#FFF", + cursor: "pointer" + }); + map.getPanes().labelPane.appendChild(div); + + // ¸øÖ÷ÈÝÆ÷Ìí¼ÓÉÏÓû§×Ô¶¨ÒåµÄÄÚÈÝ + me._appendContent(); + // ¸øÖ÷ÈÝÆ÷Ìí¼Óʼþ´¦Àí + me._setEventDispath(); + // »ñÈ¡Ö÷ÈÝÆ÷µÄ¸ß¿í + me._getContainerSize(); + + return div; + } + + /** + * Ϊ×Ô¶¨ÒåµÄMarkerÉ趨ÏÔʾλÖã¬ÊµÏÖ×Ô¶¨Ò帲¸ÇÎïµÄdraw·½·¨ + * + * @private + */ + RichMarker.prototype.draw = function () { + var map = this._map, + anchor = this._opts.anchor, + pixel = map.pointToOverlayPixel(this._position); + this._container.style.left = pixel.x + anchor.width + "px"; + this._container.style.top = pixel.y + anchor.height + "px"; + } + + /** + * ÉèÖÃMarker¿ÉÒÔÍÏ×§ + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.enableDragging(); + */ + RichMarker.prototype.enableDragging = function () { + this._opts.enableDragging = true; + } + + /** + * ÉèÖÃMarker²»ÄÜÍÏ×§ + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.disableDragging(); + */ + RichMarker.prototype.disableDragging = function () { + this._opts.enableDragging = false; + } + + /** + * »ñÈ¡MarkerÊÇ·ñÄܱ»ÍÏ×§µÄ״̬ + * @return {Boolean} trueΪ¿ÉÒÔÍÏ×§£¬falseΪ²»Äܱ»ÍÏ×§ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.isDraggable(); + */ + RichMarker.prototype.isDraggable = function () { + return this._opts.enableDragging; + } + + /** + * »ñÈ¡MarkerµÄÏÔʾλÖà + * @return {BMap.Point} ÏÔʾµÄλÖà + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.getPosition(); + */ + RichMarker.prototype.getPosition = function () { + return this._position; + } + + /** + * ÉèÖÃMarkerµÄÏÔʾλÖà + * @param {BMap.Point} position ÐèÒªÉèÖõÄλÖà + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.setPosition(new BMap.Point(116.30816, 40.056863)); + */ + RichMarker.prototype.setPosition = function (position) { + if (!position instanceof BMap.Point) { + return; + } + this._position = position; + this.draw(); + } + + /** + * »ñÈ¡MarkerµÄÆ«ÒÆÁ¿ + * @return {BMap.Size} MarkerµÄÆ«ÒÆÁ¿ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.getAnchor(); + */ + RichMarker.prototype.getAnchor = function () { + return this._opts.anchor; + } + + /** + * ÉèÖÃMarkerµÄÆ«ÒÆÁ¿ + * @param {BMap.Size} anchor ÐèÒªÉèÖÃµÄÆ«ÒÆÁ¿ + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.setAnchor(new BMap.Size(-72, -84)); + */ + RichMarker.prototype.setAnchor = function (anchor) { + if (!anchor instanceof BMap.Size) { + return; + } + this._opts.anchor = anchor; + this.draw(); + } + + /** + * Ìí¼ÓÓû§µÄ×Ô¶¨ÒåµÄÄÚÈÝ + * + * @private + * @return ÎÞ·µ»ØÖµ + */ + RichMarker.prototype._appendContent = function () { + var content = this._content; + // Óû§ÊäÈëµÄÄÚÈÝÊÇ×Ö·û´®£¬ÐèҪת»¯³Édom½Úµã + if (typeof content == "string") { + var div = document.createElement('DIV'); + div.innerHTML = content; + if (div.childNodes.length == 1) { + content = (div.removeChild(div.firstChild)); + } else { + var fragment = document.createDocumentFragment(); + while (div.firstChild) { + fragment.appendChild(div.firstChild); + } + content = fragment; + } + } + this._container.innerHTML = ""; + this._container.appendChild(content); + } + + /** + * »ñÈ¡MarkerµÄÄÚÈÝ + * @return {String | HTMLElement} µ±Ç°ÄÚÈÝ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.getContent(); + */ + RichMarker.prototype.getContent = function () { + return this._content; + } + + /** + * ÉèÖÃMarkerµÄÄÚÈÝ + * @param {String | HTMLElement} content ÐèÒªÉèÖõÄÄÚÈÝ + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * var htm = "
" + * + "»¶Ó­Ê¹ÓðٶȵØÍ¼API£¡" + * + "" + * + "
"; + * myRichMarkerObject.setContent(htm); + */ + RichMarker.prototype.setContent = function (content) { + if (!content) { + return; + } + // ´æ´¢Óû§ÊäÈëµÄMarkerÏÔʾÄÚÈÝ + this._content = content; + // Ìí¼Ó½øÖ÷ÈÝÆ÷ + this._appendContent(); + } + + /** + * »ñÈ¡MarkerµÄ¸ß¿í + * + * @private + * @return {BMap.Size} µ±Ç°¸ß¿í + */ + RichMarker.prototype._getContainerSize = function () { + if (!this._container) { + return; + } + var h = this._container.offsetHeight; + var w = this._container.offsetWidth; + this._size = new BMap.Size(w, h); + } + + /** + * »ñÈ¡MarkerµÄ¿í¶È + * @return {Number} µ±Ç°¿í¶È + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.getWidth(); + */ + RichMarker.prototype.getWidth = function () { + if (!this._size) { + return; + } + return this._size.width; + } + + /** + * ÉèÖÃMarkerµÄ¿í¶È + * @param {Number} width ÐèÒªÉèÖõĿí¶È + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.setWidth(300); + */ + RichMarker.prototype.setWidth = function (width) { + if (!this._container) { + return; + } + this._container.style.width = width + "px"; + this._getContainerSize(); + } + + /** + * »ñÈ¡MarkerµÄ¸ß¶È + * @return {Number} µ±Ç°¸ß¶È + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.getHeight(); + */ + RichMarker.prototype.getHeight = function () { + if (!this._size) { + return; + } + return this._size.height; + } + + /** + * ÉèÖÃMarkerµÄ¸ß¶È + * @param {Number} height ÐèÒªÉèÖÃµÄ¸ß¶È + * @return ÎÞ·µ»ØÖµ + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.setHeight(200); + */ + RichMarker.prototype.setHeight = function (height) { + if (!this._container) { + return; + } + this._container.style.height = height + "px"; + this._getContainerSize(); + } + + /** + * ÉèÖÃMarkerµÄ¸÷ÖÖʼþ + * + * @private + * @return ÎÞ·µ»ØÖµ + */ + RichMarker.prototype._setEventDispath = function () { + var me = this, + div = me._container, + isMouseDown = false, + // Êó±êÊÇ·ñ°´Ï£¬ÓÃÒÔÅжÏÊó±êÒÆ¶¯¹ý³ÌÖеÄÍÏ×§¼ÆËã + startPosition = null; // ÍÏקʱ£¬Êó±ê°´ÏµijõʼλÖã¬ÍÏ×§µÄ¸¨Öú¼ÆËã²ÎÊý + + // ͨ¹ýe²ÎÊý»ñÈ¡µ±Ç°Êó±êËùÔÚλÖà + function _getPositionByEvent(e) { + var e = window.event || e, + x = e.pageX || e.clientX || 0, + y = e.pageY || e.clientY || 0, + pixel = new BMap.Pixel(x, y), + point = me._map.pixelToPoint(pixel); + return { + "pixel": pixel, + "point": point + }; + } + + // µ¥»÷ʼþ + baidu.on(div, "onclick", function (e) { + /** + * µã»÷Markerʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#onclick + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("onclick", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "onclick"); + _stopAndPrevent(e); + }); + + // Ë«»÷ʼþ + baidu.on(div, "ondblclick", function (e) { + var position = _getPositionByEvent(e); + /** + * Ë«»÷Markerʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#ondblclick + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("ondblclick", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "ondblclick", { + "point": position.point, + "pixel": position.pixel + }); + _stopAndPrevent(e); + }); + + // Êó±êÒÆÉÏʼþ + div.onmouseover = function (e) { + var position = _getPositionByEvent(e); + /** + * Êó±êÒÆµ½MarkerÉÏʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#onmouseover + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("onmouseover", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "onmouseover", { + "point": position.point, + "pixel": position.pixel + }); + _stopAndPrevent(e); + } + + // Êó±êÒÆ³öʼþ + div.onmouseout = function (e) { + var position = _getPositionByEvent(e); + /** + * Êó±êÒÆ³öMarkerʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#onmouseout + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("onmouseout", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "onmouseout", { + "point": position.point, + "pixel": position.pixel + }); + _stopAndPrevent(e); + } + + // Êó±êµ¯Æðʼþ + var mouseUpEvent = function (e) { + var position = _getPositionByEvent(e); + /** + * ÔÚMarkerÉϵ¯ÆðÊó±êʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#onmouseup + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("onmouseup", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "onmouseup", { + "point": position.point, + "pixel": position.pixel + }); + + if (me._container.releaseCapture) { + baidu.un(div, "onmousemove", mouseMoveEvent); + baidu.un(div, "onmouseup", mouseUpEvent); + } else { + baidu.un(window, "onmousemove", mouseMoveEvent); + baidu.un(window, "onmouseup", mouseUpEvent); + } + + // ÅжÏÊÇ·ñÐèÒª½øÐÐÍÏקʼþµÄ´¦Àí + if (!me._opts.enableDragging) { + _stopAndPrevent(e); + return; + } + // ÍÏ×§½áÊøÊ±£¬ÊÍ·ÅÊó±ê²¶»ñ + me._container.releaseCapture && me._container.releaseCapture(); + /** + * ÍÏ×§Marker½áÊøÊ±£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#ondragend + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("ondragend", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "ondragend", { + "point": position.point, + "pixel": position.pixel + }); + isMouseDown = false; + startPosition = null; + // ÉèÖÃÍÏ×§½áÊøºóµÄÊó±êÊÖÐÍ + me._setCursor("dragend"); + // ÍÏ×§¹ý³ÌÖзÀÖ¹ÎÄ×Ö±»Ñ¡ÖÐ + me._container.style['MozUserSelect'] = ''; + me._container.style['KhtmlUserSelect'] = ''; + me._container.style['WebkitUserSelect'] = ''; + me._container['unselectable'] = 'off'; + me._container['onselectstart'] = function () { + }; + + _stopAndPrevent(e); + } + + // Êó±êÒÆ¶¯Ê¼þ + var mouseMoveEvent = function (e) { + // ÅжÏÊÇ·ñÐèÒª½øÐÐÍÏקʼþµÄ´¦Àí + if (!me._opts.enableDragging || !isMouseDown) { + return; + } + var position = _getPositionByEvent(e); + + // ¼ÆË㵱ǰmarkerÓ¦¸ÃËùÔÚµÄλÖà + var startPixel = me._map.pointToPixel(me._position); + var x = position.pixel.x - startPosition.x + startPixel.x; + var y = position.pixel.y - startPosition.y + startPixel.y; + + startPosition = position.pixel; + me._position = me._map.pixelToPoint(new BMap.Pixel(x, y)); + me.draw(); + // ÉèÖÃÍÏ×§¹ý³ÌÖеÄÊó±êÊÖÐÍ + me._setCursor("dragging"); + /** + * ÍÏ×§MarkerµÄ¹ý³ÌÖУ¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#ondragging + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("ondragging", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "ondragging", { + "point": position.point, + "pixel": position.pixel + }); + _stopAndPrevent(e); + } + + // Êó±ê°´ÏÂʼþ + baidu.on(div, "onmousedown", function (e) { + var position = _getPositionByEvent(e); + /** + * ÔÚMarkerÉϰ´ÏÂÊó±êʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#onmousedown + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("onmousedown", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "onmousedown", { + "point": position.point, + "pixel": position.pixel + }); + + if (me._container.setCapture) { + baidu.on(div, "onmousemove", mouseMoveEvent); + baidu.on(div, "onmouseup", mouseUpEvent); + } else { + baidu.on(window, "onmousemove", mouseMoveEvent); + baidu.on(window, "onmouseup", mouseUpEvent); + } + + // ÅжÏÊÇ·ñÐèÒª½øÐÐÍÏקʼþµÄ´¦Àí + if (!me._opts.enableDragging) { + _stopAndPrevent(e); + return; + } + startPosition = position.pixel; + /** + * ¿ªÊ¼ÍÏ×§Markerʱ£¬ÅÉ·¢Ê¼þµÄ½Ó¿Ú + * @name RichMarker#ondragstart + * @event + * @param {Event Object} e »Øµ÷º¯Êý»á·µ»Øevent²ÎÊý£¬°üÀ¨ÒÔÏ·µ»ØÖµ£º + *
{"target : {BMap.Overlay} ´¥·¢Ê¼þµÄÔªËØ, + *
"type£º{String} ʼþÀàÐÍ, + *
"point£º{BMap.Point} Êó±êµÄÎïÀí×ø±ê, + *
"pixel£º{BMap.Pixel} Êó±êµÄÏñËØ×ø±ê} + * + * @example ²Î¿¼Ê¾Àý£º + * myRichMarkerObject.addEventListener("ondragstart", function(e) { + * alert(e.type); + * }); + */ + _dispatchEvent(me, "ondragstart", { + "point": position.point, + "pixel": position.pixel + }); + isMouseDown = true; + // ÉèÖÃÍÏ×§¿ªÊ¼µÄÊó±êÊÖÐÍ + me._setCursor("dragstart"); + // ÍÏ×§¿ªÊ¼Ê±£¬ÉèÖÃÊó±ê²¶»ñ + me._container.setCapture && me._container.setCapture(); + // ÍÏ×§¹ý³ÌÖзÀÖ¹ÎÄ×Ö±»Ñ¡ÖÐ + me._container.style['MozUserSelect'] = 'none'; + me._container.style['KhtmlUserSelect'] = 'none'; + me._container.style['WebkitUserSelect'] = 'none'; + me._container['unselectable'] = 'on'; + me._container['onselectstart'] = function () { + return false; + }; + _stopAndPrevent(e); + }); + } + + /** + * ÉèÖÃÍÏ×§¹ý³ÌÖеÄÊÖÐÍ + * + * @private + * @param {string} cursorType ÐèÒªÉèÖõÄÊÖÐÍÀàÐÍ + */ + RichMarker.prototype._setCursor = function (cursorType) { + var cursor = ''; + var cursorStylies = { + "moz": { + "dragstart": "-moz-grab", + "dragging": "-moz-grabbing", + "dragend": "pointer" + }, + "other": { + "dragstart": "move", + "dragging": "move", + "dragend": "pointer" + } + }; + + if (navigator.userAgent.indexOf('Gecko/') !== -1) { + cursor = cursorStylies.moz[cursorType]; + } else { + cursor = cursorStylies.other[cursorType]; + } + + if (this._container.style.cursor != cursor) { + this._container.style.cursor = cursor; + } + } + + /** + * ɾ³ýMarker + * + * @private + * @return ÎÞ·µ»ØÖµ + */ + RichMarker.prototype.remove = function () { + _dispatchEvent(this, "onremove"); + // Çå³ýÖ÷ÈÝÆ÷ÉϵÄʼþ°ó¶¨ + if (this._container) { + _purge(this._container); + } + // ɾ³ýÖ÷ÈÝÆ÷ + if (this._container && this._container.parentNode) { + this._container.parentNode.removeChild(this._container); + } + } + + /** + * ¼¯ÖÐÅÉ·¢Ê¼þº¯Êý + * + * @private + * @param {Object} instance ÅÉ·¢Ê¼þµÄʵÀý + * @param {String} type ÅÉ·¢µÄʼþÃû + * @param {Json} opts ÅÉ·¢Ê¼þÀïÌí¼ÓµÄ²ÎÊý£¬¿ÉÑ¡ + */ + function _dispatchEvent(instance, type, opts) { + type.indexOf("on") != 0 && (type = "on" + type); + var event = new baidu.lang.Event(type); + if (!!opts) { + for (var p in opts) { + event[p] = opts[p]; + } + } + instance.dispatchEvent(event); + } + + /** + * ÇåÀíDOMʼþ£¬·Àֹѭ»·ÒýÓà + * + * @type {DOM} dom ÐèÒªÇåÀíµÄdom¶ÔÏó + */ + function _purge(dom) { + if (!dom) { + return; + } + var attrs = dom.attributes, + name = ""; + if (attrs) { + for (var i = 0, n = attrs.length; i < n; i++) { + name = attrs[i].name; + if (typeof dom[name] === "function") { + dom[name] = null; + } + } + } + var child = dom.childnodes; + if (child) { + for (var i = 0, n = child.length; i < n; i++) { + _purge(dom.childnodes[i]); + } + } + } + + /** + * ֹͣʼþðÅÝ´«²¥ + * + * @type {Event} e e¶ÔÏó + */ + function _stopAndPrevent(e) { + var e = window.event || e; + e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; + return baidu.preventDefault(e); + } +})(); \ No newline at end of file diff --git a/fangija-zsyf/js/district/districtDetail.js b/fangija-zsyf/js/district/districtDetail.js index bf6c3fc..723b81f 100644 --- a/fangija-zsyf/js/district/districtDetail.js +++ b/fangija-zsyf/js/district/districtDetail.js @@ -9,7 +9,21 @@ var curOption; /* 关注&已关注切æ�¢ */ $(".collection01").on("click", function () { - + doAddCollect() +}); + +function doAddCollect(){ + if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { + clicked('../user/codeSms.html',true,false,{},{},function(){ + doAddCollect(); + }) + return; + } else { + addCollect(); + } +} + +function addCollect(){ axios.post("/rest/districts/addCollect",{city:city,region:region,name:name,lat:lat,lng:lng,address:address, poiTags:tags}).then(function (response) { var msg = response.data.message if(msg){ @@ -24,11 +38,24 @@ $(".collection01").on("click", function () { .catch(function (error) { console.log(error); }); - - -}); +} + $(".collection02").on("click", function () { - + removeCollect(); +}); + +function doRemoveCollect(){ + if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { + clicked('../user/codeSms.html',true,false,{},{},function(){ + doRemoveCollect(); + }) + return; + } else { + removeCollect(); + } +} + +function removeCollect(){ axios.post("/rest/districts/removeCollect",{city:city,region:region,name:name}).then(function (response) { var msg = response.data.message if(msg){ @@ -43,8 +70,7 @@ $(".collection02").on("click", function () { .catch(function (error) { console.log(error); }); - -}); +} /* button状æ€�切æ�¢ */ $(".content-block .button").on("click", function () { @@ -52,6 +78,16 @@ $(".content-block .button").on("click", function () { $(this).addClass("active"); }); +/* 图表切æ�¢ */ +$("#tabAvgDiv").on("click", function () { + $("#tabChart1").css("z-index","1"); + $("#tabChart2").css("z-index","-1"); +}); +$("#tabRentDiv").on("click", function () { + $("#tabChart2").css("z-index","1"); + $("#tabChart1").css("z-index","-1"); +}); + var t1 = window.setTimeout(loadMap,1000); function loadMap(){ if(lng && lat){ @@ -133,6 +169,28 @@ function loadDistrictInfo(){ } } + var starScore = response.data.data.starScore + if(starScore && starScore > 0){ + var regionIndex = response.data.data.regionIndex + var districtPoiCount = response.data.data.districtPoiCount + + var schoolIndex = response.data.data.schoolIndex + var arroundIndex = response.data.data.arroundIndex + + var indexs = [] + indexs.push(vo.index); + indexs.push(regionIndex); + indexs.push(schoolIndex); + indexs.push(arroundIndex); + + /* å°�区评级 */ + loadDistrictLevel(indexs); + }else{ + $("#distLevelDiv").hide() + } + + + }else{ $("#noDataDiv").show() baseInfo.name = "å°�区详情" @@ -183,11 +241,13 @@ function loadDistrictInfo(){ function loadKLineData(city, region, name){ + var type = $("#trendDiv1 a.active").attr("t-v"); axios.get("/rest/trend/kData", { params: { city: city, region:region, - name:name + name:name, + type: type } }).then(function (response) { var datas = response.data.data @@ -234,23 +294,29 @@ function loadKLineData(city, region, name){ $("#trendDiv1 a").click(function(){ $("#trendDiv1 a").removeClass("active") $(this).addClass("active") + //showTrends(); var v = $(this).attr("t-v"); - if(v == "1"){ - curOption.dataZoom[0].start = 95 - }else if(v == "3"){ - curOption.dataZoom[0].start = 90 - }else if(v == "6"){ - curOption.dataZoom[0].start = 80 - }else if(v == "12"){ - curOption.dataZoom[0].start = 50 - }else if(v == "24"){ - curOption.dataZoom[0].start = 0 - }else if(v == "36"){ - curOption.dataZoom[0].start = 0 - } - myChart01.setOption(curOption,true); + showTrends(v) }); +function showTrends(v){ + + + if(v == "36"){ + if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { + clicked('../user/codeSms.html',true,false,{},{},function(){ + showTrends(v); + }) + return; + } else { + //curOption.dataZoom[0].start = 0 + loadKLineData(city, region, name) + } + } + //myChart01.setOption(curOption,true); + loadKLineData(city, region, name) +} + var option01 = { animation: false, @@ -680,7 +746,8 @@ function loadRentTrends(city, region, name){ showRentChart2(categories, series); }else{ //没数æ�® - $("#tabRentDiv").addClass("dn"); + //$("#tabChart2").hide(); + $("#tabRentDiv").addClass("dn") } }).catch(function (error) { alert(error) @@ -755,7 +822,7 @@ function showRentChart2(categories, series){ } /* å°�区评级 */ -function loadDistrictLevel(){ +function loadDistrictLevel(datas){ var option03 = { tooltip: { trigger: 'axis', @@ -765,10 +832,10 @@ function loadDistrictLevel(){ radar: [ { indicator: [ - {text: '活跃度评级', max: 100}, + {text: '楼盘潜力评级', max: 100}, {text: 'æ�¿å�—评级', max: 100}, {text: '教育评级', max: 100}, - {text: '物业评级', max: 100}, + {text: '生活便利评级', max: 100}, ], radius: 70, name: { @@ -812,7 +879,7 @@ function loadDistrictLevel(){ data: [ { name: '', - value: [25.29, 85.13, 36.42, 57.23] + value: datas } ] } diff --git a/fangija-zsyf/js/log/log_stat.js b/fangija-zsyf/js/log/log_stat.js new file mode 100644 index 0000000..e09e2e0 --- /dev/null +++ b/fangija-zsyf/js/log/log_stat.js @@ -0,0 +1,41 @@ +/** + * 日志记录,ä¾�赖于axios.min.js,axiosPlugin.js + * @author yinjihuan + */ +document.addEventListener('plusready', function() { + savePageLog() +}, false); + +/** + * 记录页é�¢è®¿é—®æ—¥å¿— + */ +function savePageLog() { + var page = document.getElementsByTagName("title")[0].innerHTML; + var device = plus.device.uuid; + var model = plus.device.model; + plus.geolocation.getCurrentPosition(function(p){ + province = p.address.province; + city = p.address.city; + region = p.address.district; + lng = p.coords.longitude; + lat = p.coords.latitude; + address = p.address.street; + doSavePageLog({page:page, lng:lng, lat:lat, province:province, city:city, region:region, address:address, device:device, model:model}); + }, function(e){ + doSavePageLog({page:page, device:device, model:model}); + }, + { + provider:'baidu', + enableHighAccuracy:true, + coordsType:'bd09ll' + } + ); +} + +function doSavePageLog(data) { + axios.post("/rest/log/save", data).then(function (response) { + + }).catch(function (error) { + console.log(error); + }); +} diff --git a/fangija-zsyf/views/component/baseInfoComponent.js b/fangija-zsyf/views/component/baseInfoComponent.js index f8ddedf..b272aa6 100644 --- a/fangija-zsyf/views/component/baseInfoComponent.js +++ b/fangija-zsyf/views/component/baseInfoComponent.js @@ -117,6 +117,7 @@ Vue.component('base-info-component', { $(".collection02").hide(); $(".collection01").show(); } + $(".loadingBg").hide(); if(vo){ if(vo.avgPrice){ lat = vo.lat2; @@ -165,7 +166,48 @@ Vue.component('base-info-component', { dataParam.developer = vo.developer; dataParam.estateCompany = vo.estateCompany; -// loadNearDistrict(vo.lat2, vo.lng2); + var starScore = response.data.data.starScore + + var starHtml = $("#distLevelDiv .star") + if(starHtml.length>0){ + if(starScore && starScore > 0){ + + var html = getStarContent(starScore); + $("#distLevelDiv .star").html(html); + + + + var regionIndex = response.data.data.regionIndex + var districtPoiCount = response.data.data.districtPoiCount + + var schoolIndex = response.data.data.schoolIndex + var arroundIndex = response.data.data.arroundIndex + + var indexs = [] + indexs.push(vo.index); + indexs.push(regionIndex); + indexs.push(schoolIndex); + indexs.push(arroundIndex); + + /* å°�区评级 */ + loadDistrictLevel(indexs); + }else{ + $("#distLevelDiv").hide() + } + }else{ + var ht = $("#arroundLevelDiv") + if(ht.length>0){ + var score = response.data.data.arroundIndexStar + if(score > 0){ + var html = getStarContent(score); + $("#arroundLevelDiv .star").html("生活便利 "+html); + }else{ + $("#arroundLevelDiv").hide(); + } + + } + } + }else{ $("#noDataDiv").show() baseInfo.name = "å°�区详情" @@ -182,3 +224,26 @@ Vue.component('base-info-component', { } }) +function getStarContent(starScore){ + var mod = starScore - parseInt(starScore); + var num = parseInt(starScore); + var nn = 5 - num; + + var html = "" + for(var i=1;i<=num;i++){ + html +="" + } + if(mod==0.5){ + html +="" + } + if(nn >0){ + if(mod==0.5){ + nn = nn -1 + } + for(var j=1;j<=nn;j++){ + html +="" + } + } + return html; +} + diff --git a/fangija-zsyf/views/component/nearDist.js b/fangija-zsyf/views/component/nearDist.js index 4584432..9a860e4 100644 --- a/fangija-zsyf/views/component/nearDist.js +++ b/fangija-zsyf/views/component/nearDist.js @@ -7,7 +7,7 @@ Vue.component('near-dist-component', {
-
+
{{dist.name}}
{{dist.avgPrice}}元/㎡
@@ -56,8 +56,11 @@ Vue.component('near-dist-component', { alert(error) console.log(error); }); + }, + showDistrict:function(index){ + clicked('../district/detail.html',true,false,{},{city:distDatas.nearDists[index].city,region:distDatas.nearDists[index].region,name:distDatas.nearDists[index].name}); } - }, + }, mounted:function(){ this.loadNearDistrict(); } diff --git a/fangija-zsyf/views/district/aroundDetail.html b/fangija-zsyf/views/district/aroundDetail.html index c083884..dbaee06 100644 --- a/fangija-zsyf/views/district/aroundDetail.html +++ b/fangija-zsyf/views/district/aroundDetail.html @@ -82,7 +82,7 @@ $.config = {router: false} - + + - + diff --git a/fangija-zsyf/views/evaluate/evaluateList.html b/fangija-zsyf/views/evaluate/evaluateList.html index 84286cf..4845eac 100644 --- a/fangija-zsyf/views/evaluate/evaluateList.html +++ b/fangija-zsyf/views/evaluate/evaluateList.html @@ -82,7 +82,7 @@ $.config = {router: false} - + + + - @@ -187,28 +191,30 @@
-
-
+
+
-
+ @@ -234,22 +240,22 @@
- + + + + + + + - - - - diff --git a/fangija-zsyf/views/house/houseList.html b/fangija-zsyf/views/house/houseList.html index 31750c7..49392a9 100644 --- a/fangija-zsyf/views/house/houseList.html +++ b/fangija-zsyf/views/house/houseList.html @@ -111,7 +111,7 @@ $.config = {router: false} - + - + diff --git a/fangija-zsyf/views/intelligentHouse/aroundDetail.html b/fangija-zsyf/views/intelligentHouse/aroundDetail.html index 41d1d0f..5a90b13 100644 --- a/fangija-zsyf/views/intelligentHouse/aroundDetail.html +++ b/fangija-zsyf/views/intelligentHouse/aroundDetail.html @@ -141,7 +141,7 @@ $.config = {router: false} - + + - + - + + - + + + + + diff --git a/fangija-zsyf/views/user/updatePass.html b/fangija-zsyf/views/user/updatePass.html index b1ff5db..f601f24 100644 --- a/fangija-zsyf/views/user/updatePass.html +++ b/fangija-zsyf/views/user/updatePass.html @@ -83,7 +83,7 @@ $.config = {router: false} - + - + diff --git a/fangija-zsyf/yfindex.html b/fangija-zsyf/yfindex.html index 746dfa2..ad60cd9 100644 --- a/fangija-zsyf/yfindex.html +++ b/fangija-zsyf/yfindex.html @@ -1182,7 +1182,7 @@ $.config = {router: false} - + From 9b37b4218e0d38ad44305d887e5ca8ecfca271fe Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 11 Apr 2018 14:20:42 +0800 Subject: [PATCH 04/10] update --- fangija-zsyf/js/district/districtDetail.js | 20 +++++++++++++------- fangija-zsyf/views/district/detail.html | 8 ++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fangija-zsyf/js/district/districtDetail.js b/fangija-zsyf/js/district/districtDetail.js index 723b81f..ab2b642 100644 --- a/fangija-zsyf/js/district/districtDetail.js +++ b/fangija-zsyf/js/district/districtDetail.js @@ -73,7 +73,7 @@ function removeCollect(){ } /* button状�切� */ -$(".content-block .button").on("click", function () { +$("#trendTabDiv .button").on("click", function () { $(this).parent().children().removeClass("active"); $(this).addClass("active"); }); @@ -292,16 +292,12 @@ function loadKLineData(city, region, name){ } $("#trendDiv1 a").click(function(){ - $("#trendDiv1 a").removeClass("active") - $(this).addClass("active") //showTrends(); var v = $(this).attr("t-v"); showTrends(v) }); function showTrends(v){ - - if(v == "36"){ if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { clicked('../user/codeSms.html',true,false,{},{},function(){ @@ -309,12 +305,22 @@ function showTrends(v){ }) return; } else { + $("#trendDiv1 a").removeClass("active") + $("a[t-v='36']").addClass("active") //curOption.dataZoom[0].start = 0 loadKLineData(city, region, name) } + }else{ + $("#trendDiv1 a").removeClass("active") + //myChart01.setOption(curOption,true); + if(v == 12){ + $("a[t-v='12']").addClass("active") + }else{ + $("a[t-v='6']").addClass("active") + } + loadKLineData(city, region, name) } - //myChart01.setOption(curOption,true); - loadKLineData(city, region, name) + } diff --git a/fangija-zsyf/views/district/detail.html b/fangija-zsyf/views/district/detail.html index 5cd732f..559973c 100644 --- a/fangija-zsyf/views/district/detail.html +++ b/fangija-zsyf/views/district/detail.html @@ -113,7 +113,7 @@
�区走势分�
-
+ @@ -237,9 +237,9 @@ $.config = {router: false} + From 5d821741ecf68fe665c9abc09b9bda5f0199a1b3 Mon Sep 17 00:00:00 2001 From: "xuhe@fangjia.com" Date: Wed, 11 Apr 2018 16:45:31 +0800 Subject: [PATCH 08/10] aa --- fangija-zsyf/main.html | 6 +- fangija-zsyf/views/house/detail.html | 4 +- fangija-zsyf/views/house/houseDetail.html | 322 +++++++++------------- 3 files changed, 131 insertions(+), 201 deletions(-) diff --git a/fangija-zsyf/main.html b/fangija-zsyf/main.html index 8ce27a1..1dc0688 100644 --- a/fangija-zsyf/main.html +++ b/fangija-zsyf/main.html @@ -19,7 +19,7 @@ 首页 - + 行情 @@ -48,11 +48,11 @@ localStorage.removeItem("user_token"); localStorage.removeItem("user_token_add_time"); } - document.getElementById("quotations").setAttribute("href", BASE_PATH + '/quotations/index'); + //document.getElementById("quotations").setAttribute("href", BASE_PATH + '/quotations/index'); //document.getElementById("selfInfo").setAttribute("href", BASE_PATH + '/selfInfo/index'); //mui�始化 mui.init(); - var subpages = ['yfindex.html', BASE_PATH + '/quotations/index', 'views/house/houseManageList.html', 'views/user/userInfo.html']; + var subpages = ['yfindex.html', 'views/house/houseDetail.html', 'views/house/houseManageList.html', 'views/user/userInfo.html']; var subpage_style = { top: '0', bottom: '50px', diff --git a/fangija-zsyf/views/house/detail.html b/fangija-zsyf/views/house/detail.html index eaa423d..16db67f 100644 --- a/fangija-zsyf/views/house/detail.html +++ b/fangija-zsyf/views/house/detail.html @@ -190,7 +190,7 @@
�区走势分�
-
+ @@ -478,7 +478,7 @@ function loadChart(){ } /* button状�切� */ -$(".content-block .button").on("click", function () { +$("#trendTabDiv .button").on("click", function () { $(this).parent().children().removeClass("active"); $(this).addClass("active"); }); diff --git a/fangija-zsyf/views/house/houseDetail.html b/fangija-zsyf/views/house/houseDetail.html index 193a099..ef87e3b 100644 --- a/fangija-zsyf/views/house/houseDetail.html +++ b/fangija-zsyf/views/house/houseDetail.html @@ -28,24 +28,6 @@
-