1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231 |
- <template>
- <view>
- <view class="map-box" v-if="!deviceCode">
- <!-- <view class="mp-header">
- <view class="sys-head" :style="'height:'+(statusBarHeight)+'px;'"></view>
- <view class="serch-box" :style="{height:barHeight+'px'}">
- <view class="serch-wrapper flex" @click="goEquList">
- <image class="logo" src='/static/img/addequ.png' mode="" />
- <view class="name">奶奶</view>
- <image class="arrow" src="/static/img/arrow.png" mode=""></image>
- </view>
- </view>
- </view> -->
- <!-- <map id='map' :latitude="latitude" :longitude="longitude" :markers="covers" :polyline="polyline"
- :scale="scale">
- </map> -->
- <view class="top-input" v-if="!deviceId">
- <image src="../../static/img/noneEqu.png" mode=""></image>
- <view class="btn-box" @click="goEquList">
- <view class="btn">添加设备</view>
- </view>
- </view>
- <view class="info-box" v-if="deviceId" @click="goBindPage">
- <view class="scroll-view_H">
- <scroll-view class="scroll-view-content" scroll-x @scroll="scroll" scroll-left="0">
- <view id="demo1" class="scroll-view-item_H uni-bg-red" @click="toHeartRate">
- <image class="bg-image" src="../../static/img/heart.png" mode=""></image>
- <view class="text-wrapper">
- <view class="text-overlay black">
- <view class="top-box">
- <view class="top-left">
- <view class="english">Heart rate</view>
- <view class="chinese">心率</view>
- </view>
- <image class="top-right"
- src="https://app.tjzhxx.cn:11443/image/enterprise_icon.png" mode=""></image>
- </view>
- <view class="under-box">
- <view class="under-left">
- <view class="number">98</view>
- <view class="unit">bpm</view>
- </view>
- <view class="under-right">
- <view class="range">75~96 bpm</view>
- <view class="range-word">平局区间</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view id="demo2" class="scroll-view-item_H uni-bg-green">
- <image class="bg-image" src="../../static/img/sleep.png" mode=""></image>
- <view class="text-wrapper white">
- <view class="text-overlay">
- <view class="top-box">
- <view class="top-left">
- <view class="english">Sleep log</view>
- <view class="chinese">睡眠</view>
- </view>
- </view>
- <view class="under-box">
- <view class="under-left white">
- <view class="number">5h</view>
- <view class="unit">28 min</view>
- </view>
- <view class="under-left white">
- <view class="number">66%</view>
- <view class="unit">深睡</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view id="demo3" class="scroll-view-item_H uni-bg-blue">
- <image class="bg-image" src="../../static/img/breathe.png" mode=""></image>
- <view class="text-wrapper white">
- <view class="text-overlay">
- <view class="top-box">
- <view class="top-left">
- <view class="english">Breathe log</view>
- <view class="chinese">呼吸</view>
- </view>
- </view>
- <view class="under-box">
- <view class="under-left white">
- <view class="number">21次</view>
- <view class="unit">最高</view>
- </view>
- <view class="under-left white">
- <view class="number">17次</view>
- <view class="unit">平均呼吸</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="sos-btn">
- <image src="../../static/img/sos.png" mode=""></image>
- </view>
- </view>
- <view class="icon-box-right" v-if="showBtn">
- <image src="/static/image/calendarIcon.png" mode="" @click="showDayPicker = true"></image>
- </view>
- <van-loading class="loading" v-if="showLoading" type="spinner" color="#000" />
- </view>
- <view class="" v-if="deviceCode">
- <web-view :src="h5url"></web-view>
- </view>
- <!-- </page-container> -->
- <van-popup :show="showDayPicker" position="bottom">
- <van-datetime-picker @cancel="showDayPicker=false" @confirm="onConfirm" :value="currentDay" type="date" />
- <!-- :min-date="minDate" -->
- </van-popup>
- </view>
- </template>
- <script>
- // import AMapLoader from "@amap/amap-jsapi-loader";
- import {
- toLogin
- } from '@/libs/login.js';
- import {
- mapGetters
- } from "vuex";
- import * as hrApi from '@/api/sleep/index.js';
- // import * as infoApi from '@/api/info/index.js';
- // import dayjs from "@/plugin/dayjs/dayjs.min.js";
- // #ifdef MP
- const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
- const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
- // 获取导航栏高度
- const barHeight = menuButtonInfo.height + (menuButtonInfo.top - statusBarHeight) * 2
- // #endif
- export default {
- computed: mapGetters(['deviceCode', 'isLogin']),
- data() {
- return {
- statusBarHeight: statusBarHeight,
- barHeight: barHeight,
- showPage: false,
- aaa: [117.662369, 39.032391],
- showInfo: true,
- map: null,
- windowHeight: 0,
- mapHeight: 0,
- timer: null,
- showDayPicker: false, //日
- dateTime: '',
- navigationBarTitle: '定位',
- currentDay: new Date().getTime(),
- showLoading: false,
- isDisabled: false,
- isStart: false,
- playIndex: 1,
- showBtn: false, //展示右边日历按钮
- scale: 13,
- id: 0, // 使用 marker点击事件 需要填写id
- title: 'map',
- latitude: 39.0313466,
- longitude: 117.6637305,
- // latitude: '',
- // longitude: '',
- // deviceCode: '',
- onlineForce: false,
- onlineStatus: false,
- gpsUpdateTime: '',
- addressDesc: '',
- // 标记点
- // covers: [{
- // id: 1,
- // width: 42,
- // height: 47,
- // // rotate: 270,
- // // latitude: '',
- // // longitude: '',
- // latitude: 39.0313466,
- // longitude: 117.6637305,
- // iconPath: "https://app.tjzhxx.cn:11443/image/enterprise_icon.png",
- // // callout: {
- // // content: "陕A·88888", // 车牌信息
- // // display: "ALWAYS",
- // // fontWeight: "bold",
- // // color: "#5A7BEE", //文本颜色
- // // fontSize: "12px",
- // // bgColor: "#ffffff", //背景色
- // // padding: 5, //文本边缘留白
- // // textAlign: "center",
- // // },
- // // anchor: {
- // // x: 0.5,
- // // y: 0.5,
- // // }
- // },
- // // 找到当前数据得id,在这个数据得前面造出一个没有id得json,用作北京图片,前提是经纬度一样
- // {
- // id: 2,
- // width: 47,
- // height: 49,
- // latitude: 39.037,
- // longitude: 117.660,
- // iconPath: "https://app.tjzhxx.cn:11443/image/gender_man.png",
- // },
- // {
- // // id: 3,
- // width: 40,
- // height: 45,
- // latitude: 39.037,
- // longitude: 117.660,
- // iconPath: "https://app.tjzhxx.cn:11443/image/enterprise_icon.png",
- // },
- // {
- // id: 3,
- // width: 42,
- // height: 47,
- // latitude: 39.052,
- // longitude: 117.657,
- // iconPath: "https://app.tjzhxx.cn:11443/image/enterprise_icon.png",
- // },
- // ],
- covers:[],
- // 线
- polyline: [],
- // 坐标数据
- coordinates: [{
- id: 1,
- latitude: 23.098994,
- longitude: 113.322520,
- },
- {
- id: 2,
- latitude: 23.097994,
- longitude: 113.323520,
- // iconPath: '/image/location.png',
- },
- ],
- coordinate: [], //坐标数据
- posi: { // 汽车定位点的数据,后面只用改latitude、longitude即可
- id: 1,
- width: 32,
- height: 32,
- latitude: 0,
- longitude: 0,
- iconPath: "/static/image/positonimg.png",
- callout: {
- content: "陕A·85Q1Q", // 车牌信息
- display: "BYCLICK",
- fontWeight: "bold",
- color: "#5A7BEE", //文本颜色
- fontSize: "12px",
- bgColor: "#ffffff", //背景色
- padding: 5, //文本边缘留白
- textAlign: "center",
- },
- anchor: {
- x: 0.5,
- y: 0.5,
- },
- },
- h5url:''
- }
- },
- beforeCreate() {
- console.log('我只行啊')
- uni.setStorageSync('useSleep', true);
- },
- onReady() {
- // 创建map对象
- this.map = uni.createMapContext('map');
- // 获取屏幕高度
- uni.getSystemInfo({
- success: res => {
- this.windowHeight = res.windowHeight;
- }
- });
- },
- onShow() {
- // this.initAmap();
- this.getLocationInfo()
- // this.getHrdata()
- console.log(this.deviceCode,'deviceCodedeviceCode')
- if(this.deviceCode){
- this.geth5Url()
- }
- },
- onPageUnload: function() {
- uni.navigateBack({
- delta: 0
- })
- },
- onLoad() {
- let that =this
- uni.getLocation({
- type: 'wgs84',
- success: function (res) {
- console.log(res,'我是定位接口得返回数据')
- console.log('当前位置的经度:' + res.longitude);
- console.log('当前位置的纬度:' + res.latitude);
- },
- fail: function (error) {
- console.log('获取位置信息失败:', error.errMsg);
- // 或者将错误信息显示在页面上
- // this.errorMessage = '获取位置信息失败: ' + error.errMsg;
- }
- });
- },
- onHide: function() {
- uni.setStorageSync('useSleep', false);
- },
- mounted() {
- },
- methods: {
- geth5Url(){
- hrApi.geth5url({sn:this.deviceCode}).then(res=>{
- console.log(res,777)
- this.h5url=res.data.httpsURL
- // this.$set("this.h5url",res.data.httpsURL)
- })
- },
- getHrdata(){
- hrApi.getHrInfo({sn:"B1E507CD076164C7",date:"2024-06-30"}).then(res=>{
- console.log('我是首页得心率数据',res)
- })
- },
- toHeartRate() {
- uni.navigateTo({
- url: '/pages/index/condition/heart_rate/index'
- })
- },
- goEquList() {
- console.log('走到这')
- // 记得放开
- if (!this.isLogin) {
- console.log('进来了')
- toLogin();
- return
- }
- console.log('点击了')
- uni.navigateTo({
- url: '/pages/equ_list/index',
- })
- },
- beforeleave() {
- console.log('出发了');
- this.showPage = false
- //判断是上一个页面进入(返回),还是直接进入这个页面(回首页)
- let pages = getCurrentPages()
- console.log(pages.length, 5555);
- pages.length = 2
- console.log(pages.length, 6666);
- console.log(this.showBtn, '轨迹');
- console.log(!this.showBtn, '定位');
- if (pages.length == 2 && this.showBtn) {
- this.showPage = true
- uni.navigateTo({
- url: '/pages/index/map/index'
- })
- } else {
- this.showPage = true
- uni.switchTab({
- url: '/pages/index/index'
- })
- }
- },
- onConfirm(e) {
- this.dateTime = this.formatDate(e.detail)
- this.showDayPicker = false
- this.initAmap(3)
- },
- getLocationInfo() {
- this.showLoading = true
- return
- infoApi.getLocationInfo({
- deviceId: this.deviceId
- }).then(res => {
- this.showLoading = false
- this.latitude = res.data.lat
- this.longitude = res.data.lng
- this.covers[0].latitude = res.data.lat
- this.covers[0].longitude = res.data.lng
- this.deviceCode = res.data.deviceCode
- this.onlineForce = res.data.onlineForce
- this.onlineStatus = res.data.onlineStatus
- this.gpsUpdateTime = this.formaTime(res.data.gpsUpdateTime)
- this.addressDesc = res.data.addressDesc
- })
- },
- formaTime: function(date) {
- return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
- },
- formatDate: function(date) {
- return dayjs(date).format("YYYY-MM-DD");
- },
- goFenceList() {
- let center = `${this.longitude},${this.latitude}`
- uni.navigateTo({
- url: `/pages/index/map/fencelist?center=${center}`,
- });
- },
- goBindPage() {
- },
- formatDate: function(date) {
- return dayjs(date).format("YYYY-MM-DD");
- },
- initAmap(type) {
- let _this = this;
- // _this.addMarkers()
- if (type === 2) {
- this.showLoading = true
- infoApi.refreshLocation({
- deviceId: this.deviceId
- }).then(res => {
- this.showLoading = false
- this.latitude = res.data.lat
- this.longitude = res.data.lng
- this.covers[0].latitude = res.data.lat
- this.covers[0].longitude = res.data.lng
- this.gpsUpdateTime = this.formaTime(res.data.gpsUpdateTime)
- this.addressDesc = res.data.addressDesc
- })
- }
- if (type === 3) {
- uni.navigateTo({
- url: '/pages/index/map/driving'
- })
- // return
- // this.showBtn = true
- // this.scale = 18
- // wx.setNavigationBarTitle({
- // title: "轨迹"
- // })
- // // this.onLoad()//重新调方法 改标题,有问题
- // this.dateTime = this.dateTime ? this.dateTime : this.formatDate(new Date())
- // let params = {
- // deviceId: this.deviceId,
- // dateTime: this.dateTime,
- // // deviceId:this.deviceId,
- // // dateTime:this.formatDate(new Date())
- // }
- // infoApi.getLocationLocus(params).then(res => {
- // if (res.code === 0 && res.data.length) {
- // this.coordinate = res.data.map(item => {
- // console.log('11111');
- // return {
- // latitude: item.lat,
- // longitude: item.lng,
- // }
- // })
- // _this.polyline = [{
- // points: this.coordinate,
- // color: '#F35546',
- // width: 4,
- // dottedLine: false,
- // }];
- // // TODO 找相关api,将轨迹缩放到合适比例,将起点终点放上图标
- // _this.map.translateMarker({
- // markerId: 1,
- // fail(e) {
- // // 轨迹回放失败
- // },
- // });
- // } else {
- // _this.polyline = [{
- // points: [],
- // color: '#F35546',
- // width: 4,
- // dottedLine: false,
- // }];
- // this.$util.Tips({
- // title: `${this.dateTime}暂无轨迹数据`,
- // }, () => {
- // });
- // }
- // })
- }
- },
- // start() {
- // this.isStart = true;
- // this.isDisabled = true;
- // let data = this.coordinate;
- // let len = data.length;
- // let datai = data[this.playIndex];
- // let _this = this;
- // _this.map.translateMarker({
- // markerId: 1,
- // autoRotate: true,
- // destination: {
- // longitude: datai.longitude, // 车辆即将移动到的下一个点的经度
- // latitude: datai.latitude, // 车辆即将移动到的下一个点的纬度
- // },
- // duration: 700,
- // complete: function() {
- // _this.playIndex++;
- // if (_this.playIndex < len) {
- // _this.start(_this.playIndex, data);
- // } else {
- // console.log('okokok');
- // uni.showToast({
- // title: '播放完成',
- // duration: 1400,
- // icon: 'none'
- // });
- // _this.playIndex = 0;
- // _this.isStart = false;
- // _this.isDisabled = false;
- // }
- // },
- // animationEnd: function() {
- // // 轨迹回放完成 处理H5端
- // _this.playIndex++;
- // if (_this.playIndex < len) {
- // _this.start(_this.playIndex, data);
- // } else {
- // console.log('okokok');
- // uni.showToast({
- // title: '播放完成',
- // duration: 1400,
- // icon: 'none'
- // });
- // _this.playIndex = 0;
- // _this.isStart = false;
- // _this.isDisabled = false;
- // }
- // },
- // fail(e) {
- // // 轨迹回放失败
- // },
- // });
- // },
- // },
- // addMarkers() {
- // let _this = this;
- // const positions = [{
- // latitude: 23.099994,
- // longitude: 113.324520,
- // }, {
- // latitude: 23.099994,
- // longitude: 113.322520,
- // }, {
- // latitude: 23.099994,
- // longitude: 113.326520,
- // }, {
- // latitude: 23.096994,
- // longitude: 113.329520,
- // }]
- // const markers = []
- // positions.forEach((p, i) => {
- // console.log(i)
- // markers.push(
- // Object.assign({}, {
- // id: i + 1,
- // iconPath: "http://cdn.zhoukaiwen.com/car.png",
- // width: 50,
- // height: 50,
- // joinCluster: true, // 指定了该参数才会参与聚合
- // label: {
- // width: 50,
- // height: 30,
- // borderWidth: 1,
- // borderRadius: 10,
- // bgColor: '#ffffff',
- // content: `label ${i + 1}`
- // }
- // }, p)
- // )
- // })
- // _this.map.addMarkers({
- // markers,
- // clear: false,
- // complete(res) {
- // console.log('addMarkers', res)
- // }
- // })
- // },
- initmap(type) {
- AMapLoader.load({
- // key: '2d7215a1d0f8893f2417d134af7c3798',
- key: 'c968deab485d6e688e7c68689722ffb4',
- version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
- plugins: [
- 'AMap.Autocomplete',
- 'AMap.PlaceSearch',
- 'AMap.Scale',
- 'AMap.OverView',
- 'AMap.ToolBar',
- 'AMap.MapType',
- 'AMap.PolyEditor',
- 'AMap.CircleEditor',
- 'MarkerClusterer',
- 'AMap.Geocoder'
- ]
- })
- .then((AMap) => {
- console.log('AMap', AMap)
- // 地图初始化
- // Map构造函数第一个传参的map为初始化地图的容器的id,第二个传参是配置对象
- var map = new AMap.Map('amap', {
- zoom: 15, //显示的缩放级别
- // zooms: [2, 30], //地图显示的缩放级别范围, 默认为 [2, 20] ,取值范围 [2 ~ 30]
- // center: [108.954239, 34.265472], //todo 中心点坐标
- mapStyle: 'amap://styles/macaron', //todo 地图样式
- resizeEnable: true //是否监控地图容器尺寸变化
- });
- /** 定位 */
- let marker = new AMap.Marker();
- if (this.aaa.length) {
- map.setCenter(this.aaa);
- map.add(marker);
- marker.setPosition(this.aaa);
- }
- /** 轨迹 */
- if (type === 3) {
- this.showInfo = false
- console.log('进来');
- map.clearMap();
- marker?.hide()
- const historyList = [{
- "lat": 39.91055750509886,
- "lng": 116.4036806180665,
- "gpsTime": "2023-10-08 13:47:14",
- "gpsId": 867605051108718,
- "compensate": null
- },
- {
- "lat": 39.910380195191074,
- "lng": 116.74977990361894,
- "gpsTime": "2023-10-08 14:08:14",
- "gpsId": 867605051108718,
- "compensate": null
- },
- {
- "lat": 39.91055750509886,
- "lng": 116.4036806180665,
- "gpsTime": "2023-10-08 14:26:00",
- "gpsId": 867605051108718,
- "compensate": null
- },
- {
- "lat": 39.91055750509886,
- "lng": 116.4036806180665,
- "gpsTime": "2023-10-08 14:27:00",
- "gpsId": 867605051108718,
- "compensate": null
- },
- {
- "lat": 39.91055750509886,
- "lng": 116.4036806180665,
- "gpsTime": "2023-10-08 14:30:00",
- "gpsId": 867605051108718,
- "compensate": null
- },
- {
- "lat": 39.910557505765034,
- "lng": 116.40368361866521,
- "gpsTime": "2023-10-08 14:31:00",
- "gpsId": 867605051108718,
- "compensate": null
- },
- {
- "lat": 39.032391,
- "lng": 117.662369,
- "gpsTime": "2023-10-08 19:10:00",
- "gpsId": 867605051108718,
- "compensate": null
- }
- ]
- AMap.plugin('AMap.Driving', function() {
- if (historyList.length >= 2) {
- var drivingOption = {
- policy: AMap.DrivingPolicy
- .LEAST_TIME, // 其它policy参数请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingPolicy
- ferry: 1, // 是否可以使用轮渡
- province: '京', // 车牌省份的汉字缩写
- }
- // 构造路线导航类
- var driving = new AMap.Driving(drivingOption)
- // 根据起终点经纬度规划驾车导航路线
- driving.search(new AMap.LngLat(historyList[0].lng, historyList[0]
- .lat),
- new AMap.LngLat(historyList[historyList.length - 1].lng,
- historyList[historyList.length - 1].lat),
- function(status, result) {
- if (status === 'complete') {
- if (result.routes && result.routes.length) {
- console.log(result.routes, 'result.routes');
- // 绘制第一条路线,也可以按需求绘制其它几条路线
- drawRoute(result.routes[0])
- console.log('绘制驾车路线完成')
- }
- } else {
- console.log('获取驾车数据失败:' + result)
- }
- });
- function drawRoute(route) {
- var path = parseRouteToPath(route)
- var startMarker = new AMap.Marker({
- position: path[0],
- icon: 'https://webapi.amap.com/theme/v1.3/markers/n/start.png',
- map: map
- })
- var endMarker = new AMap.Marker({
- position: path[path.length - 1],
- icon: 'https://webapi.amap.com/theme/v1.3/markers/n/end.png',
- map: map
- })
- var routeLine = new AMap.Polyline({
- path: path,
- isOutline: true,
- outlineColor: '#ffeeee',
- borderWeight: 2,
- strokeWeight: 5,
- strokeOpacity: 0.9,
- strokeColor: '#F35546',
- lineJoin: 'round'
- })
- map.add(routeLine);
- // 调整视野达到最佳显示区域
- map.setFitView([startMarker, endMarker, routeLine])
- }
- // 解析DrivingRoute对象,构造成AMap.Polyline的path参数需要的格式
- // DrivingResult对象结构参考文档 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DriveRoute
- function parseRouteToPath(route) {
- var path = []
- for (var i = 0, l = route.steps.length; i < l; i++) {
- var step = route.steps[i]
- for (var j = 0, n = step.path.length; j < n; j++) {
- path.push(step.path[j])
- }
- }
- return path
- }
- }
- })
- }
- })
- .catch((e) => {
- console.error(e) //加载错误提示
- })
- },
- }
- };
- </script>
- <style lang="scss">
- .map-box {
- z-index: 888;
- width: 100%;
- height: 100vh;
- position: relative;
- .mp-header {
- z-index: 999;
- position: fixed;
- left: 0;
- top: 0;
- width: 100%;
- /* #ifdef H5 */
- padding-bottom: 20rpx;
- /* #endif */
- // background-color: $theme-color;
- .serch-box {
- height: 100%;
- width: 210rpx;
- background-color: #fff;
- border-radius: 35rpx;
- // margin: 33rpx 0 0 30rpx;
- margin: 0 0 0 30rpx;
- .serch-wrapper {
- height: 100%;
- align-items: center;
- padding: 19rpx;
- box-sizing: border-box;
- image {
- width: 118rpx;
- height: 42rpx;
- }
- .logo {
- width: 32rpx;
- height: 32rpx;
- display: flex;
- }
- .arrow {
- width: 48rpx;
- height: 48rpx;
- }
- .name {
- flex: 1;
- text-align: center;
- color: #7C7C7C;
- font-size: 36rpx;
- margin: 0 13rpx 0 18rpx;
- white-space: nowrap;
- }
- .input {
- display: flex;
- align-items: center;
- /* #ifdef MP */
- width: 305rpx;
- /* #endif */
- height: 50rpx;
- padding: 0 0 0 30rpx;
- background: rgba(247, 247, 247, 1);
- border: 1px solid rgba(241, 241, 241, 1);
- border-radius: 29rpx;
- color: #BBBBBB;
- font-size: 28rpx;
- .iconfont {
- margin-right: 20rpx;
- }
- }
- }
- }
- }
- #map {
- width: 100%;
- height: 100%;
- }
- ::v-deep .uni-image[src^="https://app.tjzhxx.cn:11443/"] {
- border: 2px solid red;
- /* 添加2px宽的红色边框 */
- border-radius: 50%;
- /* 可选,设置为圆形边框 */
- }
- .custom-marker {
- position: relative;
- width: 42px;
- /* 根据您的标记点图标宽度调整 */
- height: 47px;
- /* 根据您的标记点图标高度调整 */
- }
- .custom-marker img {
- width: 100%;
- height: 100%;
- /* 在这里添加您需要的自定义CSS样式 */
- border: 1rpx solid red;
- }
- .loading {
- z-index: 999;
- width: 100%;
- top: 30%;
- // left:50%;
- position: absolute;
- }
- .top-input::before {
- content: "";
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: #FF0000;
- opacity: 0.1;
- filter: blur(50px);
- z-index: 66;
- pointer-events: none;
- }
- .top-input {
- width: 70%;
- height: 45%;
- top: 20%;
- left: 15%;
- text-align: center;
- position: absolute;
- box-sizing: border-box;
- font-size: 32rpx;
- font-weight: 500;
- color: #000000;
- // border: 1rpx solid red;
- padding: 119rpx 90rpx;
- image {
- width: 100%;
- height: 368rpx;
- }
- .btn-box {
- z-index: 999;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- .btn {
- background: rgba(255, 247, 247, 0.3);
- border-radius: 35rpx;
- border: 3rpx solid #EC3534;
- margin-top: 42rpx;
- width: 236rpx;
- height: 70rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: 600;
- font-size: 36rpx;
- color: #EC3534;
- }
- }
- }
- // .top-input {
- // width: 70%;
- // height: 45%;
- // top: 20%;
- // left: 15%;
- // text-align: center;
- // position: absolute;
- // box-sizing: border-box;
- // font-size: 32rpx;
- // font-weight: 500;
- // color: #000000;
- // border: 1rpx solid red;
- // background: #FF0000;
- // opacity: 0.4;
- // filter: blur(50px);
- // padding:119rpx 90rpx;
- // image{
- // width: 100%;
- // height: 368rpx;
- // }
- // .btn-box{
- // width: 100%;
- // display: flex;
- // align-items: center;
- // justify-content: center;
- // .btn{
- // background: rgba(255,247,247,0.3);
- // border-radius: 35rpx;
- // border: 3rpx solid #EC3534;
- // margin-top: 42rpx;
- // width: 236rpx;
- // height: 70rpx;
- // display: flex;
- // align-items: center;
- // justify-content: center;
- // }
- // }
- // }
- .info-box {
- width: 100%;
- height: 40%;
- display: flex;
- justify-content: center;
- flex-direction: column;
- position: absolute;
- bottom: 75rpx;
- z-index: 1000;
- // background-color: #fff;
- padding: 0 30rpx 0;
- font-size: 32rpx;
- font-weight: 400;
- color: #000000;
- box-sizing: border-box;
- .scroll-view_H {
- width: 100%;
- height: 80%;
- /* 设置适当的高度 */
- .scroll-view-content {
- height: 100%;
- white-space: nowrap;
- font-size: 0;
- overflow-x: auto;
- .scroll-view-item_H {
- width: 50%;
- height: 100%;
- display: inline-block;
- font-size: 16px;
- margin-right: 15rpx;
- position: relative;
- .bg-image {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- .text-wrapper {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: flex-start;
- padding: 60rpx 30rpx 0;
- }
- .black {
- color: #2D2D2D;
- }
- .white {
- color: #fff;
- }
- .text-overlay {
- // color: white;
- font-size: 16px;
- width: 100%;
- overflow: hidden;
- .top-box {
- display: flex;
- justify-content: space-between;
- .top-left {
- .english {
- font-size: 24rpx;
- }
- .chinese {
- font-size: 32rpx;
- }
- }
- .top-right {
- width: 76rpx;
- height: 76rpx;
- border-radius: 50%;
- }
- }
- .under-box {
- margin-top: 8rpx;
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- .under-left {
- color: #EC3534;
- .number {
- font-size: 36rpx;
- font-weight: 600;
- }
- .unit {
- font-size: 28rpx;
- font-weight: 500;
- }
- }
- .under-right {
- font-weight: 500;
- .range {
- font-size: 24rpx;
- }
- .range-word {
- font-size: 24rpx;
- }
- }
- .white {
- color: #fff;
- }
- }
- }
- }
- }
- }
- .sos-btn {
- width: 100%;
- height: 140rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .code {
- font-size: 32rpx;
- font-weight: 600;
- color: #000000;
- }
- .time {
- font-size: 28rpx;
- font-weight: 400;
- color: #999999;
- margin: 10rpx 0 16rpx;
- display: flex;
- align-items: center;
- .online-box {
- margin-right: 25rpx;
- width: 55rpx;
- height: 30rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .position {
- // margin-top: 16rpx;
- }
- }
- .icon-box {
- width: 10%;
- height: 30%;
- top: 20%;
- position: absolute;
- left: 5%;
- display: flex;
- background-color: #ECECEC;
- flex-direction: column;
- justify-content: space-between;
- border-radius: 10rpx;
- .img-box {
- text-align: center;
- height: 24.5%;
- line-height: 130rpx;
- background-color: #fff;
- image {
- width: 42rpx;
- height: 42rpx;
- }
- }
- .first {
- border-radius: 10rpx 10rpx 0 0;
- }
- .last {
- border-radius: 0 0 10rpx 10rpx;
- }
- image {
- width: 42rpx;
- height: 42rpx;
- }
- }
- .icon-box-right {
- width: 10%;
- height: 25%;
- top: 10%;
- position: absolute;
- right: 5%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- image {
- width: 70rpx;
- height: 70rpx;
- }
- }
- }
- </style>
|