amap.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. <template>
  2. <view class="map-content" :style="[
  3. isCustomBar && {
  4. height: customBarH + 'px',
  5. paddingTop: statusBarH + 'px',
  6. backgroundColor: 'transparent',
  7. top: top + 'px',
  8. },
  9. ]">
  10. <view class="top">
  11. <view class="cancel" @click="close">取消</view>
  12. <view class="address-text">
  13. {{ addressMap || '' }}
  14. </view>
  15. <view class="confirm" @click="submit"
  16. :style="{ backgroundColor: disable ? 'rgba(0, 0, 0, 0.2)' : '#42b983' }">确定</view>
  17. </view>
  18. <map class="map" id="map" :latitude="lat" :longitude="long" scale="18" show-location :markers="markers"
  19. @tap="getCurrentLocation" :polygons="isPolygons?polygons:[]" enable-poi @poitap="poitap">
  20. <cover-view>
  21. <slot name="content"></slot>
  22. </cover-view>
  23. </map>
  24. <view class="search">
  25. <view class="search-input">
  26. <input placeholder="请输入关键词" v-model="searchValue" type="text" maxlength="64" @input="searchMap" />
  27. </view>
  28. </view>
  29. <view class="bot-box">
  30. <view class="poi-list">
  31. <view class="poi-item" v-for="item in searchList" :key="item.id"
  32. @click="getCurrentSingleLocation(item)">
  33. <view v-if="searchList.length !== 0">
  34. <view class="poi-name">
  35. {{ item.name }}
  36. </view>
  37. <view class="poi-address">
  38. <view class="address">{{ item.address }}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="empty" v-if="searchList.length == 0">暂无数据, 请更检查key是否有效或者更换关键词</view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. // vue3 导入sdk不兼容 所以直接将sdk写入这个文件
  49. function AMapWX(a) {
  50. this.key = a.key
  51. this.requestConfig = {
  52. key: a.key,
  53. s: "rsx",
  54. platform: "WXJS",
  55. appname: a.key,
  56. sdkversion: "1.2.0",
  57. logversion: "2.0"
  58. }
  59. }
  60. AMapWX.prototype.getWxLocation = function(a, b) {
  61. uni.getLocation({
  62. type: "gcj02",
  63. success: function(a) {
  64. var c = a.longitude + "," + a.latitude;
  65. uni.setStorage({
  66. key: "userLocation",
  67. data: c
  68. }), b(c)
  69. },
  70. fail: function(c) {
  71. uni.getStorage({
  72. key: "userLocation",
  73. success: function(a) {
  74. a.data && b(a.data)
  75. }
  76. })
  77. }
  78. })
  79. }
  80. AMapWX.prototype.getRegeo = function(a) {
  81. function c(c) {
  82. var d = b.requestConfig;
  83. uni.request({
  84. url: "https://restapi.amap.com/v3/geocode/regeo",
  85. data: {
  86. key: b.key,
  87. location: c,
  88. extensions: "all",
  89. s: d.s,
  90. platform: d.platform,
  91. appname: b.key,
  92. sdkversion: d.sdkversion,
  93. logversion: d.logversion
  94. },
  95. method: "GET",
  96. header: {
  97. "content-type": "application/json"
  98. },
  99. success: function(b) {
  100. var d, e, f, g, h, i, j, k, l;
  101. b.data.status && "1" == b.data.status ? (d = b.data.regeocode,
  102. e = d.addressComponent, f = [], g = "", d && d.roads[
  103. 0] && d.roads[0].name && (g = d.roads[0].name + "附近"), h =
  104. c.split(",")[0], i = c.split(",")[1], d.pois && d
  105. .pois[0] && (g = d.pois[0].name + "附近", j = d.pois[0]
  106. .location, j && (h = parseFloat(j.split(",")[0]), i =
  107. parseFloat(j.split(",")[1]))), e.provice && f.push(e
  108. .provice), e.city && f.push(e.city), e.district && f.push(
  109. e.district), e.streetNumber && e.streetNumber.street && e
  110. .streetNumber.number ? (f.push(e.streetNumber.street),
  111. f.push(e.streetNumber.number)) : (k = "", d && d.roads[
  112. 0] && d.roads[0].name && (k = d.roads[0].name), f.push(
  113. k)), f = f.join(""), l = [{
  114. iconPath: a.iconPath,
  115. width: a.iconWidth,
  116. height: a.iconHeight,
  117. name: f,
  118. desc: g,
  119. longitude: h,
  120. latitude: i,
  121. id: 0,
  122. regeocodeData: d
  123. }], a.success(l)) : a?.fail && a.fail({
  124. errCode: b.data.infocode,
  125. errMsg: b.data.info
  126. })
  127. },
  128. fail: function(b) {
  129. a.fail({
  130. errCode: "0",
  131. errMsg: b.errMsg || ""
  132. })
  133. }
  134. })
  135. }
  136. var b = this;
  137. a.location ? c(a.location) : b.getWxLocation(a, function(a) {
  138. c(a)
  139. })
  140. }
  141. AMapWX.prototype.getWeather = function(a) {
  142. function d(d) {
  143. var e = "base";
  144. a.type && "forecast" == a.type && (e = "all"), uni.request({
  145. url: "https://restapi.amap.com/v3/weather/weatherInfo",
  146. data: {
  147. key: b.key,
  148. city: d,
  149. extensions: e,
  150. s: c.s,
  151. platform: c.platform,
  152. appname: b.key,
  153. sdkversion: c.sdkversion,
  154. logversion: c.logversion
  155. },
  156. method: "GET",
  157. header: {
  158. "content-type": "application/json"
  159. },
  160. success: function(b) {
  161. function c(a) {
  162. var b = {
  163. city: {
  164. text: "城市",
  165. data: a.city
  166. },
  167. weather: {
  168. text: "天气",
  169. data: a.weather
  170. },
  171. temperature: {
  172. text: "温度",
  173. data: a.temperature
  174. },
  175. winddirection: {
  176. text: "风向",
  177. data: a.winddirection + "风"
  178. },
  179. windpower: {
  180. text: "风力",
  181. data: a.windpower + "级"
  182. },
  183. humidity: {
  184. text: "湿度",
  185. data: a.humidity + "%"
  186. }
  187. };
  188. return b
  189. }
  190. var d, e;
  191. b.data.status && "1" == b.data.status ? b.data.lives ? (d = b
  192. .data.lives, d && d.length > 0 && (d = d[0], e = c(
  193. d), e["liveData"] = d, a.success(e))) : b.data
  194. .forecasts && b.data.forecasts[0] && a.success({
  195. forecast: b.data.forecasts[0]
  196. }) : a.fail({
  197. errCode: b.data.infocode,
  198. errMsg: b.data.info
  199. })
  200. },
  201. fail: function(b) {
  202. a.fail({
  203. errCode: "0",
  204. errMsg: b.errMsg || ""
  205. })
  206. }
  207. })
  208. }
  209. function e(e) {
  210. uni.request({
  211. url: "https://restapi.amap.com/v3/geocode/regeo",
  212. data: {
  213. key: b.key,
  214. location: e,
  215. extensions: "all",
  216. s: c.s,
  217. platform: c.platform,
  218. appname: b.key,
  219. sdkversion: c.sdkversion,
  220. logversion: c.logversion
  221. },
  222. method: "GET",
  223. header: {
  224. "content-type": "application/json"
  225. },
  226. success: function(b) {
  227. var c, e;
  228. b.data.status && "1" == b.data.status ? (e = b.data.regeocode, e
  229. .addressComponent ? c = e.addressComponent.adcode :
  230. e.aois && e.aois.length > 0 && (c = e.aois[0].adcode), d(c)
  231. ) : a.fail({
  232. errCode: b.data.infocode,
  233. errMsg: b.data.info
  234. })
  235. },
  236. fail: function(b) {
  237. a.fail({
  238. errCode: "0",
  239. errMsg: b.errMsg || ""
  240. })
  241. }
  242. })
  243. }
  244. var b = this,
  245. c = b.requestConfig;
  246. a.city ? d(a.city) : b.getWxLocation(a, function(a) {
  247. e(a)
  248. })
  249. }
  250. AMapWX.prototype.getPoiAround = function(a) {
  251. function d(d) {
  252. var e = {
  253. key: b.key,
  254. location: d,
  255. s: c.s,
  256. platform: c.platform,
  257. appname: b.key,
  258. sdkversion: c.sdkversion,
  259. logversion: c.logversion
  260. };
  261. a.querytypes && (e["types"] = a.querytypes), a.querykeywords && (e[
  262. "keywords"] = a.querykeywords), uni.request({
  263. url: "https://restapi.amap.com/v3/place/around",
  264. data: e,
  265. method: "GET",
  266. header: {
  267. "content-type": "application/json"
  268. },
  269. success: function(b) {
  270. var c, d, e, f;
  271. if (b.data.status && "1" == b.data.status) {
  272. if (b = b.data, b && b.pois) {
  273. for (c = [], d = 0; d < b.pois.length; d++) e = 0 == d ? a
  274. .iconPathSelected : a.iconPath, c.push({
  275. latitude: parseFloat(b.pois[d].location.split(",")[
  276. 1]),
  277. longitude: parseFloat(b.pois[d].location.split(",")[
  278. 0]),
  279. iconPath: e,
  280. width: 22,
  281. height: 32,
  282. id: d,
  283. name: b.pois[d].name,
  284. address: b.pois[d].address
  285. });
  286. f = {
  287. markers: c,
  288. poisData: b.pois
  289. }, a.success(f)
  290. }
  291. } else a.fail({
  292. errCode: b.data.infocode,
  293. errMsg: b.data.info
  294. })
  295. },
  296. fail: function(b) {
  297. a.fail({
  298. errCode: "0",
  299. errMsg: b.errMsg || ""
  300. })
  301. }
  302. })
  303. }
  304. var b = this,
  305. c = b.requestConfig;
  306. a.location ? d(a.location) : b.getWxLocation(a, function(a) {
  307. d(a)
  308. })
  309. }
  310. AMapWX.prototype.getStaticmap = function(a) {
  311. function f(b) {
  312. c.push("location=" + b), a.zoom && c.push("zoom=" + a.zoom), a.size && c
  313. .push("size=" + a.size), a.scale && c.push(
  314. "scale=" + a.scale), a.markers && c.push("markers=" + a.markers), a
  315. .labels && c.push("labels=" + a.labels), a.paths &&
  316. c.push("paths=" + a.paths), a.traffic && c.push("traffic=" + a.traffic);
  317. var e = d + c.join("&");
  318. a.success({
  319. url: e
  320. })
  321. }
  322. var e, b = this,
  323. c = [],
  324. d = "https://restapi.amap.com/v3/staticmap?";
  325. c.push("key=" + b.key), e = b.requestConfig, c.push("s=" + e.s), c.push(
  326. "platform=" + e.platform), c.push("appname=" +
  327. e.appname), c.push("sdkversion=" + e.sdkversion), c.push("logversion=" +
  328. e.logversion), a.location ? f(a.location) :
  329. b.getWxLocation(a, function(a) {
  330. f(a)
  331. })
  332. }
  333. AMapWX.prototype.getInputtips = function(a) {
  334. var b = this,
  335. c = b.requestConfig,
  336. d = {
  337. key: b.key,
  338. s: c.s,
  339. platform: c.platform,
  340. appname: b.key,
  341. sdkversion: c.sdkversion,
  342. logversion: c.logversion
  343. };
  344. a.location && (d["location"] = a.location), a.keywords && (d["keywords"] = a
  345. .keywords), a.type && (d["type"] = a.type),
  346. a.city && (d["city"] = a.city), a.citylimit && (d["citylimit"] = a
  347. .citylimit), uni.request({
  348. url: "https://restapi.amap.com/v3/assistant/inputtips",
  349. data: d,
  350. method: "GET",
  351. header: {
  352. "content-type": "application/json"
  353. },
  354. success: function(b) {
  355. b && b.data && b.data.tips && a.success({
  356. tips: b.data.tips
  357. })
  358. },
  359. fail: function(b) {
  360. a.fail({
  361. errCode: "0",
  362. errMsg: b.errMsg || ""
  363. })
  364. }
  365. })
  366. }
  367. AMapWX.prototype.getDrivingRoute = function(a) {
  368. var b = this,
  369. c = b.requestConfig,
  370. d = {
  371. key: b.key,
  372. s: c.s,
  373. platform: c.platform,
  374. appname: b.key,
  375. sdkversion: c.sdkversion,
  376. logversion: c.logversion
  377. };
  378. a.origin && (d["origin"] = a.origin),
  379. a.destination && (d["destination"] = a.destination),
  380. a.strategy && (d["strategy"] = a.strategy),
  381. a.waypoints && (d["waypoints"] = a.waypoints),
  382. a.avoidpolygons && (d["avoidpolygons"] = a.avoidpolygons),
  383. a.avoidroad && (d["avoidroad"] = a.avoidroad),
  384. uni.request({
  385. url: "https://restapi.amap.com/v3/direction/driving",
  386. data: d,
  387. method: "GET",
  388. header: {
  389. "content-type": "application/json"
  390. },
  391. success: function(b) {
  392. b && b.data && b.data.route && a.success({
  393. paths: b.data.route.paths,
  394. taxi_cost: b.data.route.taxi_cost || ""
  395. })
  396. },
  397. fail: function(b) {
  398. a.fail({
  399. errCode: "0",
  400. errMsg: b.errMsg || ""
  401. })
  402. }
  403. })
  404. }
  405. AMapWX.prototype.getWalkingRoute = function(a) {
  406. var b = this,
  407. c = b.requestConfig,
  408. d = {
  409. key: b.key,
  410. s: c.s,
  411. platform: c.platform,
  412. appname: b.key,
  413. sdkversion: c.sdkversion,
  414. logversion: c.logversion
  415. };
  416. a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a
  417. .destination), uni.request({
  418. url: "https://restapi.amap.com/v3/direction/walking",
  419. data: d,
  420. method: "GET",
  421. header: {
  422. "content-type": "application/json"
  423. },
  424. success: function(b) {
  425. b && b.data && b.data.route && a.success({
  426. paths: b.data.route.paths
  427. })
  428. },
  429. fail: function(b) {
  430. a.fail({
  431. errCode: "0",
  432. errMsg: b.errMsg || ""
  433. })
  434. }
  435. })
  436. }
  437. AMapWX.prototype.getTransitRoute = function(a) {
  438. var b = this,
  439. c = b.requestConfig,
  440. d = {
  441. key: b.key,
  442. s: c.s,
  443. platform: c.platform,
  444. appname: b.key,
  445. sdkversion: c.sdkversion,
  446. logversion: c.logversion
  447. };
  448. a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a
  449. .destination), a.strategy && (d[
  450. "strategy"] = a.strategy), a.city && (d["city"] = a.city), a.cityd && (
  451. d["cityd"] = a.cityd), uni.request({
  452. url: "https://restapi.amap.com/v3/direction/transit/integrated",
  453. data: d,
  454. method: "GET",
  455. header: {
  456. "content-type": "application/json"
  457. },
  458. success: function(b) {
  459. if (b && b.data && b.data.route) {
  460. var c = b.data.route;
  461. a.success({
  462. distance: c.distance || "",
  463. taxi_cost: c.taxi_cost || "",
  464. transits: c.transits
  465. })
  466. }
  467. },
  468. fail: function(b) {
  469. a.fail({
  470. errCode: "0",
  471. errMsg: b.errMsg || ""
  472. })
  473. }
  474. })
  475. }
  476. AMapWX.prototype.getRidingRoute = function(a) {
  477. var b = this,
  478. c = b.requestConfig,
  479. d = {
  480. key: b.key,
  481. s: c.s,
  482. platform: c.platform,
  483. appname: b.key,
  484. sdkversion: c.sdkversion,
  485. logversion: c.logversion
  486. };
  487. a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a
  488. .destination), uni.request({
  489. url: "https://restapi.amap.com/v4/direction/bicycling",
  490. data: d,
  491. method: "GET",
  492. header: {
  493. "content-type": "application/json"
  494. },
  495. success: function(b) {
  496. b && b.data && b.data.data && a.success({
  497. paths: b.data.data.paths
  498. })
  499. },
  500. fail: function(b) {
  501. a.fail({
  502. errCode: "0",
  503. errMsg: b.errMsg || ""
  504. })
  505. }
  506. })
  507. }
  508. export default {
  509. name: 'amap',
  510. props: {
  511. longitude: {
  512. type: String,
  513. default: ''
  514. },
  515. latitude: {
  516. type: String,
  517. default: ''
  518. },
  519. mapKey: {
  520. require: true,
  521. type: String,
  522. default: ''
  523. },
  524. marker: {
  525. type: Object,
  526. default: () => {}
  527. },
  528. disable: {
  529. type: Boolean,
  530. default: false
  531. },
  532. isPolygons: {
  533. type: Boolean,
  534. default: false
  535. },
  536. polygons: {
  537. type: Array,
  538. default: () => []
  539. },
  540. top: {
  541. type: [String, Number],
  542. default: 30
  543. },
  544. isCustomBar: {
  545. type: Boolean,
  546. default: false
  547. }
  548. },
  549. data() {
  550. return {
  551. statusBarH: 0,
  552. customBarH: 0,
  553. addressMap: '',
  554. searchValue: '',
  555. markers: [],
  556. amapPlugin: null,
  557. key: this.$props?.mapKey, //高德地图key https://console.amap.com/dev/key/app 服务平台选择微信小程序
  558. lat: this.$props?.latitude,
  559. long: this.$props?.longitude,
  560. regeocodeData: {},
  561. searchList: []
  562. };
  563. },
  564. created() {
  565. this.init();
  566. let self = this
  567. uni.getSystemInfo({
  568. success: function(e) {
  569. self.statusBarH = e.statusBarHeight + 5
  570. if (uni.getMenuButtonBoundingClientRect?.()) {
  571. let custom = uni.getMenuButtonBoundingClientRect()
  572. self.customBarH = custom.height + 5
  573. } else {
  574. self.customBarH = 30
  575. }
  576. },
  577. })
  578. },
  579. methods: {
  580. changeMarkers() {
  581. this.markers[0] = {
  582. ...this.$props?.marker,
  583. longitude: this.long,
  584. latitude: this.lat
  585. };
  586. },
  587. init() {
  588. this.amapPlugin = new AMapWX({
  589. key: this.key
  590. });
  591. const detail = {
  592. longitude: this.$props?.longitude,
  593. latitude: this.$props?.latitude
  594. };
  595. if (!detail.latitude || !detail.longitude) {
  596. const _this = this;
  597. uni.getLocation({
  598. type: 'gcj02',
  599. isHighAccuracy: true,
  600. success: (data) => {
  601. detail.latitude = data.latitude;
  602. detail.longitude = data.longitude;
  603. _this.getCurrentLocation({
  604. detail
  605. });
  606. }
  607. });
  608. } else {
  609. this.getCurrentLocation({
  610. detail
  611. });
  612. }
  613. },
  614. poitap(e) {
  615. this.getCurrentLocation(e)
  616. },
  617. //点击地图
  618. getCurrentLocation(e) {
  619. this.searchValue = '';
  620. const {
  621. latitude,
  622. longitude
  623. } = e.detail;
  624. if (!latitude || !longitude) return;
  625. this.getRegeo([longitude, latitude], (pois) => {
  626. this.searchList = pois;
  627. })
  628. },
  629. getInputtips() {
  630. this.amapPlugin.getInputtips({
  631. key: this.key,
  632. keywords: this.searchValue,
  633. location: this.long + ',' + this.lat,
  634. success: (data) => {
  635. this.searchList = data.tips.filter((i) => i?.id?.length && i?.location);
  636. }
  637. });
  638. },
  639. getRegeo(coordinate, fn) {
  640. this.lat = coordinate[1];
  641. this.long = coordinate[0];
  642. this.changeMarkers();
  643. this.amapPlugin.getRegeo({
  644. location: this.long + ',' + this.lat,
  645. success: (data) => {
  646. const {
  647. regeocodeData
  648. } = data[0];
  649. this.addressMap = regeocodeData.formatted_address;
  650. this.regeocodeData = regeocodeData;
  651. this.$emit('changeMarker', this.getConfirmData());
  652. fn && fn(regeocodeData.pois);
  653. }
  654. });
  655. },
  656. //搜索关键字
  657. searchMap() {
  658. this.getInputtips();
  659. },
  660. getCurrentSingleLocation(data) {
  661. let coordinate = data.location.split(',');
  662. this.searchValue = data.name;
  663. this.getRegeo(coordinate);
  664. },
  665. close() {
  666. this.$emit('confirm');
  667. },
  668. getConfirmData() {
  669. const {
  670. pois,
  671. addressComponent: {
  672. province,
  673. district,
  674. township
  675. }
  676. } = this.regeocodeData;
  677. const title = pois?.[0]?.name || province + district + township;
  678. return {
  679. ...this.regeocodeData,
  680. title,
  681. latitude: this.lat,
  682. longitude: this.long,
  683. address: this.addressMap
  684. }
  685. },
  686. submit(e) {
  687. if (this.$props.disable) {
  688. return;
  689. }
  690. if (!this.addressMap) {
  691. return;
  692. }
  693. if (JSON.stringify(this.regeocodeData) != '{}') {
  694. this.$emit('confirm', this.getConfirmData());
  695. }
  696. }
  697. }
  698. };
  699. </script>
  700. <style lang="scss" scoped>
  701. .map-content {
  702. position: fixed;
  703. top: 0;
  704. left: 0;
  705. bottom: 0;
  706. right: 0;
  707. z-index: 99;
  708. background-color: #fff;
  709. .top {
  710. position: absolute;
  711. width: 100%;
  712. height: 80rpx;
  713. display: flex;
  714. justify-content: space-between;
  715. align-items: center;
  716. padding: 10rpx 40rpx;
  717. box-sizing: border-box;
  718. background-color: rgba(0, 0, 0, 0.2);
  719. color: #fff;
  720. z-index: 999;
  721. .confirm {
  722. height: 60rpx;
  723. line-height: 60rpx;
  724. padding: 0 20rpx;
  725. border-radius: 10rpx;
  726. background-color: #42b983;
  727. }
  728. .address-text {
  729. width: 55vw;
  730. text-align: center;
  731. overflow: hidden;
  732. word-wrap: break-word;
  733. display: -webkit-box;
  734. -webkit-line-clamp: 1;
  735. -webkit-box-orient: vertical;
  736. }
  737. }
  738. .map {
  739. position: relative;
  740. width: 100vw;
  741. height: 50vh;
  742. .position-icon {
  743. position: absolute;
  744. left: 50%;
  745. top: 50%;
  746. width: 50px;
  747. height: 40px;
  748. margin-top: -12px;
  749. transform: translate(-50%, -50%);
  750. }
  751. }
  752. .search {
  753. padding: 10rpx 20rpx;
  754. display: flex;
  755. justify-content: center;
  756. background-color: #fff;
  757. input {
  758. flex: 1;
  759. width: calc(100vw - 80rpx);
  760. padding: 0 20rpx;
  761. height: 60rpx;
  762. border: 1px solid #ccc;
  763. border-radius: 10rpx;
  764. }
  765. }
  766. .bot-box {
  767. height: calc(50vh - 50px);
  768. overflow: auto;
  769. width: 100vw;
  770. background-color: #fff;
  771. .empty {
  772. margin-top: 40rpx;
  773. display: flex;
  774. align-items: center;
  775. justify-content: center;
  776. }
  777. .poi-list {
  778. // padding: 0 $uni-spacing-row-base;
  779. box-sizing: border-box;
  780. .poi-item {
  781. margin: 20rpx 0;
  782. padding: 10rpx;
  783. // border: 1px solid $uni-border-color;
  784. // border-radius: $uni-border-radius-base;
  785. .poi-name {
  786. font-size: 34rpx;
  787. color: #333;
  788. }
  789. .poi-address {
  790. .address {
  791. width: 100%;
  792. font-size: 26rpx;
  793. overflow: hidden;
  794. color: #999;
  795. white-space: nowrap;
  796. text-overflow: ellipsis;
  797. }
  798. }
  799. }
  800. .poi-item:active {
  801. color: #fff;
  802. border: 1px solid #42b983;
  803. }
  804. }
  805. }
  806. }
  807. </style>