地圖找房區域一級實現
阿新 • • 發佈:2020-08-13
html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>地圖找房</title> <link rel="stylesheet" type="text/css" href="//static.fczx.com/www/css/_common.css"><link rel="stylesheet" type="text/css" href="//static.fczx.com/www/css/module/map-search.css"> <script type="text/javascript" src="//static.fczx.com/www/js/lib/jquery.min.js"></script> <script type="text/javascript" src="//static.fczx.com/www/js/common/app.js"></script> <script type="text/javascript" src="//static.fczx.com/www/js/common/index.js"></script> <script type="text/javascript" src="//static.fczx.com/www/js/common/msg-modal.js"></script> <script type="text/javascript" src="//static.fczx.com/www/js/common/map-search.js"></script> <scripttype="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=kM1RFA6AzOnv6lmlc7qyOMhqBILu1pgk"></script> <!-- <script type="text/javascript" src="//api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils.js"></script> --> <!-- <script type="text/javascript" src="//api.map.baidu.com/library/InfoBox/1.2/src/InfoBox_min.js"></script> --> <style> .circle-bubble { margin-top: 25px; text-align: center; color: #fff; } .circle-bubble .name { font-size: 14px; font-weight: bold; } .circle-bubble .count { margin-top: 5px; font-size: 12px; } .house-bubble { display: block; position: relative; height: 30px; line-height: 30px; padding: 0 10px; text-align: center; color: #fff; } .house-bubble .triangle-down { position: absolute; left: 40%; border-width: 8px; border-style: solid; border-color: #11a43c transparent transparent transparent; opacity: .9; } .house-bubble:hover .triangle-down { border-color: #f60 transparent transparent transparent; } .house-bubble .price { font-weight: bold; } .house-bubble em { padding: 0 10px; color: #ccc; } </style> </head> <body> <div class="main-nav"> <div class="nav-content clearfix"> <div class="nav-left fl clearfix"> <div class="nav-item"> <a href="/" class="nav-logo">房產線上<small>Fczx.com</small></a> </div> <div class="nav-item nav-city"> <a href="javascript:void(0);" class="city-name">襄陽</a> </div> <div class="nav-item"> <ul class="nav-list"> <li><a href="/">首頁</a></li> <li><a href="/pages/building/list.html" target="_blank">新房</a></li> <li><a>二手房</a></li> <li><a>租房</a></li> <li><a href="/pages/consult" target="_blank">資訊</a></li> <li><a href="/pages/knowledge" target="_blank">知識</a></li> <li><a href="/pages/qa" target="_blank">問答</a></li> </ul> </div> </div> <div class="nav-right fr"> <div class="nav-item login-link hide" id="loginLink"> <ul> <li> <a href="/pages/login" class="login-btn">登入</a> </li> <li> <a href="/pages/login/register.html" class="login-btn">註冊</a> </li> </ul> </div> <div class="login-user" id="loginUser"> <div class="nav-item"> <a href="/pages/user/index.html" class="login-btn">Nyan</a> </div> <div class="user-center"> <span class="triangle-up"></span> <a href="">我的訊息</a> <a href="">我的回答</a> <a href="">看房記錄</a> <a href="" class="logout">退出</a> </div> </div> </div> </div> </div> <div class="box-map-search"> <div class="map-search-menu clearfix"> <div class="menu-list fl"> <div class="menu-item"> <div class="item-select"> <span data-name="區域">區域</span> <i class="iconfont"></i> <input type="hidden" id="region" value=""> </div> <ul class="item-select-list"> <li data-value="0">全部</li> <li id="region_1001" data-value="1001">樊城區</li> <li id="region_1002" data-value="1002">襄州區</li> <li id="region_1003" data-value="1003">谷城縣</li> <li id="region_1004" data-value="1004">老河口市</li> <li id="region_1005" data-value="1005">宜城</li> <li id="region_1006" data-value="1006">保康</li> <li id="region_1007" data-value="1007">棗陽</li> </ul> </div> <div class="menu-item"> <div class="item-select"> <span data-name="戶型">戶型</span> <i class="iconfont"></i> <input type="hidden" id="house_type" value=""> </div> <ul class="item-select-list"> <li data-value="0">全部</li> <li id="house_type_101" data-value="101">一室</li> <li id="house_type_102" data-value="102">二室</li> <li id="house_type_103" data-value="103">三室</li> <li id="house_type_104" data-value="104">四室</li> <li id="house_type_105" data-value="105">五室</li> <li id="house_type_106" data-value="106">五室以上</li> </ul> </div> <div class="menu-item"> <div class="item-select"> <span data-name="面積">面積</span> <i class="iconfont"></i> <input type="hidden" id="house_area" value=""> </div> <ul class="item-select-list"> <li data-value="0">全部</li> <li id="house_area_50" data-value="50">50平米以下</li> <li id="house_area_5070" data-value="5070">50-70平米</li> <li id="house_area_7090" data-value="7090">70-90平米</li> <li id="house_area_90110" data-value="90110">90-110平米</li> <li id="house_area_110130" data-value="110130">110-130平米</li> <li id="house_area_130150" data-value="130150">130-150平米</li> <li id="house_area_150200" data-value="150200">150-200平米</li> <li id="house_area_200300" data-value="200300">200-300平米</li> <li id="house_area_300" data-value="300">300平米以上</li> </ul> </div> <div class="menu-item"> <div class="item-select"> <span data-name="型別">型別</span> <i class="iconfont"></i> <input type="hidden" id="house_prop" value=""> </div> <ul class="item-select-list"> <li data-value="0">全部</li> <li id="house_prop_1" data-value="1">住宅</li> <li id="house_prop_2" data-value="2">別墅</li> <li id="house_prop_3" data-value="3">商住</li> <li id="house_prop_4" data-value="4">商鋪</li> <li id="house_prop_5" data-value="5">寫字樓</li> </ul> </div> <div class="menu-item"> <div class="item-select"> <span data-name="預算">預算</span> <i class="iconfont"></i> <input type="hidden" id="house_price" value=""> </div> <ul class="item-select-list"> <li data-value="0">全部</li> <li id="house_price_30" data-value="30">30萬以下</li> <li id="house_price_3050" data-value="3050">30-50萬</li> <li id="house_price_50100" data-value="50100">50-100萬</li> <li id="house_price_100200" data-value="100200">100-200萬</li> <li id="house_price_300" data-value="300">300萬以上</li> </ul> </div> </div> <div class="switch-list fr"> <a href="javascript:void(0);" class="switch-name">列表</a> <ul class="item-select-list"> <li><a href="/pages/building/list.html">新房</a></li> </ul> </div> </div> <div class="map-search-content"> <div class="map-container" id="mapContainer"></div> <div class="map-list-wrap"> <div class="fold-btn"> <i class="open"></i> </div> <div class="map-list-content"> <ul class="map-list"> <!-- <li class="mli-item clearfix" id="item_1002"> <div class="fl"> <a class="mli-img" href="javascript:void(0);"> <img src="//static.fczx.com/www/assets/images/200x150.jpg" alt=""> </a> </div> <div class="mli-detail fl"> <p class="item house-name" href="javascript:void(0);">金隅上城郡</p> <p class="item"> <span class="house-price">800萬元/套</span> </p> <p class="item house-address" title="[樊城區]團山大道與鄧城大道交叉口北150米">[樊城區]團山大道與鄧城大道交叉口北150米</p> </div> </li> --> </ul> </div> <div class="map-list-empty"> <div class="empty-content"> <img src="//static.fczx.com/www/assets/icons/house_empty.png" alt=""> <p class="empty-text">很抱歉,沒有找到符合條件的房源資訊!</p> </div> </div> </div> </div> </div> </body> <script> $(document).ready(function () { new FCZX.map.Index({ city: '襄陽', position: {}, source_url: 'http://xiangyang.fczx.com/house/list', //測試介面 // source_url: app.areaApiUrl(/house/list), city_regions: [ { "id": "1001", "name": "樊城區", "longitude": "112.146049", "latitude": "32.051797", }, { "id": "1002", "name": "襄州區", "longitude": "112.328604", "latitude": "32.207599", }, { "id": "1003", "name": "谷城縣", "longitude": "111.477729", "latitude": "32.125439", }, { "id": "1004", "name": "老河口市", "longitude": "111.774385", "latitude": "32.416571", }, { "id": "1005", "name": "宜城", "longitude": "112.264608", "latitude": "31.726207", }, { "id": "1006", "name": "保康", "longitude": "110.939608", "latitude": "31.905982", }, { "id": "1007", "name": "棗陽", "longitude": "112.778475", "latitude": "32.136441", }, { "id": "1008", "name": "東津", "longitude": "112.24564738403", "latitude": "32.037933183676", }, { "id": "1009", "name": "高新區", "longitude": "112.20214023493", "latitude": "32.124717768712", }, { "id": "1010", "name": "襄城區", "longitude": "112.14737978321", "latitude": "32.022001683487", } ] }) // let lng = 112.129108; // let lat = 32.015532; }) </script> </html>
js:
(function (win, $) { FCZX.globalNamespace('FCZX.map.Index'); FCZX.map.Index = function (opt) { this.opt = { defaultZoom: 11, regionZoom: 12, navSelector: '.main-nav', menuSelector: '.map-search-menu' } $.extend(true, this.opt, opt || {}); this.headerHeight = this._getHeaderHeight(); this._init(); } $.extend(FCZX.map.Index.prototype, { _init: function () { let _this = this; let _opt = _this.opt; this.load = new FCZX.map.Load(_this, _opt.source_url); this.list = new FCZX.map.List(_this); this.menu = new FCZX.map.Menu(_this, { menuSelector: _opt.menuSelector, city_regions: _opt.city_regions }); this.bMap = new FCZX.map.SearchMap(_this, { headerHeight: _this.headerHeight, city: _opt.city, position: _opt.position, defaultZoom: _opt.defaultZoom, regionZoom: _opt.regionZoom }); _this._resize(); $(win).resize(function () { _this._resize(); }); }, _getHeaderHeight: function () { return $(this.opt.navSelector).outerHeight(true) + $(this.opt.menuSelector).outerHeight(true) }, _resize: function () { let winHeight = $(win).outerHeight(true); this.bMap.setMapHeight(winHeight); }, _getAllParams: function () { let mapParams = this.bMap.getMapParams(); let menuParams = this.menu.getMenuParams(); return $.extend({}, mapParams, menuParams); }, updateParams: function () { let _this = this; let params = this._getAllParams(); _this.load._setParamsFetch(params); }, setMapCenter: function (zoom, position) { this.bMap.setMapCenter(zoom, position); this.updateParams(); }, updateData: function (result) { this.list.updateListData(result.label_rows); this.bMap.updateMapDataOverlays(result); } }); })(window, jQuery); (function ($) { FCZX.globalNamespace('FCZX.map.Load'); FCZX.map.Load = function (mapIndex, url) { this.mapIndex = mapIndex; this.url = url; this.timestamp = 0; this.timer = null; } $.extend(FCZX.map.Load.prototype, { _setParamsFetch: function (params) { let _this = this; if ($.type(params) !== 'object') { return; } this.timestamp += 1; $.extend(params, { timestamp: _this.timestamp }); clearTimeout(this.timer); this.timer = setTimeout(function () { _this._fetchPromise(_this.url, params); }, 200); }, _fetchPromise: function (url, params, callback) { let _this = this; app.request({ url: url, data: params, type: 'GET', dataType: 'json', headers: {}, done: function (res) { let result = res.data; if ($.type(callback) === 'function') { callback(r); } else { _this.mapIndex.updateData(result); } } }); } }) })(jQuery); (function ($) { FCZX.globalNamespace('FCZX.map.Menu'); FCZX.map.Menu = function (mapIndex, opt) { this.mapIndex = mapIndex; this.keyList = ['region', 'house_type', 'house_area', 'house_prop', 'house_price']; this._init(opt); } $.extend(FCZX.map.Menu.prototype, { _init: function (opt) { this.opt = { menuSelector: '.map-search-menu', itemSelector: '.menu-item', selectTextS: '.item-select', selectListS: '.item-select-list', optionS: 'li' } $.extend(true, this.opt, opt || {}); this._initDomEvent(); }, _initDomEvent: function () { let _this = this; let _opt = _this.opt; _opt.$cont = $(_opt.menuSelector); _opt.$item = _opt.$cont.find(_opt.itemSelector); _opt.$selectList = _opt.$cont.find(_opt.selectListS); _opt.$item.each(function () { $(this).hover(function () { $(this).find(_opt.selectListS).show(); }, function () { $(this).find(_opt.selectListS).hide(); }) }) _opt.$selectList.find(_opt.optionS).each(function () { $(this).on('click.mapMenuItem', function () { let text = $(this).text() let id = $(this).attr('id'); let value = $(this).data('value'); let selectText = $(this).parent().siblings(_opt.selectTextS); let $span = selectText.find('span'); let $input = selectText.find('input'); if (id) { $span.text(text); $input.val(value); selectText.addClass('actived'); } else { $span.text($span.data('name')); $input.val(''); selectText.removeClass('actived'); } _opt.$selectList.hide(); $(this).siblings().removeClass('actived'); $(this).addClass('actived'); _this._change($(this).parents(_opt.itemSelector).index(), value); }); }); }, _change: function (index, value) { if (index == 0) {//更新區域值 let _this = this; let indexOpt = _this.mapIndex.opt; let position = _this._getPositionById(value); if (position) { _this.mapIndex.setMapCenter(indexOpt.regionZoom, position); } else { _this.mapIndex.setMapCenter(indexOpt.defaultZoom); } return; } this._updateParams(); }, _getPositionById: function (region_id) { let position = {}; for (const item of this.opt.city_regions) { if (item.id == region_id) { position.lng = item.longitude; position.lat = item.latitude; return position; } } }, getMenuParams: function () { let obj = {}; let param = {}; for (const key of this.keyList) { obj[key] = $(`#${key}`).val() || ""; param = $.extend({}, param, obj); } return param; }, _updateParams: function () { this.mapIndex.updateParams(); } }); })(jQuery); (function ($) { FCZX.globalNamespace('FCZX.map.List'); FCZX.map.List = function (mapIndex, opt) { this.mapIndex = mapIndex; this._init(opt); } $.extend(FCZX.map.List.prototype, { _init: function (opt) { this.opt = { foldSelector: '.fold-btn', contSelector: '.map-list-content', listSelector: '.map-list', itemSelector: '.mli-item', emptySelector: '.map-list-empty' } $.extend(true, this.opt, opt || {}); this._initDomEvent(); }, _initDomEvent: function () { let _this = this; let _opt = _this.opt; _opt.$foldBtn = $(_opt.foldSelector); _opt.$content = $(_opt.contSelector); _opt.$empty = $(_opt.emptySelector); _opt.$list = $(_opt.contSelector).find(_opt.listSelector); _opt.$foldBtn.click(function () { let $icon = _opt.$foldBtn.find('i'); if ($icon.hasClass('open')) { $(this).css('left', 0); $icon.removeClass('open'); $icon.addClass('close'); _opt.$content.hide(); } else { $(this).css('left', '380px'); $icon.removeClass('close'); $icon.addClass('open'); _opt.$content.show(); } }); }, updateListData: function (listData) { let _this = this; let _opt = _this.opt; let _template = ''; let region_name = ''; if (!listData || listData.length <= 0) { _opt.$empty.show(); _opt.$list.html(_template); return; } for (const item of listData) { if (item.sub_region_name) { region_name = item.region_name + ' ' + item.sub_region_name; } else { region_name = item.region_name; } _template = _template + ` <li class="mli-item clearfix" data-id="${item.id}"> <div class="fl"> <a class="mli-img" href="${item.house_link}"> <img src="${item.image_path}" alt=""> </a> </div> <div class="mli-detail fl"> <p class="item house-name" href="${item.house_link}">${item.house_name}</p> <p class="item"> <span class="house-price">${item.price}${item.price_unit}</span> </p> <p class="item house-address" title="[${region_name}]${item.address}">[${region_name}]${item.address}</p> </div> </li> ` }; _opt.$empty.hide(); _opt.$list.html(_template); } }); })(jQuery); (function ($) { FCZX.globalNamespace('FCZX.map.SearchMap'); FCZX.map.SearchMap = function (mapIndex, opt) { this.mapIndex = mapIndex; this._init(opt); } $.extend(FCZX.map.SearchMap.prototype, { _init: function (opt) { this.map = undefined; //地圖例項 this.point = undefined; //地圖中心點 this.polygon = undefined; //行政區域折線 this.opt = { mapWrapId: 'mapContainer', lng: '', lat: '', defaultZoom: 11, regionZoom: 12, minZoom: 11, maxZoom: 18, city: '北京' } $.extend(true, this.opt, opt || {}); this._initMap(); }, _initMap: function () { let _this = this; let _opt = _this.opt; this.setMapHeight($(window).height()); this.map = new BMap.Map(_opt.mapWrapId, { enableMapClick: false }); this.setMapCenter(_opt.defaultZoom, _opt.position); // lng ,lat, zoom this.map.addControl(new BMap.NavigationControl()); //地圖平移縮放控制元件 this.map.setMinZoom(_opt.minZoom); this.map.setMaxZoom(_opt.maxZoom); this.map.enableScrollWheelZoom(); // 啟用地圖縮放 this.map.enableInertialDragging(); // 啟用地圖慣性拖拽 this.map.addControl(new BMap.ScaleControl()); // 比例尺控制元件,預設位於地圖左下方,顯示地圖的比例關係 this.map.addEventListener('load', function () { _this._bindMapEvent(); }) }, _bindMapEvent: function () { var func = $.proxy(this._updateParams, this); this.map.addEventListener('zoomend', func); this.map.addEventListener('moveend', func); this.map.addEventListener('dragend', func); this.map.addEventListener('resize', func); }, // 更新引數,重新整理地圖資料 _updateParams: function () { this.map.clearOverlays(); this.mapIndex.updateParams(); }, setMapCenter: function (zoom, position = {}) { let point = null; if ($.isEmptyObject(position)) { this.map.centerAndZoom(this.opt.city, zoom) } else { point = new BMap.Point(position.lng, position.lat); this.map.centerAndZoom(point, zoom); } }, setMapHeight: function (winHeight) { $(`#${this.opt.mapWrapId}`).height(winHeight - this.opt.headerHeight); }, //獲取地圖可視範圍 getMapParams: function () { let param = {}; let _this = this; let _map = _this.map; let bounds = _map.getBounds(); let sw = bounds.getSouthWest(); let ne = bounds.getNorthEast(); param.zoom = _map.getZoom(); param.swlng = sw.lng; param.swlat = sw.lat; param.nelng = ne.lng; param.nelat = ne.lat; return param }, updateMapDataOverlays: function (result) { let _this = this; let zoomLevel = _this.map.getZoom(); this.regions = result.gather_regions; this.houseLabels = result.label_rows; if (zoomLevel <= 12) { _this.addRegionLabels(result.gather_regions); } else { _this.addHouseLabels(result.label_rows); } }, // 根據行政區劃繪製邊界 _getBoundary: function (regionName) { let _this = this; let _map = _this.map; let boundary = new BMap.Boundary(); boundary.get(regionName, function (rs) { //行政區域的點有多少個 if (rs.boundaries.length === 0) { // alert('未能獲取當前輸入行政區域'); return; } for (const itemBoundary of rs.boundaries) { if (!_this.polygon) { _this.polygon = new BMap.Polygon(itemBoundary, { strokeWeight: 2, strokeColor: "rgb(17,164,60)", fillColor: "rgba(17,164,60, .1)", enableClicking: false }); //建立多邊形覆蓋物 _map.addOverlay(_this.polygon); //新增覆蓋物 } else { _this.polygon.setPath(itemBoundary); _map.addOverlay(_this.polygon); //新增覆蓋物 } _this.polygon.enableMassClear(); } }); }, // 根據行政區劃繪製聚合點位 addRegionLabels: function (dataArr) { // 新增marks時先清除之前的覆蓋物 let _this = this; _this.map.clearOverlays(); for (const item of dataArr) { _this.addLabel('region', item); } }, //繪製詳細樓盤點位資訊 addHouseLabels: function (dataArr) { let _this = this; _this.map.clearOverlays(); for (const item of dataArr) { _this.addLabel('house_label', item); } }, addLabel: function (type, data) { let _this = this; let _thisConfig = this.labelConfig(_this, data)[type]; let point = new BMap.Point(data.longitude, data.latitude); let size = new BMap.Size(_thisConfig.offset.x, _thisConfig.offset.y); let label = new BMap.Label(_thisConfig.template, { position: point, offset: size }); label.setStyle(_thisConfig.style) label.setTitle(_thisConfig.title); _this.map.addOverlay(label); _thisConfig.bindEvent(label); }, labelConfig: function (_this, data) { return { region: { type: "region", title: data.name, template: ` <div class="circle-bubble" data-id="${data.id}"> <p class="name">${data.name}</p> <p class="count"><span>${data.count}</span>個樓盤</p> </div>`, style: { width: "92px", //寬 height: "92px", //高度 border: "0", //邊 background: "rgba(17,164,60,.9)", //背景顏色 borderRadius: "50%", cursor: "pointer" }, offset: { x: -65, y: -45 }, bindEvent: function (label) { // 當滑鼠懸停在label上時顯示行政區劃邊界 label.addEventListener("mouseover", function () { label.setStyle({ background: "rgba(255,102,0,.9)" }); //修改覆蓋物背景顏色 var regionName = label.getTitle(); _this._getBoundary(regionName); }); // 當滑鼠離開時在刪除邊界折線資料 label.addEventListener("mouseout", function () { label.setStyle({ background: "rgba(17,164,60,.9)" }); //修改覆蓋物背景顏色 if (_this.polygon) { _this.map.removeOverlay(_this.polygon);//清除折線資料 } }); label.addEventListener("click", function () { _this.map.centerAndZoom(label.point, _this.map.getZoom() + 1); }); } }, house_label: { type: "house_label", title: data.house_name, template: ` <a class="house-bubble" data-id="${data.id}" href="${data.house_link}"> <p> <span class="price">${data.price}</span> <span class="unit">${data.price_unit}</span> <em>|</em> <span class="name">${data.house_name}</span> </p> <div class="triangle-down"></div> </a>`, style: { height: "30px", //高度 border: "0", //邊 backgroundColor: "rgba(17,164,60,.9)", borderRadius: "4px", cursor: "pointer" }, offset: { x: -65, y: -45 }, bindEvent: function (label) { //滑鼠點選時開啟新標籤並關閉上一個標籤內容 label.addEventListener("mouseover", function () { label.setStyle({ background: "rgba(255,102,0,.9)" }); }); label.addEventListener("mouseout", function () { label.setStyle({ background: "rgba(17,164,60,.9)" }); //修改覆蓋物背景顏色 }); } } } } }); })(jQuery)
css:
.map-search-menu { width: 100%; height: 50px; border-bottom: 1px solid #f2f2f2; } .map-search-menu { padding: 0 25px; } .map-search-menu .menu-item { position: relative; float: left; min-width: 60px; color: #666; } .map-search-menu .item-select { position: relative; height: 50px; line-height: 50px; padding: 0 20px; cursor: pointer; } .map-search-menu .item-select:hover { color: #f60; } .map-search-menu .item-select.actived { color: #f60; } .map-search-menu .item-select-list { display: none; position: absolute; top: 50px; width: 120px; background-color: #fff; border: 1px solid #f2f2f2; border-top: 0; z-index: 12; cursor: pointer; } .map-search-menu .menu-item:hover { background-color: #f7f7f7; } .map-search-menu .item-select-list li { height: 30px; line-height: 30px; padding-left: 18px; } .map-search-menu .item-select-list li:hover { color: #f60; background-color: #f7f7f7; } .map-search-menu .item-select-list li.actived { color: #f60; } .map-search-menu .switch-list { position: relative; } .map-search-menu .switch-list .switch-name { display: block; width: 68px; height: 50px; line-height: 50px; text-align: center; padding-left: 15px; background: url('//static.fczx.com/www/assets/icons/list.png') no-repeat 15px center; } .map-search-menu .switch-list .switch-name:hover { color: #ff3344; background: url('//static.fczx.com/www/assets/icons/list_hv.png') no-repeat 15px center; background-color: #f7f7f7; } .map-search-menu .switch-list:hover .item-select-list { display: block; } .map-search-menu .switch-list .item-select-list { width: 82px; } /*地圖搜尋內容*/ .map-search-content { position: relative; } .map-container { position: relative; width: 100%; height: 100%; background-color: #f7f7f7; } .map-list-wrap { position: absolute; top: 0; left: 0; height: 100%; background-color: #fff; box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .15); } .map-list-wrap .fold-btn { position: absolute; top: 50%; left: 380px; width: 30px; height: 65px; background-color: #fff; box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .15); cursor: pointer; } .map-list-wrap .fold-btn i { display: block; width: 100%; height: 100%; } .open { background: url('//static.fczx.com/www/assets/icons/triangle-left.png') no-repeat center center; } .close { background: url('//static.fczx.com/www/assets/icons/triangle-right.png') no-repeat center center; } .map-list-content { width: 380px; } .mli-item { padding: 20px; border-bottom: 1px solid #eee; cursor: pointer; } .mli-item:hover { background-color: #f7f7f7; } .mli-item .mli-img { position: relative; display: block; width: 100px; height: 80px; overflow: hidden; } .mli-item .mli-img img { width: 100%; height: 100%; } .mli-item .mli-detail { width: 220px; margin-left: 15px; } .mli-item .mli-detail .item { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mli-item .mli-detail .house-name { margin-bottom: 10px; font-size: 16px; font-weight: bold; color: #333; } .mli-item .mli-detail .house-price { font-weight: 700; color: #ff3344; margin: 6px 0; } .mli-item .mli-detail .house-address { margin-top: 10px; color: #666; } .map-list-empty { display: none; width: 380px; text-align: center; margin-top: 60px; } .empty-text { color: #666; margin-top: 15px; }
例圖: