123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850 |
- <template>
- <view class="content">
- <view class="" style="height: 20rpx;"></view>
- <!-- map -->
- <view class="map">
- <map @updated='mapChange' ref='map_1' class="map-map"
- :latitude="baseLat" :longitude="baseLng" :markers="marker" @markertap="lookmore" ></map>
- </view>
- <view class="" style="height: 20rpx;"></view>
- <!-- 列表 -->
- <scroll-view scroll-y="true" :style="{'height':height}" class="aed-list" @scrolltolower="loadData()">
- <view class="aed-item flex" v-for="(item,mindex) in AEDList" @click="listlookmore(item,mindex)">
- <view class="item-left">
- <view class="clamp">
- {{item.name}}
- </view>
- <view class="clamp aed-address">
- 地址:{{item.address}}
- </view>
- </view>
- <view class="item-right flex">
- <image src="../../static/icon/dingwei.png" mode=""></image>
- <view class="">
- {{item.range}}KM
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- <!-- 导航选择层 -->
- <uni-popup ref="popup" type="bottom" @click="close">
- <view class="popup_row">
- <view class="rows">
- <view class="rows-item" @click="toGaodeMap">高德地图</view>
- <view class="rows-item" @click="tobaiDuMap">百度地图</view>
- <view class="rows-item" @click="totengxunMap">腾讯地图</view>
- </view>
- </view>
- </uni-popup>
- <!-- aed详情 -->
- <uni-popup ref="popupinfo" type="bottom" >
- <view class="aedxq-wrap">
- <view class="xq-top">
- <view class="aed-name">
- {{showAed.name}}
- </view>
- <view class="aed-dis">
- 距离:{{showAed.dis}}
- </view>
- <view class="aed-address" style="padding-top: 10rpx;">
- 地址:{{showAed.address}}
- </view>
- <view class="aed-address" style="padding-top: 10rpx;">
- 安装位置:{{showAed.addressxq}}
- </view>
- </view>
- <view class="xq-img-wrap">
- <scroll-view scroll-x="true" class="aed-img-scroll">
- <view class="" style="display: flex;flex-wrap: nowrap;">
- <image :src="'https://red.liuniu946.com' + item" mode="heightFix" v-for="item in showAed.imgs"
- class="aed-img" @click="openimg(item)" :key="item"></image>
- </view>
- </scroll-view>
- <!-- <view class="aed-phone" @click="makecall(showAed.phone)">
- 电话
- </view> -->
- </view>
- <view class="aed-dh" @click="opendh">
- 导航
- </view>
- </view>
- </uni-popup>
- <!-- 导航选择层 -->
- <uni-popup ref="popup" type="bottom" @click="close">
- <view class="popup_row">
- <view class="rows">
- <view class="rows-item" @click="toGaodeMap">高德地图</view>
- <view class="rows-item" @click="tobaiDuMap">百度地图</view>
- <view class="rows-item" @click="totengxunMap">腾讯地图</view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import espempty from '@/components/espempty';
- import uniPopup from '@/components/uni-popup/uni-popup.vue';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import {
- getAed
- } from '@/api/category.js'
- export default {
- components: {
- uniPopup,
- espempty,
- uniLoadMore
- },
- //相关配置参数
- data() {
- return {
- baseLng: '',//地图中心经度
- baseLat: '',//地图中心纬度
- aedmarker: [],
- loaded: false,
- loadingType: 'more',
- page: 1,
- limit: 100,
- AEDList: [],
- height: '',
- list: [],
- latitude: '',// 本地坐标
- longitude: '',// 本地坐标
- phone: '',
- marker: [],
- showAed: {
- name: '',
- address: '',
- addressxq: '',
- dis: '',
- lat: '',
- lon: '',
- imgs: [],
- phone: ''
- },
- chooseImg: '',
- mapid: 1,
- isShow: false,
- befoId: 0,
- }
- },
- onReady(res) {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.aed-list').boundingClientRect();
- query.exec(function(res) {
- console.log(res, 'ddddddddddddd');
- _this.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', _this.height);
- });
- },
- fail: res => {}
- });
- },
- onLoad() {
- let obj = this;
- this.getLocal()
- },
- computed: {
- ...mapState('user', ['hasLogin', 'userInfo']),
- ...mapState(['baseURL'])
- },
- methods: {
- ...mapMutations('user', ['setUserInfo']),
- // 导航
- opendh() {
- console.log('导航')
- this.$refs.popup.open();
- },
- // 关闭图片弹窗
- closePup() {
- this.$refs.lookimg.close()
- },
- // 打开图片弹窗
- openimg(src,srcList) {
- let obj = this
- this.chooseImg = this.baseURL + src
-
- console.log('chooseImg', this.chooseImg)
- // this.$refs.lookimg.open()
- let arr = obj.showAed.imgs.map(item => {
- return obj.baseURL + item
- })
- uni.previewImage({
- current: this.chooseImg,
- urls: arr
- })
- },
- // 拨打电话
- makecall(num) {
- uni.makePhoneCall({
- phoneNumber: num + ''
- })
- },
- // 关闭aed详情
- closeAedXq() {
- this.$refs.aedxq.close()
- },
- listlookmore(e,index) {
- let obj = this
- obj.marker[obj.befoId].iconPath = '/static/icon/aed-na.png'
- obj.befoId = index*1 +1
- let aedobj = e
- console.log(aedobj.name,'aedobj++++')
- obj.showAed = {
- name: aedobj.name,
- address: aedobj.address,
- addressxq: aedobj.install_address,
- dis: aedobj.range*1 >= 1 ? (aedobj.range + 'km') : (aedobj.distance + 'm'),
- lat: aedobj.latitude,
- lon: aedobj.longitude,
- imgs: aedobj.images.split(','),
- phone: aedobj.phone
- }
- obj.baseLat = aedobj.latitude
- obj.baseLng = aedobj.longitude
- obj.marker[index*1 + 1].iconPath = '/static/icon/aed-a.png'
- console.log(obj.showAed.name,'obj.showAed')
- // obj.isShow = true
- obj.$refs.popupinfo.open()
- },
- // 打开aed详情
- lookmore(e,from) {
- console.log(e.id,'lookmore++++++++++++')
- let obj = this
- if(obj.befoId != 0) {
- obj.marker[obj.befoId].iconPath = '/static/icon/aed-na.png'
- }
- obj.befoId = e.detail.markerId * 1
- let aedobj = obj.AEDList[e.detail.markerId * 1 - 1]
- console.log(aedobj,'aedobj')
- obj.showAed = {
- name: aedobj.name,
- address: aedobj.address,
- addressxq: aedobj.install_address,
- dis: aedobj.range*1 >= 1 ? (aedobj.range + 'km') : (aedobj.distance + 'm'),
- lat: aedobj.latitude,
- lon: aedobj.longitude,
- imgs: aedobj.images.split(','),
- phone: aedobj.phone
- }
- obj.marker[e.detail.markerId].iconPath = '/static/icon/aed-a.png'
- // obj.isShow = true
- obj.$refs.popupinfo.open()
- },
- // 获取本地坐标
- getLocal() {
- let obj = this;
- console.log('ddddddddddddddddddddddddd')
- let weichatBrowser = uni.getStorageSync('weichatBrowser')
- if(weichatBrowser) {
- let wxOjb = require('jweixin-module');
- wxOjb.ready(() => {
- console.log('加载完毕注册事件');
- wxOjb.getLocation({
- type: 'gcj02',
- success(e) {
- console.log(e)
- obj.baseLat = obj.latitude = Math.abs(e.latitude)
- obj.baseLng = obj.longitude = Math.abs(e.longitude)
- console.log('本地坐标', obj.latitude, obj.longitude)
- let item = {
- id: 0,
- latitude: obj.latitude,
- longitude: obj.longitude,
- iconPath: '/static/img/img19.png',
- width: '35',
- height: '35',
- }
- obj.marker.push(item)
- obj.loadData()
- },
- fail(err) {
- obj.getLocal()
- }
- })
- })
- }else {
- uni.getLocation({
- type: 'gcj02',
- success(e) {
- console.log(e)
- obj.baseLat = obj.latitude = Math.abs(e.latitude)
- obj.baseLng = obj.longitude = Math.abs(e.longitude)
- console.log('本地坐标', obj.latitude, obj.longitude)
- let item = {
- id: 0,
- latitude: obj.latitude,
- longitude: obj.longitude,
- iconPath: '/static/img/img19.png',
- width: '35',
- height: '35',
- }
- obj.marker.push(item)
- obj.loadData()
- },
- fail(err) {
- obj.getLocal()
- }
- })
- }
-
-
- },
- // 地图渲染完毕事件
- mapChange(e) {
- console.log(e);
- },
- // 载入数据
- async loadData() {
- let obj = this;
- if (obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
- return
- }
- obj.loadingType = 'loading'
- getAed({
- latitude: obj.latitude,
- longitude: obj.longitude,
- page: obj.page,
- limit: obj.limit,
- }).then(({
- data
- }) => {
- console.log(data, 'aed++++++++++++++')
- obj.AEDList = obj.AEDList.concat(data);
- let arr = data.map(item => ({
- latitude: item.latitude,
- longitude: item.longitude,
- iconPath: '/static/icon/aed-na.png',
- width: '35',
- height: '35',
- id: obj.mapid++,
- address: item.address
- }));
- obj.marker = obj.marker.concat(arr)
- console.log(obj.page,'obj.page++++++')
- if(obj.page == 1) {
- console.log('obj.lookmore+++++++++++++')
- // obj.lookmore({
- // detail: {
- // markerId: 1
- // }
- // })
- }
- obj.page++
- console.log('加入完成+++++++++++++')
- if (data.length == obj.limit) {
- obj.loadingType = 'more'
- } else {
- obj.loadingType = 'noMore'
- }
- })
- },
- // 调用高德
- toGaodeMap() {
- let latitude = this.showAed.lat;
- let longitude = this.showAed.lon;
- let address = this.showAed.name;
- console.log(address)
- console.log('选择高德', latitude, longitude, address);
- window.location.href = `https://uri.amap.com/marker?position=${longitude},${latitude}&name=${address}`;
- },
- // 调用腾讯
- totengxunMap() {
- let latitude = this.showAed.lat;
- let longitude = this.showAed.lon;
- let address = this.showAed.name;
- console.log('选择腾讯', latitude, longitude);
- window.location.href =
- `http://apis.map.qq.com/uri/v1/marker?marker=coord:${latitude},${longitude};addr:${address}`;
- },
- // 调用百度
- tobaiDuMap() {
- let latlon = this.bd_encrypt(this.showAed.lon,this.showAed.lat)
- let latlon1 = this.bd_encrypt( this.longitude,this.latitude)
- let latitude = latlon.bd_lat;
- let longitude = latlon.bd_lng;
- let latitude6 = latlon1.bd_lat;
- let longitude6 = latlon1.bd_lng;
- let address = this.showAed.name;
- console.log('选择百度', latitude, longitude);
- console.log('获取当前经纬度', latitude6, longitude6);
- window.location.href =
- `http://api.map.baidu.com/direction?origin=latlng:${latitude6},${longitude6}|name:我的位置&destination=${latitude},${longitude}&mode=driving®ion=${address}&output=html&src=webapp.baidu.openAPIdemo`;
- },
- // 高德坐标、腾讯坐标转百度坐标
- bd_encrypt(gg_lng, gg_lat) {
- var X_PI = Math.PI * 3000.0 / 180.0;
- var x = gg_lng,
- y = gg_lat;
- var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * X_PI);
- var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * X_PI);
- var bd_lng = z * Math.cos(theta) + 0.0065;
- var bd_lat = z * Math.sin(theta) + 0.006;
- return {
- bd_lat: bd_lat,
- bd_lng: bd_lng
- };
- }
- }
- }
- </script>
- <style lang="scss">
- body,
- page {
- height: 100%;
- width: 100%;
- background-color: #fff;
- }
- .content {
- height: 100%;
- width: 100%;
- background-color: #fff;
- }
- .map {
- // width: 100%;
- // height: 100%;
- height: 780rpx;
- border-radius: 20rpx;
- .map-map {
- width: 689rpx;
- height: 780rpx;
- border-radius: 20rpx;
- margin: auto;
- }
- }
- /* #ifdef H5 */
- .location {
- overflow-y: scroll; //溢出就滑动起来
- // z-index: 990;
- position: fixed;
- bottom: 0;
- height: 55%;
- width: 100%;
- background-color: #fff;
- padding: 24rpx;
- //搜索框
- .Search-box {
- // z-index: 999;
- height: 80rpx;
- // position: fixed;
- // top: 0;
- // left: 0;
- // width: 100%;
- // background: #FFFFFF;
- // padding-top: 10rpx;
- padding-right: 24rpx;
- padding-left: 24rpx;
- .Search-box-sort {
- float: left;
- margin-left: 32rpx;
- margin-right: 19rpx;
- .sort-text {
- width: 57rpx;
- height: 29rpx;
- font-size: 30rpx;
- font-weight: 500;
- color: rgba(51, 51, 51, 1);
- line-height: 58rpx;
- margin-right: 19rpx;
- }
- .sort-img {
- width: 21rpx;
- height: 11rpx;
- margin-bottom: 4rpx;
- }
- }
- .Search-box-size {
- // width:70%;
- height: 58rpx;
- border-radius: 32rpx;
- background-color: #f1f1f1;
- padding-left: 36rpx;
- display: flex;
- align-items: center;
- .box-img {
- height: 32rpx;
- width: 32rpx;
- margin-right: 16rpx;
- }
- // .box-right{
- // height: 58rpx;
- // // width: 100%;
- // background-color: pink;
- // }
- .box-word {
- width: 100%;
- font-size: 26rpx;
- font-weight: 500;
- color: rgba(205, 203, 203, 1);
- line-height: 55rpx;
- }
- }
- }
- .location-item {
- z-index: 1000;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1rpx solid #E7E8EA;
- padding: 15rpx 0;
- .box-left {
- display: flex;
- .img01 {
- width: 8rpx;
- height: 28rpx;
- margin-right: 18rpx;
- image {
- width: 8rpx;
- height: 28rpx;
- }
- }
- .img02 {
- width: 117rpx;
- height: 117rpx;
- border-radius: 50%;
- image {
- width: 117rpx;
- height: 117rpx;
- border-radius: 50%;
- }
- }
- .info {
- margin-left: 16rpx;
- .info-header {
- display: flex;
- align-items: center;
- .name {
- font-size: 32rpx;
- color: #333333;
- }
- .distance {
- margin-left: 25rpx;
- font-size: 28rpx;
- color: #303133;
- }
- .location-icon {
- margin-left: 10rpx;
- width: 20rpx;
- height: 26rpx;
- image {
- width: 20rpx;
- height: 26rpx;
- display: inline;
- }
- }
- }
- .address {
- font-size: 26rpx;
- color: #333333;
- margin-top: 33rpx;
- }
- }
- }
- .box-right {
- .img {
- height: 107rpx;
- image {
- width: 107rpx;
- height: 107rpx;
- }
- }
- .called {
- margin-right: 16rpx;
- height: 107rpx;
- line-height: 107rpx;
- font-size: 28rpx;
- color: #CB131C;
- }
- }
- }
- }
- /* #endif */
- .list-tpl {
- background-color: #ffffff;
- margin-bottom: 25rpx;
- padding: 25rpx 25rpx;
- font-size: 28rpx;
- border-radius: 15rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #f1f1f1;
- .list-left {
- display: flex;
- width: 100%;
- .number {
- font-size: 32rpx;
- margin-right: 14rpx;
- }
- .info {
- width: 100%;
- .title {
- font-size: 32rpx;
- color: #222222;
- font-weight: 500;
- }
- .addr {
- width: 400rpx;
- margin-top: 20rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- }
- }
- .image {
- width: 20%;
- text-align: center;
- image {
- width: 50rpx;
- height: 50rpx;
- }
- .tip {
- color: #7f7f7f;
- font-size: 21rpx;
- }
- }
- }
- .popup_row {
- width: 100%;
- height: 500rpx;
- background-color: #ffffff;
- border-radius: 20rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- .rows {
- width: 100%;
- padding: 0 24rpx;
- .rows-item {
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- width: 100%;
- font-size: 32rpx;
- color: #303133;
- }
- }
- }
- .scroll-wrapper {
- padding-top: 20rpx;
- }
- .aedxq-wrap {
-
-
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- margin: auto;
- width: 710rpx;
- min-height: 400rpx;
- border-radius: 20rpx;
- padding: 0 25rpx;
- background-color: rgba($color: #000000, $alpha: 0.9);
- color: #fff;
- // position: relative;
-
- .xq-top {
- padding-top: 25rpx;
- width: 660rpx;
- min-height: 210rpx;
- border-bottom: 1px solid #fff;
-
- .aed-name {
- font-size: 28rpx;
- width: 479rpx;
- }
-
- .aed-dis {
- padding-top: 10rpx;
- font-size: 22rpx;
- width: 479rpx;
- }
- }
-
- .xq-img-wrap {
- height: 165rpx;
- width: 660rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
-
- .aed-img-scroll {
- height: 107rpx;
- width: 620rpx;
- // background-color: #bfa;
- // display: flex;
- // // justify-content: ;
- // // flex-direction: column;
- // flex-wrap: nowrap;
-
- .aed-img {
- // display: inline-block;
- height: 107rpx;
- // width: 107rpx;
- margin-right: 15rpx;
- // background-color: red;
- flex-shrink: 0;
-
- }
- }
-
- .aed-phone {
- width: 112rpx;
- height: 52rpx;
- line-height: 52rpx;
- text-align: center;
- border: 1px solid #fff;
- border-radius: 10rpx;
- }
-
- // background-color: red;
- }
-
- .aed-dh {
- width: 147rpx;
- height: 82rpx;
- line-height: 82rpx;
- text-align: center;
- background-color: #4d8bd6;
- border-radius: 15rpx;
- position: absolute;
- right: 25rpx;
- top: 25rpx;
- }
- }
- .pop-wrap {
- width: 522rpx;
- height: 800rpx;
- // background-color: red;
- }
- .popup-box {
- width: 522rpx;
- height: 800rpx;
- border-radius: 20rpx;
- position: relative;
- overflow: hidden;
- background-color: #fff;
- .popup-item {
- width: 100%;
- height: 100%;
- image {
- width: 100%;
- // height: 100%;
- }
- }
- }
- .close {
- display: block;
- width: 40rpx;
- height: 40rpx;
- border: 50%;
- position: absolute;
- // background-color: red;
- bottom: -100rpx;
- left: 0;
- right: 0;
- margin: 0 auto;
- }
- .aed-list {
-
-
- .aed-item {
- width: 690rpx;
- margin: auto;
- justify-content: space-between;
- align-items: center;
- height: 100rpx;
- border-bottom: 1px solid #F1F1F1;
- .item-left {
- width: 550rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #333333;
- .aed-address {
- padding-top: 10rpx;
- font-size: 20rpx;
- font-weight: 500;
- color: #999999;
- }
- }
- .item-right {
- width: 100rpx;
-
- flex-shrink: 0;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-size: 20rpx;
- font-weight: 500;
- color: #999999;
- image {
- width: 28rpx;
- height: 32rpx;
- margin-bottom: 10rpx;
- }
- }
- }
- }
- </style>
|